Commit de51b171 authored by liujiangnan's avatar liujiangnan

feat: 添加调试

parent b09ef7fe
......@@ -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">
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment