Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kaishi_test_01
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
kaishi_test_01
Commits
de51b171
Commit
de51b171
authored
Jun 24, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加调试
parent
b09ef7fe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
index.html
play/index.html
+5
-0
index.js
play/index.js
+30
-1
No files found.
play/index.html
View file @
de51b171
...
...
@@ -5,9 +5,14 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<title>
h5-template-generator
</title>
<!-- <script src="http://localhost:8011/socket.io/socket.io.js"></script> -->
<script
type=
"text/javascript"
src=
"../lib/js/jquery-1.12.3.min.js"
></script>
<link
href=
"./index.css"
rel=
"stylesheet"
>
<script
type=
"text/javascript"
src=
"//staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"
></script>
<script
src=
'https://cdn.bootcss.com/vConsole/3.2.2/vconsole.min.js'
type=
"text/javascript"
charset=
"utf-8"
></script>
<script>
window
.
vConsole
=
new
window
.
VConsole
()
</script>
</head>
<body>
<div
class=
"main"
>
...
...
play/index.js
View file @
de51b171
...
...
@@ -37,11 +37,40 @@ $(function(){
const
txt
=
$
(
this
).
text
();
$
(
"
.log
"
).
append
(
`页面点击触发了:
${
txt
}
<br>`
);
//获取滚动条高度
var
sh
=
$
(
"
.log
"
).
prop
(
"
scrollHeight
"
);
const
sh
=
$
(
"
.log
"
).
prop
(
"
scrollHeight
"
);
$
(
'
.log
'
).
animate
({
scrollTop
:
sh
},
10
);
});
$
(
"
.clear
"
).
bind
(
'
click
'
,
function
(){
$
(
"
.log
"
).
html
(
""
);
});
try
{
}
catch
(
e
)
{
}
var
ws
=
new
WebSocket
(
"
ws://localhost:8011
"
);
ws
.
onmessage
=
function
(
e
){
console
.
log
(
Date
.
now
(),
e
.
data
);
// 返回答题结果
const
resData
=
JSON
.
parse
(
e
.
data
);
if
(
resData
.
fun
==
"
answer_update
"
){
$
(
"
.log
"
).
append
(
`答题器触发了:选项
${
resData
.
ans_str
}
<br>`
);
}
}
// 发送开始答题
const
json
=
{
"
fun
"
:
"
answer_start
"
,
"
uID
"
:
0
,
"
seq
"
:
2
,
"
type
"
:
1
};
ws
.
send
(
`
${
JSON
.
stringify
(
json
)}
\n`
);
// const socket = io.connect('http://localhost:8011');
// socket.on("clickOption", function(index){
// $(".log").append(`答题器触发了:${arr[index]} <br>`);
// //获取滚动条高度
// const sh = $(".log").prop("scrollHeight");
// $('.log').animate({scrollTop:sh},10);
// });
})
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment