正在显示
20 个修改的文件
包含
19 行增加
和
4111 行删除
| @@ -228,6 +228,7 @@ body{ | @@ -228,6 +228,7 @@ body{ | ||
| 228 | height:540px; | 228 | height:540px; |
| 229 | overflow: hidden; | 229 | overflow: hidden; |
| 230 | position: relative; | 230 | position: relative; |
| 231 | + display: none; | ||
| 231 | } | 232 | } |
| 232 | .motionMapBox{ | 233 | .motionMapBox{ |
| 233 | height:540px; | 234 | height:540px; |
| @@ -272,6 +273,7 @@ body{ | @@ -272,6 +273,7 @@ body{ | ||
| 272 | left:0; | 273 | left:0; |
| 273 | right:0; | 274 | right:0; |
| 274 | margin:0 auto; | 275 | margin:0 auto; |
| 276 | + min-height:600px; | ||
| 275 | } | 277 | } |
| 276 | /*首页*/ | 278 | /*首页*/ |
| 277 | .box{ | 279 | .box{ |
| @@ -280,11 +282,11 @@ body{ | @@ -280,11 +282,11 @@ body{ | ||
| 280 | left:0; | 282 | left:0; |
| 281 | right:0; | 283 | right:0; |
| 282 | margin:0 auto; | 284 | margin:0 auto; |
| 283 | - min-height: 1000px; | ||
| 284 | } | 285 | } |
| 285 | .curriculumBox{ | 286 | .curriculumBox{ |
| 286 | float: left; | 287 | float: left; |
| 287 | width: 100%; | 288 | width: 100%; |
| 289 | + display: none; | ||
| 288 | } | 290 | } |
| 289 | .curriculumBox1{ | 291 | .curriculumBox1{ |
| 290 | margin-bottom:45px; | 292 | margin-bottom:45px; |
src/ape/ActionType.js
已删除
100644 → 0
| 1 | -/* | ||
| 2 | -* | ||
| 3 | -* 音视频设置的消息类型 | ||
| 4 | -* */ | ||
| 5 | -class ActionType { | ||
| 6 | - constructor() { | ||
| 7 | - } | ||
| 8 | -} | ||
| 9 | - | ||
| 10 | -ActionType. CHANGE_CAMERA = "changeCamera";// | ||
| 11 | -ActionType. CHANGE_MICROPHONE = "changeMicrophone";// | ||
| 12 | -ActionType. CHANGE_RESOLUTION = "changeResolution";// | ||
| 13 | -ActionType. CHANGE_SPEAKER_VOLUME = "changeSpeakerVolume";// | ||
| 14 | -ActionType. CHANGE_MICROPHONE_GAIN = "changeMicrophoneGain";// | ||
| 15 | -ActionType. CHANGE_MICROPHONE_CODE = "changeMicrophoneCode"; | ||
| 16 | - | ||
| 17 | -export default ActionType; |
| @@ -4,9 +4,6 @@ | @@ -4,9 +4,6 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import DrawTool from "./DrawTool"; | ||
| 9 | -import LaserPen from "./LaserPen"; | ||
| 10 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 11 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 12 | let loger = Loger.getLoger('PC-AdministratorApe'); | 9 | let loger = Loger.getLoger('PC-AdministratorApe'); |
| @@ -84,7 +81,6 @@ class AdministratorApe extends Ape { | @@ -84,7 +81,6 @@ class AdministratorApe extends Ape { | ||
| 84 | isLocalStorage(){ | 81 | isLocalStorage(){ |
| 85 | if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_2){ | 82 | if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_2){ |
| 86 | this.detailPage(); | 83 | this.detailPage(); |
| 87 | - console.log('管理员',111111111) | ||
| 88 | } | 84 | } |
| 89 | } | 85 | } |
| 90 | //首页 | 86 | //首页 |
src/ape/AnswerApe.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 答题卡模块 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | -import Loger from "../Loger"; | ||
| 6 | -import Ape from "./Ape"; | ||
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 9 | -import $ from "jquery"; | ||
| 10 | -let loger = Loger.getLoger('PC-AnswerApe'); | ||
| 11 | - | ||
| 12 | -const newAnswerInput = `<li class="themeTrendsLi"> | ||
| 13 | - <input type="text" class="themeVal" value="输入答案" maxlength="26"> | ||
| 14 | - <span>×</span> | ||
| 15 | - </li>`; | ||
| 16 | -const newAnswerP = `<li class="themeTrendsLi"> | ||
| 17 | - <p></p> | ||
| 18 | - <span>×</span> | ||
| 19 | - </li>`; | ||
| 20 | -const newList = `<li class="resultValueList"> | ||
| 21 | - <input type="radio" name="result" value="{value}" data-val="{index}">{value} | ||
| 22 | - </li>`; | ||
| 23 | -const newResultList = `<li class="resultList"> | ||
| 24 | - <b>{ele}</b> | ||
| 25 | - <span>{_ratio}%</span> | ||
| 26 | - <p class="staticPlan"></p> | ||
| 27 | - <p class="dynamicPlan dynamicPlan{index}"></p> | ||
| 28 | - </li>`; | ||
| 29 | - | ||
| 30 | -class AnswerApe extends Ape { | ||
| 31 | - constructor () { | ||
| 32 | - super(); | ||
| 33 | - this._questionObject = {};//问题 对象 | ||
| 34 | - this._isErrer = false;//自定义题目的时候用来判断是不是输入值 | ||
| 35 | - this._showPage = false;//判断当前页面是不是终止状态 | ||
| 36 | - this._maxLen = 6;//题目最大长度 | ||
| 37 | - this._minLen = 2;//input最小长度 | ||
| 38 | - this._minLen1 = 1;//其他题目最小长度 | ||
| 39 | - this._countNum = 0;//控制题目长度,默认为0 | ||
| 40 | - this._brevity = [] | ||
| 41 | - this.timerList = [0,30,60,120,180,300]; //选择答题倒计时 | ||
| 42 | - this.isCancel = false;//控制学生端是否显示 | ||
| 43 | - this.isHide = false;//控制老师端是否显示 | ||
| 44 | - this.addEvent(); | ||
| 45 | - this.init(); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - init() { | ||
| 49 | - | ||
| 50 | - $('.slelctShow').on("click", this._slelctShowHandler.bind(this));//点击显示答题倒计时 | ||
| 51 | - $('.answer').on("click", this._answerHandler.bind(this));//点击弹出答题卡 | ||
| 52 | - $(".themeHeadline .iconfont").on("click", this._closeAnswerHandler.bind(this));//关闭答题卡/最小化 | ||
| 53 | - $('.themeUl').on("click",'li',this._answerLiHandler.bind(this));//选择答题计时时间 | ||
| 54 | - $('.themeList').on('mouseenter',this._mouseenterAnswer.bind(this));//移入题目项显示发布按钮 | ||
| 55 | - $('.themeList').on('mouseleave',this._mouseleaveAnswer.bind(this));//移出题目项移除发布按钮 | ||
| 56 | - $('.themeTrendsUl').on('mouseenter','li',this._mouseenterAddOff.bind(this));//移入每一条题目列表时显示关闭按钮 | ||
| 57 | - $('.themeTrendsUl').on('mouseleave','li',this._mouseleaveAddOff.bind(this));//移出每一条题目列表时移除关闭按钮 | ||
| 58 | - $('.themeTrendsUl').on('focus','.themeVal',this._answerFocus.bind(this));//input框获得焦点隐藏默认字体 | ||
| 59 | - $('.themeTrendsUl').on('blur','.themeVal',this._answerBlur.bind(this));//input框失去焦点显示默认字体 | ||
| 60 | - $('.themeTrendsUl').on('click','span',this._answerListRemove.bind(this));//点击X删除列表项 | ||
| 61 | - $('.themeAdd').on('click',this._answerAdd.bind(this));//点击列表后添加按钮 来添加列表项 | ||
| 62 | - $('.dynamicRight').on('click',this._answerSubmit.bind(this));//点击发布提交信息 | ||
| 63 | - $('.inputErrerA').on('click',this._inputErrerClone.bind(this));//关闭input自定义题目为空时弹出框 | ||
| 64 | - $('.resultConceal').on('click',this._resultConcealClone.bind(this));//隐藏按钮 | ||
| 65 | - $('.resultHeadline .iconfont').on('click',this._resultConcealClone.bind(this));//答题卡结果关闭按钮 | ||
| 66 | - $('.resultTermination').on('click',this._resultTermination.bind(this));//终止答题卡 | ||
| 67 | - $('.referBtn').on('click',this._referBtnClone.bind(this));//学生端提交信息 | ||
| 68 | - $('.abandonBtn').on('click',this._abandonBtnClone.bind(this));//学生端放弃提交信息 | ||
| 69 | - //老师端结果 移入显示当前选项选择人数 | ||
| 70 | - $('.resultListUl').on('mouseenter','p',this._mouseenterResult.bind(this)); | ||
| 71 | - $('.resultListUl').on('mouseleave','p',this._mouseleaveResult.bind(this)); | ||
| 72 | - $('body').on('click',function(evt){ | ||
| 73 | - $('.layerBox').hide(); | ||
| 74 | - if(!$(evt.target).is('.themeShow')){ | ||
| 75 | - $('.themeUl').hide(); | ||
| 76 | - } | ||
| 77 | - }); | ||
| 78 | - //渲染题目列表显示数据 | ||
| 79 | - this._renderDom(); | ||
| 80 | - //刷新列表时input框重新改为默认值 | ||
| 81 | - this._setDefault(); | ||
| 82 | - | ||
| 83 | - | ||
| 84 | - } | ||
| 85 | - addEvent() { | ||
| 86 | - //更新显示答题结果 | ||
| 87 | - xdysdk.on('update_answer_question',this.upDateAnswerQuestion.bind(this)); | ||
| 88 | - //答题结束 | ||
| 89 | - xdysdk.on('stop_answer_question',this.stopAnswerQuestion.bind(this)); | ||
| 90 | - //收到答题消息 | ||
| 91 | - xdysdk.on('start_answer_question',this.startAnswerQuestion.bind(this)); | ||
| 92 | - | ||
| 93 | - //点名和答题卡的计时器 | ||
| 94 | - xdysdk.on("update_question_time",this.updateQuestionTime.bind(this)); | ||
| 95 | - | ||
| 96 | - } | ||
| 97 | - timerCounterUptate(timestamp){ | ||
| 98 | - $('#answerCountDown').html(this._newTime(timestamp)); | ||
| 99 | - } | ||
| 100 | - _newTime(timestamp){ | ||
| 101 | - let minute = 0, | ||
| 102 | - second = 0; | ||
| 103 | - minute = Math.floor(timestamp / 60)<10 ? '0'+Math.floor(timestamp / 60):Math.floor(timestamp / 60); | ||
| 104 | - second = Math.floor(timestamp - minute * 60)<10?'0'+Math.floor(timestamp - minute * 60):Math.floor(timestamp - minute * 60) | ||
| 105 | - | ||
| 106 | - let timeValue = ClassDataProxy.localConfig.answerCountdown | ||
| 107 | - timeValue +=( minute > 0 ) ? minute + ' : ' : '00 : ' | ||
| 108 | - timeValue += (second > 0 ) ? second : '00' | ||
| 109 | - return timeValue; | ||
| 110 | - } | ||
| 111 | - //事件监听----------- | ||
| 112 | - //更新显示答题结果 | ||
| 113 | - upDateAnswerQuestion(_data){ | ||
| 114 | - if(_data.type!=100 && ClassDataProxy.userRole==ClassDataProxy.USER_HOST){ | ||
| 115 | - this._questionObject = _data; | ||
| 116 | - this._showPage = true; | ||
| 117 | - loger.log('更新显示答题结果'); | ||
| 118 | - if(!this.isHide){ | ||
| 119 | - this._showResultBox(); | ||
| 120 | - } | ||
| 121 | - this._resultDom(_data); | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - } | ||
| 125 | - //答题结束 | ||
| 126 | - stopAnswerQuestion(_data){ | ||
| 127 | - if(_data.type!=100){ | ||
| 128 | - loger.log('答题结束',_data); | ||
| 129 | - this._questionObject = null; | ||
| 130 | - this._hideAnswerStudentBox(); | ||
| 131 | - this._hideResultBox(); | ||
| 132 | - this._showPage = false; | ||
| 133 | - this.isCancel = false; | ||
| 134 | - this.isHide = false; | ||
| 135 | - } | ||
| 136 | - } | ||
| 137 | - //收到答题消息 | ||
| 138 | - startAnswerQuestion(_data){ | ||
| 139 | - if(_data.type!=100){ | ||
| 140 | - if(ClassDataProxy.userRole==ClassDataProxy.USER_NOTMAL){ | ||
| 141 | - this._questionObject = _data; | ||
| 142 | - loger.log('收到答题消息',_data) | ||
| 143 | - if(_data.timeLimit == 100000){ | ||
| 144 | - $('.countdown').css('opacity',0); | ||
| 145 | - }else{ | ||
| 146 | - $('.countdown').css('opacity',1); | ||
| 147 | - } | ||
| 148 | - if(!this.isCancel){ | ||
| 149 | - this._showAnswerStudentBox(); | ||
| 150 | - } | ||
| 151 | - this._answerStudent(_data); | ||
| 152 | - } | ||
| 153 | - } | ||
| 154 | - } | ||
| 155 | - //答题卡的计时器 | ||
| 156 | - updateQuestionTime(_data){ | ||
| 157 | - if(_data.type!=100){ | ||
| 158 | - //loger.log('答题卡的计时器',_data) | ||
| 159 | - this.timerCounterUptate(_data.timestamp); | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - _setDefault(){ | ||
| 164 | - $('.themeTrendsUl .themeVal').val(ClassDataProxy.localConfig.inputAnswer); | ||
| 165 | - } | ||
| 166 | - _renderDom(){ | ||
| 167 | - let renderArray = ['A','B','C','D','E','F']; | ||
| 168 | - let themeTrendsUlA = $('#themeTrendsUlA li p'); | ||
| 169 | - let themeTrendsUlB = $('#themeTrendsUlB li p'); | ||
| 170 | - let themeTrendsUlC = $('#themeTrendsUlC li input'); | ||
| 171 | - | ||
| 172 | - $.each(themeTrendsUlA,function(index,ele){ | ||
| 173 | - $(ele).text(renderArray[index]) | ||
| 174 | - }) | ||
| 175 | - $.each(themeTrendsUlB,function(index,ele){ | ||
| 176 | - $(ele).text(index+1) | ||
| 177 | - }) | ||
| 178 | - } | ||
| 179 | - // 渲染答题结果 | ||
| 180 | - _resultDom(_data){ | ||
| 181 | - if(_data){ | ||
| 182 | - //清除原数据 重新渲染老师端答题结果列表 | ||
| 183 | - $('.resultListUl').html(''); | ||
| 184 | - let list = _data.totalUser; | ||
| 185 | - let _newResultList = ''; | ||
| 186 | - let _this = this; | ||
| 187 | - $('.attendNum').text(list) | ||
| 188 | - let _ratio = 0; | ||
| 189 | - $.each(_data.options,function(index,ele){ | ||
| 190 | - _ratio = _data.answers[index].percent; | ||
| 191 | - _newResultList = _this._format(newResultList, { | ||
| 192 | - ele : ele, | ||
| 193 | - _ratio :_ratio, | ||
| 194 | - index : index | ||
| 195 | - }); | ||
| 196 | - $('.resultListUl').append(_newResultList); | ||
| 197 | - $('.resultListUl').find('.dynamicPlan'+index).css('width',_ratio+'%'); | ||
| 198 | - }) | ||
| 199 | - } | ||
| 200 | - } | ||
| 201 | - //点击弹出答题卡 | ||
| 202 | - _answerHandler(){ | ||
| 203 | - //弹出答题卡时 渲染倒计时列表 | ||
| 204 | - this._showTimerList(); | ||
| 205 | - //显示时间格式 | ||
| 206 | - $('.themeShow').html($('.themeUl').find('li').eq(0).html()) //默认答题计时显示第一个 | ||
| 207 | - .attr('data-val',$('.themeUl li').eq(0).attr('data-val')); | ||
| 208 | - this._showAnswerAllBox(); | ||
| 209 | - if(!this._showPage){ | ||
| 210 | - $(".themeBox").fadeIn(800); | ||
| 211 | - }else{ | ||
| 212 | - $('.resultBox').fadeIn(800); | ||
| 213 | - } | ||
| 214 | - } | ||
| 215 | - //关闭答题卡/最小化 | ||
| 216 | - _closeAnswerHandler() { | ||
| 217 | - this.isHide = true; | ||
| 218 | - this._hideAnswerAllBox(); | ||
| 219 | - } | ||
| 220 | - //点击显示答题倒计时 | ||
| 221 | - _slelctShowHandler() { | ||
| 222 | - $('.themeUl').is(':hidden') ? $('.themeUl').show() : $('.themeUl').hide(); | ||
| 223 | - } | ||
| 224 | - //选择答题计时时间 | ||
| 225 | - _answerLiHandler(evt){ | ||
| 226 | - let ele = $(evt.target); | ||
| 227 | - let index = ele.index(); | ||
| 228 | - //选择倒计时时 添加类 | ||
| 229 | - this._judgeDddClass($('.themeUl li'),index) | ||
| 230 | - $('.themeShow').html(ele.html()) | ||
| 231 | - .attr('data-val',ele.data('val')); | ||
| 232 | - | ||
| 233 | - $('.themeUl').hide(); | ||
| 234 | - } | ||
| 235 | - //选择倒计时时 添加类 | ||
| 236 | - _judgeDddClass(ele,ind){ | ||
| 237 | - ele.eq(ind).addClass('active').siblings().removeClass('active'); | ||
| 238 | - } | ||
| 239 | - //移入题目项显示发布按钮 | ||
| 240 | - _mouseenterAnswer(evt){ | ||
| 241 | - $(evt.target).find('.dynamicRight').show(); | ||
| 242 | - /* if($('#themeTrendsUlC .themeTrendsLi').length >= 6){ | ||
| 243 | - $('#themeAdd').hide(); | ||
| 244 | - }*/ | ||
| 245 | - } | ||
| 246 | - //移出题目项移除发布按钮 | ||
| 247 | - _mouseleaveAnswer(evt){ | ||
| 248 | - $('.dynamicRight').hide(); | ||
| 249 | - } | ||
| 250 | - //移入每一条题目列表时显示关闭按钮 | ||
| 251 | - _mouseenterAddOff(evt){ | ||
| 252 | - $(evt.target).next().show(); | ||
| 253 | - } | ||
| 254 | - //移出每一条题目列表时移除关闭按钮 | ||
| 255 | - _mouseleaveAddOff(){ | ||
| 256 | - $('.themeList span').hide(); | ||
| 257 | - } | ||
| 258 | - //input框获得焦点隐藏默认字体 | ||
| 259 | - _answerFocus(evt){ | ||
| 260 | - let price = $(evt.target); | ||
| 261 | - if(price.val() === ClassDataProxy.localConfig.inputAnswer) price.val(''); | ||
| 262 | - } | ||
| 263 | - //input框失去焦点显示默认字体 | ||
| 264 | - _answerBlur(evt){ | ||
| 265 | - let price = $(evt.target); | ||
| 266 | - if(price.val() === '') price.val(ClassDataProxy.localConfig.inputAnswer); | ||
| 267 | - } | ||
| 268 | - //点击发布提交信息 | ||
| 269 | - _answerSubmit(evt){ | ||
| 270 | - let _themeLi = $(evt.target).prev().children(); | ||
| 271 | - let _themeP = _themeLi.find('p'); | ||
| 272 | - let _themeInput = _themeLi.find('input'); | ||
| 273 | - let _parentType = $(evt.target).parent().data('type'); | ||
| 274 | - let _this = this; | ||
| 275 | - let array =[]; | ||
| 276 | - $.each(_themeP,function(key,val){ | ||
| 277 | - let text = $(val).text(); | ||
| 278 | - array.push(text); | ||
| 279 | - }) | ||
| 280 | - let length = []; | ||
| 281 | - $.each(_themeInput,function(key,val){ | ||
| 282 | - let text = $(val).val(); | ||
| 283 | - let parten = /(^\s*)|(\s*$)/g ; | ||
| 284 | - if(text=== ClassDataProxy.localConfig.inputAnswer || text.replace(parten,'') == ''){ | ||
| 285 | - length.push(text) | ||
| 286 | - _this._isErrer = true; | ||
| 287 | - _this._inputErrerOpen(); | ||
| 288 | - }else{ | ||
| 289 | - array.push(text); | ||
| 290 | - } | ||
| 291 | - }) | ||
| 292 | - | ||
| 293 | - if(length.length > 0){ | ||
| 294 | - this._inputErrerOpen(); | ||
| 295 | - }else{ | ||
| 296 | - this._resultBounced(); | ||
| 297 | - let _timeLimit = parseInt( $('.themeShow').attr('data-val') ); | ||
| 298 | - | ||
| 299 | - let paramInfo = {}; | ||
| 300 | - paramInfo.type = parseInt(_parentType) || 1;; //1单选,2多选,3判断,4点名 | ||
| 301 | - paramInfo.content = '答题'; //题目 没有就传"" | ||
| 302 | - paramInfo.timeLimit = _timeLimit;//有效时间(秒) | ||
| 303 | - paramInfo.correct = [];//正确答案,没有就传[] | ||
| 304 | - paramInfo.options = array || [] ;//选项数组,没有就传[] | ||
| 305 | - paramInfo.answer = [];//学生选择的答案,没有就传[] | ||
| 306 | - xdysdk.api("creatQuestion",paramInfo); | ||
| 307 | - } | ||
| 308 | - } | ||
| 309 | - _resultBounced(){ | ||
| 310 | - this._showPage = true; | ||
| 311 | - $('.themeBox').hide(); | ||
| 312 | - $('.resultBox').show(); | ||
| 313 | - } | ||
| 314 | - //答题题目为自定义时需输入内容否则弹出错误弹框 | ||
| 315 | - _inputErrerOpen(){ | ||
| 316 | - if(this._isErrer){ | ||
| 317 | - $(".inputErrerBox").show(); | ||
| 318 | - } | ||
| 319 | - } | ||
| 320 | - //错误弹框关闭 | ||
| 321 | - _inputErrerClone(){ | ||
| 322 | - $(".inputErrerBox").hide(); | ||
| 323 | - } | ||
| 324 | - _inputAdd(_answerLi,Dom){ | ||
| 325 | - this._countNum ++; | ||
| 326 | - _answerLi.before(newAnswerInput); | ||
| 327 | - $('.themeTrendsLi').attr('value',ClassDataProxy.localConfig.inputAnswer) | ||
| 328 | - // this._setDefault(); | ||
| 329 | - if(this._countNum === this._maxLen){ | ||
| 330 | - this._countNum = 6; | ||
| 331 | - Dom.hide(); | ||
| 332 | - } | ||
| 333 | - } | ||
| 334 | - _textAdd(_answerLi,Dom){ | ||
| 335 | - this._countNum ++; | ||
| 336 | - _answerLi.before(newAnswerP); | ||
| 337 | - this._renderDom(); | ||
| 338 | - if(this._countNum === this._maxLen){ | ||
| 339 | - this._countNum = 6; | ||
| 340 | - Dom.hide(); | ||
| 341 | - } | ||
| 342 | - } | ||
| 343 | - _inputDomPos(){ | ||
| 344 | - let themeTrendsLi = $('#themeTrendsUlC').children('.themeTrendsLi'); | ||
| 345 | - let liList = $('#themeTrendsUlC li'); | ||
| 346 | - let len = themeTrendsLi.length; | ||
| 347 | - let _dynamicRight1 = $('.dynamicRight1'); | ||
| 348 | - if(len > 3){ | ||
| 349 | - _dynamicRight1.css('top','33px'); | ||
| 350 | - }else{ | ||
| 351 | - _dynamicRight1.css('top','12px'); | ||
| 352 | - } | ||
| 353 | - } | ||
| 354 | - _answerAdd(evt){ | ||
| 355 | - let themeTrendsUlA = $('#themeTrendsUlA'); | ||
| 356 | - let themeTrendsUlB = $('#themeTrendsUlB'); | ||
| 357 | - let themeTrendsUlC = $('#themeTrendsUlC'); | ||
| 358 | - let _isInput = $(evt.target).prev().children().is('input'); | ||
| 359 | - let _isText = $(evt.target).parent().children().first().text(); | ||
| 360 | - let _themeLi = $(evt.target); | ||
| 361 | - let _len = $(evt.target).parent().children('.themeTrendsLi').length; | ||
| 362 | - let _inputLen = $(evt.target).siblings().length; | ||
| 363 | - this._countNum = _inputLen; | ||
| 364 | - if(themeTrendsUlC && _isInput){ | ||
| 365 | - this._inputAdd(_themeLi,$(evt.target)); | ||
| 366 | - }else if((themeTrendsUlA || themeTrendsUlB ) && ( _isText === 'A×' || _isText === '1×' )){ | ||
| 367 | - this._textAdd(_themeLi,$(evt.target)); | ||
| 368 | - } | ||
| 369 | - this._inputDomPos(); | ||
| 370 | - } | ||
| 371 | - _removeList(_countNum,len,ele){ | ||
| 372 | - if(_countNum === len){ | ||
| 373 | - _countNum = len; | ||
| 374 | - }else{ | ||
| 375 | - _countNum --; | ||
| 376 | - ele.remove(); | ||
| 377 | - this._renderDom(); | ||
| 378 | - } | ||
| 379 | - } | ||
| 380 | - //点击X删除列表项 | ||
| 381 | - _answerListRemove(evt){ | ||
| 382 | - let _plus = $(evt.target).parents('ul').children().find('.themeAdd').is(':hidden'); | ||
| 383 | - let _isP = $(evt.target).prev().is('p'); | ||
| 384 | - let _inputLen = $(evt.target).parent().siblings().length; | ||
| 385 | - let _themeAdd = $(evt.target).parents('ul').children('.themeAdd'); | ||
| 386 | - if(_themeAdd.is(":hidden")){ | ||
| 387 | - _themeAdd.show(); | ||
| 388 | - } | ||
| 389 | - this._countNum = _inputLen; | ||
| 390 | - let parentDom = $(evt.target).parent(); | ||
| 391 | - if(_isP){ | ||
| 392 | - this._removeList(this._countNum,this._minLen,parentDom); | ||
| 393 | - }else{ | ||
| 394 | - this._removeList(this._countNum,this._minLen1,parentDom); | ||
| 395 | - } | ||
| 396 | - this._inputDomPos(); | ||
| 397 | - } | ||
| 398 | - //答题卡结果关闭按钮 | ||
| 399 | - _resultConcealClone(){ | ||
| 400 | - this.isHide = true; | ||
| 401 | - $('.resultBox').hide(); | ||
| 402 | - $('.answerAllBox').hide(); | ||
| 403 | - } | ||
| 404 | - //终止答题卡 | ||
| 405 | - _resultTermination(){ | ||
| 406 | - //清除所有数据 还原默认数据 | ||
| 407 | - this._clearAnswer(); | ||
| 408 | - //终止时隐藏所有盒子 | ||
| 409 | - this._hideResultBox(); | ||
| 410 | - //调用SDK停止答题 | ||
| 411 | - this._stopAnswer(); | ||
| 412 | - } | ||
| 413 | - //清除所有数据 还原默认数据 | ||
| 414 | - _clearAnswer(){ | ||
| 415 | - this._showPage = false; | ||
| 416 | - $('#minute,#second').text('00'); | ||
| 417 | - //答题卡结果关闭按钮 | ||
| 418 | - this._resultConcealClone(); | ||
| 419 | - //终止答题卡时题目列表默认显示原数据 | ||
| 420 | - this._revocation(); | ||
| 421 | - //终止答题卡时input框的默认值显示原数据 | ||
| 422 | - this._setDefault(); | ||
| 423 | - //默认 无 默认选中 | ||
| 424 | - this._judgeDddClass($('.themeUl li'),0); | ||
| 425 | - this.isCancel = false; | ||
| 426 | - this.isHide = false; | ||
| 427 | - //input框重置 | ||
| 428 | - $('.dynamicRight1').css('top','12px'); | ||
| 429 | - $('#themeAdd').show(); | ||
| 430 | - $('.dynamicPlan').css('width',0) | ||
| 431 | - $('.resultList span').html('0%'); | ||
| 432 | - $('.resultList').empty(); | ||
| 433 | - $('.attendNum').text('0') | ||
| 434 | - } | ||
| 435 | - _stopAnswer(){ | ||
| 436 | - let paramInfo = {}; | ||
| 437 | - paramInfo.itemIdx = this._questionObject.itemIdx; | ||
| 438 | - paramInfo.questionId = this._questionObject.questionId; | ||
| 439 | - xdysdk.api("stopQuestion",paramInfo); | ||
| 440 | - this._questionObject = null; | ||
| 441 | - } | ||
| 442 | - _revocation(){ | ||
| 443 | - $('.themeShow').html(ClassDataProxy.localConfig.nothing); | ||
| 444 | - let themeTrendsUlA = $('#themeTrendsUlA .themeTrendsLi').length; | ||
| 445 | - let themeTrendsUlB = $('#themeTrendsUlB .themeTrendsLi').length; | ||
| 446 | - let themeTrendsUlC = $('#themeTrendsUlC .themeTrendsLi').length; | ||
| 447 | - let len,len1,len2; | ||
| 448 | - | ||
| 449 | - this._recoverfunc(themeTrendsUlC,len,'C',3); | ||
| 450 | - this._recoverfunc(themeTrendsUlB,len2,'B',4); | ||
| 451 | - this._recoverfunc(themeTrendsUlA,len1,'A',4); | ||
| 452 | - } | ||
| 453 | - _recoverfunc(ele,len,val,count){ | ||
| 454 | - if( ele < count){ | ||
| 455 | - len = count - ele; | ||
| 456 | - this._addfunc(val,len); | ||
| 457 | - }else{ | ||
| 458 | - len = ele - count; | ||
| 459 | - this._removefunc(val,len); | ||
| 460 | - } | ||
| 461 | - } | ||
| 462 | - _addfunc(ele,len){ | ||
| 463 | - for(let i = 0;i<len;i++){ | ||
| 464 | - $('#themeTrendsUl'+ele).prepend($('#themeTrendsUl'+ele).children().first().clone(true)); | ||
| 465 | - } | ||
| 466 | - this._renderDom(); | ||
| 467 | - } | ||
| 468 | - _removefunc(ele,len){ | ||
| 469 | - for(let i = 0; i< len;i++){ | ||
| 470 | - $('#themeTrendsUl'+ele).children().first().remove(); | ||
| 471 | - } | ||
| 472 | - this._renderDom(); | ||
| 473 | - } | ||
| 474 | - _answerStudent(_data){ | ||
| 475 | - this._answerStudentShow(); | ||
| 476 | - let resultValueUl = $('.resultValueUl'); | ||
| 477 | - //清除原数据 重新渲染学生端列表 | ||
| 478 | - resultValueUl.html(''); | ||
| 479 | - let array = _data.options; | ||
| 480 | - let _newList = ''; | ||
| 481 | - let _this = this; | ||
| 482 | - $.each(array,function(index,value){ | ||
| 483 | - _newList += _this._format(newList, { | ||
| 484 | - value: value, | ||
| 485 | - index:index | ||
| 486 | - }); | ||
| 487 | - }) | ||
| 488 | - resultValueUl.append(_newList) | ||
| 489 | - let len = resultValueUl.find('li').length; | ||
| 490 | - $('.resultValueList').width(100/len+'%'); | ||
| 491 | - } | ||
| 492 | - _answerStudentShow(){ | ||
| 493 | - $('.answerStudentBox').show(); | ||
| 494 | - } | ||
| 495 | - //学生端提交信息 | ||
| 496 | - _referBtnClone(){ | ||
| 497 | - let _val = $('.resultValueList input:checked').attr('data-val'); | ||
| 498 | - if(_val){ | ||
| 499 | - let paramInfo = {}; | ||
| 500 | - paramInfo.itemIdx = this._questionObject.itemIdx; | ||
| 501 | - paramInfo.questionId = this._questionObject.questionId; | ||
| 502 | - paramInfo.answer = [];//答题当前单选 存取的值是答题的索引 | ||
| 503 | - paramInfo.answer.push(parseInt(_val)); | ||
| 504 | - xdysdk.api("sendAnswer",paramInfo); | ||
| 505 | - loger.log('学生端提交信息',paramInfo) | ||
| 506 | - this._abandonBtnClone(); | ||
| 507 | - } | ||
| 508 | - return; | ||
| 509 | - } | ||
| 510 | - //老师端结果 移入显示当前选项选择人数 | ||
| 511 | - _mouseenterResult(evt){ | ||
| 512 | - let array = this._questionObject; | ||
| 513 | - let _text = $(evt.target).siblings('b').text(); | ||
| 514 | - let layerBox = $('.layerBox'); | ||
| 515 | - let _resultContentx = $('.resultContent').offset().left; | ||
| 516 | - let _resultContenty = $('.resultContent').offset().top; | ||
| 517 | - let _x = evt.pageX - _resultContentx; | ||
| 518 | - let _y = evt.pageY - _resultContenty - layerBox.outerHeight(); | ||
| 519 | - let _span = ''; | ||
| 520 | - layerBox.show() | ||
| 521 | - .css({'left':_x,'top':_y}) | ||
| 522 | - .html(''); | ||
| 523 | - let ind = $(evt.target).parent().index() | ||
| 524 | - let nameList = array.answers[ind].userNames.toString(); | ||
| 525 | - let reg = /\,/g; | ||
| 526 | - if( nameList && nameList.length > 0){ | ||
| 527 | - nameList = nameList.replace(reg,'、'); | ||
| 528 | - _span = '<span>'+ nameList +'</span>'; | ||
| 529 | - } | ||
| 530 | - if(_span){ | ||
| 531 | - layerBox.html(_span) | ||
| 532 | - }else{ | ||
| 533 | - layerBox.hide(); | ||
| 534 | - } | ||
| 535 | - } | ||
| 536 | - _mouseleaveResult(){ | ||
| 537 | - $('.layerBox').hide(); | ||
| 538 | - } | ||
| 539 | - //学生端放弃提交信息 | ||
| 540 | - _abandonBtnClone(){ | ||
| 541 | - this.isCancel = true; | ||
| 542 | - this._hideAnswerStudentBox(); | ||
| 543 | - $('.themeAdd').show(); | ||
| 544 | - $('.resultValueList').remove(); | ||
| 545 | - } | ||
| 546 | - //渲染时间列表 | ||
| 547 | - _showTimerList(){ | ||
| 548 | - let themeUl = $('.themeUl'),newLi; | ||
| 549 | - themeUl.html(''); | ||
| 550 | - $.each(this.timerList,function(key,val){ | ||
| 551 | - if(val == 0){ | ||
| 552 | - newLi = '<li data-val="100000" data-ind="'+key+'" class="active">'+ClassDataProxy.localConfig.nothing+'</li>'; | ||
| 553 | - }else if(val/60 < 1){ | ||
| 554 | - newLi = '<li data-val="'+val+'" data-ind="'+key+'">'+val+ClassDataProxy.localConfig.second+'</li>'; | ||
| 555 | - }else{ | ||
| 556 | - newLi = '<li data-val="'+val+'" data-ind="'+key+'">'+val/60+ClassDataProxy.localConfig.minute+'</li>'; | ||
| 557 | - } | ||
| 558 | - themeUl.append(newLi); | ||
| 559 | - }) | ||
| 560 | - } | ||
| 561 | - //工具类 | ||
| 562 | - _format(str, obj) { | ||
| 563 | - return str.replace(/\{(\w+)\}/g, function (match, group, index) { | ||
| 564 | - return obj[group]; | ||
| 565 | - }); | ||
| 566 | - }; | ||
| 567 | - //隐藏答题卡弹框 | ||
| 568 | - _showAnswerAllBox(){ | ||
| 569 | - $('.answerAllBox').show(); | ||
| 570 | - } | ||
| 571 | - //隐藏答题卡弹框 | ||
| 572 | - _hideAnswerAllBox(){ | ||
| 573 | - $('.answerAllBox').hide(); | ||
| 574 | - } | ||
| 575 | - //显示答题卡结果弹出框 | ||
| 576 | - _showResultBox(){ | ||
| 577 | - $('.answerAllBox').show(); | ||
| 578 | - $('.resultBox').show(); | ||
| 579 | - $('.themeBox').hide(); | ||
| 580 | - } | ||
| 581 | - //终止答题卡 | ||
| 582 | - _hideResultBox(){ | ||
| 583 | - $('.answerAllBox').hide(); | ||
| 584 | - $('.themeBox').hide(); | ||
| 585 | - $('.resultBox').hide(); | ||
| 586 | - $('.answerStudentBox').hide(); | ||
| 587 | - } | ||
| 588 | - //显示学生界面弹出框 | ||
| 589 | - _showAnswerStudentBox(){ | ||
| 590 | - $('.answerAllBox').show(); | ||
| 591 | - $('.themeBox').hide(); | ||
| 592 | - $('.answerStudentBox').show(); | ||
| 593 | - } | ||
| 594 | - //隐藏学生界面弹出框 | ||
| 595 | - _hideAnswerStudentBox(){ | ||
| 596 | - $('.answerAllBox').hide(); | ||
| 597 | - $('.answerStudentBox').hide(); | ||
| 598 | - } | ||
| 599 | -} | ||
| 600 | - | ||
| 601 | -export default AnswerApe; |
src/ape/ChatApe.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 聊天模块 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | - | ||
| 6 | -import Ape from "./Ape"; | ||
| 7 | -import Loger from "../Loger"; | ||
| 8 | -import xdysdk from "libs/xdysdk"; | ||
| 9 | -import $ from "jquery"; | ||
| 10 | -import ChatFace from "./ChatFace"; | ||
| 11 | -import UserList from "./UserList"; | ||
| 12 | -import ChatImg from "./ChatImg"; | ||
| 13 | -import UIMagnifyApe from "ape/UIMagnifyApe"; | ||
| 14 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 15 | - | ||
| 16 | -let loger = Loger.getLoger('PC-Chat'); | ||
| 17 | -let classCurInfo; | ||
| 18 | -// 消息模板-老师 | ||
| 19 | -const tpl_message_teacher = `<div class="message_client"> | ||
| 20 | - <div class="teaNameBox" > | ||
| 21 | - <span class="teaName">{name}</span> | ||
| 22 | -</div> | ||
| 23 | -<div style="margin-left: 20px"> | ||
| 24 | - <div class="message triangle-isosceles leftmsg">{message}</div> | ||
| 25 | - </div> | ||
| 26 | - </div>`; | ||
| 27 | -// 消息模板-学生 | ||
| 28 | -const tpl_message_student = `<div class="message_client"> | ||
| 29 | - <div class="stuNameBox"> | ||
| 30 | - <span class="stuName">{name}</span> | ||
| 31 | - </div> | ||
| 32 | - <div style="margin-right: 15px"> | ||
| 33 | - <div class="message stutriangle-isosceles rightmsg">{message}</div> | ||
| 34 | - </div> | ||
| 35 | - </div>`; | ||
| 36 | - | ||
| 37 | -class Chat extends Ape { | ||
| 38 | - constructor() { | ||
| 39 | - super(); | ||
| 40 | - this.chatFace; | ||
| 41 | - this.userList; | ||
| 42 | - this.addEvent(); | ||
| 43 | - this.init(); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - init() { | ||
| 47 | - this.chatFace = new ChatFace(); | ||
| 48 | - this.userList = new UserList(); | ||
| 49 | - this.chatImg = new ChatImg(); | ||
| 50 | - this.chatImg.callback=this._sendImgMessageHandler.bind(this); | ||
| 51 | - | ||
| 52 | - this.userList.on(UserList.WINDOW_VIEW_CHANGE, this.onWindowViewChange.bind(this)); | ||
| 53 | - //布局 | ||
| 54 | - // $("#txt_message")[0].value = '' | ||
| 55 | - //UI按钮点击事件 | ||
| 56 | - $("#btn_send").on("click", this._sendMessageHandler.bind(this)); | ||
| 57 | - //回车键发送聊天消息 | ||
| 58 | - let that = this; | ||
| 59 | - | ||
| 60 | - /* $("#txt_message").on("keydown", function (e) { | ||
| 61 | - let curKey = e.which; | ||
| 62 | - if (ClassDataProxy.isKeypress) { | ||
| 63 | - if (curKey == 13) that._sendMessageHandler(); | ||
| 64 | - } | ||
| 65 | - });*/ | ||
| 66 | - | ||
| 67 | - $('.left').on('contextmenu', this._preventDefault.bind(this)); | ||
| 68 | - $('.header').on('contextmenu', this._preventDefault.bind(this)); | ||
| 69 | - //$('.videoWindow').on('contextmenu', this._preventDefault.bind(this)); | ||
| 70 | - $('.middle').on('contextmenu', this._preventDefault.bind(this)); | ||
| 71 | - $('.tabTitle').on('contextmenu', this._preventDefault.bind(this)); | ||
| 72 | - // $('.input-send').on('contextmenu',this._preventDefault.bind(this)); | ||
| 73 | - $('.transmitBox').on('contextmenu', this._preventDefault.bind(this)); | ||
| 74 | - $('.fold').on('contextmenu', this._preventDefault.bind(this)); | ||
| 75 | - $('.rightGap').on('contextmenu', this._preventDefault.bind(this)); | ||
| 76 | - $('.leftGap').on('contextmenu', this._preventDefault.bind(this)); | ||
| 77 | - $('.curClassUserList').on('contextmenu', this._preventDefault.bind(this)); | ||
| 78 | - /* $("#txt_message").on('focus', function () { | ||
| 79 | - that._sendImgMessageHandler(); | ||
| 80 | - })*/ | ||
| 81 | - } | ||
| 82 | - onWindowViewChange() { | ||
| 83 | - this._emit(UserList.WINDOW_VIEW_CHANGE); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - addEvent() { | ||
| 87 | - xdysdk.on("chat_receive_message", this._chatReceiveHandler.bind(this));//// 聊天消息处理 | ||
| 88 | - xdysdk.on("class_join_success", this._classJoinSuccess); //监听加入课堂成功 | ||
| 89 | - | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - clear() { | ||
| 93 | - $("#panel_message").empty(); | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - _preventDefault(evt) { | ||
| 97 | - evt.preventDefault(); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - _classJoinSuccess(callBackData) { | ||
| 101 | - classCurInfo = callBackData; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - _chatReceiveHandler(_data) { | ||
| 105 | - //自己发的消息不需要再次显示,因为自己发送的时候已经直接显示了 | ||
| 106 | - if (_data && _data.fromNodeId == ClassDataProxy.nodeId) { | ||
| 107 | - loger.log("自己发送的聊天消息不需要再显示", _data); | ||
| 108 | - return; | ||
| 109 | - } | ||
| 110 | - loger.log("显示聊天消息", _data); | ||
| 111 | - this._showChatMessage(_data); | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - //显示内容 | ||
| 115 | - _showChatMessage(_data) { | ||
| 116 | - if (!_data) { | ||
| 117 | - loger.warn("聊天信息无效->", _data); | ||
| 118 | - return; | ||
| 119 | - } | ||
| 120 | - loger.log('上传图片成功是显示图片', _data) | ||
| 121 | - let str = _data.message; | ||
| 122 | - | ||
| 123 | - //msgType为1的时候是图片,其他的按文本消息处理 | ||
| 124 | - if(_data.msgType==1){ | ||
| 125 | - this.showChatImg(_data); | ||
| 126 | - }else { | ||
| 127 | - this.showChatMessage(_data); | ||
| 128 | - } | ||
| 129 | - /* let index = str .lastIndexOf("."); | ||
| 130 | - str = str .substring(index + 1, str.length); | ||
| 131 | - let msgValue =str ; | ||
| 132 | - if(msgValue=="jpg"||msgValue=="png"||msgValue=="gif"||msgValue=="jpeg"||msgValue=="bmp"){ | ||
| 133 | - this.showChatImg(_data); | ||
| 134 | - } | ||
| 135 | - else{ | ||
| 136 | - this.showChatMessage(_data); | ||
| 137 | - }*/ | ||
| 138 | - | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - showChatImg(_data) { | ||
| 142 | - | ||
| 143 | - let tpl = _data.fromNodeId !== classCurInfo.nodeId ? tpl_message_teacher : tpl_message_student; | ||
| 144 | - let message = '<img class="chatImg" src=' + _data.message + '>'; | ||
| 145 | - let strHTML = this._format(tpl, { | ||
| 146 | - name: _data.fromName, | ||
| 147 | - message: message | ||
| 148 | - }); | ||
| 149 | - $("#panel_message").append(strHTML); | ||
| 150 | - $("#panel_message")[0].scrollTop = $("#panel_message")[0].scrollHeight; | ||
| 151 | - $(".chatImg").on('load', this._onLoadImage.bind(this)); | ||
| 152 | - $(".chatImg").on("click", this._expandChatImg.bind(this)); //放大截图 | ||
| 153 | - } | ||
| 154 | - | ||
| 155 | - showChatMessage(_data) { | ||
| 156 | - let tpl = _data.fromNodeId !== classCurInfo.nodeId ? tpl_message_teacher : tpl_message_student; | ||
| 157 | - let message = (_data.message + "").replace(/\[img:([^\[:\]]*)\]/ig, function (match, group, index) { | ||
| 158 | - return '<img src="images/face/' + group + '.png"/>'; | ||
| 159 | - }); | ||
| 160 | - let strHTML = this._format(tpl, { | ||
| 161 | - name: _data.fromName, | ||
| 162 | - message: message | ||
| 163 | - }); | ||
| 164 | - $("#panel_message").append(strHTML); | ||
| 165 | - $("#panel_message")[0].scrollTop = $("#panel_message")[0].scrollHeight; | ||
| 166 | - } | ||
| 167 | - _onLoadImage(){ | ||
| 168 | - $("#panel_message")[0].scrollTop = $("#panel_message")[0].scrollHeight; | ||
| 169 | - } | ||
| 170 | - //MouseEvent | ||
| 171 | - _expandChatImg(evt) { | ||
| 172 | - UIMagnifyApe.show(evt.target.currentSrc); | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - _sendMessageHandler() { | ||
| 176 | - let msg = $("#txt_message")[0].value; | ||
| 177 | - if (msg) { | ||
| 178 | - let parten = /^\s*$/; | ||
| 179 | - if (parten.test(msg)) { | ||
| 180 | - loger.log("全是空格"); | ||
| 181 | - } else { | ||
| 182 | - let msgType=0;////0是文本,1是图片 | ||
| 183 | - xdysdk.api("sendChatMsg", {msgType: msgType, "message": msg, "to": 0}); | ||
| 184 | - $("#txt_message")[0].value = ""; | ||
| 185 | - | ||
| 186 | - //自己的直接显示 | ||
| 187 | - let chatData = {}; | ||
| 188 | - chatData.fromNodeId = ClassDataProxy.nodeId; | ||
| 189 | - chatData.toNodeId = 0; | ||
| 190 | - chatData.msgType=msgType; | ||
| 191 | - chatData.message = msg; | ||
| 192 | - chatData.fromName = ClassDataProxy.userName; | ||
| 193 | - chatData.fromRole = ClassDataProxy.userRole; | ||
| 194 | - this._showChatMessage(chatData); | ||
| 195 | - } | ||
| 196 | - } else { | ||
| 197 | - loger.log("发送消息内容不能为空"); | ||
| 198 | - } | ||
| 199 | - $("#txt_message").focus(); | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - //图片上传完成后就发送 | ||
| 203 | - _sendImgMessageHandler(_data) { | ||
| 204 | - if(!_data){ | ||
| 205 | - return; | ||
| 206 | - } | ||
| 207 | - let msg =_data.fileName||""; | ||
| 208 | - if (msg) { | ||
| 209 | - let parten = /^\s*$/; | ||
| 210 | - if (parten.test(msg)) { | ||
| 211 | - loger.log("全是空格"); | ||
| 212 | - } else { | ||
| 213 | - //let arr=msg.split('.'); | ||
| 214 | - //let len=arr.length; | ||
| 215 | - //let msgValue =arr[len-1]; | ||
| 216 | - | ||
| 217 | - let index=msg.lastIndexOf("."); | ||
| 218 | - let msgValue=msg.substr(index+1); | ||
| 219 | - | ||
| 220 | - | ||
| 221 | - if(msgValue){ | ||
| 222 | - msgValue = msgValue.toLowerCase(); | ||
| 223 | - } | ||
| 224 | - if (msgValue == "jpg" || msgValue == "png" || msgValue == "gif" || msgValue == "jpeg" || msgValue == "bmp") { | ||
| 225 | - let msgType=1;////0是文本,1是图片 | ||
| 226 | - let url= _data.url||""; | ||
| 227 | - xdysdk.api("sendChatMsg", {msgType: msgType, "message":url, "to": 0}); | ||
| 228 | - //$("#txt_message")[0].value = ""; | ||
| 229 | - let chatData = {}; | ||
| 230 | - chatData.fromNodeId = ClassDataProxy.nodeId; | ||
| 231 | - chatData.toNodeId = 0; | ||
| 232 | - chatData.msgType=msgType; | ||
| 233 | - chatData.message = url; | ||
| 234 | - chatData.fromName = ClassDataProxy.userName; | ||
| 235 | - chatData.fromRole = ClassDataProxy.userRole; | ||
| 236 | - this._showChatMessage(chatData); | ||
| 237 | - } | ||
| 238 | - } | ||
| 239 | - } else { | ||
| 240 | - loger.log("发送消息内容不能为空"); | ||
| 241 | - } | ||
| 242 | - //$("#txt_message")[0].value == ''; | ||
| 243 | - } | ||
| 244 | - | ||
| 245 | - //工具类 | ||
| 246 | - _format(str, obj) { | ||
| 247 | - return str.replace(/\{(\w+)\}/g, function (match, group, index) { | ||
| 248 | - return obj[group]; | ||
| 249 | - }); | ||
| 250 | - }; | ||
| 251 | -} | ||
| 252 | -export default Chat; | ||
| 253 | - | ||
| 254 | - | ||
| 255 | - | ||
| 256 | - | ||
| 257 | - |
src/ape/ChatFace.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 聊天表情 和选项卡 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | -import Emiter from "Emiter"; | ||
| 6 | -import Loger from "Loger"; | ||
| 7 | -import $ from "jquery"; | ||
| 8 | - | ||
| 9 | - | ||
| 10 | -let loger = Loger.getLoger('PC-ChatFace'); | ||
| 11 | -let step = 0, count = 4; | ||
| 12 | -let $inner = $("#inner-slide"), $tip = $("#tiplist"), $tipList = $tip.children("li"); | ||
| 13 | -class ChatFace extends Emiter { | ||
| 14 | - constructor() { | ||
| 15 | - super(); | ||
| 16 | - this.addEvent(); | ||
| 17 | - this.init(); | ||
| 18 | - } | ||
| 19 | - | ||
| 20 | - init() { | ||
| 21 | - let that = this; | ||
| 22 | - //布局 | ||
| 23 | - | ||
| 24 | - $(".face").on("click", that._showHide.bind(this)); | ||
| 25 | - $(".swiper-slide").on("click", "li", function (e) { | ||
| 26 | - | ||
| 27 | - $("#txt_message").val($("#txt_message").val() + "[img:" + $(this).find("img").attr("data-type") + "]"); | ||
| 28 | - const faceList = document.getElementById("facelist"); | ||
| 29 | - faceList.style.display = "none"; | ||
| 30 | - }); | ||
| 31 | - //UI按钮点击事件 | ||
| 32 | - $tipList.bind("click", function () { | ||
| 33 | - step = $(this).index(); | ||
| 34 | - $inner.stop().animate({left: -step * 320}, 500); | ||
| 35 | - that._changeTip(); | ||
| 36 | - }); | ||
| 37 | - //选项卡s | ||
| 38 | - this._changeTab(); | ||
| 39 | - //文字区域点击后表情消失 | ||
| 40 | - /* $("#txt_message").on("focus",that._hideFace.bind(this)); | ||
| 41 | - $("#panel_message").on("click",that._hideFace.bind(this)); | ||
| 42 | - $(".middle").on("click",that._hideFace.bind(this)); | ||
| 43 | - $(".left").on("click",that._hideFace.bind(this)); | ||
| 44 | - $(".header").on("click",that._hideFace.bind(this)); | ||
| 45 | - $(".videoWindow").on("click",that._hideFace.bind(this)); | ||
| 46 | - $(".userListTitle").on("click",that._hideFace.bind(this));*/ | ||
| 47 | - | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - addEvent() { | ||
| 51 | - | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - _showHide() { | ||
| 55 | - let faceList = document.getElementById("facelist"); | ||
| 56 | - this._showHideFace(faceList); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - _showHideFace(obj) { | ||
| 60 | - if (obj.style.display == "none") { | ||
| 61 | - obj.style.display = 'block'; | ||
| 62 | - } else { | ||
| 63 | - obj.style.display = 'none'; | ||
| 64 | - } | ||
| 65 | - } | ||
| 66 | - _hideFace(){ | ||
| 67 | - let faceList = document.getElementById("facelist"); | ||
| 68 | - if (faceList.style.display == "block") { | ||
| 69 | - faceList.style.display = 'none'; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - _faceSelected() { | ||
| 75 | - $("#txt_message").val($("#txt_message").val() + "[img:" + $(this).find("img").attr("data-type") + "]"); | ||
| 76 | - let faceList = document.getElementById("facelist"); | ||
| 77 | - faceList.style.display = "none"; | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - | ||
| 81 | - _changeTip() { | ||
| 82 | - let that = this; | ||
| 83 | - let temp = step; | ||
| 84 | - temp >= count ? temp = 0 : null; | ||
| 85 | - $tipList.each(function (index, item) { | ||
| 86 | - index === temp ? $(this).addClass("bg") : $(this).removeClass("bg"); | ||
| 87 | - }); | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - _changeTab() { | ||
| 91 | - $(document).ready(function () { | ||
| 92 | - $(".tabTitle li").click(function () { | ||
| 93 | - $(".tabTitle li").eq($(this).index()).addClass("select").siblings().removeClass("select"); | ||
| 94 | - $(".tabCon").hide().eq($(this).index()).show(); | ||
| 95 | - }); | ||
| 96 | - $(".userListTitle").click(function () { | ||
| 97 | - $(".userListTitle").css("borderBottom", "1px solid #3498db"); | ||
| 98 | - $(".discussTitle").css("borderBottom", "1px solid #666"); | ||
| 99 | - }); | ||
| 100 | - $(".discussTitle").click(function () { | ||
| 101 | - $(".userListTitle").css("borderBottom", "1px solid #666"); | ||
| 102 | - $(".discussTitle").css("borderBottom", "1px solid #3498db"); | ||
| 103 | - $("#panel_message")[0].scrollTop=$("#panel_message")[0].scrollHeight; | ||
| 104 | - }) | ||
| 105 | - }) | ||
| 106 | - } | ||
| 107 | -} | ||
| 108 | -ChatFace.prototype.CHAT_FACE_CHANGE = ChatFace.CHAT_FACE_CHANGE = "chat_face_change"; | ||
| 109 | -export default ChatFace; |
src/ape/ChatImg.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 聊天上传图片 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | -import Emiter from "Emiter"; | ||
| 6 | -import Loger from "Loger"; | ||
| 7 | -import $ from "jquery"; | ||
| 8 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 9 | -import UIControlApe from './UIControlApe'; | ||
| 10 | -import ErrorApe from './ErrorApe'; | ||
| 11 | -import MD5 from "md5"; | ||
| 12 | - | ||
| 13 | -let loger = Loger.getLoger('PC-ChatImg'); | ||
| 14 | -let fileItem; | ||
| 15 | -class ChatImg extends Emiter { | ||
| 16 | - constructor() { | ||
| 17 | - super(); | ||
| 18 | - this.callback=null; | ||
| 19 | - this.init(); | ||
| 20 | - } | ||
| 21 | - init(){ | ||
| 22 | - $("#fileImgInput").on("change", this._uploadFile.bind(this));//上传截图 | ||
| 23 | - } | ||
| 24 | - _uploadFile(evt){ | ||
| 25 | - fileItem=document.getElementById('fileImgInput').files[0]; | ||
| 26 | - if(!fileItem){ | ||
| 27 | - loger.log("没有选择文件"); | ||
| 28 | - return; | ||
| 29 | - } | ||
| 30 | - // this._closeDocListHandler(); | ||
| 31 | - let fileStr=fileItem.name; | ||
| 32 | - let fileValue=fileStr.split('.')[1]; | ||
| 33 | - loger.log("文件名:" + fileItem.name + "->文件类型:" + fileItem.type); | ||
| 34 | - //目前最大支持50M 格式为jpg png pdf docx pptx xlsx | ||
| 35 | - let fileName=fileItem.name.toLowerCase(); | ||
| 36 | - //判断选择的文件类型 | ||
| 37 | - if(fileName.lastIndexOf('.jpg')<0&& | ||
| 38 | - fileName.lastIndexOf('.jpeg')<0&& | ||
| 39 | - fileName.lastIndexOf('.png')<0&& | ||
| 40 | - fileName.lastIndexOf('.gif')<0&& | ||
| 41 | - fileName.lastIndexOf('.bmp')<0){ | ||
| 42 | - ErrorApe.showError(ErrorApe.TYPE_3,ClassDataProxy.localConfig.layoutImg); | ||
| 43 | - return; | ||
| 44 | - } | ||
| 45 | - //判断文件的大小 | ||
| 46 | - if(fileItem.size>(5*1024*1024)){ | ||
| 47 | - ErrorApe.showError(ErrorApe.TYPE_3,ClassDataProxy.localConfig.chatError); | ||
| 48 | - return; | ||
| 49 | - } | ||
| 50 | - if(!ClassDataProxy.DOCServerIP){ | ||
| 51 | - loger.warn("截图服务器地址无效,无法上传文件!"); | ||
| 52 | - ErrorApe.showError(ErrorApe.TYPE_3,ClassDataProxy.localConfig.serverError); | ||
| 53 | - return | ||
| 54 | - } | ||
| 55 | - UIControlApe.disEnabledDocBar(); | ||
| 56 | - UIControlApe.disEnabledMediaBar(); | ||
| 57 | - //UIControlApe.disEnabledLeftBar(); | ||
| 58 | - //UIControlApe.disEnabledBottomBar(); | ||
| 59 | - //UIControlApe.hideBottomDocControlBar(); | ||
| 60 | - let timestamp=ClassDataProxy.creatTimestamp(); | ||
| 61 | - let authId=MD5(ClassDataProxy.siteId+""+timestamp);///authId String MD5(siteId+timestamp) | ||
| 62 | - //console.log("authId:"+authId,"siteId:"+ClassDataProxy.siteId,"timestamp:"+timestamp); | ||
| 63 | - let fd = new FormData(); | ||
| 64 | - fd.append("fileToUpload", fileItem); | ||
| 65 | - fd.append("filename", escape(fileItem.name)); | ||
| 66 | - fd.append("size", fileItem.size); | ||
| 67 | - fd.append("siteId", ClassDataProxy.siteId); //站点 | ||
| 68 | - fd.append("timestamp", String(timestamp)); //时间戳 | ||
| 69 | - fd.append("authId",authId); //上传时间 | ||
| 70 | - fd.append("classId", String(ClassDataProxy.classId)); //课堂号 | ||
| 71 | - /* let ipport=ClassDataProxy.DOCServerIP; | ||
| 72 | - if( ClassDataProxy.DOCServerPort){ | ||
| 73 | - ipport=ipport+":"+ClassDataProxy.DOCServerPort; | ||
| 74 | - } | ||
| 75 | - let mediaUploadUrl= `http://${ipport}/DocSharing/imageUpload`; | ||
| 76 | -*/ | ||
| 77 | - let ipport=ClassDataProxy.DOCServerIP; | ||
| 78 | - if( ClassDataProxy.DOCServerPort){ | ||
| 79 | - ipport=ipport+":"+ClassDataProxy.DOCServerPort; | ||
| 80 | - } | ||
| 81 | - let mediaUploadUrl= `${ClassDataProxy.locationProtocol+ipport}/DocSharing/imageUpload`; | ||
| 82 | - | ||
| 83 | - $.ajax({ | ||
| 84 | - type: "POST", | ||
| 85 | - url: mediaUploadUrl, | ||
| 86 | - processData: false, | ||
| 87 | - contentType: false, | ||
| 88 | - data: fd, | ||
| 89 | - xhr:function(){ | ||
| 90 | - let xhr = $.ajaxSettings.xhr(); | ||
| 91 | - if( xhr.upload) { | ||
| 92 | - xhr.upload.addEventListener("progress" ,function(evt){ | ||
| 93 | - let loaded = evt.loaded; //已经上传大小情况 | ||
| 94 | - let tot = evt.total; //附件总大小 | ||
| 95 | - let per = Math.floor(100*loaded/tot); //已经上传的百分比 | ||
| 96 | - } , false); | ||
| 97 | - return xhr; | ||
| 98 | - } | ||
| 99 | - }, | ||
| 100 | - success: function (data) { | ||
| 101 | - UIControlApe.enabledDocBar(); | ||
| 102 | - UIControlApe.enabledMediaBar(); | ||
| 103 | - //UIControlApe.enabledLeftBar(); | ||
| 104 | - //UIControlApe.enabledBottomBar(); | ||
| 105 | - //UIControlApe.showBottomDocControlBar(); | ||
| 106 | - this._uploadFileSuccess(data); | ||
| 107 | - $("#fileImgInput").val(''); | ||
| 108 | - }.bind(this), | ||
| 109 | - error: function (data) { | ||
| 110 | - UIControlApe.enabledDocBar(); | ||
| 111 | - UIControlApe.enabledMediaBar(); | ||
| 112 | - loger.warn(name+"->上传文件失败", data); | ||
| 113 | - ErrorApe.showError(ErrorApe.TYPE_3,name+"->"+ClassDataProxy.localConfig.serverError); | ||
| 114 | - $("#fileImgInput").val('') | ||
| 115 | - } | ||
| 116 | - }); | ||
| 117 | - } | ||
| 118 | - //将上传文件的信息,传递给底层 | ||
| 119 | - _uploadFileSuccess(msg) { | ||
| 120 | - loger.log("服务器返回的截图信息->", msg); | ||
| 121 | - //{"code":0,"list":[{"name":"sintel (2).mp4","id":"7","url":"http://101.200.150.192:9090/media/h5dev/201706/1478111117/76303834c69cd86f6c6212ae3019b1d0.mp4"}]} | ||
| 122 | - /* | ||
| 123 | - //code | ||
| 124 | - 0:成功 | ||
| 125 | - 1:不是上传请求 | ||
| 126 | - 2:编码错误 | ||
| 127 | - 3:无法解析请求内容 | ||
| 128 | - 4:没有上传文件,或者上传文件超过10个 | ||
| 129 | - 5:siteId 不能为空 | ||
| 130 | - 6:authId 错误 | ||
| 131 | - 7:文件类型不支持 | ||
| 132 | - 8:保存文件信息失败 | ||
| 133 | - 10:保存文件失败*/ | ||
| 134 | - if(msg&&msg.code==0){ | ||
| 135 | - //返回的数据中是一个数组,支持多个上传,目前只处理一个上传的情况 | ||
| 136 | - if(!msg){ | ||
| 137 | - loger.warn('上传文件返回的数据中数组没有数据',msg.list); | ||
| 138 | - return; | ||
| 139 | - } | ||
| 140 | - let fileInfo = {}; | ||
| 141 | - fileInfo.fileName = fileItem.name;//伴音名字 | ||
| 142 | - fileInfo.url = msg.url; //图片绝对地址 默认值: null | ||
| 143 | - | ||
| 144 | - if(this.callback){ | ||
| 145 | - this.callback(fileInfo); | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - //console.log("fileInfo", fileInfo); | ||
| 149 | - //$("#txt_message").val(fileInfo.fileName); | ||
| 150 | - //ClassDataProxy.imgInfo=fileInfo; | ||
| 151 | - //$("#txt_message").focus(); | ||
| 152 | - | ||
| 153 | - }else { | ||
| 154 | - loger.warn("截图上传失败->", msg.code); | ||
| 155 | - ErrorApe.showError(ErrorApe.TYPE_3,'截图上传失败->code:'+msg.code); | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | -} | ||
| 159 | -export default ChatImg; |
src/ape/ClassApe.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 课堂管理模块 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | -import Loger from "../Loger"; | ||
| 6 | -import Ape from "./Ape"; | ||
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 9 | -import $ from "jquery"; | ||
| 10 | -import FlashToolComponet from "libs/FlashToolComponet"; | ||
| 11 | -import ErrorApe from './ErrorApe'; | ||
| 12 | -let loger = Loger.getLoger('PC-ClassApe'); | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -class ClassApe extends Ape { | ||
| 16 | - constructor() { | ||
| 17 | - super(); | ||
| 18 | - this.isExit = false;//是否点击了退出或结束课堂 | ||
| 19 | - this.curClassStuNum = 0; | ||
| 20 | - this._isEndClass = false; //判断是否点击结束课堂 | ||
| 21 | - this._isExitClass = false;//判断是否点击退出课堂 | ||
| 22 | - this._isNetwork = false;//判断是否有网络 | ||
| 23 | - this.addEvent(); | ||
| 24 | - this.init(); | ||
| 25 | - this._setClassStatus(); | ||
| 26 | - | ||
| 27 | - //显示页面信息 | ||
| 28 | - this._showPageInfo(); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - init() { | ||
| 32 | - //设置当前版本号 | ||
| 33 | - $('#pcVersion').text("v2.58.3.20170823"); | ||
| 34 | - //布局,未加入课堂成之前上课界面不显示 | ||
| 35 | - //$('.header').hide(); | ||
| 36 | - //$(".content ").hide(); | ||
| 37 | - $(".loginBg ").show();//登陆框 | ||
| 38 | - $(".initParamsOut ").show();//初始化界面 | ||
| 39 | - | ||
| 40 | - //默认先尝试自动登陆,初始化的按钮先隐藏 | ||
| 41 | - //隐藏初始化界面UI | ||
| 42 | - this._hideInitUI(); | ||
| 43 | - //隐藏登陆界面UI | ||
| 44 | - this._hideLoginUI(); | ||
| 45 | - | ||
| 46 | - //header 按钮点击事件 | ||
| 47 | - $('.startClass').on("click", this._startClassHandler.bind(this)); | ||
| 48 | - $('.pauseClass').on("click", this._pasueClassHandler.bind(this)); | ||
| 49 | - $('.closeClass').on("click", this._closeClassHandler.bind(this));//结束课堂(所有人都要退出) | ||
| 50 | - //$('.endClassEnsure').on("click", this._closeClassEnsureHandler.bind(this)); | ||
| 51 | - //$('.endClassCancel').on("click", this._closeClassCancelHandler.bind(this)); | ||
| 52 | - $('.help').on("click", this._helpHandler.bind(this)); | ||
| 53 | - | ||
| 54 | - $('.exit').on("click", this._exitClassHandler.bind(this));//退出课堂 | ||
| 55 | - $('.exitClassA').on("click", this._exitClassPopupHandler.bind(this)); | ||
| 56 | - //$('.exitClassEnsure').on("click", this._exitClassEnsureHandler.bind(this)); | ||
| 57 | - //$('.exitClassCancel').on("click", this._exitClassCancelHandler.bind(this)); | ||
| 58 | - $(".helpHeadline .iconfont").on("click", this._closeHelpHandler.bind(this)); | ||
| 59 | - //$(".setHeadline .iconfont").on("click", this._closeSetHandler.bind(this)); | ||
| 60 | - //初始化界面按钮 | ||
| 61 | - $('.ensureTeaBtn').show(); | ||
| 62 | - $('.ensureStuBtn').show(); | ||
| 63 | - $('.ensureTeaBtn').on("click", this._stuInitHandler.bind(this)); | ||
| 64 | - $('.ensureStuBtn').on("click", this._teacherInitHandler.bind(this)); | ||
| 65 | - //登陆界面按钮 | ||
| 66 | - $('.btnLoginLi').on("click", this._loginHandler.bind(this)); | ||
| 67 | - let that = this; | ||
| 68 | - $(".passWordInput").on("keydown", function (e) { | ||
| 69 | - let curKey = e.which; | ||
| 70 | - if (curKey == 13) that._loginHandler(); | ||
| 71 | - }); | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - addEvent() { | ||
| 75 | - xdysdk.on("error_event", this._classErrorHandler.bind(this)); | ||
| 76 | - xdysdk.on("class_init_success", this._classInitSuccessHandler.bind(this)); | ||
| 77 | - xdysdk.on("class_get_info_success", this._classGetInfoSuccessHandler.bind(this)); | ||
| 78 | - xdysdk.on("class_join_success", this._classJoinSuccessHandler.bind(this)); | ||
| 79 | - xdysdk.on("class_update_status", this._classUpdateHandler.bind(this));//会议状态更新 | ||
| 80 | - xdysdk.on("class_insert_roster", this._classInsertRosterHandler.bind(this));//会议有用户加入 | ||
| 81 | - xdysdk.on("class_delete_roster", this._classDeleteRosterHandler.bind(this));//会议有人离开 | ||
| 82 | - xdysdk.on("class_update_timer", this._classUpdateTimerHandler.bind(this));//更新会议时间显示 | ||
| 83 | - xdysdk.on("class_exit", this._classExitHandler.bind(this)); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - //设置文字显示国际化 | ||
| 87 | - _showPageInfo() { | ||
| 88 | - | ||
| 89 | - $('#memberNum').text(ClassDataProxy.localConfig.memberNum); | ||
| 90 | - $('.exitText').text(ClassDataProxy.localConfig.exitBtn); | ||
| 91 | - $('.settingText').text(ClassDataProxy.localConfig.setBtn); | ||
| 92 | - $('.helpText').text(ClassDataProxy.localConfig.helpBtn); | ||
| 93 | - $('#endClassroom').text(ClassDataProxy.localConfig.endClassroom); | ||
| 94 | - $('#pauseClassroom').text(ClassDataProxy.localConfig.pauseClassroom); | ||
| 95 | - $('#startClassroom').text(ClassDataProxy.localConfig.startClassroom); | ||
| 96 | - | ||
| 97 | - $('.btnPublishVideo').attr('title', ClassDataProxy.localConfig.openVideo); | ||
| 98 | - $('.btnPublishAudio').attr('title', ClassDataProxy.localConfig.openAudio); | ||
| 99 | - $('.btnOpenVideo').attr('title', ClassDataProxy.localConfig.openVideo); | ||
| 100 | - $('.btnOpenAudio').attr('title', ClassDataProxy.localConfig.openAudio); | ||
| 101 | - $('.btnStopPublishVideo').attr('title', ClassDataProxy.localConfig.closeVideo); | ||
| 102 | - $('.btnStopPublishAudio').attr('title', ClassDataProxy.localConfig.closeAudio); | ||
| 103 | - $('.btnStopPublishMedia').attr('title', ClassDataProxy.localConfig.closeMedia); | ||
| 104 | - | ||
| 105 | - $('#showColor').attr('title', ClassDataProxy.localConfig.showColor); | ||
| 106 | - $('#controlBrush').attr('title', ClassDataProxy.localConfig.controlBrush); | ||
| 107 | - $('.pencil').attr('title', ClassDataProxy.localConfig.pencil); | ||
| 108 | - $('.rescind').attr('title', ClassDataProxy.localConfig.rescind); | ||
| 109 | - $('.clearContent').attr('title', ClassDataProxy.localConfig.delete); | ||
| 110 | - | ||
| 111 | - $('#pptNextStep').attr('title', ClassDataProxy.localConfig.downAnimated); | ||
| 112 | - $('#pptPrevStep').attr('title', ClassDataProxy.localConfig.onAnimated); | ||
| 113 | - $('#fitHeight').attr('title', ClassDataProxy.localConfig.adaptiveHigh); | ||
| 114 | - $('#fitWidth').attr('title', ClassDataProxy.localConfig.adaptiveWidth); | ||
| 115 | - $('#fitNormal').attr('title', ClassDataProxy.localConfig.showAll); | ||
| 116 | - $('#raiseBtn').attr('title', ClassDataProxy.localConfig.raiseBtn); | ||
| 117 | - | ||
| 118 | - $('.userNameInput').attr('placeholder', ClassDataProxy.localConfig.enterUserName); | ||
| 119 | - $('.passWordInput').attr('placeholder', ClassDataProxy.localConfig.enterPassword); | ||
| 120 | - $('.classId').attr('placeholder', ClassDataProxy.localConfig.enterClass); | ||
| 121 | - $('.userId').attr('placeholder', ClassDataProxy.localConfig.enterId); | ||
| 122 | - | ||
| 123 | - | ||
| 124 | - $('#member').text(ClassDataProxy.localConfig.member); | ||
| 125 | - $('#discuss').text(ClassDataProxy.localConfig.discuss); | ||
| 126 | - $('#btn_send').text(ClassDataProxy.localConfig.sendMsg); | ||
| 127 | - $('#docListTitle').text(ClassDataProxy.localConfig.documentList); | ||
| 128 | - $('#mediaListTitle').text(ClassDataProxy.localConfig.mediaShareList); | ||
| 129 | - $('.helpHeadlineTitle').text(ClassDataProxy.localConfig.help); | ||
| 130 | - $('.setHeadlineTitle').text(ClassDataProxy.localConfig.setUp); | ||
| 131 | - $('#camera').text(ClassDataProxy.localConfig.camera); | ||
| 132 | - $('#microphone').text(ClassDataProxy.localConfig.microphone); | ||
| 133 | - $('#volume').text(ClassDataProxy.localConfig.volume); | ||
| 134 | - $('.setSave').text(ClassDataProxy.localConfig.preserve); | ||
| 135 | - $('.setCancel').text(ClassDataProxy.localConfig.cancel); | ||
| 136 | - $('.endClassHeadlineTitle').text(ClassDataProxy.localConfig.endClassroom); | ||
| 137 | - $('.endClassText').text(ClassDataProxy.localConfig.endClassroomCont); | ||
| 138 | - //$('.endClassEnsure').text(ClassDataProxy.localConfig.confirm); | ||
| 139 | - //$('.endClassCancel').text(ClassDataProxy.localConfig.cancel); | ||
| 140 | - | ||
| 141 | - $('.exitClassHeadlineTitle').text(ClassDataProxy.localConfig.exitBtn); | ||
| 142 | - $('.exitClassText').text(ClassDataProxy.localConfig.exitCont); | ||
| 143 | - //$('.exitClassEnsure').text(ClassDataProxy.localConfig.confirm); | ||
| 144 | - //$('.exitClassCancel').text(ClassDataProxy.localConfig.cancel); | ||
| 145 | - | ||
| 146 | - $('#btnLogin').text(ClassDataProxy.localConfig.register); | ||
| 147 | - $('.ensureTeaBtn').text(ClassDataProxy.localConfig.teacher); | ||
| 148 | - $('.ensureStuBtn').text(ClassDataProxy.localConfig.student); | ||
| 149 | - | ||
| 150 | - $('#opening').html(ClassDataProxy.localConfig.opening); | ||
| 151 | - $('#download').html(ClassDataProxy.localConfig.downloadVersion); | ||
| 152 | - $('#downloading').html(ClassDataProxy.localConfig.downloading); | ||
| 153 | - $('#stopShare').html(ClassDataProxy.localConfig.stopSharing); | ||
| 154 | - $('.themeHeadlineTitle,.resultHeadlineTitle,.studentHeadline,.answerText').html(ClassDataProxy.localConfig.answerSheet); | ||
| 155 | - $('.signHeadlineTitle,.signStudentHeadlineTitle,.signText').html(ClassDataProxy.localConfig.rollCall); | ||
| 156 | - $('#docListOut').attr('title', ClassDataProxy.localConfig.selectFile); | ||
| 157 | - $('#screenSharingOut').attr('title', ClassDataProxy.localConfig.screenSharing); | ||
| 158 | - $('#mediaUpLoadOut').attr('title', ClassDataProxy.localConfig.updateMediaFile); | ||
| 159 | - $('#mediaListOut').attr('title', ClassDataProxy.localConfig.selectMediaFile); | ||
| 160 | - $('#uploadAudio').attr('title', ClassDataProxy.localConfig.uploadAudio); | ||
| 161 | - $('.laserPen').attr('title', ClassDataProxy.localConfig.laserPen); | ||
| 162 | - | ||
| 163 | - $('.sponsorSign').html(ClassDataProxy.localConfig.startName); | ||
| 164 | - $('.attendance').html(ClassDataProxy.localConfig.attendance); | ||
| 165 | - $('.turnResultBtn').html(ClassDataProxy.localConfig.terminationRollCall); | ||
| 166 | - $('.turnStudentBtn').html(ClassDataProxy.localConfig.signIn); | ||
| 167 | - $('.themeTit').html(ClassDataProxy.localConfig.cardType); | ||
| 168 | - $('.gotIt').html(ClassDataProxy.localConfig.gotIt); | ||
| 169 | - $('.understand').html(ClassDataProxy.localConfig.understand); | ||
| 170 | - $('.yes').html(ClassDataProxy.localConfig.yes); | ||
| 171 | - $('.wrong').html(ClassDataProxy.localConfig.wrong); | ||
| 172 | - $('.yup').html(ClassDataProxy.localConfig.yup); | ||
| 173 | - $('.nothing').html(ClassDataProxy.localConfig.nothing); | ||
| 174 | - $('.answerTime').html(ClassDataProxy.localConfig.answerTime); | ||
| 175 | - $('.dynamicRight').html(ClassDataProxy.localConfig.release); | ||
| 176 | - $('.enterAnswer').html(ClassDataProxy.localConfig.enterAnswer); | ||
| 177 | - $('.answerResult').html(ClassDataProxy.localConfig.answerResult); | ||
| 178 | - $('.share').html(ClassDataProxy.localConfig.share); | ||
| 179 | - $('.participation').html(ClassDataProxy.localConfig.participation); | ||
| 180 | - $('.resultConceal').html(ClassDataProxy.localConfig.hideCount); | ||
| 181 | - $('.resultTermination').html(ClassDataProxy.localConfig.termination); | ||
| 182 | - $('.referBtn').html(ClassDataProxy.localConfig.submitMsg); | ||
| 183 | - $('.abandonBtn').html(ClassDataProxy.localConfig.giveUp); | ||
| 184 | - | ||
| 185 | - $('.mediaFileContentTxt').html(ClassDataProxy.localConfig.listedFiles); | ||
| 186 | - $('.mediaFileContentMenuLableTxt').html(ClassDataProxy.localConfig.upload); | ||
| 187 | - $('#musicListTitle').html(ClassDataProxy.localConfig.audioFilelist); | ||
| 188 | - $('.inputCount').html(ClassDataProxy.localConfig.answerIsNotEmpty); | ||
| 189 | - | ||
| 190 | - $('.downloadCancel').html(ClassDataProxy.localConfig.cancel); | ||
| 191 | - | ||
| 192 | - $('#showForm').attr('title', ClassDataProxy.localConfig.selectShape);//选择形状 | ||
| 193 | - $('#curveBrush').attr('title', ClassDataProxy.localConfig.curveStyle);//曲线 | ||
| 194 | - $('#straightBrush').attr('title', ClassDataProxy.localConfig.justStyle);//直线 | ||
| 195 | - $('#circleBrush').attr('title', ClassDataProxy.localConfig.circleStyle);//圆形 | ||
| 196 | - $('#squareBrush').attr('title', ClassDataProxy.localConfig.squareStyle);//方形 | ||
| 197 | - | ||
| 198 | - //询问弹框中的确定和取消按钮 | ||
| 199 | - $('#choiceConfirm').html(ClassDataProxy.localConfig.confirm); | ||
| 200 | - $('#choiceCancel').html(ClassDataProxy.localConfig.cancel); | ||
| 201 | - //提示框 | ||
| 202 | - $('#nowLiveVersion').html(ClassDataProxy.localConfig.nowLiveVersion); | ||
| 203 | - $('#nowPlaybackVersion').html(ClassDataProxy.localConfig.nowPlaybackVersion); | ||
| 204 | - $('#browserAreaSettings').html(ClassDataProxy.localConfig.browserAreaSettings); | ||
| 205 | - $('.speed360Recommend').html(ClassDataProxy.localConfig.speed360Recommend); | ||
| 206 | - $('.speed360').html(ClassDataProxy.localConfig.speed360); | ||
| 207 | - $('.security360').html(ClassDataProxy.localConfig.security360); | ||
| 208 | - $('.security360Only').html(ClassDataProxy.localConfig.security360Only); | ||
| 209 | - $('.sogouExplorer').html(ClassDataProxy.localConfig.sogouExplorer); | ||
| 210 | - $('#flashVersionsLow').html(ClassDataProxy.localConfig.flashVersionsLow); | ||
| 211 | - $('#flashDownload').html(ClassDataProxy.localConfig.download); | ||
| 212 | - $('#flashRetry').html(ClassDataProxy.localConfig.retry); | ||
| 213 | - $('.flashForbiddenMsg').html(ClassDataProxy.localConfig.flashForbiddenMsg); | ||
| 214 | - $('#flashMsgContent').html(ClassDataProxy.localConfig.flashMsgContent); | ||
| 215 | - $('#flashDetailSteps').html(ClassDataProxy.localConfig.flashDetailSteps); | ||
| 216 | - $('#flashUpdataVersions').html(ClassDataProxy.localConfig.flashUpdataVersions); | ||
| 217 | - | ||
| 218 | - } | ||
| 219 | - | ||
| 220 | - _showInitClassInuptBox() { | ||
| 221 | - this._showInitUI(); | ||
| 222 | - $(".classId ").val(ClassDataProxy.classId); | ||
| 223 | - $(".userId ").val(ClassDataProxy.userId); | ||
| 224 | - $(".initParamsOut ").show(); | ||
| 225 | - | ||
| 226 | - } | ||
| 227 | - | ||
| 228 | - _showJoinClassInputBox() { | ||
| 229 | - $(".userNameInput ").val(ClassDataProxy.userName); | ||
| 230 | - $(".loginBg ").show(); | ||
| 231 | - this._showLoginUI(); | ||
| 232 | - if (ClassDataProxy.passwordRequired) { | ||
| 233 | - $(".passWordInput ").val(ClassDataProxy.password); | ||
| 234 | - } else { | ||
| 235 | - $(".passWordLi ").hide(); | ||
| 236 | - loger.log("ClassDataProxy.passwordRequired", ClassDataProxy.passwordRequired); | ||
| 237 | - } | ||
| 238 | - } | ||
| 239 | - | ||
| 240 | - //EVENT-------------------------------------------------- | ||
| 241 | - startClassRun() { | ||
| 242 | - this._initClass(); | ||
| 243 | - } | ||
| 244 | - | ||
| 245 | - //初始化课堂 | ||
| 246 | - _initClass() { | ||
| 247 | - loger.log("initClass", ClassDataProxy.getInitClassData()); | ||
| 248 | - loger.log("是否是录制回放->", ClassDataProxy.isRecordPlayBack); | ||
| 249 | - | ||
| 250 | - | ||
| 251 | - $(".initParams .errorTip").text(ClassDataProxy.localConfig.initClass); | ||
| 252 | - $(".initParams .errorTip").show(); | ||
| 253 | - //隐藏初始化和登陆按钮,如果是自动登陆,这些按钮就不用显示了 | ||
| 254 | - this._hideInitUI(); | ||
| 255 | - | ||
| 256 | - $(".classId ").val(ClassDataProxy.classId); | ||
| 257 | - $(".userId ").val(ClassDataProxy.userId); | ||
| 258 | - if (ClassDataProxy.isRecordPlayBack) { | ||
| 259 | - $("#mainContentBox ").css("top", "2px"); | ||
| 260 | - xdysdk.api("initRecordPlayback", ClassDataProxy.getInitClassData()); | ||
| 261 | - } else { | ||
| 262 | - xdysdk.api("init", ClassDataProxy.getInitClassData()); | ||
| 263 | - } | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | - //加入课堂 | ||
| 267 | - _joinClass() { | ||
| 268 | - loger.log("joinClass", ClassDataProxy.getJoinClassData()); | ||
| 269 | - this._hideLoginUI(); | ||
| 270 | - $(".btnLoginLi ").hide(); | ||
| 271 | - $(".initParamsOut ").hide(); | ||
| 272 | - $(".userNameInput ").val(ClassDataProxy.userName); | ||
| 273 | - $(".passWordInput ").val(ClassDataProxy.password); | ||
| 274 | - $(".loginContent .errorTip").text(ClassDataProxy.localConfig.initClass); | ||
| 275 | - xdysdk.api("joinClass", ClassDataProxy.getJoinClassData()); | ||
| 276 | - } | ||
| 277 | - | ||
| 278 | - _setClassStatus() { | ||
| 279 | - if (ClassDataProxy.userRole == ClassDataProxy.USER_HOST) { | ||
| 280 | - //设置状态显示 | ||
| 281 | - if (ClassDataProxy.classStatus == 1) { | ||
| 282 | - $('.startClass').hide(); | ||
| 283 | - $('.pauseClass').show(); | ||
| 284 | - } else { | ||
| 285 | - $('.startClass').show(); | ||
| 286 | - $('.pauseClass').hide(); | ||
| 287 | - } | ||
| 288 | - } | ||
| 289 | - | ||
| 290 | - //录制回放状态 | ||
| 291 | - if (ClassDataProxy.isRecordPlayBack) { | ||
| 292 | - $('.classStatus').text(ClassDataProxy.localConfig.playback); | ||
| 293 | - $('.classStatus').css("color", "#d95136"); | ||
| 294 | - $('.classStatusIcon').html(''); | ||
| 295 | - $('.classStatusIcon').css("color", "#d95136"); | ||
| 296 | - return; | ||
| 297 | - } | ||
| 298 | - | ||
| 299 | - //正常使用状态 | ||
| 300 | - if (ClassDataProxy.classStatus == 1) { | ||
| 301 | - $('.classStatus').text(ClassDataProxy.localConfig.liveBroadcast); | ||
| 302 | - $('.classStatus').css("color", "#d95136"); | ||
| 303 | - $('.classStatusIcon').html(''); | ||
| 304 | - $('.classStatusIcon').css("color", "#d95136"); | ||
| 305 | - } else if (ClassDataProxy.classStatus == 2) { | ||
| 306 | - $('.classStatus').text(ClassDataProxy.localConfig.rest); | ||
| 307 | - $('.classStatusIcon').html(''); | ||
| 308 | - $('.classStatusIcon').css("color", "#ccc"); | ||
| 309 | - $('.classStatus').css("color", "#ccc"); | ||
| 310 | - } else { | ||
| 311 | - $('.classStatus').text(ClassDataProxy.localConfig.notStart); | ||
| 312 | - $('.classStatusIcon').html(''); | ||
| 313 | - $('.classStatusIcon').css("color", "#ccc"); | ||
| 314 | - $('.classStatus').css("color", "#ccc"); | ||
| 315 | - } | ||
| 316 | - } | ||
| 317 | - | ||
| 318 | - _hideInitUI() { | ||
| 319 | - loger.log("_hideInitUI"); | ||
| 320 | - $(".initParamsClassId ").hide(); | ||
| 321 | - $(".initParamsUserId ").hide(); | ||
| 322 | - $(".initParamsRoleBtn ").hide(); | ||
| 323 | - $('.initParamsBox').css('background', ''); | ||
| 324 | - } | ||
| 325 | - | ||
| 326 | - _showInitUI() { | ||
| 327 | - loger.log("_showInitUI"); | ||
| 328 | - $(".initParamsClassId ").show(); | ||
| 329 | - $(".initParamsUserId ").show(); | ||
| 330 | - $(".initParamsRoleBtn ").show(); | ||
| 331 | - $(".initParams .errorTip").show(); | ||
| 332 | - $('.initParamsBox').css('background', '#484646'); | ||
| 333 | - } | ||
| 334 | - | ||
| 335 | - _hideLoginUI() { | ||
| 336 | - $(".btnLoginLi ").hide(); | ||
| 337 | - $(".userNameLi ").hide(); | ||
| 338 | - $(".passWordLi ").hide(); | ||
| 339 | - $('.loginContentBox').css('background', ''); | ||
| 340 | - } | ||
| 341 | - | ||
| 342 | - _showLoginUI() { | ||
| 343 | - $(".btnLoginLi ").show(); | ||
| 344 | - $(".userNameLi ").show(); | ||
| 345 | - $(".passWordLi ").show(); | ||
| 346 | - $('.loginContentBox').css('background', '#484646'); | ||
| 347 | - } | ||
| 348 | - | ||
| 349 | - //xdysdk事件监听处理-------------------------------------- | ||
| 350 | - _classErrorHandler(_data) { | ||
| 351 | - loger.warn("_classErrorHandler", _data); | ||
| 352 | - switch (_data.code) { | ||
| 353 | - case 100: | ||
| 354 | - case 101: | ||
| 355 | - case 102: | ||
| 356 | - case 103: | ||
| 357 | - case 105: | ||
| 358 | - case 106: | ||
| 359 | - case 107: | ||
| 360 | - case 301: | ||
| 361 | - this._showInitClassInuptBox(); | ||
| 362 | - $(".initParams .errorTip").text("" + _data.reson); | ||
| 363 | - break; | ||
| 364 | - case 200: | ||
| 365 | - case 201: | ||
| 366 | - case 202: | ||
| 367 | - case 203: | ||
| 368 | - case 204: | ||
| 369 | - case 205: | ||
| 370 | - case 207: | ||
| 371 | - this._showJoinClassInputBox(); | ||
| 372 | - $(".loginContent .errorTip").text("" + _data.reson); | ||
| 373 | - break; | ||
| 374 | - case 206: | ||
| 375 | - //请输入正确密码 | ||
| 376 | - this._showJoinClassInputBox(); | ||
| 377 | - $(".loginContent .errorTip").text(ClassDataProxy.localConfig.correctPassword); | ||
| 378 | - break; | ||
| 379 | - case 300: | ||
| 380 | - case 301: | ||
| 381 | - loger.warn(_data); | ||
| 382 | - break; | ||
| 383 | - case 910: | ||
| 384 | - ErrorApe.showWarnError("" + _data.reson) | ||
| 385 | - $(".initParams .errorTip").text("" + _data.reson); | ||
| 386 | - break; | ||
| 387 | - case 911: | ||
| 388 | - ErrorApe.showWarnError("" + _data.reson) | ||
| 389 | - $(".initParams .errorTip").text("" + _data.reson); | ||
| 390 | - break; | ||
| 391 | - case 20000: | ||
| 392 | - //已经退出就不再显示网络端口了 | ||
| 393 | - if (this.isExit) { | ||
| 394 | - return; | ||
| 395 | - } | ||
| 396 | - ErrorApe.showWarnError(ClassDataProxy.localConfig.disconnected); | ||
| 397 | - this._emit(ClassApe.CLASS_STOP_MEDIA_PUBLISH); | ||
| 398 | - break; | ||
| 399 | - default: | ||
| 400 | - break; | ||
| 401 | - } | ||
| 402 | - } | ||
| 403 | - | ||
| 404 | - _classInitSuccessHandler(_data) { | ||
| 405 | - loger.log("课堂初始化成功", new Date().getTime(), _data); | ||
| 406 | - $(".initParamsOut ").hide(); | ||
| 407 | - ClassDataProxy.siteId = _data.siteId; | ||
| 408 | - ClassDataProxy.classType = _data.classType; | ||
| 409 | - ClassDataProxy.userName = _data.userName; | ||
| 410 | - ClassDataProxy.userRole = _data.userRole;//以加入成功之后的为准 | ||
| 411 | - ClassDataProxy.passwordRequired = _data.passwordRequired; | ||
| 412 | - this._joinClass(); | ||
| 413 | - } | ||
| 414 | - | ||
| 415 | - _classGetInfoSuccessHandler(_data) { | ||
| 416 | - loger.log("获取课堂信息完成", new Date().getTime(), _data); | ||
| 417 | - } | ||
| 418 | - | ||
| 419 | - _classJoinSuccessHandler(_data) { | ||
| 420 | - loger.log("加入课堂成功", new Date().getTime(), _data); | ||
| 421 | - $(".initParamsOut ").hide(); | ||
| 422 | - $(".loginBg ").hide(); | ||
| 423 | - this._isNetwork = true; | ||
| 424 | - | ||
| 425 | - ClassDataProxy.maxAudioChannels = _data.maxAudioChannels; | ||
| 426 | - ClassDataProxy.maxVideoChannels = _data.maxVideoChannels; | ||
| 427 | - ClassDataProxy.nodeId = _data.nodeId; | ||
| 428 | - ClassDataProxy.classTimestamp = _data.classTimestamp || 0; | ||
| 429 | - ClassDataProxy.recordPlaybackMaxTime = _data.recordPlaybackMaxTime || 0; | ||
| 430 | - ClassDataProxy.classType = _data.classType || 1; | ||
| 431 | - ClassDataProxy.className = _data.className || ClassDataProxy.localConfig.unknown; | ||
| 432 | - ClassDataProxy.siteId = _data.siteId || ClassDataProxy.localConfig.unknown; | ||
| 433 | - ClassDataProxy.userRole = _data.userRole; | ||
| 434 | - ClassDataProxy.classStatus = _data.classStatus; | ||
| 435 | - | ||
| 436 | - ClassDataProxy.DOCServerIP = _data.DOCServerIP || ""; | ||
| 437 | - ClassDataProxy.DOCServerPort = _data.DOCServerPort || ""; | ||
| 438 | - ClassDataProxy.serverTimeDistance = _data.serverAndLoacTimeDistanc; | ||
| 439 | - if (!ClassDataProxy.serverTimeDistance) { | ||
| 440 | - ClassDataProxy.serverTimeDistance = 0; | ||
| 441 | - } | ||
| 442 | - | ||
| 443 | - ClassDataProxy.ssTunnelAppURL = _data.ssTunnelAppURL || "";//插件地址 | ||
| 444 | - //console.log("ClassDataProxy",ClassDataProxy); | ||
| 445 | - ClassDataProxy.currentSceneTableId = _data.currentSceneTableId || ClassDataProxy.SCENE_DOC;//记录文档区域当前显示的是哪个模块;0=文档模块,1=屏幕共享,2=媒体共享 | ||
| 446 | - | ||
| 447 | - $('.header').show(); | ||
| 448 | - $('.pauseClass').hide(); | ||
| 449 | - $(".content ").show(); | ||
| 450 | - //$('.classTheme').text(`[${ClassDataProxy.siteId}]-${ClassDataProxy.className}`);//这里不显示,显示在title中 | ||
| 451 | - $('.classTheme').hide(); | ||
| 452 | - if (ClassDataProxy.classTimestamp > 0) { | ||
| 453 | - $('.classTimestampText').text(ClassDataProxy.timestampToDateTimeFull(ClassDataProxy.classTimestamp)); | ||
| 454 | - } else { | ||
| 455 | - $('.classTimestampText').text(""); | ||
| 456 | - } | ||
| 457 | - | ||
| 458 | - document.title = ClassDataProxy.className || ""; | ||
| 459 | - //设置界面元素不可选,如果不设置会影响到canvas的绘制 | ||
| 460 | - /* document.body.onselectstart = document.body.oncontextmenu = function () { | ||
| 461 | - if ($('div').is('.message')) { | ||
| 462 | - return true; | ||
| 463 | - } | ||
| 464 | - return false; | ||
| 465 | - };*/ | ||
| 466 | - this._setClassStatus(); | ||
| 467 | - | ||
| 468 | - //如果不是老师,不能操作课堂按钮 | ||
| 469 | - if (ClassDataProxy.userRole == ClassDataProxy.USER_HOST) { | ||
| 470 | - $(".laserRed").hide(); | ||
| 471 | - //老师可以操作不 | ||
| 472 | - } else if (ClassDataProxy.userRole == ClassDataProxy.USER_INVISIBLE) { | ||
| 473 | - //监课不能使用的功能 自己的设置面板 绘画区的工具栏 底部工具类 举手 | ||
| 474 | - $('.setting').hide(); | ||
| 475 | - $('.foldDrawToolOut').hide(); | ||
| 476 | - $('.drawTool').remove(); | ||
| 477 | - $("#controlBrush").hide(); | ||
| 478 | - $('.raiseBtn').hide(); | ||
| 479 | - $('.answer').hide(); | ||
| 480 | - $('.sign').hide(); | ||
| 481 | - $('.startClass').hide(); | ||
| 482 | - $('.pauseClass').hide(); | ||
| 483 | - $('.closeClass').hide(); | ||
| 484 | - $('.left').hide(); | ||
| 485 | - } else { | ||
| 486 | - //其他身份按普通人处理 | ||
| 487 | - loger.log("隐藏控制按钮"); | ||
| 488 | - $('.startClass').hide(); | ||
| 489 | - $('.pauseClass').hide(); | ||
| 490 | - $('.closeClass').hide(); | ||
| 491 | - $('.left').hide(); | ||
| 492 | - $('.answer').hide(); | ||
| 493 | - $('.sign').hide(); | ||
| 494 | - } | ||
| 495 | - | ||
| 496 | - //录制回放时的状态设置 | ||
| 497 | - if (ClassDataProxy.isRecordPlayBack) { | ||
| 498 | - $('.exit').hide(); | ||
| 499 | - $('.startClass').hide(); | ||
| 500 | - $('.pauseClass').hide(); | ||
| 501 | - $('.closeClass').hide(); | ||
| 502 | - $('.left').hide(); | ||
| 503 | - $('.curClassUserNum').hide(); | ||
| 504 | - $('.classTimestampText').hide(); | ||
| 505 | - $('.setting').hide(); | ||
| 506 | - $('.userListTitle').hide(); | ||
| 507 | - $('#raiseBtn').hide(); | ||
| 508 | - } | ||
| 509 | - | ||
| 510 | - this._setClassStatus(); | ||
| 511 | - | ||
| 512 | - | ||
| 513 | - /* | ||
| 514 | - //移动端做延迟处理,PC端不做处理 | ||
| 515 | - setTimeout(function(){ | ||
| 516 | - //延迟消息处理 | ||
| 517 | - xdysdk.api("setMessageDelay",{"messageDelay":true}); | ||
| 518 | - },3000); | ||
| 519 | - */ | ||
| 520 | - //只有在1v1课堂时,学生可以进行画 | ||
| 521 | - if (ClassDataProxy.maxMediaChannels == 2 && ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL) { | ||
| 522 | - $('.foldDrawToolOut').show(); | ||
| 523 | - $('.foldDrawTool').show(); | ||
| 524 | - $(".drawTool").show(); | ||
| 525 | - $(".drawTool").css("height", "160px"); | ||
| 526 | - $(".clearContent").hide(); | ||
| 527 | - $(".laserPen").hide(); | ||
| 528 | - $("#controlBrush").hide(); | ||
| 529 | - } else if (ClassDataProxy.maxMediaChannels !== 2 && ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL) { | ||
| 530 | - $('.foldDrawToolOut').hide(); | ||
| 531 | - $('.foldDrawTool').hide(); | ||
| 532 | - $(".drawTool").hide(); | ||
| 533 | - $(".clearContent").hide(); | ||
| 534 | - $(".laserPen").hide(); | ||
| 535 | - $("#controlBrush").hide(); | ||
| 536 | - } | ||
| 537 | - | ||
| 538 | - } | ||
| 539 | - | ||
| 540 | - _classUpdateHandler(_data) { | ||
| 541 | - loger.log('课堂状态发送改变->', _data); | ||
| 542 | - ClassDataProxy.classStatus = _data.classStatus; | ||
| 543 | - ClassDataProxy.classStartTime = _data.classStartTime; | ||
| 544 | - ClassDataProxy.classStopTime = _data.classStopTime; | ||
| 545 | - ClassDataProxy.classBeginTime = _data.classBeginTime; | ||
| 546 | - ClassDataProxy.classEndTime = _data.classEndTime; | ||
| 547 | - ClassDataProxy.currentSceneTableId = _data.currentSceneTableId || ClassDataProxy.SCENE_DOC;//记录文档区域当前显示的是哪个模块;0=文档模块,1=屏幕共享,2=媒体共享 | ||
| 548 | - | ||
| 549 | - this._setClassStatus(); | ||
| 550 | - } | ||
| 551 | - | ||
| 552 | - _classInsertRosterHandler(_data) { | ||
| 553 | - //loger.log(_data); | ||
| 554 | - this.curClassStuNum++; | ||
| 555 | - $(".curClassUserNumTotal").html(this.curClassStuNum); | ||
| 556 | - } | ||
| 557 | - | ||
| 558 | - _classDeleteRosterHandler(_data) { | ||
| 559 | - //loger.log(_data); | ||
| 560 | - this.curClassStuNum--; | ||
| 561 | - if (this.curClassStuNum < 0) { | ||
| 562 | - this.curClassStuNum = 0; | ||
| 563 | - } | ||
| 564 | - $(".curClassUserNumTotal").html(this.curClassStuNum); | ||
| 565 | - } | ||
| 566 | - | ||
| 567 | - _classUpdateTimerHandler(_data) { | ||
| 568 | - ClassDataProxy.classTimestamp = _data.classTimestamp; | ||
| 569 | - if (!ClassDataProxy.isRecordPlayBack) { | ||
| 570 | - $('.classTimestampText').text(ClassDataProxy.timestampToDateTimeFull(ClassDataProxy.classTimestamp)); | ||
| 571 | - } | ||
| 572 | - } | ||
| 573 | - | ||
| 574 | - //退出课堂,关闭界面 | ||
| 575 | - _classExitHandler() { | ||
| 576 | - loger.log("_classExitHandler"); | ||
| 577 | - this.isExit = true; | ||
| 578 | - ClassDataProxy.classStatus = 0; | ||
| 579 | - $('.classStatus').text(ClassDataProxy.localConfig.notStart); | ||
| 580 | - $(".box").hide(); | ||
| 581 | - $('.answerAllBox').hide(); | ||
| 582 | - $('.signAllBox').hide(); | ||
| 583 | - $(".setBox").hide(); | ||
| 584 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.quitClass) | ||
| 585 | - $("#h5Music").attr("src", ""); | ||
| 586 | - $("#h5MediaShare").attr("src", ""); | ||
| 587 | - } | ||
| 588 | - | ||
| 589 | - //mouseEvent-------------------------------- | ||
| 590 | - _startClassHandler() { | ||
| 591 | - //开始之前需要停止当前的所有音视频 | ||
| 592 | - setTimeout(function () { | ||
| 593 | - xdysdk.api("sendStartClass"); | ||
| 594 | - }, 200); | ||
| 595 | - | ||
| 596 | - } | ||
| 597 | - | ||
| 598 | - _pasueClassHandler() { | ||
| 599 | - //暂停的时候停止当前的所有音视频 | ||
| 600 | - setTimeout(function () { | ||
| 601 | - xdysdk.api("sendPauseClass"); | ||
| 602 | - }, 200) | ||
| 603 | - | ||
| 604 | - } | ||
| 605 | - | ||
| 606 | - //询问是结束课堂(所有人都要退出) | ||
| 607 | - _closeClassHandler() { | ||
| 608 | - let _this = this; | ||
| 609 | - ErrorApe.showError(ErrorApe.TYPE_20, ClassDataProxy.localConfig.endClassroomCont, function (_value) { | ||
| 610 | - // loger.log("_closeClassHandler================",_value); | ||
| 611 | - if (_value == true) { | ||
| 612 | - loger.warn("确定结束课堂", _value); | ||
| 613 | - _this._closeClassEnsureHandler(); | ||
| 614 | - } else { | ||
| 615 | - loger.warn("取消结束课堂", _value); | ||
| 616 | - } | ||
| 617 | - ErrorApe.hide(); | ||
| 618 | - }) | ||
| 619 | - } | ||
| 620 | - | ||
| 621 | - _closeClassEnsureHandler() { | ||
| 622 | - this.isExit = true; | ||
| 623 | - xdysdk.api("sendCloseClass"); | ||
| 624 | - } | ||
| 625 | - | ||
| 626 | - _closeClassCancelHandler() { | ||
| 627 | - ErrorApe.hide(); | ||
| 628 | - } | ||
| 629 | - | ||
| 630 | - //询问是否退出课堂(自己) | ||
| 631 | - _exitClassHandler() { | ||
| 632 | - let _this = this; | ||
| 633 | - ErrorApe.showError(ErrorApe.TYPE_20, ClassDataProxy.localConfig.exitCont, function (_value) { | ||
| 634 | - if (_value == true) { | ||
| 635 | - loger.warn("确定退出课堂", _value); | ||
| 636 | - _this._exitClassEnsureHandler(); | ||
| 637 | - } else { | ||
| 638 | - loger.warn("取消退出课堂", _value); | ||
| 639 | - } | ||
| 640 | - ErrorApe.hide(); | ||
| 641 | - }); | ||
| 642 | - } | ||
| 643 | - | ||
| 644 | - _exitClassPopupHandler() { | ||
| 645 | - ErrorApe.hide(); | ||
| 646 | - } | ||
| 647 | - | ||
| 648 | - _exitClassEnsureHandler() { | ||
| 649 | - // ErrorApe.hide(); | ||
| 650 | - this.isExit = true; | ||
| 651 | - xdysdk.api("leaveClass"); | ||
| 652 | - this._classExitHandler(); | ||
| 653 | - | ||
| 654 | - } | ||
| 655 | - | ||
| 656 | - _exitClassCancelHandler() { | ||
| 657 | - ErrorApe.hide(); | ||
| 658 | - } | ||
| 659 | - | ||
| 660 | - _helpHandler() { | ||
| 661 | - $(".helpBox").show(); | ||
| 662 | - $(".masker").show(); | ||
| 663 | - } | ||
| 664 | - | ||
| 665 | - _closeHelpHandler() { | ||
| 666 | - $(".helpBox").hide(); | ||
| 667 | - $(".masker").hide(); | ||
| 668 | - } | ||
| 669 | - | ||
| 670 | - _stuInitHandler() { | ||
| 671 | - ClassDataProxy.userRole = ClassDataProxy.USER_NOTMAL; | ||
| 672 | - ClassDataProxy.classId = parseInt($(".classId ")[0].value); | ||
| 673 | - ClassDataProxy.userId = $(".userId ")[0].value; | ||
| 674 | - this._initClass(); | ||
| 675 | - } | ||
| 676 | - | ||
| 677 | - _teacherInitHandler() { | ||
| 678 | - ClassDataProxy.userRole = ClassDataProxy.USER_HOST; | ||
| 679 | - ClassDataProxy.classId = parseInt($(".classId ")[0].value); | ||
| 680 | - ClassDataProxy.userId = $(".userId ")[0].value; | ||
| 681 | - this._initClass(); | ||
| 682 | - } | ||
| 683 | - | ||
| 684 | - _loginHandler() { | ||
| 685 | - let userName = $('.userNameInput').val(); | ||
| 686 | - let userPwd = $('.passWordInput').val(); | ||
| 687 | - let errMsg = $(".errorTip"); | ||
| 688 | - if (userPwd) { | ||
| 689 | - $(".loginSpinner").show(); | ||
| 690 | - } | ||
| 691 | - if (!userName) { | ||
| 692 | - errMsg.html('请输入用户名').addClass('showErr'); | ||
| 693 | - return false; | ||
| 694 | - } | ||
| 695 | - if (ClassDataProxy.passwordRequired && !userPwd) { | ||
| 696 | - errMsg.html('请输入密码').addClass('showErr'); | ||
| 697 | - return false; | ||
| 698 | - } | ||
| 699 | - ClassDataProxy.userName = $(".userNameInput ")[0].value || ''; | ||
| 700 | - ClassDataProxy.password = $(".passWordInput ")[0].value; | ||
| 701 | - this._joinClass(); | ||
| 702 | - } | ||
| 703 | -} | ||
| 704 | - | ||
| 705 | -ClassApe.prototype.CLASS_STOP_MEDIA_PUBLISH = ClassApe.CLASS_STOP_MEDIA_PUBLISH = "class_stop_media_publish";//停止所有媒体推流 | ||
| 706 | -export default ClassApe; | ||
| 707 | - | ||
| 708 | - | ||
| 709 | - | ||
| 710 | - | ||
| 711 | - |
| @@ -4,9 +4,6 @@ | @@ -4,9 +4,6 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import DrawTool from "./DrawTool"; | ||
| 9 | -import LaserPen from "./LaserPen"; | ||
| 10 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 11 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 12 | import dateUI from 'libs/laydate'; | 9 | import dateUI from 'libs/laydate'; |
src/ape/DocApe.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 文档模块 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | -import Loger from "../Loger"; | ||
| 6 | -import Ape from "./Ape"; | ||
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import $ from "jquery"; | ||
| 9 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 10 | -import DynamicPPT from './DynamicPPT'; | ||
| 11 | -import UIControlApe from './UIControlApe'; | ||
| 12 | -import ErrorApe from './ErrorApe'; | ||
| 13 | -let loger = Loger.getLoger('PC-DocApe'); | ||
| 14 | - | ||
| 15 | -const DOC_SHOW_FULL = 0;//完整显示 | ||
| 16 | -const DOC_SHOW_WIDTH = 1;//按宽度显示 | ||
| 17 | -const DOC_SHOW_HEIGHT = 2;//按高度显示 | ||
| 18 | -const PPT_WIDTH = 720;//动态ppt标准宽度 | ||
| 19 | -const PPT_HEIGHT = 540;//动态ppt标准高度 | ||
| 20 | - | ||
| 21 | -class DocApe extends Ape { | ||
| 22 | - constructor() { | ||
| 23 | - super(); | ||
| 24 | - this.showDocDefaultDelay = 0; | ||
| 25 | - this._docShowType = DOC_SHOW_FULL;//文档显示模式 | ||
| 26 | - this.lastV=0; | ||
| 27 | - this.lastH=0; | ||
| 28 | - this.curV=0; | ||
| 29 | - this.curH=0; | ||
| 30 | - this._docList = {};//文档数据 | ||
| 31 | - this._currentDocId = 0;//当前显示文档id,0就是没有文档,只显示白板 | ||
| 32 | - this._currentPageNum = 1;//,默认页数是1 | ||
| 33 | - this._pageNum = 1;//,默认总页数是1 | ||
| 34 | - this.currentImagePath = "";//当前显示的图片地址 | ||
| 35 | - this.resizeDelay;//窗口大小变化延迟处理 | ||
| 36 | - this.dynamicPPT; | ||
| 37 | - this.addEvent(); | ||
| 38 | - this.init(); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - init() { | ||
| 42 | - //布局 | ||
| 43 | - this.dynamicPPT = new DynamicPPT(); | ||
| 44 | - $(window).on('resize', this.onWindowResize.bind(this)); | ||
| 45 | - $('.docBox').on('scroll', this._changeDocScroll.bind(this));//监听文档滚动 | ||
| 46 | - | ||
| 47 | - $(".docView").hide(); | ||
| 48 | - $(".docView").on('load', this._onLoadImage.bind(this)); | ||
| 49 | - $(".docView").on('error', this._onLoadImageError.bind(this)); | ||
| 50 | - | ||
| 51 | - //UI按钮点击事件 | ||
| 52 | - //$("#file").on("change", this._uploadFile.bind(this));//左侧栏的上传文档 | ||
| 53 | - $("#docFileBtn").on("change", this._uploadFile.bind(this));//文件列表中的上传文档 | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - $("#docListOut").on("click", this._openDocListHandler.bind(this));//打开列表 | ||
| 57 | - //$(".docHeadline .iconfont").on("click", this._closeDocListHandler.bind(this)); | ||
| 58 | - $("#closeDocList").on("click", this._closeDocListHandler.bind(this)); | ||
| 59 | - | ||
| 60 | - //botTurn | ||
| 61 | - $(".nextPage").on("click", this._nextHandler.bind(this)); | ||
| 62 | - $(".prevPage").on("click", this._prevHandler.bind(this)); | ||
| 63 | - $("#totalPageNum").text(this._pageNum); | ||
| 64 | - $("#currentPageNum").text(this._currentPageNum); | ||
| 65 | - | ||
| 66 | - //显示模式 | ||
| 67 | - $(".fitHeight").on("click", this._fitInHandler.bind(this)); | ||
| 68 | - $(".fitWidth").on("click", this._fitInHandler.bind(this)); | ||
| 69 | - $(".fitNormal").on("click", this._fitInHandler.bind(this)); | ||
| 70 | - | ||
| 71 | - //默认文档全部显示 | ||
| 72 | - $('.fitNormal').css("color", "#3498db"); | ||
| 73 | - | ||
| 74 | - //显示底部控制栏的按钮,默认都隐藏 | ||
| 75 | - $(".nextPage").hide(); | ||
| 76 | - $(".prevPage").hide(); | ||
| 77 | - this.hideFitGroup(); | ||
| 78 | - ; | ||
| 79 | - | ||
| 80 | - //默认隐藏页码显示 | ||
| 81 | - this._hidePageInfo(); | ||
| 82 | - this.onWindowResize(); | ||
| 83 | - UIControlApe.showBottomDocControlBar(); | ||
| 84 | - | ||
| 85 | - //特定页码 | ||
| 86 | - $('.turn').on('click', this._particularPage.bind(this)); | ||
| 87 | - let that = this; | ||
| 88 | - $("#pageNo").on("keydown", function (e) { | ||
| 89 | - let curKey = e.which; | ||
| 90 | - if (curKey == 13) that._particularPage(); | ||
| 91 | - }); | ||
| 92 | - if (ClassDataProxy.userRole == ClassDataProxy.USER_HOST) { | ||
| 93 | - $(document).keydown(function (e) { | ||
| 94 | - if (e.keyCode == 37) { | ||
| 95 | - that._prevHandler(); | ||
| 96 | - } | ||
| 97 | - }); | ||
| 98 | - | ||
| 99 | - $(document).keydown(function (e) { | ||
| 100 | - if (e.keyCode == 39) { | ||
| 101 | - that._nextHandler(); | ||
| 102 | - } | ||
| 103 | - }); | ||
| 104 | - } | ||
| 105 | - | ||
| 106 | - $('.docBox')[0].ondragstart = function(){ | ||
| 107 | - return false; | ||
| 108 | - } | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - addEvent() { | ||
| 112 | - xdysdk.on("class_join_success", this._classJoinSuccessHandler.bind(this)); | ||
| 113 | - xdysdk.on("document_update", this._docUpdateHanlder.bind(this));//文档更新 | ||
| 114 | - xdysdk.on("document_delete", this._docDeleteHanlder.bind(this));//文档删除 | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - _classJoinSuccessHandler(_data) { | ||
| 118 | - | ||
| 119 | - if (_data.userRole == ClassDataProxy.USER_NOTMAL || ClassDataProxy.isRecordPlayBack) { | ||
| 120 | - $("#docUploadOut").hide(); | ||
| 121 | - $("#file").hide(); | ||
| 122 | - $("#docListOut").hide(); | ||
| 123 | - $(".nextPage").hide(); | ||
| 124 | - $(".prevPage").hide(); | ||
| 125 | - | ||
| 126 | - this.hideFitGroup(); | ||
| 127 | - } | ||
| 128 | - this.onWindowResize(); | ||
| 129 | - } | ||
| 130 | - | ||
| 131 | - clear() { | ||
| 132 | - loger.log("clear"); | ||
| 133 | - this._docList = {};//文档数据 | ||
| 134 | - this._currentDocId = 0; | ||
| 135 | - this._currentPageNum = 1; | ||
| 136 | - this._pageNum = 1; | ||
| 137 | - this.currentImagePath = "";//清空记录的图片地址 | ||
| 138 | - ClassDataProxy.currentPageNum = this._currentPageNum; | ||
| 139 | - ClassDataProxy.currentDocId = this._currentDocId; | ||
| 140 | - this._hideDocView(); | ||
| 141 | - this.dynamicPPT.updataPPT(null); | ||
| 142 | - } | ||
| 143 | - | ||
| 144 | - stop() { | ||
| 145 | - loger.log("stop"); | ||
| 146 | - this._docList = {};//文档数据 | ||
| 147 | - this._currentDocId = 0; | ||
| 148 | - this._currentPageNum = 1; | ||
| 149 | - this._pageNum = 1; | ||
| 150 | - this.currentImagePath = "";//清空记录的图片地址 | ||
| 151 | - ClassDataProxy.currentPageNum = this._currentPageNum; | ||
| 152 | - ClassDataProxy.currentDocId = this._currentDocId; | ||
| 153 | - this._hideDocView(); | ||
| 154 | - this.dynamicPPT.updataPPT(null); | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - //舞台大小发生改变 | ||
| 158 | - onWindowResize() { | ||
| 159 | - //loger.log("舞台大小发生改变"); | ||
| 160 | - clearTimeout(this.resizeDelay); | ||
| 161 | - let _this = this; | ||
| 162 | - this.resizeDelay = setTimeout(function () { | ||
| 163 | - //loger.log("舞台大小发生改变->刷新文档显示"); | ||
| 164 | - clearTimeout(_this.resizeDelay); | ||
| 165 | - _this._fitInDocView(_this._docShowType); | ||
| 166 | - }, 400); | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - //文档区域的滚动条发生改变 | ||
| 170 | - _changeDocScroll(evt) { | ||
| 171 | - clearTimeout(this.scrollCompleteTimer); | ||
| 172 | - //如果自己是老师,需要同步自己的滚动条位置给其他人,否则不做处理 | ||
| 173 | - if (ClassDataProxy.userRole != ClassDataProxy.USER_HOST) { | ||
| 174 | - return; | ||
| 175 | - } | ||
| 176 | - | ||
| 177 | - this.scrollCompleteTimer = setTimeout(() => { | ||
| 178 | - this._updateCurrentDocScroll(); | ||
| 179 | - }, 400); | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | - //更新当前文档的滚动条位置-老师控制-发送 | ||
| 183 | - _updateCurrentDocScroll() { | ||
| 184 | - if (ClassDataProxy.userRole != ClassDataProxy.USER_HOST) { | ||
| 185 | - return; | ||
| 186 | - } | ||
| 187 | - let maxScrollH = $(".docBox").prop("scrollWidth") - $(".docBox").width(); | ||
| 188 | - let maxScrollV = $(".docBox").prop("scrollHeight") - $(".docBox").height(); | ||
| 189 | - let _curV =parseInt( $(".docBox").scrollTop()); | ||
| 190 | - let _curH = parseInt($(".docBox").scrollLeft()); | ||
| 191 | - this.curV = parseInt(_curV / maxScrollV * 1000)||0; | ||
| 192 | - this.curH = parseInt(_curH / maxScrollH * 1000)||0; | ||
| 193 | - | ||
| 194 | - //loger.warn("lastV:"+this.lastV+" curV:"+this.curV+" lastH:"+this.lastH+" curH:"+this.curH); | ||
| 195 | - if(Math.abs(this.curH-this.lastH)<20&&Math.abs(this.curV-this.lastV)<20){ | ||
| 196 | - //loger.warn("不需要同步滚动条位置"); | ||
| 197 | - this.lastV=this.curV; | ||
| 198 | - this.lastH=this.curH; | ||
| 199 | - return; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - this.lastV=this.curV; | ||
| 203 | - this.lastH=this.curH; | ||
| 204 | - | ||
| 205 | - if (this._currentDocId > 0) { | ||
| 206 | - this._sendDocumentCommand2sdk(); | ||
| 207 | - } | ||
| 208 | - } | ||
| 209 | - | ||
| 210 | - //更新当前文档的滚动条位置-收取 | ||
| 211 | - _setCurrentDocScroll(_data) { | ||
| 212 | - if (ClassDataProxy.userRole == ClassDataProxy.USER_HOST) { | ||
| 213 | - return; | ||
| 214 | - } | ||
| 215 | - this.curV = parseInt(_data.curV); | ||
| 216 | - this.curH = parseInt(_data.curH); | ||
| 217 | - let maxScrollH = $(".docBox").prop("scrollWidth") - $(".docBox").width(); | ||
| 218 | - let maxScrollV = $(".docBox").prop("scrollHeight") - $(".docBox").height(); | ||
| 219 | - | ||
| 220 | - let leftS = parseInt(this.curV * maxScrollV * 0.001); | ||
| 221 | - let topS = parseInt(this.curH * maxScrollH * 0.001); | ||
| 222 | - $(".docBox").scrollTop(leftS); | ||
| 223 | - $(".docBox").scrollLeft(topS); | ||
| 224 | - // loger.log("更新当前文档的滚动条位置",maxScrollH,maxScrollV,leftS,topS,_data); | ||
| 225 | - } | ||
| 226 | - | ||
| 227 | - | ||
| 228 | - //监听文档更新消息 | ||
| 229 | - _docUpdateHanlder(_data) { | ||
| 230 | - //loger.log("文档模块收到SDK数据"); | ||
| 231 | - if (_data == null) { | ||
| 232 | - return; | ||
| 233 | - } | ||
| 234 | - this._setCurrentDocScroll(_data); | ||
| 235 | - | ||
| 236 | - //更新文档视图区域 | ||
| 237 | - if (_data.visible == true) { | ||
| 238 | - clearTimeout(this.showDocDefaultDelay); | ||
| 239 | - this._currentDocId = _data.itemIdx; | ||
| 240 | - this._currentPageNum = _data.curPageNo; | ||
| 241 | - this._pageNum = _data.pageNum; | ||
| 242 | - //记录文档的显示模式 | ||
| 243 | - //如果是录制回放模式,固定使用全部显示的模式 | ||
| 244 | - if (ClassDataProxy.isRecordPlayBack) { | ||
| 245 | - this._docShowType = DOC_SHOW_FULL; | ||
| 246 | - } else { | ||
| 247 | - this._docShowType = _data.showType || DOC_SHOW_FULL; | ||
| 248 | - } | ||
| 249 | - this._changeDocShowBtns(this._docShowType); | ||
| 250 | - | ||
| 251 | - ClassDataProxy.currentPageNum = this._currentPageNum; | ||
| 252 | - ClassDataProxy.currentDocId = this._currentDocId; | ||
| 253 | - | ||
| 254 | - if (this._pageNum <= 1) { | ||
| 255 | - this._hidePageInfo(); | ||
| 256 | - } else { | ||
| 257 | - this._showPageInfo(); | ||
| 258 | - } | ||
| 259 | - | ||
| 260 | - this._showDocView(_data); | ||
| 261 | - | ||
| 262 | - } | ||
| 263 | - | ||
| 264 | - //操作数据 | ||
| 265 | - this._updateDocListData(_data, "add"); | ||
| 266 | - | ||
| 267 | - } | ||
| 268 | - | ||
| 269 | - //监听文档删除消息 | ||
| 270 | - _docDeleteHanlder(_data) { | ||
| 271 | - loger.log("_docDeleteHanlder", _data); | ||
| 272 | - this._updateDocListData(_data, "delete"); | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - //更新文档数据(包括更新和删除) | ||
| 276 | - _updateDocListData(_data, _type) { | ||
| 277 | - if (_type == "add" && _data) { | ||
| 278 | - //loger.log("添加文件数据", _data); | ||
| 279 | - this._docList[_data.itemIdx] = _data; | ||
| 280 | - } else { | ||
| 281 | - loger.log("删除文档数据", _data.itemIdx); | ||
| 282 | - delete this._docList[_data.itemIdx]; | ||
| 283 | - if (this._currentDocId == _data.itemIdx) { | ||
| 284 | - this._currentDocId = 0; | ||
| 285 | - this._currentPageNum = 1; | ||
| 286 | - this._pageNum = 1; | ||
| 287 | - ClassDataProxy.currentPageNum = this._currentPageNum; | ||
| 288 | - ClassDataProxy.currentDocId = this._currentDocId; | ||
| 289 | - | ||
| 290 | - //当前显示的文档数据被清除,文档图片也要删除 | ||
| 291 | - this._hideDocView(); | ||
| 292 | - | ||
| 293 | - //如果是动态ppt,也需要删除 | ||
| 294 | - if (this.dynamicPPT.pptData && this.dynamicPPT.pptData.itemIdx == _data.itemIdx) { | ||
| 295 | - this.dynamicPPT.updataPPT(null); | ||
| 296 | - | ||
| 297 | - } | ||
| 298 | - this._docShowType = DOC_SHOW_FULL;//文档显示模式 | ||
| 299 | - //标注的区域也需要设置 | ||
| 300 | - $(".docView").width("0"); | ||
| 301 | - $(".docView").height("0"); | ||
| 302 | - let docBoxWidh = $(".docBox")[0].clientWidth; | ||
| 303 | - let docBoxHeight = $(".docBox")[0].clientHeight; | ||
| 304 | - $(".docGroup").width(docBoxWidh); | ||
| 305 | - $(".docGroup").height(docBoxHeight); | ||
| 306 | - $(".docGroup").css("left", "0px"); | ||
| 307 | - $(".docGroup").css("top", "0px"); | ||
| 308 | - this._hidePageInfo(); | ||
| 309 | - this.hideFitGroup(); | ||
| 310 | - this._hideOverflow(); | ||
| 311 | - this._emit(DocApe.DOC_IMAGE_LOAD, {"width": docBoxWidh, "height": docBoxHeight}); | ||
| 312 | - this.onWindowResize(); | ||
| 313 | - } | ||
| 314 | - } | ||
| 315 | - //更新文件列表(列表数据更新的时候需要刷新) | ||
| 316 | - this._updateDocListView(); | ||
| 317 | - | ||
| 318 | - //根据总页数显示翻页按钮 | ||
| 319 | - if (this._currentDocId > 0 && this._pageNum > 1 && ClassDataProxy.userRole == ClassDataProxy.USER_HOST) { | ||
| 320 | - $(".nextPage").show(); | ||
| 321 | - $(".prevPage").show(); | ||
| 322 | - } else { | ||
| 323 | - $(".nextPage").hide(); | ||
| 324 | - $(".prevPage").hide(); | ||
| 325 | - } | ||
| 326 | - | ||
| 327 | - //显示当前页和总页数 | ||
| 328 | - $("#totalPageNum").text(this._pageNum); | ||
| 329 | - $("#currentPageNum").text(this._currentPageNum); | ||
| 330 | - | ||
| 331 | - } | ||
| 332 | - | ||
| 333 | - //更新底部控制栏 | ||
| 334 | - _updateFitGroup() { | ||
| 335 | - if (this._currentDocId == 0 || this._pageNum < 1 || ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL || ClassDataProxy.userRole == ClassDataProxy.USER_INVISIBLE) { | ||
| 336 | - this.hideFitGroup(); | ||
| 337 | - } else if (this._currentDocId > 0 && ClassDataProxy.userRole == ClassDataProxy.USER_HOST) { | ||
| 338 | - this.showFitGroup(); | ||
| 339 | - } | ||
| 340 | - } | ||
| 341 | - | ||
| 342 | - hideFitGroup() { | ||
| 343 | - $(".fitHeight").hide(); | ||
| 344 | - $(".fitWidth").hide(); | ||
| 345 | - $(".fitNormal").hide(); | ||
| 346 | - $(".turn").hide(); | ||
| 347 | - $(".pageNo").hide(); | ||
| 348 | - } | ||
| 349 | - | ||
| 350 | - showFitGroup() { | ||
| 351 | - $(".fitHeight").show(); | ||
| 352 | - $(".fitWidth").show(); | ||
| 353 | - $(".fitNormal").show(); | ||
| 354 | - } | ||
| 355 | - | ||
| 356 | - //更新文件列表显示 | ||
| 357 | - _updateDocListView() { | ||
| 358 | - $("#docFileContent").empty(); | ||
| 359 | - console.log("this._docList", this._docList); | ||
| 360 | - for (let i in this._docList) { | ||
| 361 | - if (this._docList[i].docId) { | ||
| 362 | - let listItem = this._creatListItemDiv(i, this._docList[i].fileName, this._docList[i].itemIdx); | ||
| 363 | - $("#docFileContent").append(listItem); | ||
| 364 | - } | ||
| 365 | - } | ||
| 366 | - } | ||
| 367 | - | ||
| 368 | - //隐藏滚动条 | ||
| 369 | - _hideOverflow() { | ||
| 370 | - $(".docBox")[0].style.overflow = ""; | ||
| 371 | - } | ||
| 372 | - | ||
| 373 | - //显示滚动条 _type(显示的滚动条方向) | ||
| 374 | - _showOverflow(_type) { | ||
| 375 | - this._hideOverflow(); | ||
| 376 | - if (_type && _type == "y") { | ||
| 377 | - $(".docBox")[0].style.overflowY = "scroll"; | ||
| 378 | - $(".docBox")[0].style.overflowX = "hidden"; | ||
| 379 | - } else { | ||
| 380 | - $(".docBox")[0].style.overflowX = "scroll"; | ||
| 381 | - $(".docBox")[0].style.overflowY = "hidden"; | ||
| 382 | - } | ||
| 383 | - } | ||
| 384 | - | ||
| 385 | - //隐藏页码信息 | ||
| 386 | - _hidePageInfo() { | ||
| 387 | - $(".total-page").hide(); | ||
| 388 | - $(".cur-page").hide(); | ||
| 389 | - $(".bias").hide(); | ||
| 390 | - $(".pageNo").hide(); | ||
| 391 | - $(".turn").hide(); | ||
| 392 | - } | ||
| 393 | - | ||
| 394 | - //显示页码信息 | ||
| 395 | - _showPageInfo() { | ||
| 396 | - $(".total-page").show(); | ||
| 397 | - $(".cur-page").show(); | ||
| 398 | - $(".bias").show(); | ||
| 399 | - $(".pageNo").show(); | ||
| 400 | - $(".turn").show(); | ||
| 401 | - } | ||
| 402 | - | ||
| 403 | - //显示文档 | ||
| 404 | - _showDocView(_data) { | ||
| 405 | - if (_data.fileType == "zip") { | ||
| 406 | - this.dynamicPPT.updataPPT(_data); | ||
| 407 | - this._hideDocView(); | ||
| 408 | - this.onWindowResize(); | ||
| 409 | - this.hideFitGroup(); | ||
| 410 | - //老师的需要显示翻页 | ||
| 411 | - if (ClassDataProxy.userRole == ClassDataProxy.USER_HOST) { | ||
| 412 | - $(".turn").show(); | ||
| 413 | - $(".pageNo").show(); | ||
| 414 | - } | ||
| 415 | - } else { | ||
| 416 | - this.dynamicPPT.updataPPT(null); | ||
| 417 | - this.currentImagePath = "";//清空记录的图片地址 | ||
| 418 | - this._hideDocView(); | ||
| 419 | - this._updateFitGroup(); | ||
| 420 | - let imgArr = _data.images || []; | ||
| 421 | - if (imgArr && imgArr.length > 0) { | ||
| 422 | - let img = imgArr[this._currentPageNum - 1]; | ||
| 423 | - if (img) { | ||
| 424 | - //console.warn("currentImagePath:"+this.currentImagePath,"newImg:"+img); | ||
| 425 | - this.currentImagePath = img; | ||
| 426 | - $(".docView").attr('src', img); | ||
| 427 | - if (_data.curPageNo > 0 && _data.curPageNo < _data.pageNum - 1) { | ||
| 428 | - if (_data.curPageNo >= 3) { | ||
| 429 | - let _arr = [_data.images[_data.curPageNo - 3], _data.images[_data.curPageNo - 2], _data.images[_data.curPageNo], _data.images[_data.curPageNo + 1]]; | ||
| 430 | - this._preloadimages(_arr); | ||
| 431 | - } else if (_data.curPageNo < 3&&_data.curPageNo>=1) { | ||
| 432 | - let _arr = [_data.images[_data.curPageNo-1],_data.images[_data.curPageNo]]; | ||
| 433 | - this._preloadimages(_arr); | ||
| 434 | - } | ||
| 435 | - } | ||
| 436 | - else if(_data.curPageNo > 0 &&_data.pageNum<=3){ | ||
| 437 | - let _arr = _data.images; | ||
| 438 | - this._preloadimages(_arr); | ||
| 439 | - } | ||
| 440 | - $(".docView").attr('alt', _data.fileName || ""); | ||
| 441 | - $(".docView").show(); | ||
| 442 | - } | ||
| 443 | - } | ||
| 444 | - } | ||
| 445 | - } | ||
| 446 | - _preloadimages(arr) { | ||
| 447 | - var newimages = []; | ||
| 448 | - var arr = (typeof arr != "object") ? [arr] : arr //确保参数总是数组 | ||
| 449 | - for (var i = 0; i < arr.length; i++) { | ||
| 450 | - newimages[i] = new Image(); | ||
| 451 | - newimages[i].src = arr[i]; | ||
| 452 | - if (newimages[i].complete || newimages[i].width) { | ||
| 453 | - loger.log('该图片已经存在于缓存之中,不会再去重新下载'); | ||
| 454 | - } | ||
| 455 | - else { | ||
| 456 | - loger.log('图片不存在缓存之中'); | ||
| 457 | - newimages[i].onload = function () { | ||
| 458 | - loger.log('图片下载成功!'); | ||
| 459 | - } | ||
| 460 | - | ||
| 461 | - } | ||
| 462 | - } | ||
| 463 | - } | ||
| 464 | - //隐藏文档 | ||
| 465 | - _hideDocView(_data) { | ||
| 466 | - //清除原来的设置,先获取实际大小 | ||
| 467 | - $(".docView").removeAttr("width"); | ||
| 468 | - $(".docView").removeAttr("height"); | ||
| 469 | - $(".docView").attr('src', ""); | ||
| 470 | - $(".docView").width("0"); | ||
| 471 | - $(".docView").height("0"); | ||
| 472 | - $(".docView").hide(); | ||
| 473 | - this.currentImagePath=""; | ||
| 474 | - this._hideOverflow(); | ||
| 475 | - if (this._pageNum <= 1) { | ||
| 476 | - this._hidePageInfo(); | ||
| 477 | - } else { | ||
| 478 | - this._showPageInfo(); | ||
| 479 | - } | ||
| 480 | - } | ||
| 481 | - | ||
| 482 | - //显示文档列表 | ||
| 483 | - _openDocListHandler() { | ||
| 484 | - this._emit(DocApe.SCENE_DOC_CHANGE, ClassDataProxy.SCENE_DOC); | ||
| 485 | - UIControlApe.enabledBottomBar(); | ||
| 486 | - UIControlApe.enabledLeftBar(); | ||
| 487 | - UIControlApe.showBottomDocControlBar(); | ||
| 488 | - $("#docModalList").show(); | ||
| 489 | - $(".masker").show(); | ||
| 490 | - } | ||
| 491 | - | ||
| 492 | - //关闭文档列表 | ||
| 493 | - _closeDocListHandler() { | ||
| 494 | - $("#docModalList").hide(); | ||
| 495 | - $(".masker").hide(); | ||
| 496 | - } | ||
| 497 | - | ||
| 498 | - //下一页 | ||
| 499 | - _nextHandler() { | ||
| 500 | - loger.log('下一页', this.dynamicPPT.isNextAnimationComplete()); | ||
| 501 | - if (this.dynamicPPT && !this.dynamicPPT.isNextAnimationComplete()) { | ||
| 502 | - //如果动态ppt的动画没有播放完成,需要切换动画 | ||
| 503 | - this.dynamicPPT.pptNextAnimationHandler(); | ||
| 504 | - } else { | ||
| 505 | - //切换页面 | ||
| 506 | - if (this._currentDocId > 0 && this._currentPageNum < this._pageNum) { | ||
| 507 | - let paramInfo = { | ||
| 508 | - "itemIdx": this._currentDocId, | ||
| 509 | - "curPageNo": this._currentPageNum + 1 | ||
| 510 | - }; | ||
| 511 | - xdysdk.api("sendDocumentSwitchPage", paramInfo); | ||
| 512 | - } | ||
| 513 | - } | ||
| 514 | - | ||
| 515 | - } | ||
| 516 | - | ||
| 517 | - //上一页 | ||
| 518 | - _prevHandler() { | ||
| 519 | - loger.log('上一页', this.dynamicPPT.isPrevAnimationComplete()); | ||
| 520 | - if (this.dynamicPPT && !this.dynamicPPT.isPrevAnimationComplete()) { | ||
| 521 | - //如果动态ppt的动画没有播放完成,需要切换动画 | ||
| 522 | - this.dynamicPPT.pptPrevAnimationHandler(); | ||
| 523 | - } else { | ||
| 524 | - //切换页面 | ||
| 525 | - if (this._currentDocId > 0 && this._currentPageNum > 1) { | ||
| 526 | - let paramInfo = { | ||
| 527 | - "itemIdx": this._currentDocId, | ||
| 528 | - "curPageNo": this._currentPageNum - 1 | ||
| 529 | - }; | ||
| 530 | - xdysdk.api("sendDocumentSwitchPage", paramInfo); | ||
| 531 | - } | ||
| 532 | - } | ||
| 533 | - } | ||
| 534 | - | ||
| 535 | - //显示默认模式 | ||
| 536 | - stopAndHide() { | ||
| 537 | - this._closeDocListHandler(); | ||
| 538 | - if (this._docShowType == DOC_SHOW_FULL) { | ||
| 539 | - return; | ||
| 540 | - } | ||
| 541 | - this._docShowType = DOC_SHOW_FULL; | ||
| 542 | - this._changeDocShowBtns(this._docShowType); | ||
| 543 | - this._fitInDocView(this._docShowType); | ||
| 544 | - if (this._currentDocId > 0) { | ||
| 545 | - this._sendDocumentCommand2sdk(); | ||
| 546 | - } | ||
| 547 | - } | ||
| 548 | - | ||
| 549 | - //切换文档显示模式 | ||
| 550 | - _fitInHandler(evt) { | ||
| 551 | - //loger.log("切换文档显示模式", evt.target.className); | ||
| 552 | - switch (evt.target.id) { | ||
| 553 | - case "fitWidth": | ||
| 554 | - if (this._docShowType == DOC_SHOW_WIDTH) { | ||
| 555 | - return; | ||
| 556 | - } | ||
| 557 | - this._docShowType = DOC_SHOW_WIDTH; | ||
| 558 | - this._changeDocShowBtns(this._docShowType); | ||
| 559 | - break; | ||
| 560 | - case "fitHeight": | ||
| 561 | - if (this._docShowType == DOC_SHOW_HEIGHT) { | ||
| 562 | - return; | ||
| 563 | - } | ||
| 564 | - this._docShowType = DOC_SHOW_HEIGHT; | ||
| 565 | - this._changeDocShowBtns(this._docShowType); | ||
| 566 | - break; | ||
| 567 | - case "fitNormal": | ||
| 568 | - if (this._docShowType == DOC_SHOW_FULL) { | ||
| 569 | - return; | ||
| 570 | - } | ||
| 571 | - this._docShowType = DOC_SHOW_FULL; | ||
| 572 | - this._changeDocShowBtns(this._docShowType); | ||
| 573 | - break; | ||
| 574 | - default: | ||
| 575 | - break; | ||
| 576 | - } | ||
| 577 | - this._fitInDocView(this._docShowType); | ||
| 578 | - | ||
| 579 | - if (this._currentDocId > 0) { | ||
| 580 | - this._sendDocumentCommand2sdk(); | ||
| 581 | - } | ||
| 582 | - } | ||
| 583 | - | ||
| 584 | - //发送文档控制消息 | ||
| 585 | - _sendDocumentCommand2sdk() { | ||
| 586 | - xdysdk.api("sendDocumentCommand", { | ||
| 587 | - "itemIdx": this._currentDocId, | ||
| 588 | - "showType": this._docShowType, | ||
| 589 | - "curV": this.curV,//垂直方向的滚动条进度百分比 0-100 | ||
| 590 | - "curH": this.curH,//水平方向的滚动条进度百分比 0-100 | ||
| 591 | - "scale": 100//文档缩放百分比 0-100 | ||
| 592 | - }); | ||
| 593 | - } | ||
| 594 | - | ||
| 595 | - _changeDocShowBtns(_showType) { | ||
| 596 | - switch (_showType) { | ||
| 597 | - case DOC_SHOW_WIDTH: | ||
| 598 | - $('.fitWidth').css("color", "#3498db"); | ||
| 599 | - $('.fitHeight').css("color", "#ccc"); | ||
| 600 | - $('.fitNormal').css("color", "#ccc"); | ||
| 601 | - break; | ||
| 602 | - case DOC_SHOW_HEIGHT: | ||
| 603 | - $('.fitHeight').css("color", "#3498db"); | ||
| 604 | - $('.fitWidth').css("color", "#ccc"); | ||
| 605 | - $('.fitNormal').css("color", "#ccc"); | ||
| 606 | - break; | ||
| 607 | - default : | ||
| 608 | - $('.fitNormal').css("color", "#3498db"); | ||
| 609 | - $('.fitHeight').css("color", "#ccc"); | ||
| 610 | - $('.fitWidth').css("color", "#ccc"); | ||
| 611 | - break; | ||
| 612 | - } | ||
| 613 | - } | ||
| 614 | - | ||
| 615 | - //适配文档显示,type是显示的类型(width-按宽度显示;height-按高度显示;full-完整显示) | ||
| 616 | - _fitInDocView(_type) { | ||
| 617 | - let docView = $(".docView")[0]; | ||
| 618 | - //let imgUrl=docView.src; | ||
| 619 | - //let imgUrl=""; | ||
| 620 | - //loger.log("切换文档显示模式->", _type, this.currentImagePath); | ||
| 621 | - if (docView && this.currentImagePath) { | ||
| 622 | - $(".docView").attr('src', this.currentImagePath); | ||
| 623 | - $(".docView").show(); | ||
| 624 | - } else { | ||
| 625 | - let docBoxWidh = $(".docBox")[0].clientWidth; | ||
| 626 | - let docBoxHeight = $(".docBox")[0].clientHeight; | ||
| 627 | - //没有文档的时候,就按动态ppt的标注尺寸为准 | ||
| 628 | - let viewW = PPT_WIDTH; | ||
| 629 | - let viewH = PPT_HEIGHT; | ||
| 630 | - | ||
| 631 | - //loger.log("舞台尺寸->", docBoxWidh, docBoxHeight); | ||
| 632 | - //设置适合的尺寸模型显示 | ||
| 633 | - let sizeObj; | ||
| 634 | - if (this._docShowType == DOC_SHOW_WIDTH) { | ||
| 635 | - sizeObj = ClassDataProxy.getFitInWidth(docBoxWidh, docBoxHeight, viewW, viewH); | ||
| 636 | - this._showOverflow("y"); | ||
| 637 | - } else if (this._docShowType == DOC_SHOW_HEIGHT) { | ||
| 638 | - sizeObj = ClassDataProxy.getFitInHeight(docBoxWidh, docBoxHeight, viewW, viewH); | ||
| 639 | - this._showOverflow("x"); | ||
| 640 | - } else { | ||
| 641 | - sizeObj = ClassDataProxy.getFitInFull(docBoxWidh, docBoxHeight, viewW, viewH); | ||
| 642 | - this._hideOverflow(); | ||
| 643 | - } | ||
| 644 | - | ||
| 645 | - if (sizeObj) { | ||
| 646 | - //loger.log("设置图片显示", sizeObj); | ||
| 647 | - let docView = $(".docView"); | ||
| 648 | - docView.width(sizeObj.w); | ||
| 649 | - docView.height(sizeObj.h); | ||
| 650 | - | ||
| 651 | - $(".docGroup").width(sizeObj.w); | ||
| 652 | - $(".docGroup").height(sizeObj.h); | ||
| 653 | - $(".docGroup").css("left", "0"); | ||
| 654 | - $(".docGroup").css("top", "0"); | ||
| 655 | - | ||
| 656 | - //水平居中显示 | ||
| 657 | - if (sizeObj.w < docBoxWidh) { | ||
| 658 | - let leftMargin = (docBoxWidh - sizeObj.w) * 0.5; | ||
| 659 | - $(".docGroup").css("left", "" + leftMargin + "px"); | ||
| 660 | - } | ||
| 661 | - //垂直居中 | ||
| 662 | - if (sizeObj.h < docBoxHeight) { | ||
| 663 | - let topMargin = (docBoxHeight - sizeObj.h) * 0.5; | ||
| 664 | - $(".docGroup").css("top", "" + topMargin + "px"); | ||
| 665 | - } | ||
| 666 | - this._emit(DocApe.DOC_IMAGE_LOAD, {"width": sizeObj.w, "height": sizeObj.h}); | ||
| 667 | - this.dynamicPPT.setPPTSize({"width": sizeObj.w, "height": sizeObj.h}); | ||
| 668 | - } else { | ||
| 669 | - loger.warn("文档适配失败"); | ||
| 670 | - } | ||
| 671 | - } | ||
| 672 | - } | ||
| 673 | - | ||
| 674 | - //文档图片加载完成 | ||
| 675 | - _onLoadImage(evt) { | ||
| 676 | - let imagW = evt.currentTarget.naturalWidth; | ||
| 677 | - let imagH = evt.currentTarget.naturalHeight; | ||
| 678 | - | ||
| 679 | - let docBoxWidh = $(".docBox")[0].clientWidth; | ||
| 680 | - let docBoxHeight = $(".docBox")[0].clientHeight; | ||
| 681 | - //loger.log("加载图片完成->实际尺寸->", imagW, imagH); | ||
| 682 | - //loger.log("舞台尺寸->", docBoxWidh, docBoxHeight); | ||
| 683 | - //设置适合的尺寸模型显示 | ||
| 684 | - let sizeObj; | ||
| 685 | - if (this._docShowType == DOC_SHOW_WIDTH) { | ||
| 686 | - sizeObj = ClassDataProxy.getFitInWidth(docBoxWidh, docBoxHeight, imagW, imagH); | ||
| 687 | - this._showOverflow("y"); | ||
| 688 | - } else if (this._docShowType == DOC_SHOW_HEIGHT) { | ||
| 689 | - sizeObj = ClassDataProxy.getFitInHeight(docBoxWidh, docBoxHeight, imagW, imagH); | ||
| 690 | - this._showOverflow("x"); | ||
| 691 | - } else { | ||
| 692 | - sizeObj = ClassDataProxy.getFitInFull(docBoxWidh, docBoxHeight, imagW, imagH); | ||
| 693 | - this._hideOverflow(); | ||
| 694 | - } | ||
| 695 | - | ||
| 696 | - | ||
| 697 | - if (sizeObj) { | ||
| 698 | - // loger.log("设置图片显示", sizeObj); | ||
| 699 | - let docView = $(".docView"); | ||
| 700 | - docView.width(sizeObj.w); | ||
| 701 | - docView.height(sizeObj.h); | ||
| 702 | - | ||
| 703 | - $(".docGroup").width(sizeObj.w); | ||
| 704 | - $(".docGroup").height(sizeObj.h); | ||
| 705 | - $(".docGroup").css("left", "0"); | ||
| 706 | - $(".docGroup").css("top", "0"); | ||
| 707 | - //水平居中显示 | ||
| 708 | - if (sizeObj.w < docBoxWidh) { | ||
| 709 | - let leftMargin = (docBoxWidh - sizeObj.w) * 0.5; | ||
| 710 | - //loger.warn("left-----------------",leftMargin); | ||
| 711 | - $(".docGroup").css("left", "" + leftMargin + "px"); | ||
| 712 | - } | ||
| 713 | - //垂直居中 | ||
| 714 | - if (sizeObj.h < docBoxHeight) { | ||
| 715 | - let topMargin = (docBoxHeight - sizeObj.h) * 0.5; | ||
| 716 | - $(".docGroup").css("top", "" + topMargin + "px"); | ||
| 717 | - } | ||
| 718 | - | ||
| 719 | - this._emit(DocApe.DOC_IMAGE_LOAD, {"width": sizeObj.w, "height": sizeObj.h}); | ||
| 720 | - this.dynamicPPT.setPPTSize({"width": sizeObj.w, "height": sizeObj.h}); | ||
| 721 | - } else { | ||
| 722 | - loger.warn("文档适配失败"); | ||
| 723 | - } | ||
| 724 | - } | ||
| 725 | - | ||
| 726 | - //文档图片加载失败 | ||
| 727 | - _onLoadImageError(evt) { | ||
| 728 | - if (!ClassDataProxy.isRecordPlayBack && this.currentImagePath) { | ||
| 729 | - loger.warn("文档加载失败->", evt.currentTarget.alt, this.currentImagePath); | ||
| 730 | - //ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.fileLoadingErr + "->" + evt.currentTarget.alt); | ||
| 731 | - } | ||
| 732 | - } | ||
| 733 | - | ||
| 734 | - //上传文件 | ||
| 735 | - _uploadFile(evt) { | ||
| 736 | - let fileItem = document.getElementById('docFileBtn').files[0]; | ||
| 737 | - if (!fileItem) { | ||
| 738 | - loger.log("没有选择文件"); | ||
| 739 | - return; | ||
| 740 | - } | ||
| 741 | - this._closeDocListHandler(); | ||
| 742 | - let fileStr = fileItem.name; | ||
| 743 | - if(fileStr){ | ||
| 744 | - fileStr=fileStr.toLowerCase(); | ||
| 745 | - } | ||
| 746 | - //let fileValue = fileStr.split('.')[1]; | ||
| 747 | - if (fileStr.lastIndexOf(".zip")>=0) { | ||
| 748 | - this._uploadPPT(fileItem, evt); | ||
| 749 | - } | ||
| 750 | - else { | ||
| 751 | - loger.log("文件名:" + fileItem.name + "->文件类型:" + fileItem.type); | ||
| 752 | - //目前最大支持50M 格式为jpg png pdf docx pptx xlsx | ||
| 753 | - //判断文件的大小 | ||
| 754 | - if (fileItem.size > 52428800) { | ||
| 755 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.fileError); | ||
| 756 | - return; | ||
| 757 | - } | ||
| 758 | - | ||
| 759 | - let fileName = fileItem.name; | ||
| 760 | - if(fileName){ | ||
| 761 | - fileName = fileName.toLowerCase(); | ||
| 762 | - } | ||
| 763 | - | ||
| 764 | - //判断选择的文件类型 | ||
| 765 | - if (fileName.lastIndexOf('.jpg') < 0 && | ||
| 766 | - fileName.lastIndexOf('.png') < 0 && | ||
| 767 | - fileName.lastIndexOf('.pdf') < 0 && | ||
| 768 | - fileName.lastIndexOf('.doc') < 0 && | ||
| 769 | - fileName.lastIndexOf('.ppt') < 0 && | ||
| 770 | - fileName.lastIndexOf('.xls') < 0) { | ||
| 771 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.layoutCont); | ||
| 772 | - return; | ||
| 773 | - } | ||
| 774 | - | ||
| 775 | - if (!ClassDataProxy.DOCServerIP) { | ||
| 776 | - loger.warn("文档服务器地址无效,无法上传文件!"); | ||
| 777 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.serverError); | ||
| 778 | - return | ||
| 779 | - } | ||
| 780 | - //上传时动画效果 | ||
| 781 | - UIControlApe.showLoadingMask(); | ||
| 782 | - //上传过程中 上传按钮不可点击 | ||
| 783 | - //$('.docUploadForbid').show(); | ||
| 784 | - UIControlApe.disEnabledDocBar(); | ||
| 785 | - UIControlApe.disEnabledMediaBar(); | ||
| 786 | - let fd = new FormData(); | ||
| 787 | - fd.append("fileToUpload", fileItem); | ||
| 788 | - fd.append("siteID", ClassDataProxy.siteId); //站点 | ||
| 789 | - fd.append("convertTools", "msoffice"); //pptflash 仅限动态转ppt msoffice 其它类型 | ||
| 790 | - fd.append("meetingid", String(ClassDataProxy.classId)); //课堂号 | ||
| 791 | - fd.append("timestamp", String(ClassDataProxy.creatTimestamp())); //时间戳 | ||
| 792 | - fd.append("createUserName", String(ClassDataProxy.userName)); //上传人姓名 | ||
| 793 | - fd.append("createUserID", String(ClassDataProxy.nodeId)); //上传人ID | ||
| 794 | - fd.append("modifyDate", ClassDataProxy.creatTimestampStr()); //上传时间 | ||
| 795 | - | ||
| 796 | - /*let ipport = ClassDataProxy.DOCServerIP; | ||
| 797 | - if (ClassDataProxy.DOCServerPort) { | ||
| 798 | - ipport = ipport + ":" + ClassDataProxy.DOCServerPort; | ||
| 799 | - } | ||
| 800 | - let docUrl = `http://${ipport}/DocSharing/fileUploadJson`;*/ | ||
| 801 | - | ||
| 802 | - let ipport=ClassDataProxy.DOCServerIP; | ||
| 803 | - if( ClassDataProxy.DOCServerPort){ | ||
| 804 | - ipport=ipport+":"+ClassDataProxy.DOCServerPort; | ||
| 805 | - } | ||
| 806 | - let docUrl= `${ClassDataProxy.locationProtocol+ipport}/DocSharing/fileUploadJson`; | ||
| 807 | - | ||
| 808 | - | ||
| 809 | - | ||
| 810 | - | ||
| 811 | - $.ajax({ | ||
| 812 | - type: "POST", | ||
| 813 | - url: docUrl, | ||
| 814 | - processData: false, | ||
| 815 | - contentType: false, | ||
| 816 | - data: fd, | ||
| 817 | - xhr: function () { | ||
| 818 | - let xhr = $.ajaxSettings.xhr(); | ||
| 819 | - if (xhr.upload) { | ||
| 820 | - xhr.upload.addEventListener("progress", function (evt) { | ||
| 821 | - let loaded = evt.loaded; //已经上传大小情况 | ||
| 822 | - let tot = evt.total; //附件总大小 | ||
| 823 | - let per = Math.floor(100 * loaded / tot); //已经上传的百分比 | ||
| 824 | - UIControlApe.updataLoadingMaskProgress(per); | ||
| 825 | - }, false); | ||
| 826 | - return xhr; | ||
| 827 | - } | ||
| 828 | - }, | ||
| 829 | - success: function (data) { | ||
| 830 | - //loger.log("文档服务器返回的文档数据-.", data); | ||
| 831 | - UIControlApe.hideLoadingMask(); | ||
| 832 | - UIControlApe.enabledDocBar(); | ||
| 833 | - UIControlApe.enabledMediaBar(); | ||
| 834 | - this._uploadFileSuccess(data); | ||
| 835 | - $("#docFileBtn").val('') | ||
| 836 | - }.bind(this), | ||
| 837 | - error: function (data) { | ||
| 838 | - UIControlApe.hideLoadingMask(); | ||
| 839 | - UIControlApe.enabledDocBar(); | ||
| 840 | - UIControlApe.enabledMediaBar(); | ||
| 841 | - loger.warn(name + "->上传文件失败", data); | ||
| 842 | - ErrorApe.showError(ErrorApe.TYPE_3, name + "->" + ClassDataProxy.localConfig.uploaDocumentErr); | ||
| 843 | - $("#docFileBtn").val('') | ||
| 844 | - } | ||
| 845 | - }); | ||
| 846 | - } | ||
| 847 | - | ||
| 848 | - } | ||
| 849 | - | ||
| 850 | - //上传ppt的zip | ||
| 851 | - _uploadPPT(fileItem, evt) { | ||
| 852 | - loger.log("文件名:" + fileItem.name + "->文件类型:" + fileItem.type); | ||
| 853 | - //目前最大支持50M 格式为jpg png pdf docx pptx xlsx | ||
| 854 | - //判断文件的大小 | ||
| 855 | - if (fileItem.size > 52428800) { | ||
| 856 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.fileError); | ||
| 857 | - return; | ||
| 858 | - } | ||
| 859 | - | ||
| 860 | - let fileName = fileItem.name.toLowerCase(); | ||
| 861 | - //判断选择的文件类型 | ||
| 862 | - if (fileName.lastIndexOf('.zip') < 0) { | ||
| 863 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.fileFormatError); | ||
| 864 | - return; | ||
| 865 | - } | ||
| 866 | - | ||
| 867 | - if (!ClassDataProxy.DOCServerIP) { | ||
| 868 | - loger.warn("文档服务器地址无效,无法上传文件!"); | ||
| 869 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.serverError); | ||
| 870 | - return | ||
| 871 | - } | ||
| 872 | - //上传时动画效果 | ||
| 873 | - UIControlApe.showLoadingMask(); | ||
| 874 | - UIControlApe.disEnabledDocBar(); | ||
| 875 | - UIControlApe.disEnabledMediaBar(); | ||
| 876 | - | ||
| 877 | - //上传过程中 上传按钮不可点击 | ||
| 878 | - //$('.docUploadForbid').show(); | ||
| 879 | - let fd = new FormData(); | ||
| 880 | - fd.append("fileToUpload", fileItem); | ||
| 881 | - fd.append("classId", String(ClassDataProxy.classId)); //课堂号 | ||
| 882 | - fd.append("siteID", ClassDataProxy.siteId); //站点 | ||
| 883 | - fd.append("createUserID", String(ClassDataProxy.nodeId)); //上传人ID | ||
| 884 | - fd.append("createUserName", String(ClassDataProxy.userName)); //上传人姓名 | ||
| 885 | - | ||
| 886 | - /* let ipport = ClassDataProxy.DOCServerIP; | ||
| 887 | - if (ClassDataProxy.DOCServerPort) { | ||
| 888 | - ipport = ipport + ":" + ClassDataProxy.DOCServerPort; | ||
| 889 | - } | ||
| 890 | - let pptUrl = `http://${ipport}/DocSharing/zipUpload`;*/ | ||
| 891 | - | ||
| 892 | - let ipport=ClassDataProxy.DOCServerIP; | ||
| 893 | - if( ClassDataProxy.DOCServerPort){ | ||
| 894 | - ipport=ipport+":"+ClassDataProxy.DOCServerPort; | ||
| 895 | - } | ||
| 896 | - let pptUrl= `${ClassDataProxy.locationProtocol+ipport}/DocSharing/zipUpload`; | ||
| 897 | - | ||
| 898 | - | ||
| 899 | - | ||
| 900 | - $.ajax({ | ||
| 901 | - type: "POST", | ||
| 902 | - url: pptUrl, | ||
| 903 | - processData: false, | ||
| 904 | - contentType: false, | ||
| 905 | - data: fd, | ||
| 906 | - xhr: function () { | ||
| 907 | - let xhr = $.ajaxSettings.xhr(); | ||
| 908 | - if (xhr.upload) { | ||
| 909 | - xhr.upload.addEventListener("progress", function (evt) { | ||
| 910 | - let loaded = evt.loaded; //已经上传大小情况 | ||
| 911 | - let tot = evt.total; //附件总大小 | ||
| 912 | - let per = Math.floor(100 * loaded / tot); //已经上传的百分比 | ||
| 913 | - UIControlApe.updataLoadingMaskProgress(per); | ||
| 914 | - }, false); | ||
| 915 | - return xhr; | ||
| 916 | - } | ||
| 917 | - }, | ||
| 918 | - success: function (data) { | ||
| 919 | - //loger.log("文档服务器返回的文档数据-.", data); | ||
| 920 | - UIControlApe.hideLoadingMask(); | ||
| 921 | - UIControlApe.enabledDocBar(); | ||
| 922 | - UIControlApe.enabledMediaBar(); | ||
| 923 | - this._uploadpptSuccess(data); | ||
| 924 | - $("#docFileBtn").val('') | ||
| 925 | - }.bind(this), | ||
| 926 | - error: function (data) { | ||
| 927 | - UIControlApe.hideLoadingMask(); | ||
| 928 | - UIControlApe.enabledDocBar(); | ||
| 929 | - UIControlApe.enabledMediaBar(); | ||
| 930 | - loger.warn(name + "->上传文件失败", data); | ||
| 931 | - ErrorApe.showError(ErrorApe.TYPE_3, name + "" + ClassDataProxy.localConfig.uploaDocumentErr); | ||
| 932 | - $("#docFileBtn").val('') | ||
| 933 | - } | ||
| 934 | - }); | ||
| 935 | - } | ||
| 936 | - | ||
| 937 | - //上传的ppt的zip成功 | ||
| 938 | - _uploadpptSuccess(msg) { | ||
| 939 | - loger.log("服务器返回的zip信息->", msg); | ||
| 940 | - if (msg.docId) { | ||
| 941 | - console.log("msg", msg); | ||
| 942 | - $("#frame").attr("src", msg.filePath); | ||
| 943 | - let fileInfo = {}; | ||
| 944 | - fileInfo.pageNum = msg.imgSize;// 文档的总页数 | ||
| 945 | - fileInfo.fileName = msg.fileName;//文档名字 | ||
| 946 | - fileInfo.fileType = msg.fileType; // 文档的原始类型(上传时的类型) | ||
| 947 | - fileInfo.relativeUrl = msg.relativeLocation; //文档相对地址 | ||
| 948 | - let urlPath = msg.filePath + 'l'; | ||
| 949 | - urlPath = urlPath.replace('.htmll', '.html'); | ||
| 950 | - fileInfo.url = urlPath; //文档绝对地址 默认值: null | ||
| 951 | - fileInfo.docId = msg.docId; //文档在数据库中的唯一id标识 默认值: null | ||
| 952 | - fileInfo.visible = false; // 是否显示 默认值: false | ||
| 953 | - loger.log("同步上传的文档消息给sdk", fileInfo); | ||
| 954 | - xdysdk.api("sendDocumentUpload", fileInfo); | ||
| 955 | - } else { | ||
| 956 | - loger.warn("服务器返回的zip文件信息->不能同步-->docId无效", msg.docId); | ||
| 957 | - ErrorApe.showError(ErrorApe.TYPE_3, name + "" + ClassDataProxy.localConfig.uploaDocumentErr); | ||
| 958 | - } | ||
| 959 | - } | ||
| 960 | - | ||
| 961 | - //将上传文件的信息,传递给底层 | ||
| 962 | - _uploadFileSuccess(msg) { | ||
| 963 | - loger.log("服务器返回的文档信息->", msg); | ||
| 964 | - if (msg.docId && msg.flag == 0) { | ||
| 965 | - let fileInfo = {}; | ||
| 966 | - fileInfo.pageNum = msg.imgSize;// 文档的总页数 | ||
| 967 | - fileInfo.fileName = msg.fileName;//文档名字 | ||
| 968 | - fileInfo.fileType = msg.fileType; // 文档的原始类型(上传时的类型) | ||
| 969 | - fileInfo.relativeUrl = msg.relativeLocation; //文档相对地址 | ||
| 970 | - fileInfo.url = msg.filePath; //文档绝对地址 默认值: null | ||
| 971 | - fileInfo.docId = msg.docId; //文档在数据库中的唯一id标识 默认值: null | ||
| 972 | - fileInfo.visible = false; // 是否显示 默认值: false | ||
| 973 | - fileInfo.dynamicTS = msg.dynamicTransferStatic; //是否动态转换 //文档上传后返回值中的字段dynamicTransferStatic 默认值: 0 | ||
| 974 | - //loger.log("同步上传的文档消息给sdk", fileInfo); | ||
| 975 | - xdysdk.api("sendDocumentUpload", fileInfo); | ||
| 976 | - } else { | ||
| 977 | - loger.warn("服务器返回的文件信息->不能同步-->docId无效", msg.docId); | ||
| 978 | - ErrorApe.showError(ErrorApe.TYPE_3, ClassDataProxy.localConfig.uploaDocumentErr); | ||
| 979 | - } | ||
| 980 | - | ||
| 981 | - } | ||
| 982 | - | ||
| 983 | - //点击列表中切换文档 | ||
| 984 | - _switchDcoBtnHandler(evt) { | ||
| 985 | - loger.log("_switchDcoBtnHandler---->", evt.target.id); | ||
| 986 | - this._switchDcoHandler(evt.target.id) | ||
| 987 | - } | ||
| 988 | - | ||
| 989 | - //切换文档,把要显示的文档数据发送给SDK | ||
| 990 | - _switchDcoHandler(_itemIdx) { | ||
| 991 | - loger.log("_switchDcoHandler---->", _itemIdx); | ||
| 992 | - let docItem = this._docList[_itemIdx]; | ||
| 993 | - if (docItem) { | ||
| 994 | - let paramInfo = { | ||
| 995 | - "itemIdx": parseInt(_itemIdx), | ||
| 996 | - "visible": true | ||
| 997 | - }; | ||
| 998 | - xdysdk.api("sendDocumentSwitchDoc", paramInfo); | ||
| 999 | - this._closeDocListHandler(); | ||
| 1000 | - } else { | ||
| 1001 | - loger.log("_switchDcoHandler---->文档不存在"); | ||
| 1002 | - } | ||
| 1003 | - } | ||
| 1004 | - | ||
| 1005 | - | ||
| 1006 | - //删除文档鼠标事件 | ||
| 1007 | - _deleteDcoHandler(evt) { | ||
| 1008 | - loger.log("_deleteDcoHandler---->", evt.target.id); | ||
| 1009 | - let docItem = this._docList[parseInt(evt.target.id)]; | ||
| 1010 | - if (docItem) { | ||
| 1011 | - let paramInfo = { | ||
| 1012 | - "itemIdx": docItem.itemIdx, | ||
| 1013 | - "docId": docItem.docId, | ||
| 1014 | - "classId": ClassDataProxy.classId //课堂号 | ||
| 1015 | - }; | ||
| 1016 | - xdysdk.api("sendDocumentDelete", paramInfo); | ||
| 1017 | - } else { | ||
| 1018 | - loger.log("_deleteDcoHandler---->文档不存在"); | ||
| 1019 | - } | ||
| 1020 | - } | ||
| 1021 | - | ||
| 1022 | - //获取文档图片序列 | ||
| 1023 | - _getDocFullAddress(_data) { | ||
| 1024 | - loger.log("获取文档显示地址---->", _data); | ||
| 1025 | - let paramInfo = { | ||
| 1026 | - "itemIdx": _data.itemIdx, | ||
| 1027 | - "url": _data.url | ||
| 1028 | - }; | ||
| 1029 | - let result = xdysdk.api("getDocFullAddress", paramInfo); | ||
| 1030 | - loger.log("获取文档显示地址-->返回->", result); | ||
| 1031 | - if (result.code == 0) { | ||
| 1032 | - return result.docFullAddress.images; | ||
| 1033 | - } | ||
| 1034 | - return []; | ||
| 1035 | - } | ||
| 1036 | - | ||
| 1037 | - _particularPage() { | ||
| 1038 | - let pageNo = $('#pageNo'); | ||
| 1039 | - if (!pageNo || !pageNo.val()) { | ||
| 1040 | - return; | ||
| 1041 | - } | ||
| 1042 | - | ||
| 1043 | - let page = parseInt(pageNo.val()); | ||
| 1044 | - if (page) { | ||
| 1045 | - if (page > this._pageNum) { | ||
| 1046 | - page = this._pageNum; | ||
| 1047 | - } | ||
| 1048 | - if (page <= 0) { | ||
| 1049 | - page = 1; | ||
| 1050 | - } | ||
| 1051 | - pageNo.val(page); | ||
| 1052 | - let paramInfo = { | ||
| 1053 | - "itemIdx": this._currentDocId, | ||
| 1054 | - "curPageNo": page | ||
| 1055 | - }; | ||
| 1056 | - xdysdk.api("sendDocumentSwitchPage", paramInfo); | ||
| 1057 | - $("#pageNo")[0].value = ""; | ||
| 1058 | - $("#pageNo").blur(); | ||
| 1059 | - } | ||
| 1060 | - } | ||
| 1061 | - | ||
| 1062 | - | ||
| 1063 | - //创建列表元素 | ||
| 1064 | - _creatListItemDiv(_id, _fileName, _owner) { | ||
| 1065 | - let div = document.createElement("div"); | ||
| 1066 | - div.id = "doc_" + _id; | ||
| 1067 | - | ||
| 1068 | - //文件id | ||
| 1069 | - let ico = document.createElement("label"); | ||
| 1070 | - ico.innerHTML = ""; | ||
| 1071 | - ico.className = "iconfont"; | ||
| 1072 | - div.appendChild(ico); | ||
| 1073 | - | ||
| 1074 | - //文件名称 | ||
| 1075 | - let nameDiv = document.createElement("label"); | ||
| 1076 | - nameDiv.innerText = "" + _fileName; | ||
| 1077 | - nameDiv.title = "" + _fileName; | ||
| 1078 | - nameDiv.onclick = this._switchDcoBtnHandler.bind(this); | ||
| 1079 | - nameDiv.id = _id; | ||
| 1080 | - div.appendChild(nameDiv); | ||
| 1081 | - | ||
| 1082 | - //删除按钮 | ||
| 1083 | - let deleteBtn = document.createElement("label"); | ||
| 1084 | - deleteBtn.type = "button"; | ||
| 1085 | - // deleteBtn.value = "删除"; | ||
| 1086 | - deleteBtn.id = _id; | ||
| 1087 | - deleteBtn.innerHTML = ""; | ||
| 1088 | - deleteBtn.className = "iconfont"; | ||
| 1089 | - deleteBtn.onclick = this._deleteDcoHandler.bind(this); | ||
| 1090 | - div.appendChild(deleteBtn); | ||
| 1091 | - | ||
| 1092 | - return div; | ||
| 1093 | - } | ||
| 1094 | -} | ||
| 1095 | -DocApe.prototype.DOC_IMAGE_LOAD = DocApe.DOC_IMAGE_LOAD = "doc_image_load"; | ||
| 1096 | -DocApe.prototype.SCENE_DOC_CHANGE = DocApe.SCENE_DOC_CHANGE = "scene_doc_change"; | ||
| 1097 | -export default DocApe; | ||
| 1098 | - | ||
| 1099 | - |
src/ape/DrawTool.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 白板标注工具栏 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | -import Emiter from "Emiter"; | ||
| 6 | -import Loger from "Loger"; | ||
| 7 | -import $ from "jquery"; | ||
| 8 | -import xdysdk from "libs/xdysdk"; | ||
| 9 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 10 | - | ||
| 11 | - | ||
| 12 | -let loger = Loger.getLoger('PC-DrawTool'); | ||
| 13 | -class DrawTool extends Emiter { | ||
| 14 | - constructor() { | ||
| 15 | - super(); | ||
| 16 | - this.isShow = false; | ||
| 17 | - ClassDataProxy.isDraw = false; | ||
| 18 | - this.addEvent(); | ||
| 19 | - this.init(); | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - init() { | ||
| 23 | - //布局 | ||
| 24 | - | ||
| 25 | - $(".foldDrawTool").on("click", this._controlDrawToolVisible.bind(this)); | ||
| 26 | - | ||
| 27 | - //UI按钮点击事件 | ||
| 28 | - $(".toolColor").on("mouseleave", this._showColorNone.bind(this)); | ||
| 29 | - // $(".showColor").on("mouseleave", this._showColorNone.bind(this)); | ||
| 30 | - $(".showColor").on("mouseenter", this._showColorBlock.bind(this)); | ||
| 31 | - | ||
| 32 | - //形状列表显示 | ||
| 33 | - $(".toolForm").on("mouseleave", this._showFormNone.bind(this)); | ||
| 34 | - $("#showForm").on("mouseenter", this._showFormBlock.bind(this)); | ||
| 35 | - | ||
| 36 | - //点击形状按钮 | ||
| 37 | - $('#showForm').on('click',this._showFormBlock.bind(this)); | ||
| 38 | - $('#curveBrush').on('click',this._formHandler.bind(this)); | ||
| 39 | - $('#straightBrush').on('click',this._formHandler.bind(this)); | ||
| 40 | - $('#squareBrush').on('click',this._formHandler.bind(this)); | ||
| 41 | - $('#circleBrush').on('click',this._formHandler.bind(this)); | ||
| 42 | - $('#customBrush').on('click',this._formHandler.bind(this)); | ||
| 43 | - | ||
| 44 | - $(".showColor").on("click", this._showColorBlock.bind(this)); | ||
| 45 | - $(".redColor").on("click", this._colorHandler.bind(this)); | ||
| 46 | - $(".blueColor").on("click", this._colorHandler.bind(this)); | ||
| 47 | - $(".purpleColor").on("click", this._colorHandler.bind(this)); | ||
| 48 | - $(".yellowColor").on("click", this._colorHandler.bind(this)); | ||
| 49 | - $(".pencil").on("click", this._pencilHandler.bind(this)); | ||
| 50 | - $(".rescind").on("click", this._rescindHandler.bind(this));//撤销 | ||
| 51 | - $(".clearContent").on("click", this._clearHandler.bind(this));//删除 | ||
| 52 | - | ||
| 53 | - | ||
| 54 | - //点击其他区域后颜色板隐藏 | ||
| 55 | - // $(".middle").on("click",this._hideColorTool.bind(this)); | ||
| 56 | - $(".left").on("click",this._hideColorTool.bind(this)); | ||
| 57 | - $(".header").on("click",this._hideColorTool.bind(this)); | ||
| 58 | - $(".right").on("click",this._hideColorTool.bind(this)); | ||
| 59 | - $(".docBox").on("click",this._hideColorTool.bind(this)); | ||
| 60 | - | ||
| 61 | - | ||
| 62 | - //老是断控制学生端画笔 | ||
| 63 | - $('#controlBrush').on('click',this._controlBrushHandler.bind(this)); | ||
| 64 | - | ||
| 65 | - | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - addEvent() { | ||
| 69 | - xdysdk.on("class_join_success", this._classJoinSuccessHandler.bind(this)); | ||
| 70 | - xdysdk.on("class_insert_roster", this._insertRosterHandler.bind(this)); //人员进入 | ||
| 71 | - xdysdk.on("class_update_status", this._classUpdateHandler.bind(this));//会议状态更新 | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - _classJoinSuccessHandler(_data) { | ||
| 75 | - if (_data.userRole == ClassDataProxy.USER_NOTMAL) { | ||
| 76 | - // $(".foldDrawTool").hide(); | ||
| 77 | - // $(".drawTool").hide(); | ||
| 78 | - this.isShow = true; | ||
| 79 | - } else { | ||
| 80 | - $(".foldDrawTool").show(); | ||
| 81 | - $(".drawTool").show(); | ||
| 82 | - this.isShow = true; | ||
| 83 | - } | ||
| 84 | - } | ||
| 85 | - _insertRosterHandler(_data){ | ||
| 86 | - if(_data){ | ||
| 87 | - if(ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL){ | ||
| 88 | - if(!ClassDataProxy.isEnableDraw){ | ||
| 89 | - //隐藏学生端画笔 | ||
| 90 | - this._hideBrushSwitch(); | ||
| 91 | - } | ||
| 92 | - } | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - _classUpdateHandler(_data){ | ||
| 96 | - if(_data){ | ||
| 97 | - //控制学生端画笔是否可以绘画 | ||
| 98 | - ClassDataProxy.isEnableDraw = _data.isEnableDraw || false; | ||
| 99 | - this._checkBrushSwitch(); | ||
| 100 | - } | ||
| 101 | - } | ||
| 102 | - _checkBrushSwitch(){ | ||
| 103 | - this._brushSwitchHandler(); | ||
| 104 | - } | ||
| 105 | - //老是断控制学生端画笔 | ||
| 106 | - _controlBrushHandler(evt){ | ||
| 107 | - if(ClassDataProxy.isEnableDraw == true){ | ||
| 108 | - ClassDataProxy.isEnableDraw = false; | ||
| 109 | - xdysdk.api("changeDrawStatus",{"isEnableDraw":false}); | ||
| 110 | - }else{ | ||
| 111 | - ClassDataProxy.isEnableDraw = true; | ||
| 112 | - xdysdk.api("changeDrawStatus",{"isEnableDraw":true}) | ||
| 113 | - } | ||
| 114 | - } | ||
| 115 | - //学生端画笔开关 | ||
| 116 | - _brushSwitchHandler(){ | ||
| 117 | - if(ClassDataProxy.isEnableDraw == true){ | ||
| 118 | - if(ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL){ | ||
| 119 | - //显示学生端画笔 | ||
| 120 | - this._showBrushSwitch(); | ||
| 121 | - } | ||
| 122 | - //更改老师端状态 | ||
| 123 | - if(ClassDataProxy.userRole == ClassDataProxy.USER_HOST){ | ||
| 124 | - $('.controlBrush').addClass('controlBrushClick'); | ||
| 125 | - } | ||
| 126 | - }else{ | ||
| 127 | - //隐藏学生端画笔 | ||
| 128 | - if(ClassDataProxy.userRole == ClassDataProxy.USER_NOTMAL){ | ||
| 129 | - this._hideBrushSwitch(); | ||
| 130 | - //学生端是否可以画图 | ||
| 131 | - ClassDataProxy.isDraw = false; | ||
| 132 | - } | ||
| 133 | - //更改老师端状态 | ||
| 134 | - if(ClassDataProxy.userRole == ClassDataProxy.USER_HOST){ | ||
| 135 | - $('.controlBrush').removeClass('controlBrushClick'); | ||
| 136 | - } | ||
| 137 | - } | ||
| 138 | - } | ||
| 139 | - //显示学生端画笔 | ||
| 140 | - _showBrushSwitch(){ | ||
| 141 | - $('.foldDrawToolOut').show(); | ||
| 142 | - $('.foldDrawTool').show(); | ||
| 143 | - $(".drawTool").show(); | ||
| 144 | - $(".drawTool").css("height", "160px"); | ||
| 145 | - } | ||
| 146 | - //隐藏学生端画笔 | ||
| 147 | - _hideBrushSwitch(){ | ||
| 148 | - $('.foldDrawToolOut').hide(); | ||
| 149 | - $('.foldDrawTool').hide(); | ||
| 150 | - $(".drawTool").hide(); | ||
| 151 | - } | ||
| 152 | - _pencilHandler() { | ||
| 153 | - if(ClassDataProxy.isLaser==true){ | ||
| 154 | - ClassDataProxy.isLaser=false; | ||
| 155 | - let paramInfo = { | ||
| 156 | - "pointGroup": [],//有多个坐标点组成 | ||
| 157 | - "duration":0 //多长时间发一次数据 | ||
| 158 | - }; | ||
| 159 | - xdysdk.api("sendInsertCursor", paramInfo); | ||
| 160 | - $(".canvasContent").css("cursor", "default"); | ||
| 161 | - } | ||
| 162 | - $(".laserBoard").css("z-index","-1"); | ||
| 163 | - $(".toolColor").css("display", "none"); | ||
| 164 | - ClassDataProxy.isDraw = !ClassDataProxy.isDraw; | ||
| 165 | - this._emit(DrawTool.DRAW_TOOL_CHANGE, {"action": "pencil", "isDraw": ClassDataProxy.isDraw}); | ||
| 166 | - if (ClassDataProxy.isDraw) { | ||
| 167 | - $(".canvasContent").css({"cursor":"url(images/tool/penciling.png),crosshair"}); | ||
| 168 | - | ||
| 169 | - } else { | ||
| 170 | - $(".canvasContent").css("cursor", "default"); | ||
| 171 | - } | ||
| 172 | - } | ||
| 173 | - | ||
| 174 | - _rescindHandler() { | ||
| 175 | - $(".toolColor").css("display", "none"); | ||
| 176 | - this._emit(DrawTool.DRAW_TOOL_CHANGE, {"action": "rescind"}); | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - _clearHandler() { | ||
| 180 | - $(".toolColor").css("display", "none"); | ||
| 181 | - this._emit(DrawTool.DRAW_TOOL_CHANGE, {"action": "clear"}); | ||
| 182 | - } | ||
| 183 | - | ||
| 184 | - _colorHandler(evt) { | ||
| 185 | - $(".toolColor").css("display","none"); | ||
| 186 | - loger.log(evt.target.id, evt.target.title); | ||
| 187 | - let color = evt.target.title; | ||
| 188 | - this._emit(DrawTool.DRAW_TOOL_CHANGE, {"action": "changeColor", "color": color}); | ||
| 189 | - let showColor = document.getElementById('showColor'); | ||
| 190 | - switch (evt.target.id) { | ||
| 191 | - case "redColor": | ||
| 192 | - showColor.style.background = 'url("images/colorRed.png") no-repeat'; | ||
| 193 | - $(".showColor").unbind("click"); | ||
| 194 | - this._showColorNone(); | ||
| 195 | - this._showFormNone(); | ||
| 196 | - break; | ||
| 197 | - case "blueColor": | ||
| 198 | - showColor.style.background = 'url("images/colorBlue.png") no-repeat'; | ||
| 199 | - $(".showColor").unbind("click"); | ||
| 200 | - this._showColorNone(); | ||
| 201 | - this._showFormNone(); | ||
| 202 | - break; | ||
| 203 | - case "purpleColor": | ||
| 204 | - showColor.style.background = 'url("images/colorPurple.png") no-repeat'; | ||
| 205 | - $(".showColor").unbind("click"); | ||
| 206 | - this._showColorNone(); | ||
| 207 | - this._showFormNone(); | ||
| 208 | - break; | ||
| 209 | - case "yellowColor": | ||
| 210 | - showColor.style.background = 'url("images/colorYellow.png") no-repeat'; | ||
| 211 | - $(".showColor").unbind("click"); | ||
| 212 | - this._showColorNone(); | ||
| 213 | - this._showFormNone(); | ||
| 214 | - break; | ||
| 215 | - default: | ||
| 216 | - break | ||
| 217 | - } | ||
| 218 | - } | ||
| 219 | - | ||
| 220 | - _formHandler(){ | ||
| 221 | - $(".toolForm").css("display","none"); | ||
| 222 | - $("#showForm").unbind("click"); | ||
| 223 | - loger.log('点击隐藏形状工具列表'); | ||
| 224 | - } | ||
| 225 | - _showColorBlock() { | ||
| 226 | - $(".toolColor").css("display", "block"); | ||
| 227 | - $(".toolColor").css("z-index", 0); | ||
| 228 | - $(".toolForm").css("display", "none"); | ||
| 229 | - $(".toolForm").css("z-index", 0); | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | - _showColorNone() { | ||
| 233 | - $(".toolColor").css("display", "none"); | ||
| 234 | - $(".toolColor").css("z-index", 0); | ||
| 235 | - } | ||
| 236 | - _showFormBlock(){ | ||
| 237 | - $(".toolForm").css("display", "block"); | ||
| 238 | - $(".toolForm").css("z-index", 2); | ||
| 239 | - $(".toolColor").css("display", "none"); | ||
| 240 | - $(".toolColor").css("z-index", 0); | ||
| 241 | - } | ||
| 242 | - _showFormNone(){ | ||
| 243 | - $(".toolForm").css("display", "none"); | ||
| 244 | - $(".toolForm").css("z-index", 0); | ||
| 245 | - } | ||
| 246 | - | ||
| 247 | - _controlDrawToolVisible() { | ||
| 248 | - // if(ClassDataProxy.isEnableDraw == true){ | ||
| 249 | - if (this.isShow) { | ||
| 250 | - $(".drawTool").hide(); | ||
| 251 | - $(".arrowTop").hide(); | ||
| 252 | - $(".arrowBottom").show(); | ||
| 253 | - } else { | ||
| 254 | - $(".drawTool").show(); | ||
| 255 | - $(".arrowTop").show(); | ||
| 256 | - $(".arrowBottom").hide(); | ||
| 257 | - } | ||
| 258 | - this.isShow = !this.isShow; | ||
| 259 | - // } | ||
| 260 | - } | ||
| 261 | - _hideColorTool(){ | ||
| 262 | - $(".toolColor").css("display", "none"); | ||
| 263 | - $(".toolForm").css("display", "none"); | ||
| 264 | - } | ||
| 265 | -} | ||
| 266 | -DrawTool.prototype.DRAW_TOOL_CHANGE = DrawTool.DRAW_TOOL_CHANGE = "draw_tool_change"; | ||
| 267 | -export default DrawTool; |
src/ape/DynamicPPT.js
已删除
100644 → 0
| 1 | -/* | ||
| 2 | - * | ||
| 3 | - * 动态PPT 尺寸1:(高:宽 540/864 =250/400 = 0.625) 尺寸2: 720 540 4;3 | ||
| 4 | - * | ||
| 5 | - * */ | ||
| 6 | - | ||
| 7 | -import Emiter from "Emiter"; | ||
| 8 | -import Loger from "Loger"; | ||
| 9 | -import $ from "jquery"; | ||
| 10 | -import xdysdk from "libs/xdysdk"; | ||
| 11 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 12 | - | ||
| 13 | -let loger = Loger.getLoger('PC-DynamicPPT'); | ||
| 14 | - | ||
| 15 | -window.ispringPresentationConnector ={}; | ||
| 16 | -window.pptPlayer; | ||
| 17 | - | ||
| 18 | -class DynamicPPT extends Emiter { | ||
| 19 | - constructor() { | ||
| 20 | - super(); | ||
| 21 | - this.currentAnimationStep=1;//默人动画页数是1 | ||
| 22 | - this.animationStepCount=1;//默认动画总页数时1 | ||
| 23 | - | ||
| 24 | - this.currenSlideIndex=0;//当前显示的页码 从0开始 | ||
| 25 | - | ||
| 26 | - this.pptiframeSrc='';//当前页地址,ip地址换成允许跨域的ip | ||
| 27 | - this.pptData=null; | ||
| 28 | - this.changePageTimer=0; | ||
| 29 | - this.addEvent(); | ||
| 30 | - } | ||
| 31 | - addEvent(){ | ||
| 32 | - //监听动态ppt加载 | ||
| 33 | - $("#framePPT").on('load', this._onLoadPPT.bind(this)); | ||
| 34 | - $("#framePPT").on('error', this._onLoadPPTError.bind(this)); | ||
| 35 | - | ||
| 36 | - //上一步下一步动画 | ||
| 37 | - $(".pptNextStep").hide(); | ||
| 38 | - $(".pptPrevStep").hide(); | ||
| 39 | - $(".pptNextStep").on("click", this.pptNextAnimationHandler.bind(this)); | ||
| 40 | - $(".pptPrevStep").on("click", this.pptPrevAnimationHandler.bind(this)); | ||
| 41 | - } | ||
| 42 | - //更新ppt,显示和删除都用这个接口 _data为null的时候就是删除 | ||
| 43 | - updataPPT(_data){ | ||
| 44 | - console.log('更新ppt数据',_data); | ||
| 45 | - if(_data){ | ||
| 46 | - this.pptData=_data; | ||
| 47 | - //有数据,并且是可见,需要更新操作数据 | ||
| 48 | - if (_data.visible == true) { | ||
| 49 | - this.showPPT(); | ||
| 50 | - //获取数据中的html地址,然后转换为允许跨域访问的地址 | ||
| 51 | - let iframeSrc =_data.html||""; | ||
| 52 | - | ||
| 53 | - //替换IP地址,解决跨域问题,后续服务器会解决跨域,不需要再替换 | ||
| 54 | - /* iframeSrc=iframeSrc.replace('http://',''); | ||
| 55 | - let index=iframeSrc.indexOf('/'); | ||
| 56 | - let iframeLastSrc=ifreamDocIp+iframeSrc.substr(index);*/ | ||
| 57 | - | ||
| 58 | - //如果是本地测试就用本地文件地址,否则就用线上地址 | ||
| 59 | - let url = encodeURI(window.location.href); | ||
| 60 | - let index=url.indexOf('localhost:'); | ||
| 61 | - if(index<0){ | ||
| 62 | - index=url.indexOf('127.0.0.1'); | ||
| 63 | - } | ||
| 64 | - if(index>=0){ | ||
| 65 | - iframeSrc='./ppt0516/index.html'; | ||
| 66 | - loger.warn('使用本地的动态ppt测试',iframeSrc); | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - if(!iframeSrc){ | ||
| 70 | - loger.warn('ppt地址转换失败'); | ||
| 71 | - return; | ||
| 72 | - } | ||
| 73 | - if(this.pptiframeSrc==iframeSrc){ | ||
| 74 | - //文档已经存在 | ||
| 75 | - this.changePage(); | ||
| 76 | - }else { | ||
| 77 | - //文档不存在 | ||
| 78 | - this._loadIframSrc(iframeSrc); | ||
| 79 | - } | ||
| 80 | - }else { | ||
| 81 | - this.hidePPT(); | ||
| 82 | - } | ||
| 83 | - }else { | ||
| 84 | - //没有数据,清除 | ||
| 85 | - this.pptData=null; | ||
| 86 | - this.hidePPT(); | ||
| 87 | - this.clearPPT(); | ||
| 88 | - } | ||
| 89 | - } | ||
| 90 | - //显示ppt | ||
| 91 | - showPPT(){ | ||
| 92 | - //loger.log("显示ppt"); | ||
| 93 | - $("#framePPT").show(); | ||
| 94 | - } | ||
| 95 | - //隐藏ppt | ||
| 96 | - hidePPT(){ | ||
| 97 | - // loger.log("隐藏ppt"); | ||
| 98 | - $("#framePPT").hide(); | ||
| 99 | - $(".pptPrevStep").hide(); | ||
| 100 | - $(".pptNextStep").hide(); | ||
| 101 | - $("#framePPT").attr('src', ""); | ||
| 102 | - } | ||
| 103 | - //设置大小 | ||
| 104 | - setPPTSize(sizeObj){ | ||
| 105 | - //if(sizeObj) { | ||
| 106 | - // loger.log("设置ppt显示大小", sizeObj); | ||
| 107 | - //} | ||
| 108 | - } | ||
| 109 | - //清除ppt数据 | ||
| 110 | - clearPPT(){ | ||
| 111 | - //loger.log("清除ppt数据"); | ||
| 112 | - clearTimeout( this.changePageTimer); | ||
| 113 | - this.pptData=null; | ||
| 114 | - this.pptiframeSrc=''; | ||
| 115 | - this.currentAnimationStep=1; | ||
| 116 | - this.animationStepCount=1; | ||
| 117 | - this.currenSlideIndex=0; | ||
| 118 | - window.ispringPresentationConnector ={}; | ||
| 119 | - window.pptPlayer=null; | ||
| 120 | - } | ||
| 121 | - // 加载动态ppt地址 | ||
| 122 | - _loadIframSrc(_iframeLastSrc){ | ||
| 123 | - let isFirstLoad=true;//每次更地址都会重置,如果是重加载,加载完成后需要切换页面 | ||
| 124 | - let _this=this; | ||
| 125 | - window.ispringPresentationConnector.register = function (player){ | ||
| 126 | - window.pptPlayer=player; | ||
| 127 | - console.log('ispringPresentationConnector'); | ||
| 128 | - window.pptPlayer.view().playbackController().slideChangeEvent().addHandler(function(slideIndex) { | ||
| 129 | - console.log( "动态ppt当前index: " + (slideIndex )); | ||
| 130 | - _this.currenSlideIndex=slideIndex; | ||
| 131 | - _this.animationStepCount=window.pptPlayer.view().playbackController().currentSlide().animationSteps().count(); | ||
| 132 | - //第一次加载完成的时候切换一次 | ||
| 133 | - if(isFirstLoad){ | ||
| 134 | - isFirstLoad=false; | ||
| 135 | - _this.changePage(1000); | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - }); | ||
| 139 | - | ||
| 140 | - window.pptPlayer.view().playbackController().stepChangeEvent().addHandler(function(stepIndex){ | ||
| 141 | - _this.currentAnimationStep=stepIndex+1||1; | ||
| 142 | - | ||
| 143 | - _this.animationStepCount=window.pptPlayer.view().playbackController().currentSlide().animationSteps().count(); | ||
| 144 | - console.log("动态ppt当前 step: " + stepIndex,' this.currentAnimationStep:'+ _this.currentAnimationStep); | ||
| 145 | - }); | ||
| 146 | - | ||
| 147 | - window.pptPlayer.view().playbackController().clock.tickEvent().addHandler(function(theClock){ | ||
| 148 | - var ts = theClock.timestamp(); | ||
| 149 | - window.console.log("Tick. Slide:", ts.slideIndex(), "; step: ", ts.stepIndex(), "; timeOffset: ", ts.timeOffset()); | ||
| 150 | - }); | ||
| 151 | - } | ||
| 152 | - | ||
| 153 | - //加完监听之后开始加载网页 | ||
| 154 | - this.pptiframeSrc=_iframeLastSrc; | ||
| 155 | - console.log("pptiframeSrc",this.pptiframeSrc); | ||
| 156 | - $("#framePPT").attr("src",this.pptiframeSrc); | ||
| 157 | - | ||
| 158 | - } | ||
| 159 | - changePage(_deley){ | ||
| 160 | - console.log("切换PPT页码---->",this.pptData); | ||
| 161 | - if(!this.pptData||!window.pptPlayer){ | ||
| 162 | - console.warn("切换PPT页码-->_data数据不存在"); | ||
| 163 | - return; | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - if(this.pptData.curPageNo!=(this.currenSlideIndex+1)){ | ||
| 167 | - clearTimeout( this.changePageTimer); | ||
| 168 | - if(_deley){ | ||
| 169 | - let _this=this; | ||
| 170 | - this.changePageTimer=setTimeout(function(){ | ||
| 171 | - console.log(_deley,"延迟切换PPT页码---->",_this.pptData.curPageNo); | ||
| 172 | - this.currentAnimationStep=1;//默人动画页数是1 | ||
| 173 | - this.animationStepCount=1;//默认动画总页数时1 | ||
| 174 | - window.pptPlayer.view().playbackController().gotoSlide((_this.pptData.curPageNo-1),false); | ||
| 175 | - setTimeout(function () { | ||
| 176 | - let curAnimationStep=_this.pptData.animationStep; | ||
| 177 | - for(let i=0;i<(curAnimationStep-1);i++){ | ||
| 178 | - window.pptPlayer.view().playbackController().gotoNextStep(); | ||
| 179 | - } | ||
| 180 | - },1000); | ||
| 181 | - },_deley) | ||
| 182 | - }else { | ||
| 183 | - console.log("切换PPT页码---->",this.pptData.curPageNo); | ||
| 184 | - this.currentAnimationStep=1;//默人动画页数是1 | ||
| 185 | - this.animationStepCount=1;//默认动画总页数时1 | ||
| 186 | - window.pptPlayer.view().playbackController().gotoSlide((this.pptData.curPageNo-1),false); | ||
| 187 | - } | ||
| 188 | - }else { | ||
| 189 | - //页数切换完成,切换动画步骤 | ||
| 190 | - this._changeAnimationStep(); | ||
| 191 | - } | ||
| 192 | - } | ||
| 193 | - | ||
| 194 | - _changeAnimationStep(){ | ||
| 195 | - console.log("切换动画步数---->",this.currentAnimationStep,'-->',this.pptData.animationStep); | ||
| 196 | - if(!this.pptData||!window.pptPlayer){ | ||
| 197 | - console.warn("切换PPT动画步骤-->_data数据不存在"); | ||
| 198 | - return; | ||
| 199 | - } | ||
| 200 | - if(this.animationStepCount<2){ | ||
| 201 | - console.log("当前页码的动画步数为->"+this.animationStepCount); | ||
| 202 | - return; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - if(this.pptData.animationStep>this.currentAnimationStep){ | ||
| 206 | - console.log("切换动画步数---->下一步") | ||
| 207 | - // this.currentAnimationStep = this.pptData.animationStep; | ||
| 208 | - for(let i=this.currentAnimationStep;i<this.pptData.animationStep;i++){ | ||
| 209 | - try{ | ||
| 210 | - window.pptPlayer.view().playbackController().gotoNextStep(); | ||
| 211 | - }catch (err){ | ||
| 212 | - console.warn("切换动画步数---->下一步-失败",err); | ||
| 213 | - } | ||
| 214 | - | ||
| 215 | - } | ||
| 216 | - | ||
| 217 | - }else if(this.pptData.animationStep<this.currentAnimationStep){ | ||
| 218 | - console.log("切换动画步数---->上一步"); | ||
| 219 | - window.pptPlayer.view().playbackController().gotoPreviousStep(); | ||
| 220 | - for(let i=this.pptData.animationStep;i<this.currentAnimationStep;i++){ | ||
| 221 | - | ||
| 222 | - try{ | ||
| 223 | - window.pptPlayer.view().playbackController().gotoPreviousStep(); | ||
| 224 | - }catch (err){ | ||
| 225 | - console.warn("切换动画步数---->上一步-失败",err); | ||
| 226 | - } | ||
| 227 | - | ||
| 228 | - } | ||
| 229 | - }else { | ||
| 230 | - console.log("切换动画步数---->完成"); | ||
| 231 | - } | ||
| 232 | - } | ||
| 233 | - | ||
| 234 | - //ppt加载完成 | ||
| 235 | - _onLoadPPT(evt) { | ||
| 236 | - console.log("ppt加载完成---->"); | ||
| 237 | - } | ||
| 238 | - | ||
| 239 | - //ppt加载失败 | ||
| 240 | - _onLoadPPTError(evt){ | ||
| 241 | - console.warn("ppt加载失败---->",evt); | ||
| 242 | - } | ||
| 243 | - isNextAnimationComplete(){ | ||
| 244 | - if(this.animationStepCount>1&&this.animationStepCount!=this.currentAnimationStep){ | ||
| 245 | - this.currentAnimationStep = this.pptData.animationStep; | ||
| 246 | - console.warn("还有动画需要操作-.不能翻页"); | ||
| 247 | - return false; | ||
| 248 | - } | ||
| 249 | - console.warn("没有动画需要操作-.可以翻页"); | ||
| 250 | - return true; | ||
| 251 | - } | ||
| 252 | - isPrevAnimationComplete(){ | ||
| 253 | - if(this.animationStepCount>1&&this.currentAnimationStep>2){ | ||
| 254 | - console.warn("还有动画需要操作-.不能翻页"); | ||
| 255 | - return false; | ||
| 256 | - } | ||
| 257 | - console.warn("没有动画需要操作-.可以翻页"); | ||
| 258 | - return true; | ||
| 259 | - } | ||
| 260 | - //下一步动画 | ||
| 261 | - pptNextAnimationHandler(){ | ||
| 262 | - if(!this.pptData||!window.pptPlayer){ | ||
| 263 | - console.warn("下一步动画---->数据无效"); | ||
| 264 | - return; | ||
| 265 | - } | ||
| 266 | - xdysdk.api("sendDocumentSwitchAnimation",{"step":1}); | ||
| 267 | - } | ||
| 268 | - //上一步动画 | ||
| 269 | - pptPrevAnimationHandler(){ | ||
| 270 | - if(!this.pptData||!window.pptPlayer){ | ||
| 271 | - console.warn("下一步动画---->数据无效"); | ||
| 272 | - return; | ||
| 273 | - } | ||
| 274 | - xdysdk.api("sendDocumentSwitchAnimation",{"step":-1}); | ||
| 275 | - } | ||
| 276 | -} | ||
| 277 | -DynamicPPT.prototype.SET_PPT_CHANGE = DynamicPPT.SET_PPT_CHANGE = "set_ppt_change"; | ||
| 278 | -export default DynamicPPT; |
| @@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 9 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 10 | let loger = Loger.getLoger('PC-ErrorApe'); | 9 | let loger = Loger.getLoger('PC-ErrorApe'); |
| @@ -4,12 +4,9 @@ | @@ -4,12 +4,9 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import DrawTool from "./DrawTool"; | ||
| 9 | -import LaserPen from "./LaserPen"; | ||
| 10 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 11 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 12 | - | 9 | +import MessageTypes from "../MessageTypes"; |
| 13 | const classifyList = `<div class="classifyList {_classifyListR}" id="{_id}"> | 10 | const classifyList = `<div class="classifyList {_classifyListR}" id="{_id}"> |
| 14 | <img class="curriculumListImg" src="{_msgImg}" alt=""> | 11 | <img class="curriculumListImg" src="{_msgImg}" alt=""> |
| 15 | <p class="curriculumListTit">{_classroomTitle}</p> | 12 | <p class="curriculumListTit">{_classroomTitle}</p> |
| @@ -44,7 +41,6 @@ class HomeApe extends Ape { | @@ -44,7 +41,6 @@ class HomeApe extends Ape { | ||
| 44 | isLocalStorage(){ | 41 | isLocalStorage(){ |
| 45 | if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_0 || ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){ | 42 | if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_0 || ClassDataProxy.userType == ClassDataProxy.USER_TYPE_8){ |
| 46 | this.detailPage(); | 43 | this.detailPage(); |
| 47 | - console.log('学生',111111111) | ||
| 48 | } | 44 | } |
| 49 | } | 45 | } |
| 50 | _judgeListPlace(){ | 46 | _judgeListPlace(){ |
| @@ -57,13 +53,12 @@ class HomeApe extends Ape { | @@ -57,13 +53,12 @@ class HomeApe extends Ape { | ||
| 57 | } | 53 | } |
| 58 | } | 54 | } |
| 59 | _lanclassBtnHandler(evt){ | 55 | _lanclassBtnHandler(evt){ |
| 56 | + loger.log('首页',ClassDataProxy.userType) | ||
| 60 | $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); | 57 | $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); |
| 61 | - let userType = window.localStorage.getItem("userType"); | ||
| 62 | - if( userType== ClassDataProxy.USER_TYPE_8 || userType== ClassDataProxy.USER_TYPE_0){ | 58 | + if( ClassDataProxy.userType== ClassDataProxy.USER_TYPE_8 || ClassDataProxy.userType== ClassDataProxy.USER_TYPE_0){ |
| 63 | this.studentClick(); | 59 | this.studentClick(); |
| 64 | - }else if(userType== ClassDataProxy.USER_TYPE_1){ | ||
| 65 | - let userType = ClassDataProxy.userType; | ||
| 66 | - this._emit(MessageTypes.HOME_SKIP,{userType:userType}); | 60 | + }else if(ClassDataProxy.userType == ClassDataProxy.USER_TYPE_1){ |
| 61 | + this._emit(MessageTypes.HOME_SKIP,{userType:ClassDataProxy.userType}); | ||
| 67 | } | 62 | } |
| 68 | } | 63 | } |
| 69 | detailPage(){ | 64 | detailPage(){ |
| @@ -110,6 +105,7 @@ class HomeApe extends Ape { | @@ -110,6 +105,7 @@ class HomeApe extends Ape { | ||
| 110 | studentClick(){ | 105 | studentClick(){ |
| 111 | $('#slideshow').show(); | 106 | $('#slideshow').show(); |
| 112 | $('#defaultBox').show(); | 107 | $('#defaultBox').show(); |
| 108 | + $('.curriculumBox').show(); | ||
| 113 | $('#classifyListBox').hide(); | 109 | $('#classifyListBox').hide(); |
| 114 | $('#teacherDetailBox').hide(); | 110 | $('#teacherDetailBox').hide(); |
| 115 | $('#lanclassBox').hide(); | 111 | $('#lanclassBox').hide(); |
| @@ -117,6 +113,7 @@ class HomeApe extends Ape { | @@ -117,6 +113,7 @@ class HomeApe extends Ape { | ||
| 117 | teacher(){ | 113 | teacher(){ |
| 118 | $('#slideshow').hide(); | 114 | $('#slideshow').hide(); |
| 119 | $('#defaultBox').hide(); | 115 | $('#defaultBox').hide(); |
| 116 | + $('.curriculumBox').hide(); | ||
| 120 | $('#classifyListBox').show(); | 117 | $('#classifyListBox').show(); |
| 121 | $('#teacherDetailBox').hide(); | 118 | $('#teacherDetailBox').hide(); |
| 122 | $('#lanclassBox').hide(); | 119 | $('#lanclassBox').hide(); |
| @@ -4,9 +4,6 @@ | @@ -4,9 +4,6 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import DrawTool from "./DrawTool"; | ||
| 9 | -import LaserPen from "./LaserPen"; | ||
| 10 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 11 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 12 | let loger = Loger.getLoger('PC-LanclassApe'); | 9 | let loger = Loger.getLoger('PC-LanclassApe'); |
| @@ -47,6 +44,7 @@ class LanclassApe extends Ape { | @@ -47,6 +44,7 @@ class LanclassApe extends Ape { | ||
| 47 | $('#classifyListContent').find('.classifyList').eq(i==3).addClass('classifyListR'); | 44 | $('#classifyListContent').find('.classifyList').eq(i==3).addClass('classifyListR'); |
| 48 | } | 45 | } |
| 49 | _lanclassBtnHandler(evt){ | 46 | _lanclassBtnHandler(evt){ |
| 47 | + loger.log('直播',ClassDataProxy.userType) | ||
| 50 | let _ele = $(evt.target); | 48 | let _ele = $(evt.target); |
| 51 | if(_ele.attr('data')){ | 49 | if(_ele.attr('data')){ |
| 52 | $('.header_listMsg').eq(_ele.attr('data')).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); | 50 | $('.header_listMsg').eq(_ele.attr('data')).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); |
| @@ -54,6 +52,7 @@ class LanclassApe extends Ape { | @@ -54,6 +52,7 @@ class LanclassApe extends Ape { | ||
| 54 | $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); | 52 | $(evt.target).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); |
| 55 | $('#slideshow').hide(); | 53 | $('#slideshow').hide(); |
| 56 | $('#defaultBox').hide(); | 54 | $('#defaultBox').hide(); |
| 55 | + $('.curriculumBox').hide(); | ||
| 57 | $('#classifyListBox').show(); | 56 | $('#classifyListBox').show(); |
| 58 | $('#teacherDetailBox').hide(); | 57 | $('#teacherDetailBox').hide(); |
| 59 | $('#lanclassBox').hide(); | 58 | $('#lanclassBox').hide(); |
src/ape/LaserPen.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 激光笔模块 | ||
| 3 | -// */ | ||
| 4 | -import Loger from "../Loger"; | ||
| 5 | -import Ape from "./Ape"; | ||
| 6 | -import xdysdk from "libs/xdysdk"; | ||
| 7 | -import $ from "jquery"; | ||
| 8 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 9 | -// import DrawTool from "./DrawTool"; | ||
| 10 | - | ||
| 11 | -let loger = Loger.getLoger('PC-LaserPen'); | ||
| 12 | -// let _drawTool; | ||
| 13 | -class LaserPen extends Ape { | ||
| 14 | - constructor() { | ||
| 15 | - super(); | ||
| 16 | - ClassDataProxy.isLaser = false; | ||
| 17 | - this.laserPenInfo; | ||
| 18 | - this.laserBoardContent; | ||
| 19 | - this.laserBoardWidth=0; | ||
| 20 | - this.laserBoardHeight=0; | ||
| 21 | - this.scroolTop = 0; | ||
| 22 | - this.scroolLeft = 0; | ||
| 23 | - this.laserBoardTop = 0; | ||
| 24 | - this.laserBoardLeft = 0; | ||
| 25 | - this.laserGrou=[]; | ||
| 26 | - this.init(); | ||
| 27 | - this.addEvent(); | ||
| 28 | - } | ||
| 29 | - init(){ | ||
| 30 | - this.laserBoardContent = $(".laserBoard"); | ||
| 31 | - // _drawTool=new DrawTool(); | ||
| 32 | - } | ||
| 33 | - addEvent(){ | ||
| 34 | - $(".laserBoard").on('mousemove', this._laserMoveHandler.bind(this)); | ||
| 35 | - xdysdk.on("cursor_update", this._laserUpdateHanlder.bind(this)); | ||
| 36 | - $(".laserPen").on("click", this._laserPenHandler.bind(this));//激光笔 | ||
| 37 | - } | ||
| 38 | - setCanvasSize(_data) { | ||
| 39 | - if (this.laserBoardContent) { | ||
| 40 | - //文档的尺寸已经更改,需要更新laserBoard大小 | ||
| 41 | - this.laserBoardWidth = _data.width; | ||
| 42 | - this.laserBoardHeight = _data.height; | ||
| 43 | - this.laserBoardContent[0].width = this.laserBoardWidth; | ||
| 44 | - this.laserBoardContent[0].height = this.laserBoardHeight; | ||
| 45 | - this.laserBoardTop = this.laserBoardContent.offset().top - this.scroolTop; | ||
| 46 | - this.laserBoardLeft = this.laserBoardContent.offset().left - this.scroolLeft; | ||
| 47 | - this._startLaserDraw(this.laserreceiveData); | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - _laserUpdateHanlder(_data){ | ||
| 51 | - if(_data.duration!==0){ | ||
| 52 | - if(ClassDataProxy.userRole==ClassDataProxy.USER_NOTMAL||ClassDataProxy.userRole==ClassDataProxy.USER_INVISIBLE){ | ||
| 53 | - $(".laserBoard").css("z-index","1"); | ||
| 54 | - $(".laserRed").show(); | ||
| 55 | - //console.log("1111111111",$(".laserBoard").css("z-index")==1); | ||
| 56 | - //console.log("2222222222",ClassDataProxy.isDraw==true); | ||
| 57 | - //console.log("zzzzzzzzzz",$(".laserBoard").css("z-index")==1&&ClassDataProxy.isDraw==true); | ||
| 58 | - if( $(".laserBoard").css("z-index")==1&&ClassDataProxy.isDraw==true){ | ||
| 59 | - $(".pencil").click(function () { | ||
| 60 | - $(".laserBoard").css("z-index","-1"); | ||
| 61 | - ClassDataProxy.isDraw=true | ||
| 62 | - $(".canvasContent").css("cursor","url(images/tool/penciling.png),crosshair"); | ||
| 63 | - // _drawTool._pencilHandler(); | ||
| 64 | - }) | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - // console.log("接收激光笔数据===",_data); | ||
| 68 | - let duration=(_data.duration)*1000; | ||
| 69 | - // clearTimeout(durId); | ||
| 70 | - let that=this; | ||
| 71 | - let laserannotaionItems = _data.pointGroup; | ||
| 72 | - //清除重绘制数据 | ||
| 73 | - that.laserreceiveData = []; | ||
| 74 | - //本地储存一份数据 | ||
| 75 | - if (laserannotaionItems && laserannotaionItems.length > 0) { | ||
| 76 | - for (let i = 0; i < laserannotaionItems.length; i++) { | ||
| 77 | - that.laserreceiveData.push(laserannotaionItems[i]); | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - //绘制全部数据 | ||
| 81 | - that._startLaserDraw(laserannotaionItems); | ||
| 82 | - } | ||
| 83 | - else if (_data.duration==0){ | ||
| 84 | - $(".laserBoard").css("z-index","-1"); | ||
| 85 | - $(".laserRed").hide(); | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - } | ||
| 89 | - _startLaserDraw(_data){ | ||
| 90 | - if (_data && _data.length > 0) { | ||
| 91 | - for (let i = 0; i < _data.length; i++) { | ||
| 92 | - let item = _data[i]; | ||
| 93 | - this._drawLaser(item); | ||
| 94 | - } | ||
| 95 | - } | ||
| 96 | - } | ||
| 97 | - _drawLaser(_data){ | ||
| 98 | - let pointGroup = _data; | ||
| 99 | - if (pointGroup) { | ||
| 100 | - let point = this.xyFromPer(pointGroup.w, pointGroup.h); | ||
| 101 | - // $(".laserRed").show(); | ||
| 102 | - $(".laserRed").css({ | ||
| 103 | - left:point.x, | ||
| 104 | - top:point.y | ||
| 105 | - }) | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | - _laserPenHandler(){ | ||
| 109 | - if(ClassDataProxy.isDraw==true){ | ||
| 110 | - ClassDataProxy.isDraw=false; | ||
| 111 | - } | ||
| 112 | - $(".toolColor").css("display", "none"); | ||
| 113 | - $(".laserBoard").css("z-index","1"); | ||
| 114 | - ClassDataProxy.isLaser = !ClassDataProxy.isLaser; | ||
| 115 | - if (ClassDataProxy.isLaser) { | ||
| 116 | - // $(".laserRed").show(); | ||
| 117 | - $(".laserBoard").css({"cursor":"url(images/tool/pen.png),crosshair"}); | ||
| 118 | - } else { | ||
| 119 | - $(".laserBoard").css("cursor", "default"); | ||
| 120 | - $(".canvasContent").css("cursor", "default"); | ||
| 121 | - let paramInfo = { | ||
| 122 | - "pointGroup": [],//有多个坐标点组成 | ||
| 123 | - "duration":0 //多长时间发一次数据 | ||
| 124 | - }; | ||
| 125 | - xdysdk.api("sendInsertCursor", paramInfo); | ||
| 126 | - | ||
| 127 | - } | ||
| 128 | - this.laserPenInfo={ | ||
| 129 | - "action": "laserPen", "isLaser": ClassDataProxy.isLaser | ||
| 130 | - }; | ||
| 131 | - this._laserPenChangeHandler(this.laserPenInfo); | ||
| 132 | - } | ||
| 133 | - _laserPenChangeHandler(_data){ | ||
| 134 | - switch (_data.action) { | ||
| 135 | - case "laserPen": | ||
| 136 | - //激光笔 | ||
| 137 | - ClassDataProxy.isLaser = _data.isLaser; | ||
| 138 | - break; | ||
| 139 | - default : | ||
| 140 | - break | ||
| 141 | - } | ||
| 142 | - } | ||
| 143 | - _laserMoveHandler(evt){ | ||
| 144 | - this.laserGrou=[]; | ||
| 145 | - if (ClassDataProxy.isLaser){ | ||
| 146 | - let toX = evt.clientX - this.laserBoardLeft; | ||
| 147 | - let toY = evt.clientY - this.laserBoardTop; | ||
| 148 | - this.laserGrou.push(this.xyToPer(Math.round(toX), Math.round(toY))); | ||
| 149 | - let that=this; | ||
| 150 | - that._sendLaser(); | ||
| 151 | - } | ||
| 152 | - } | ||
| 153 | - _sendLaser(){ | ||
| 154 | - if (this.laserGrou.length >= 1) { | ||
| 155 | - let paramInfo = { | ||
| 156 | - "pointGroup": this.laserGrou,//有多个坐标点组成 | ||
| 157 | - "duration":3 //多长时间发一次数据 | ||
| 158 | - }; | ||
| 159 | - xdysdk.api("sendInsertCursor", paramInfo); | ||
| 160 | - this.laserGrou=[]; | ||
| 161 | - } | ||
| 162 | - } | ||
| 163 | - //把X Y坐标转换为相对laserBoard宽度的百分比 | ||
| 164 | - xyToPer(x, y) { | ||
| 165 | - let recordPencilObject = {}; | ||
| 166 | - recordPencilObject.w = parseInt(x / this.laserBoardWidth * 10000) / 100; | ||
| 167 | - recordPencilObject.h = parseInt(y / this.laserBoardWidth * 10000) / 100; | ||
| 168 | - //loger.log("xyToPer",recordPencilObject); | ||
| 169 | - return recordPencilObject; | ||
| 170 | - } | ||
| 171 | - xyFromPer(w, h) { | ||
| 172 | - let xyObj = {}; | ||
| 173 | - xyObj.x = Math.round((w * this.laserBoardWidth) / 100) ;//加0.5偏移 平滑 | ||
| 174 | - xyObj.y = Math.round((h * this.laserBoardWidth ) / 100); | ||
| 175 | - //loger.log("xyFromPer",xyObj); | ||
| 176 | - return xyObj; | ||
| 177 | - } | ||
| 178 | -} | ||
| 179 | -LaserPen.prototype.LASER_PEN_CHANGE = LaserPen.LASER_PEN_CHANGE = "laser_pen_change"; | ||
| 180 | -export default LaserPen; |
| @@ -4,9 +4,6 @@ | @@ -4,9 +4,6 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import DrawTool from "./DrawTool"; | ||
| 9 | -import LaserPen from "./LaserPen"; | ||
| 10 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 11 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 12 | 9 | ||
| @@ -73,10 +70,10 @@ class ListDetailsApe extends Ape { | @@ -73,10 +70,10 @@ class ListDetailsApe extends Ape { | ||
| 73 | _classDateContent(_data){ | 70 | _classDateContent(_data){ |
| 74 | let _dataList = _data.meetingInfo[0]; | 71 | let _dataList = _data.meetingInfo[0]; |
| 75 | if(_dataList.meetingType == 1){ | 72 | if(_dataList.meetingType == 1){ |
| 76 | - console.log('互动课堂') | 73 | + loger.log('互动课堂') |
| 77 | this._lanclassRender(_dataList); | 74 | this._lanclassRender(_dataList); |
| 78 | }else if(_dataList.meetingType == 2){ | 75 | }else if(_dataList.meetingType == 2){ |
| 79 | - console.log('直播课堂') | 76 | + loger.log('直播课堂') |
| 80 | this._liveRender(_dataList); | 77 | this._liveRender(_dataList); |
| 81 | }else{ | 78 | }else{ |
| 82 | this._lanclassRender(_dataList); | 79 | this._lanclassRender(_dataList); |
| @@ -86,6 +83,7 @@ class ListDetailsApe extends Ape { | @@ -86,6 +83,7 @@ class ListDetailsApe extends Ape { | ||
| 86 | //互动课堂 | 83 | //互动课堂 |
| 87 | _lanclassRender(_dataList){ | 84 | _lanclassRender(_dataList){ |
| 88 | $('#defaultBox').hide(); | 85 | $('#defaultBox').hide(); |
| 86 | + $('.curriculumBox').hide(); | ||
| 89 | $('#teacherDetailBox').show(); | 87 | $('#teacherDetailBox').show(); |
| 90 | 88 | ||
| 91 | $('#teacherDetailInfoImg').attr('src','images/u293.png');//老师授课标题图片 | 89 | $('#teacherDetailInfoImg').attr('src','images/u293.png');//老师授课标题图片 |
| @@ -106,6 +104,7 @@ class ListDetailsApe extends Ape { | @@ -106,6 +104,7 @@ class ListDetailsApe extends Ape { | ||
| 106 | //直播课堂 | 104 | //直播课堂 |
| 107 | _liveRender(_dataList){ | 105 | _liveRender(_dataList){ |
| 108 | $('#defaultBox').hide(); | 106 | $('#defaultBox').hide(); |
| 107 | + $('.curriculumBox').hide(); | ||
| 109 | $('#lanclassBox').show(); | 108 | $('#lanclassBox').show(); |
| 110 | 109 | ||
| 111 | $('#lanclassContentCover').attr('src','images/u373.png');//老师授课标题图片 | 110 | $('#lanclassContentCover').attr('src','images/u373.png');//老师授课标题图片 |
| @@ -4,9 +4,6 @@ | @@ -4,9 +4,6 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import DrawTool from "./DrawTool"; | ||
| 9 | -import LaserPen from "./LaserPen"; | ||
| 10 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 11 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 12 | let loger = Loger.getLoger('PC-LanclassApe'); | 9 | let loger = Loger.getLoger('PC-LanclassApe'); |
| @@ -47,6 +44,7 @@ class LanclassApe extends Ape { | @@ -47,6 +44,7 @@ class LanclassApe extends Ape { | ||
| 47 | $('#classifyListContent').find('.classifyList').eq(i==3).addClass('classifyListR'); | 44 | $('#classifyListContent').find('.classifyList').eq(i==3).addClass('classifyListR'); |
| 48 | } | 45 | } |
| 49 | _lanclassBtnHandler(evt){ | 46 | _lanclassBtnHandler(evt){ |
| 47 | + loger.log('互动',ClassDataProxy.userType) | ||
| 50 | let _ele = $(evt.target); | 48 | let _ele = $(evt.target); |
| 51 | if(_ele.attr('data')){ | 49 | if(_ele.attr('data')){ |
| 52 | $('.header_listMsg').eq(_ele.attr('data')).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); | 50 | $('.header_listMsg').eq(_ele.attr('data')).addClass('header_listMsgCheck').siblings().removeClass('header_listMsgCheck'); |
| @@ -4,9 +4,6 @@ | @@ -4,9 +4,6 @@ | ||
| 4 | 4 | ||
| 5 | import Loger from "../Loger"; | 5 | import Loger from "../Loger"; |
| 6 | import Ape from "./Ape"; | 6 | import Ape from "./Ape"; |
| 7 | -import xdysdk from "libs/xdysdk"; | ||
| 8 | -import DrawTool from "./DrawTool"; | ||
| 9 | -import LaserPen from "./LaserPen"; | ||
| 10 | import $ from "jquery"; | 7 | import $ from "jquery"; |
| 11 | import ClassDataProxy from "proxy/ClassDataProxy"; | 8 | import ClassDataProxy from "proxy/ClassDataProxy"; |
| 12 | import MessageTypes from "../MessageTypes"; | 9 | import MessageTypes from "../MessageTypes"; |
| @@ -123,6 +120,7 @@ class LoginOrRegister extends Ape { | @@ -123,6 +120,7 @@ class LoginOrRegister extends Ape { | ||
| 123 | $('#loginPassWord').val(''); | 120 | $('#loginPassWord').val(''); |
| 124 | $('#slideshow').show(); | 121 | $('#slideshow').show(); |
| 125 | $('#defaultBox').show(); | 122 | $('#defaultBox').show(); |
| 123 | + $('.curriculumBox').show(); | ||
| 126 | $('#header_list').show(); | 124 | $('#header_list').show(); |
| 127 | $('#header_seek').show(); | 125 | $('#header_seek').show(); |
| 128 | $('#androidDownload').show(); | 126 | $('#androidDownload').show(); |
| @@ -287,6 +285,7 @@ class LoginOrRegister extends Ape { | @@ -287,6 +285,7 @@ class LoginOrRegister extends Ape { | ||
| 287 | url: _url, | 285 | url: _url, |
| 288 | data: signInfo, | 286 | data: signInfo, |
| 289 | success:function(_data){ | 287 | success:function(_data){ |
| 288 | + loger.log('登录返回数据',_data) | ||
| 290 | if(_data || _data.code == 200){ | 289 | if(_data || _data.code == 200){ |
| 291 | ClassDataProxy.userType = ClassDataProxy.USER_TYPE_1; | 290 | ClassDataProxy.userType = ClassDataProxy.USER_TYPE_1; |
| 292 | //ClassDataProxy.userType= _data.returnData.data.userType; | 291 | //ClassDataProxy.userType= _data.returnData.data.userType; |
src/ape/MediaControlBarApe.js
已删除
100644 → 0
| 1 | -//* | ||
| 2 | -// 媒体控制栏 | ||
| 3 | -// */ | ||
| 4 | - | ||
| 5 | -import Loger from "../Loger"; | ||
| 6 | -import Ape from "./Ape"; | ||
| 7 | -import $ from "jquery"; | ||
| 8 | -import ClassDataProxy from "proxy/ClassDataProxy"; | ||
| 9 | -import TimerCounterTool from "libs/TimerCounterTool"; | ||
| 10 | - | ||
| 11 | -let loger = Loger.getLoger('PC-MediaControlBarApe'); | ||
| 12 | -const SOUND_BTN_WIDTH=66; | ||
| 13 | -const TIME_TEXT_WIDTH=90; | ||
| 14 | -class MediaControlBarApe extends Ape { | ||
| 15 | - constructor() { | ||
| 16 | - super(); | ||
| 17 | - this.playStatus = ""; | ||
| 18 | - this.isShowVolumeBar = false;// | ||
| 19 | - this.isProgressMouseDown = false;//进度条是否按下 | ||
| 20 | - this.isProVolMouseDown = false;//音量控制条是否已经按钮 | ||
| 21 | - this.isOpenUpdateStatusInfo = false;//是否开同步信息 | ||
| 22 | - this.video = null;//需要控制的播放器 | ||
| 23 | - this.controlCallback = null; | ||
| 24 | - this.totalTime = 0; | ||
| 25 | - this.duration=0;//媒体文件的总时间长 | ||
| 26 | - this.mediaVolume = 60;//当前音量 | ||
| 27 | - this.seekPercent = 0;//当前进度 | ||
| 28 | - this.seekTime = 0;// | ||
| 29 | - | ||
| 30 | - this.updateCounter = 0;//定时更新数据的计数器 | ||
| 31 | - this.updateStatusDelay = 5;//每5秒更新一次数据 | ||
| 32 | - this.timerCounter = new TimerCounterTool();//计时器 | ||
| 33 | - this.timerCounter.addTimerCallBack(this.timerCounterUptate.bind(this), 1);//计时器监听 每秒更新一次 | ||
| 34 | - | ||
| 35 | - this.init(); | ||
| 36 | - this.addEvent(); | ||
| 37 | - this.onWindowResize();//默认刷新一次界面布局 | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - init() { | ||
| 41 | - this.stop(); | ||
| 42 | - this.updatePlayProgressBar(); | ||
| 43 | - this.updaterVolumeProgressBar() | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - addEvent() { | ||
| 47 | - //监听舞台 | ||
| 48 | - $(window).on('resize', this.onWindowResize.bind(this)); | ||
| 49 | - | ||
| 50 | - $("#mediaShareVolumePlay").on("click", this._openVolumeControl.bind(this));//打开音量控制 | ||
| 51 | - //音量控制 | ||
| 52 | - $('#mediaShareVoice_btn').on('mousedown', this._changeVolume.bind(this));//音量进度条 | ||
| 53 | - //暂停播放伴音按钮 | ||
| 54 | - $("#mediaShareProgressPause").on("click", this._clickPause.bind(this)); | ||
| 55 | - //继续播放伴音按钮 | ||
| 56 | - $("#mediaShareProgressPlay").on("click", this._clickPlay.bind(this)); | ||
| 57 | - | ||
| 58 | - //进度条控制 | ||
| 59 | - $('#mediaShareProgress_btn').on('mousedown', this._changeProgressBar.bind(this)); | ||
| 60 | - | ||
| 61 | - //给整个进度条可以点击seek | ||
| 62 | - $('#mediaShareProgress_bg').on('mousedown', this._clickProgressBarBg.bind(this)); | ||
| 63 | - $('#mediaShareProgress_color').on('mousedown', this._clickProgressBarBg.bind(this)); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - //计时器------------------- | ||
| 67 | - //开启计时器 | ||
| 68 | - startTimerCounter() { | ||
| 69 | - loger.log("开启计时器") | ||
| 70 | - this.updateCounter = 0; | ||
| 71 | - this.stopTimerCounter(); | ||
| 72 | - if (this.timerCounter) { | ||
| 73 | - this.timerCounter.startTimer(); | ||
| 74 | - } | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - //停止计时器 | ||
| 78 | - stopTimerCounter() { | ||
| 79 | - loger.log("停止计时器") | ||
| 80 | - this.updateCounter = 0; | ||
| 81 | - if (this.timerCounter) { | ||
| 82 | - this.timerCounter.stopTimer(); | ||
| 83 | - } | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - timerCounterUptate() { | ||
| 87 | - if (this.video && !this.isProgressMouseDown) { | ||
| 88 | - this.totalTime = this.video.duration || this.duration; | ||
| 89 | - this.seekTime = this.video.currentTime || 0; | ||
| 90 | - this.seekPercent = parseInt(this.seekTime / this.totalTime * 100); | ||
| 91 | - //console.log("totalTime", this.totalTime) | ||
| 92 | - //console.log("seekTime", this.seekTime) | ||
| 93 | - //console.log("seekPercent", this.seekPercent) | ||
| 94 | - this.updatePlayProgressBar(); | ||
| 95 | - } | ||
| 96 | - if (this.seekTime >= this.totalTime&&this.seekTime!=1) { | ||
| 97 | - if (this.totalTime > 0) { | ||
| 98 | - this.sendCallBack(MediaControlBarApe.STOP) | ||
| 99 | - } | ||
| 100 | - this.stopTimerCounter(); | ||
| 101 | - this.stop(); | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - //定时更新同步数据 | ||
| 105 | - this.updateCounter++; | ||
| 106 | - if (this.updateCounter >= this.updateStatusDelay) { | ||
| 107 | - this.updateCounter = 0; | ||
| 108 | - loger.warn("定时同步更新媒体共享的状态") | ||
| 109 | - this.sendCallBack(this.playStatus); | ||
| 110 | - } | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - //外部接口调用------------------------------ | ||
| 114 | - play(_seek) { | ||
| 115 | - loger.log("play"); | ||
| 116 | - this.playStatus = MediaControlBarApe.PLAY; | ||
| 117 | - this.showPauseUI(); | ||
| 118 | - this.showBox(); | ||
| 119 | - this.startTimerCounter(); | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - pause() { | ||
| 123 | - loger.log("pause"); | ||
| 124 | - this.playStatus = MediaControlBarApe.PAUSE; | ||
| 125 | - this.showPlayUI(); | ||
| 126 | - this.showBox(); | ||
| 127 | - this.stopTimerCounter(); | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - stop() { | ||
| 131 | - loger.log("stop"); | ||
| 132 | - this.seekPercent = 0; | ||
| 133 | - this.seekTime = 0; | ||
| 134 | - this.totalTime = 0; | ||
| 135 | - this.playStatus = MediaControlBarApe.STOP; | ||
| 136 | - this._hideMediaSharePlayProgressVoiceBox(); | ||
| 137 | - this.updatePlayProgressBar(); | ||
| 138 | - this.showPlayUI(); | ||
| 139 | - this.hideBox(); | ||
| 140 | - this.stopTimerCounter(); | ||
| 141 | - } | ||
| 142 | - | ||
| 143 | - seek(_seek) { | ||
| 144 | - loger.log("seek"); | ||
| 145 | - this.showBox(); | ||
| 146 | - this.seekTime = _seek || 0; | ||
| 147 | - this.seekPercent = parseInt(this.seekTime / this.totalTime * 100); | ||
| 148 | - this.updateVideoProgress(); | ||
| 149 | - this._hideMediaSharePlayProgressVoiceBox(); | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | - changeVolume(_volume) { | ||
| 153 | - loger.log("changeVolume"); | ||
| 154 | - this.showBox(); | ||
| 155 | - this.mediaVolume = _volume || 0; | ||
| 156 | - this.updaterVolumeProgressBar(); | ||
| 157 | - } | ||
| 158 | - | ||
| 159 | - | ||
| 160 | - //-UI | ||
| 161 | - showPlayUI() { | ||
| 162 | - $("#mediaShareProgressPause").hide(); | ||
| 163 | - $("#mediaShareProgressPlay").show(); | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - showPauseUI() { | ||
| 167 | - $("#mediaShareProgressPause").show(); | ||
| 168 | - $("#mediaShareProgressPlay").hide(); | ||
| 169 | - } | ||
| 170 | - | ||
| 171 | - showBox() { | ||
| 172 | - $("#h5MediaShareControls").show(); | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - hideBox() { | ||
| 176 | - $("#h5MediaShareControls").hide(); | ||
| 177 | - } | ||
| 178 | - | ||
| 179 | - //------------------------------------ | ||
| 180 | - //播放按钮 | ||
| 181 | - _clickPlay() { | ||
| 182 | - loger.log("播放按钮点击===>"); | ||
| 183 | - this.updateCounter = 0; | ||
| 184 | - this.playStatus = MediaControlBarApe.PLAY; | ||
| 185 | - this._hideMediaSharePlayProgressVoiceBox(); | ||
| 186 | - this.showPauseUI(); | ||
| 187 | - this.startTimerCounter(); | ||
| 188 | - this.sendCallBack(MediaControlBarApe.PLAY); | ||
| 189 | - } | ||
| 190 | - | ||
| 191 | - //暂停播放 | ||
| 192 | - _clickPause() { | ||
| 193 | - loger.log("暂停播放按钮点击===>"); | ||
| 194 | - this.updateCounter = 0; | ||
| 195 | - this.playStatus = MediaControlBarApe.PAUSE; | ||
| 196 | - this._hideMediaSharePlayProgressVoiceBox(); | ||
| 197 | - this.showPlayUI(); | ||
| 198 | - this.stopTimerCounter(); | ||
| 199 | - this.sendCallBack(MediaControlBarApe.PAUSE); | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | -//打开音量控制条 | ||
| 203 | - _openVolumeControl() { | ||
| 204 | - if (this.isShowVolumeBar == true) { | ||
| 205 | - this._hideMediaSharePlayProgressVoiceBox(); | ||
| 206 | - } else { | ||
| 207 | - this._showMediaSharePlayProgressVoiceBox(); | ||
| 208 | - } | ||
| 209 | - } | ||
| 210 | - | ||
| 211 | - //音量进度条----------------------------------------- | ||
| 212 | - //音量控制鼠标按下 | ||
| 213 | - _changeVolume(evt) { | ||
| 214 | - this.updateCounter = 0; | ||
| 215 | - this.isProVolMouseDown = true; | ||
| 216 | - document.onmousemove = this._mouseMoveMediaVoiceHandler.bind(this); | ||
| 217 | - document.onmouseup = this._mouseUpMediaVoiceHandler.bind(this); | ||
| 218 | - return false; | ||
| 219 | - } | ||
| 220 | - | ||
| 221 | - //音量条移动 | ||
| 222 | - _mouseMoveMediaVoiceHandler(evt) { | ||
| 223 | - let per = this._moveVolMethod(evt); | ||
| 224 | - this.mediaVolume = per; | ||
| 225 | - this.updaterVolumeProgressBar(); | ||
| 226 | - } | ||
| 227 | - | ||
| 228 | - _mouseUpMediaVoiceHandler(evt) { | ||
| 229 | - if (this.isProVolMouseDown) { | ||
| 230 | - if (this.playStatus == MediaControlBarApe.PLAY) { | ||
| 231 | - this.sendCallBack(MediaControlBarApe.PLAY) | ||
| 232 | - } else if (this.playStatus == MediaControlBarApe.PAUSE) { | ||
| 233 | - this.sendCallBack(MediaControlBarApe.PAUSE) | ||
| 234 | - } else { | ||
| 235 | - this.sendCallBack(MediaControlBarApe.STOP) | ||
| 236 | - } | ||
| 237 | - } | ||
| 238 | - this.isProVolMouseDown = false; | ||
| 239 | - document.onmousemove = null; | ||
| 240 | - document.onmouseup = null | ||
| 241 | - } | ||
| 242 | - | ||
| 243 | - | ||
| 244 | - //音量移动函数 | ||
| 245 | - _moveVolMethod(evt) { | ||
| 246 | - let windowY = (evt || window.event).clientY; | ||
| 247 | - let _width = $('#mediaShareVoice_bg') | ||
| 248 | - let top = _width.offset().top; | ||
| 249 | - let _percentage = _width.innerHeight(); | ||
| 250 | - let prevX = parseInt(windowY - top); | ||
| 251 | - if (prevX < 0)prevX = 0; | ||
| 252 | - if (prevX > _percentage)prevX = _percentage; | ||
| 253 | - let per = Math.floor(100 * prevX / _percentage); | ||
| 254 | - per = 100 - per; | ||
| 255 | - return per; | ||
| 256 | - } | ||
| 257 | - | ||
| 258 | - updaterVolumeProgressBar() { | ||
| 259 | - let _color = $('#mediaShareVoice_color'); | ||
| 260 | - let _btn = $('#mediaShareVoice_btn'); | ||
| 261 | - let perChange = this.mediaVolume / 100; | ||
| 262 | - if (this.video) { | ||
| 263 | - this.video.volume = perChange;//设置音量 | ||
| 264 | - } | ||
| 265 | - //let curSeek = document.getElementById("h5MediaShare").currentTime; | ||
| 266 | - _btn.css('top', 100 - this.mediaVolume + '%'); | ||
| 267 | - _color.css('height', (this.mediaVolume) + '%'); | ||
| 268 | - } | ||
| 269 | - | ||
| 270 | - _showMediaSharePlayProgressVoiceBox() { | ||
| 271 | - this.isShowVolumeBar = true; | ||
| 272 | - $(".mediaSharePlayProgressVoiceBox").show(); | ||
| 273 | - } | ||
| 274 | - | ||
| 275 | - _hideMediaSharePlayProgressVoiceBox() { | ||
| 276 | - this.isShowVolumeBar = false; | ||
| 277 | - $(".mediaSharePlayProgressVoiceBox").hide(); | ||
| 278 | - } | ||
| 279 | - | ||
| 280 | - //播放进度条控制------------------------------------- | ||
| 281 | - _changeProgressBar(evt) { | ||
| 282 | - this._hideMediaSharePlayProgressVoiceBox(); | ||
| 283 | - this.isProgressMouseDown = true; | ||
| 284 | - document.onmousemove = this._mouseMoveMediaProgressHandler.bind(this); | ||
| 285 | - document.onmouseup = this._mouseUpMediaaHandler.bind(this); | ||
| 286 | - return false; | ||
| 287 | - } | ||
| 288 | - _clickProgressBarBg(evt) { | ||
| 289 | - this.isProgressMouseDown=true; | ||
| 290 | - let per = this._moveMethod(evt); | ||
| 291 | - this.seekPercent = per; | ||
| 292 | - this.updatePlayProgressBar(); | ||
| 293 | - this. _mouseUpMediaaHandler(evt); | ||
| 294 | - } | ||
| 295 | - | ||
| 296 | - //鼠标在进度条上移动 | ||
| 297 | - _mouseMoveMediaProgressHandler(evt) { | ||
| 298 | - let per = this._moveMethod(evt); | ||
| 299 | - this.seekPercent = per; | ||
| 300 | - this.updatePlayProgressBar(); | ||
| 301 | - //console.log("进度条移动百分比", this.seekPercent); | ||
| 302 | - } | ||
| 303 | - | ||
| 304 | - updatePlayProgressBar() { | ||
| 305 | - let _color = $('#mediaShareProgress_color'); | ||
| 306 | - let _btn = $('#mediaShareProgress_btn'); | ||
| 307 | - _btn.css('left', this.seekPercent + '%'); | ||
| 308 | - _color.css('width', this.seekPercent + '%'); | ||
| 309 | - | ||
| 310 | - let curTimeStr=this.timerCounterLayOut(this.seekTime); | ||
| 311 | - let totalTimeStr=this.timerCounterLayOut(this.totalTime); | ||
| 312 | - $("#mediaShareTimestamp").html(curTimeStr+"/"+totalTimeStr); | ||
| 313 | - } | ||
| 314 | - | ||
| 315 | - updateVideoProgress() { | ||
| 316 | - if (this.video) { | ||
| 317 | - try{ | ||
| 318 | - this.video.currentTime = this.seekTime;//设置音量 | ||
| 319 | - }catch (err){ | ||
| 320 | - loger.warn("无法设置video的currentTime"); | ||
| 321 | - } | ||
| 322 | - | ||
| 323 | - } | ||
| 324 | - } | ||
| 325 | - | ||
| 326 | - //鼠标进度条抬起 | ||
| 327 | - _mouseUpMediaaHandler(evt) { | ||
| 328 | - if (this.isProgressMouseDown) { | ||
| 329 | - this.seekTime = parseInt(this.seekPercent * this.totalTime * 0.01); | ||
| 330 | - | ||
| 331 | - if (this.playStatus == MediaControlBarApe.PLAY) { | ||
| 332 | - this.sendCallBack(MediaControlBarApe.PLAY) | ||
| 333 | - } else if (this.playStatus == MediaControlBarApe.PAUSE) { | ||
| 334 | - this.sendCallBack(MediaControlBarApe.PAUSE) | ||
| 335 | - } else { | ||
| 336 | - this.sendCallBack(MediaControlBarApe.STOP) | ||
| 337 | - } | ||
| 338 | - this.updateVideoProgress(); | ||
| 339 | - } | ||
| 340 | - this.isProgressMouseDown = false; | ||
| 341 | - document.onmousemove = null; | ||
| 342 | - document.onmouseup = null | ||
| 343 | - } | ||
| 344 | - | ||
| 345 | - //进度条移动函数 | ||
| 346 | - _moveMethod(evt) { | ||
| 347 | - let windowX = (evt || window.event).clientX; | ||
| 348 | - let _width = $('#mediaShareProgress_bg') | ||
| 349 | - let left = _width.offset().left; | ||
| 350 | - let _percentage = _width.innerWidth(); | ||
| 351 | - let prevX = parseInt(windowX - left); | ||
| 352 | - if (prevX < 0)prevX = 0; | ||
| 353 | - if (prevX > _percentage)prevX = _percentage; | ||
| 354 | - let per = Math.floor(100 * prevX / _percentage); | ||
| 355 | - return per; | ||
| 356 | - } | ||
| 357 | - | ||
| 358 | - timerCounterLayOut(timestamp) { | ||
| 359 | - let minute = 0, | ||
| 360 | - second = 0; | ||
| 361 | - minute = Math.floor(timestamp / 60); | ||
| 362 | - second = Math.floor(timestamp - minute * 60) | ||
| 363 | - let timeValue = ((minute < 10) ? "0" : "") + minute; | ||
| 364 | - timeValue += ((second < 10) ? ":0" : ":") + second; | ||
| 365 | - return timeValue; | ||
| 366 | - } | ||
| 367 | - | ||
| 368 | - //舞台大小发生改变 | ||
| 369 | - onWindowResize() { | ||
| 370 | - //loger.log("舞台大小发生改变"); | ||
| 371 | - let boxWidth = $(".h5MediaShareControls").width(); | ||
| 372 | - //进度条的宽度是盒子的总宽度减去 声音按钮和时间显示区域的宽度 | ||
| 373 | - $(".mediaSharePlayProgressBox").width((boxWidth - SOUND_BTN_WIDTH-TIME_TEXT_WIDTH) + "px") | ||
| 374 | - } | ||
| 375 | - | ||
| 376 | - //调用回调函数通知外部 | ||
| 377 | - sendCallBack(_action, _data) { | ||
| 378 | - if (!this.isOpenUpdateStatusInfo) { | ||
| 379 | - return | ||
| 380 | - } | ||
| 381 | - if (this.controlCallback) { | ||
| 382 | - this.controlCallback({ | ||
| 383 | - action: _action, | ||
| 384 | - data: { | ||
| 385 | - seek: this.seekTime, | ||
| 386 | - mediaVolume: this.mediaVolume | ||
| 387 | - } | ||
| 388 | - }) | ||
| 389 | - } | ||
| 390 | - } | ||
| 391 | -} | ||
| 392 | -MediaControlBarApe.prototype.STOP = MediaControlBarApe.STOP = "stop";//0 | ||
| 393 | -MediaControlBarApe.prototype.PLAY = MediaControlBarApe.PLAY = "play";//1 | ||
| 394 | -MediaControlBarApe.prototype.PAUSE = MediaControlBarApe.PAUSE = "pause";//2 | ||
| 395 | -MediaControlBarApe.prototype.SEEK = MediaControlBarApe.SEEK = "seek";//3 | ||
| 396 | -MediaControlBarApe.prototype.CHANGE_VOLUME = MediaControlBarApe.CHANGE_VOLUME = "change_volume";//4 | ||
| 397 | - | ||
| 398 | -export default MediaControlBarApe; | ||
| 399 | - | ||
| 400 | - |
-
请 注册 或 登录 后发表评论