Commit 983ed655c8e12927d805b319e68bd233a6859ea4
1 parent
9c098925
add host 127
Showing
3 changed files
with
18 additions
and
11 deletions
server/app.js
src/live/js/student.js
| 1 | 1 | $(function() { |
| 2 | 2 | var teacherId = document.getElementById('teacher'); |
| 3 | 3 | var studentId = document.getElementById('student'); |
| 4 | - var socket = io('http://live-api.com:3306'); | |
| 4 | + var socket = io('http://127.0.0.1:3306'); | |
| 5 | 5 | |
| 6 | 6 | var teacher = CodeMirror.fromTextArea(teacherId, { |
| 7 | 7 | value: '输入HTML代码', | ... | ... |
src/live/js/teacher.js
| 1 | 1 | $(function(){ |
| 2 | 2 | var teacherId = document.getElementById('teacher'); |
| 3 | - var socket = io('http://live-api.com:3306'); | |
| 3 | + var socket = io('http://127.0.0.1:3306'); | |
| 4 | 4 | |
| 5 | 5 | // 初始化codemirror页面 |
| 6 | 6 | var teacher = CodeMirror.fromTextArea(teacherId, { |
| ... | ... | @@ -88,10 +88,13 @@ $(function(){ |
| 88 | 88 | |
| 89 | 89 | // 禁止关闭浏览器 |
| 90 | 90 | window.onbeforeunload = function(){ |
| 91 | - // return ('你确定要结束教学吗?请确认保存内容'); | |
| 92 | - $('#liveStart').hide(); | |
| 91 | + alert('-0000'); | |
| 92 | + console.log('-----======') | |
| 93 | + return ('你确定要结束教学吗?请确认保存内容'); | |
| 93 | 94 | } |
| 94 | 95 | |
| 96 | + | |
| 97 | + | |
| 95 | 98 | LiveTeacher.init(); |
| 96 | 99 | |
| 97 | 100 | // 开始录制 |
| ... | ... | @@ -162,17 +165,22 @@ $(function(){ |
| 162 | 165 | teacher.setValue(''); |
| 163 | 166 | console.log('programming.clear') |
| 164 | 167 | |
| 165 | - // socket.on('programming.clear', function(msg) { | |
| 166 | - // console.log('programming.clear ---- '); | |
| 167 | - // content = ''; | |
| 168 | - // io.emit('programming.content', msg); | |
| 169 | - // }); | |
| 168 | + socket.on('programming.clear', function(msg) { | |
| 169 | + console.log('programming.clear ---- '); | |
| 170 | + content = ''; | |
| 171 | + io.emit('programming.content', msg); | |
| 172 | + }); | |
| 170 | 173 | |
| 171 | 174 | |
| 172 | 175 | // window.onbeforeunload = function(){ |
| 173 | 176 | // return ('你确定要结束教学吗?') |
| 174 | 177 | // } |
| 175 | - window.close() | |
| 178 | + // window.close() | |
| 179 | + | |
| 180 | + $(window).unbind('beforeunload', function(){ | |
| 181 | + return '确认退出? 将不保存你的代码'; | |
| 182 | + }); | |
| 183 | + window.close(); | |
| 176 | 184 | } |
| 177 | 185 | |
| 178 | 186 | ... | ... |