| 12 |
- require('./common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_course/videoDetail"],{905:function(e,t,n){"use strict";(function(e,t){var i=n(4);n(26);i(n(25));var s=i(n(906));e.__webpack_require_UNI_MP_PLUGIN__=n,t(s.default)}).call(this,n(1)["default"],n(2)["createPage"])},906:function(e,t,n){"use strict";n.r(t);var i=n(907),s=n(909);for(var o in s)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return s[e]}))}(o);n(914),n(916);var r,a=n(34),u=Object(a["default"])(s["default"],i["render"],i["staticRenderFns"],!1,null,"9607b5be",null,!1,i["components"],r);u.options.__file="pages_course/videoDetail.vue",t["default"]=u.exports},907:function(e,t,n){"use strict";n.r(t);var i=n(908);n.d(t,"render",(function(){return i["render"]})),n.d(t,"staticRenderFns",(function(){return i["staticRenderFns"]})),n.d(t,"recyclableRender",(function(){return i["recyclableRender"]})),n.d(t,"components",(function(){return i["components"]}))},908:function(e,t,n){"use strict";var i;n.r(t),n.d(t,"render",(function(){return s})),n.d(t,"staticRenderFns",(function(){return r})),n.d(t,"recyclableRender",(function(){return o})),n.d(t,"components",(function(){return i}));try{i={uNoticeBar:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-notice-bar/u-notice-bar")]).then(n.bind(null,1081))},uniPopup:function(){return n.e("uni_modules/uni-popup/components/uni-popup/uni-popup").then(n.bind(null,1089))},uInput:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-input/u-input")]).then(n.bind(null,1096))}}}catch(a){if(-1===a.message.indexOf("Cannot find module")||-1===a.message.indexOf(".vue"))throw a;console.error(a.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var s=function(){var e=this,t=e.$createElement,n=(e._self._c,e.isLogin&&1==e.isAddKf?e.numberToChinese(e.lineIndex+1):null),i=e.__map(e.lineList,(function(t,n){var i=e.__get_orig(t),s=e.numberToChinese(n+1);return{$orig:i,m1:s}})),s=e.inputText?e.inputText.trim().length:null,o=e.errQues&&e.errQues.length>0,r="恭喜你,回答正确"!=e.errTitle?e.errQues&&e.errQues.length>0:null,a=e.isLogin&&1==e.isAddKf&&1==e.currentTab&&e.quesList&&e.quesList.length>0&&0==e.showBtn;e.$mp.data=Object.assign({},{$root:{m0:n,l0:i,g0:s,g1:o,g2:r,g3:a}})},o=!1,r=[];s._withStripped=!0},909:function(e,t,n){"use strict";n.r(t);var i=n(910),s=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=s.a},910:function(e,t,n){"use strict";(function(e){var i=n(4);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=i(n(59)),o=i(n(61)),r=i(n(911)),a=i(n(11)),u=n(36),c=i(n(165)),l=n(913),h=["questionOption"];function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){(0,a.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var p=function(){n.e("pages_course/components/turntableOne").then(function(){return resolve(n(1104))}.bind(null,n)).catch(n.oe)},g=function(){n.e("pages_course/components/turntableTwo").then(function(){return resolve(n(1111))}.bind(null,n)).catch(n.oe)},m=function(){n.e("pages_course/components/appPopup").then(function(){return resolve(n(1118))}.bind(null,n)).catch(n.oe)},v=function(){n.e("pages_course/components/ques").then(function(){return resolve(n(1125))}.bind(null,n)).catch(n.oe)},T=function(){n.e("pages_course/components/descInfo").then(function(){return resolve(n(1132))}.bind(null,n)).catch(n.oe)},y=function(){n.e("pages_course/components/descInfoNav").then(function(){return resolve(n(1139))}.bind(null,n)).catch(n.oe)},w=function(){n.e("pages_course/components/commentBox").then(function(){return resolve(n(1146))}.bind(null,n)).catch(n.oe)},I=function(){n.e("pages_course/components/treasureChest").then(function(){return resolve(n(1153))}.bind(null,n)).catch(n.oe)},b={components:{descInfoNav:y,descInfo:T,commentBox:w,ques:v,treasureChest:I,appPopup:m,turntableOne:p,turntableTwo:g},data:function(){var t;return t={socket:null,isSocketOpen:!1,pingpangTimes:null,baseUrl:e.getStorageSync("requestImagesPath"),rewardType:[],currentReward:-1,player:null,loading:!0,progress:0,code:null,statusBarHeight:e.getSystemInfoSync().statusBarHeight,scrollTop:0,height:"0px",isLogin:!1,videoUrl:"",videoId:"",playTime:0,duration:0,playDuration:0,playDurationSeek:0,tipsTime:0,tipsOpen:!1,config:{},courseInfo:{},quesList:[],lineList:[],errQues:[],remain:0,errTitle:"",errDesc:"",showPlay:!0,showControls:!1,playStatus:"",isfull:!1,isAddKf:0,lineIndex:0,textHeight:0,qwUserId:"",qrcode:"",corpId:"",qrcodeMsg:"",urlOption:{},bufferRate:0,uuId:"",isEnded:!1,linkType:0,ip:null,checked:!0,isFinish:0,interval:null,intervalIntegral:null,options:{sources:[{src:""}],poster:"",live:!1,controls:!0,autoplay:!1,licenseUrl:"https://license.vod2.myqcloud.com/license/v2/1323137866_1/v_cube.license",LicenseKey:"bcc5bd9a14b798b48c52ff005a21d926",controlBar:{volumePanel:!1,playbackRateMenuButton:!1,QualitySwitcherMenuButton:!1},plugins:{ContextMenu:{statistic:!1}}},poster:"",errorCount:0,answerPopup:!1,sortLink:"",isExpire:!1,menuButtonLeft:281,menuButtonH:45,timer:null,flag:!1,focus:!1,openDanmuType:0,danmuboxHeight:0,user:{},crtShow:!0,isCheckRealUrl:!1,courseLogo:""},(0,a.default)(t,"isfull",!1),(0,a.default)(t,"navList",[{id:0,name:"介绍"},{id:1,name:"答题"},{id:2,name:"评论"}]),(0,a.default)(t,"currentTab",1),(0,a.default)(t,"triggered",!1),(0,a.default)(t,"isMore",!1),(0,a.default)(t,"inputText",""),(0,a.default)(t,"viewCommentNum",200),(0,a.default)(t,"openCommentStatus",3),(0,a.default)(t,"showAnswerTip",!1),(0,a.default)(t,"showDanmu",1),(0,a.default)(t,"activeDanmus",[]),(0,a.default)(t,"flagTime",0),(0,a.default)(t,"notice",""),(0,a.default)(t,"fsUserCourseRewardRoundStatusVO",[]),(0,a.default)(t,"onHide",!1),(0,a.default)(t,"courseNote",""),(0,a.default)(t,"showBtn",0),(0,a.default)(t,"showNote",0),(0,a.default)(t,"showTreatment",1),(0,a.default)(t,"treatmentPackage",[]),t},computed:f(f({},(0,u.mapGetters)(["coureLogin"])),{},{currentRewardText:function(){var e=this,t=this.rewardType.findIndex((function(t){return t.value==e.currentReward}));return t>-1&&this.rewardType[t].text||""}}),watch:{coureLogin:{immediate:!0,handler:function(e){2==e&&(console.log("AppToken失效,请重新登录"),this.isLogin=!1,this.isAddKf=0,this.goLogin())}}},onLoad:function(t){this.code=t.code,this.urlOption=t.course?JSON.parse(decodeURIComponent(t.course)):{},this.videoId=this.urlOption.videoId||"",this.qwUserId=this.urlOption.qwUserId||"",this.corpId=this.urlOption.corpId||"",this.linkType=this.urlOption.linkType||0;this.videoId&&(this.getH5CourseByVideo(),this.getConfigByKey()),this.sortLink=this.urlOption.link||"",this.getMenuButton(),e.onKeyboardHeightChange(this.keyboardHeightChange)},onShow:function(){this.onHide=!1,this.tipsOpen=!1,this.uuId=this.utils.generateRandomString(16),e.getStorageSync("auto_userInfo")&&"{}"!=JSON.stringify(e.getStorageSync("auto_userInfo"))?this.user=JSON.parse(e.getStorageSync("auto_userInfo")):this.user={},this.sortLink?this.getLink():(e.showToast({title:"sortLink is not found",icon:"none"}),this.isLogin&&this.getUserPhoneDeviceType())},mounted:function(){this.getIP(),this.getHeight()},onHide:function(){this.onHide=!0,this.player&&this.player.pause(),this.closeSocket()},onUnload:function(){null!=this.interval&&(clearInterval(this.interval),this.interval=null),this.clearIntegral(),e.offKeyboardHeightChange(this.keyboardHeightChange),this.closeSocket()},beforeDestroy:function(){this.player=e.createVideoContext("video-content-box"),this.player&&(this.player.stop(),this.player=null),null!=this.interval&&(clearInterval(this.interval),this.interval=null),this.clearIntegral(),e.offKeyboardHeightChange(this.keyboardHeightChange),this.closeSocket()},methods:{getVideoRewardTypes:function(){var e=this;(0,l.getVideoRewardTypes)(f({},this.urlOption)).then((function(t){200==t.code&&(e.rewardType=t.data,e.currentReward=e.rewardType&&e.rewardType.length>0?e.rewardType[0].value:-1)}))},getConfigByKey:function(){var e=this,t={key:"course.config"};(0,l.getConfigByKey)(t).then((function(t){if(200==t.code){var n=t.data?JSON.parse(t.data):{};e.notice=n.notify||""}}),(function(e){}))},numberToChinese:function(e){if(e){var t=["一","二","三","四","五","六","七","八","九"];return t[e-1]}return""},keyboardHeightChange:function(e){console.log("this.danmuboxHeight",this.danmuboxHeight),this.danmuboxHeight=e.height},getMenuButton:function(){var t=e.getMenuButtonBoundingClientRect();this.menuButtonLeft=t.left,this.menuButtonH=t.height},onTimeUpdate:function(t){var n=this,i=Math.round(t.detail.currentTime);if(this.playDurationSeek>0?(this.playTime=this.playDurationSeek,this.throttle((function(){return n.changeTime(n)}),1e3,!1)):(1!=this.linkType&&(i-this.playTime>3||i-this.playTime<-3)&&1!=this.isFinish&&(e.showToast({title:"不能快进哦",icon:"none"}),i=this.playTime,this.player.seek(this.playTime)),this.playTime=i),Math.floor(t.detail.currentTime)!=this.flagTime){var s;this.flagTime=Math.floor(t.detail.currentTime);var o=this.playTime>=this.duration-60;this.showAnswerTip=this.isEnded||o;var r=this.duration?(this.playTime||0)/this.duration:0,a=Number(null!==(s=this.config.answerRate)&&void 0!==s?s:1),u=r>=a;this.showNote=this.isEnded||1===this.isFinish||u?1:0,this.fsUserCourseRewardRoundStatusVO&&this.fsUserCourseRewardRoundStatusVO.length>0&&this.$refs.treasureChest&&this.$refs.treasureChest.showTreasure(this.flagTime),2==this.openCommentStatus&&this.$refs.danmuBox&&this.$refs.danmuBox.checkDanmu(this.flagTime)}},changeTime:function(e,t){e.playDurationSeek=0},videoErrorCallback:function(e){this.errorCount++,this.errorCount>3||(null!=this.interval&&clearInterval(this.interval),this.clearIntegral(),console.log(e),this.getErrMsg(e.target.errMsg),this.getH5CourseVideoDetails("error"))},getPlay:function(){this.errorCount=0},getPause:function(){this.clearIntegral()},getEnded:function(){this.clearIntegral(),this.isEnded=!0,this.showAnswerTip=!0,this.isFinish=1,this.showNote=1,this.getFinishCourseVideo()},getWaiting:function(){this.getErrMsg("","waiting")},fullscreenchange:function(e){this.isfull=e.detail.fullScreen,this.isfull&&this.$refs.danmuBox&&this.$refs.danmuBox.initTracks()},controlstoggle:function(e){this.crtShow=e.detail.show},getIP:function(){var t=this;e.request({url:"https://ipinfo.io/json",method:"GET",success:function(e){t.ip=e.data.ip}})},getHeight:function(){var t=this;setTimeout((function(){var n=e.createSelectorQuery().in(t);n.select("#title-contentnav").boundingClientRect((function(e){if(e){var n=0==t.showBtn?80:0;t.height="calc(100vh - ".concat(e.height,"px - 420rpx - ").concat(t.statusBarHeight,"px - ").concat(n,"px - 88rpx)")}})).exec()}),200)},numberToLetter:function(e){var t=e+65,n=String.fromCharCode(t);return n},updateTime:function(){var e=this;null!=this.interval&&clearInterval(this.interval),this.interval=setInterval((function(){e.getFinishCourseVideo(),e.getInternetTraffic()}),6e4)},judgeDuration:function(){var e=this;null!=this.intervalIntegral&&(clearInterval(this.intervalIntegral),this.intervalIntegral=null),this.intervalIntegral=setInterval((function(){e.getIntegralByH5Video()}),6e5)},clearIntegral:function(){null!=this.intervalIntegral&&(clearInterval(this.intervalIntegral),this.intervalIntegral=null)},getH5CourseByVideo:function(){var t=this;this.loading=!0,(0,l.getH5CourseByVideoId)({videoId:this.videoId}).then((function(n){t.loading=!1,200==n.code&&(t.courseInfo=n.data,e.setNavigationBarTitle({title:t.courseInfo&&t.courseInfo.title?t.courseInfo.title:""})),t.getHeight(),t.$nextTick((function(){t.$refs.descInfo&&t.$refs.descInfo.getDescHeight(),t.$refs.descInfoNav&&t.$refs.descInfoNav.getDescHeight()}))}),(function(e){t.loading=!1})).catch((function(){t.loading=!1}))},getH5CourseVideoDetails:function(t){var n=this;(0,l.getH5CourseVideoDetails)(this.urlOption).then((function(i){if(200==i.code){n.config=i.config||{},n.courseNote=i.course&&i.course.note,n.isFinish=i.isFinish||0,n.showNote=1==n.isFinish?1:0,n.duration=i.course&&i.course.duration?i.course.duration:0,n.playDuration=i.playDuration||0,n.tipsTime=i.tipsTime||0;var s=i.course&&null!=i.course.showTreatment?i.course.showTreatment:1;n.treatmentPackage=i.course&&i.course.treatmentPackage?i.course.treatmentPackage:[],n.showTreatment=0==s&&n.treatmentPackage.length>0?0:1;var o=[];i.course&&i.course.lineOne&&o.push(i.course.lineOne),i.course&&i.course.lineTwo&&o.push(i.course.lineTwo),i.course&&i.course.lineThree&&o.push(i.course.lineThree),n.lineList=o,n.courseLogo=i.config&&i.config.courseLogo,n.viewCommentNum=i.config&&i.config.viewCommentNum||200,n.openCommentStatus=i.config&&i.config.openCommentStatus||3,3==n.openCommentStatus?n.closeSocket():n.initSocket(),n.currentTab=1,2==n.openCommentStatus&&1==n.showDanmu||(n.activeDanmus=[]),n.fsUserCourseRewardRoundStatusVO=n.getBox(i),n.player&&"error"!=t?(n.playTime=n.playTime>n.playDuration?n.playTime:n.playDuration>=n.duration?0:n.playDuration,n.playDurationSeek=n.playTime,n.player.seek(n.playTime),n.player.play()):(n.lineIndex=n.config.defaultLine,n.videoUrl=o[n.lineIndex],n.poster=i.course&&i.course.imgUrl?i.course.imgUrl:"",n.playTime=n.playDuration>=n.duration?0:n.playDuration,n.playDurationSeek=n.playTime,setTimeout((function(){n.player=e.createVideoContext("video-content-box"),n.player.seek(n.playTime),n.player.play()}),500)),n.updateTime(),n.quesList=i.questions&&i.questions.length>0?i.questions:[],n.quesList=n.quesList.map((function(e){return f(f({},e),{},{questionOption:JSON.parse(e.question),answer:""})}))}n.getHeight(),n.$nextTick((function(){n.$refs.descInfo&&n.$refs.descInfo.getDescHeight(),n.$refs.descInfoNav&&n.$refs.descInfoNav.getDescHeight()}))}),(function(e){}))},handleAnswer:function(t){t.item;var n=t.option,i=t.index,s=this.playTime;if(this.isEnded||1==this.isFinish?s=this.duration:s<this.playDuration&&1!=this.isFinish&&(s=this.playDuration),0==Number(this.duration||0)||s<this.duration-60)e.showToast({title:"请先观看完整课程再答题哦~",icon:"none"});else if(1==this.quesList[i].type)this.quesList[i].answer=n.name;else if(2==this.quesList[i].type){var o=this.quesList[i].answer?this.quesList[i].answer.split(","):[];-1===o.indexOf(n.name)?(o.push(n.name),this.quesList[i].answer=o.join(",")):(o.splice(o.indexOf(n.name),1),this.quesList[i].answer=o.join(","))}},submit:function(){var t=this;this.isExpire?e.showToast({title:"课程已过期或链接无效",icon:"none"}):this.utils.isLoginCourse().then((function(n){n?1==t.isAddKf&&t.isCheckRealUrl?t.courseAnswer():t.videoId&&t.qwUserId?t.getIsAddKf():e.showToast({title:"请添加客服",icon:"none"}):t.goLogin()}),(function(e){}))},courseAnswer:function(){var t=this,n=this.playTime;if(this.isEnded||1==this.isFinish?n=this.duration:n<this.playDuration&&1!=this.isFinish&&(n=this.playDuration),0==Number(this.duration||0)||n<this.duration-60)e.showToast({title:"请先观看完整课程再答题哦~",icon:"none"});else if(this.quesList.some((function(e){return!e.answer})))e.showToast({title:"请确认是否答完所有题目",icon:"none"});else{var i=this.quesList.map((function(e){e.questionOption;var t=(0,r.default)(e,h);return t}));if(this.isCheckRealUrl){var s=f(f({},this.urlOption),{},{questions:i,videoId:this.videoId,duration:this.playTime});this.errTitle="",this.errDesc="",this.errQues=[],(0,l.courseAnswer)(s).then((function(n){200==n.code?n.incorrectQuestions?(n.incorrectQuestions.length>0&&(t.errQues=n.incorrectQuestions),t.remain=n.remain||0,n.remain>0&&(t.errTitle="很遗憾答错了",t.errDesc='<span style="color:#FF5C03">还有'.concat(n.remain,"次机会,继续加油</span>"),t.$refs.answerPopup.open("center"))):(t.errTitle="恭喜你,回答正确",t.errDesc="请选择奖励",t.currentReward=t.rewardType&&t.rewardType.length>0?t.rewardType[0].value:-1,t.$refs.answerPopup.open("center")):"该课题到达答错次数限制"==n.msg?(t.errTitle="答题次数超过限制",t.errDesc="以后的课程要认真学习哦",t.$refs.answerPopup.open("center")):e.showToast({title:n.msg,icon:"none"})}),(function(e){}))}}},rewardChange:function(e){this.currentReward=e.value},closeAnswerPopup:function(){this.$refs.answerPopup.close(),this.isCheckRealUrl&&"恭喜你,回答正确"==this.errTitle&&(4==this.currentReward?this.$refs.turntableTwo.open(this.urlOption):3==this.currentReward?this.$refs.turntableOne.open(this.urlOption):this.sendRewardFun(this.currentReward))},sendRewardFun:function(t){var n=this;this.currentReward=t;var i=f(f({},this.urlOption),{},{rewardType:Number(this.currentReward),source:2,appId:getApp().globalData.appId});(0,l.sendReward)(i).then((function(i){200==i.code?4==t?n.$refs.turntableTwo.endSuccess(i.data):3==t?n.$refs.turntableOne.endSuccess(i.data):e.showToast({title:i.msg,icon:"none"}):(4==n.currentReward?n.$refs.turntableTwo.close("close"):3==n.currentReward&&n.$refs.turntableOne.close("close"),e.showToast({title:i.msg,icon:"none"}))}))},openAppPop:function(){this.$refs.appPopup.openPop()},openPop:function(){this.$refs.popup.open("bottom")},close:function(){this.$refs.popup.close()},handleLine:function(t){var n=this;this.lineIndex!=t||this.videoUrl!=this.lineList[t]?(this.lineIndex=t,this.videoUrl=this.lineList[t],this.tipsOpen=!1,this.playDurationSeek=this.playTime||0,this.player=e.createVideoContext("video-content-box"),setTimeout((function(){n.player.seek(n.playDurationSeek),n.player.play()}),500),this.close()):this.close()},getIsAddKf:function(){var t=this;this.qrcode="",this.qrcodeMsg="",this.isAddKf=0,(0,l.getIsAddKf)(this.urlOption).then((function(n){if(200==n.code)t.isAddKf=1,t.isCheckRealUrl=!0,t.getH5CourseVideoDetails();else if(400==n.code)t.isAddKf=0,t.isCheckRealUrl=!1,t.qrcode=n.qrcode,t.qrcodeMsg=n.msg,t.$refs.kfPopup.open();else if(504==n.code)t.isCheckRealUrl=!1,t.goLogin();else if(566==n.code){var i=n.courseLink.realLink.split("?course=")[1];t.urlOption=JSON.parse(i),t.isAddKf=1,t.isCheckRealUrl=!0,t.getH5CourseVideoDetails()}else 567==n.code?(t.urlOption=f(f({},t.urlOption),{},{qwExternalId:n.qwExternalId}),t.isAddKf=1,t.isCheckRealUrl=!0,t.getH5CourseVideoDetails()):(t.isCheckRealUrl=!1,t.isAddKf=0,e.showToast({title:n.msg,icon:"none"}))}),(function(e){}))},closeKFPop:function(){this.$refs.kfPopup.close()},getFinishCourseVideo:function(){if(this.isLogin&&this.playTime&&this.isCheckRealUrl){var e=f({duration:this.playTime},this.urlOption);(0,l.getFinishCourseVideo)(e)}},getIntegralByH5Video:function(){if(this.isLogin&&this.isCheckRealUrl){var t=f({duration:this.playTime},this.urlOption);(0,l.getIntegralByH5Video)(t).then((function(t){200==t.code&&e.showToast({title:"芳华币+10",icon:"none"})}))}},progressChange:function(e){this.bufferRate=Math.ceil(e.detail.buffered)},getInternetTraffic:function(){if(this.isLogin&&this.isCheckRealUrl){var e=Math.ceil(this.playTime/this.duration*100);if((0==this.bufferRate||this.bufferRate<e)&&(this.bufferRate=e),0!=this.bufferRate&&0!=Number(this.bufferRate.toFixed(2))){var t=f(f({},this.urlOption),{},{uuId:(0,c.default)().format("YYYYMMDD")+this.uuId,duration:this.playTime,bufferRate:Number(this.bufferRate.toFixed(2))});t.bufferRate&&(0,l.internetTraffic)(t)}}},getErrMsg:function(e,t){var n={errType:t||"error",videoUrl:this.videoUrl,lineIndex:this.lineIndex,errTime:new Date,ip:this.ip,errMsg:e||""};(0,l.getErrMsg)({msg:JSON.stringify(n)})},goLogin:function(){var t=this;this.utils.getProvider().then((function(n){console.log("当前的环境商",n),n||reject(),e.login({provider:n,success:function(){var i=(0,o.default)(s.default.mark((function i(o){return s.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:console.log(o),e.getUserInfo({provider:n,success:function(n){e.showToast({title:"处理中...",icon:"loading"}),(0,l.loginByMp)({code:o.code,encryptedData:n.encryptedData,iv:n.iv,appId:getApp().globalData.appId}).then((function(n){e.hideLoading(),200==n.code?(t.$store.commit("setCoureLogin",1),e.setStorageSync("AppTokenmini_RTCourse",n.token),e.setStorageSync("auto_userInfo",JSON.stringify(n.user)),t.user=n.user,t.isLogin=!0,t.getIsAddKf(),t.getVideoRewardTypes(),t.getUserPhoneDeviceType()):e.showToast({title:n.msg,icon:"none"})})).catch((function(t){e.hideLoading(),e.showToast({icon:"none",title:"登录失败,请重新登录"})}))}});case 2:case"end":return i.stop()}}),i)})));function r(e){return i.apply(this,arguments)}return r}()})})).catch((function(e){}))},getLink:function(){var t=this;(0,l.getRealLink)({sortLink:this.sortLink}).then((function(n){200==n.code?(t.isExpire=!1,t.isLogin&&t.getUserPhoneDeviceType(),t.isLogin&&1==t.isAddKf&&t.isCheckRealUrl&&t.getH5CourseVideoDetails(),!t.videoId||1==t.isAddKf&&t.isCheckRealUrl||t.utils.isLoginCourse().then((function(e){t.isLogin=e,e?(t.getIsAddKf(),t.getVideoRewardTypes()):t.goLogin()}),(function(e){}))):(t.isExpire=!0,e.showToast({title:"课程已过期或链接无效",icon:"none"}))})).catch((function(n){t.isExpire=!0,e.showToast({title:"发生错误,请稍后再试",icon:"none"})}))},throttle:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];i?this.flag||(this.flag=!0,"function"===typeof e&&e(),this.timer=setTimeout((function(){t.flag=!1}),n)):this.flag||(this.flag=!0,this.timer=setTimeout((function(){t.flag=!1,"function"===typeof e&&e()}),n))},openDanmu:function(e){this.openDanmuType=e,this.inputText="",1==e&&this.player.exitFullScreen(),this.$refs.danmuPopup.open()},changeShowPopup:function(e){this.focus=e.show},switchDanmu:function(){this.showDanmu=1==this.showDanmu?0:1,0==this.showDanmu&&this.$refs.danmuBox&&(this.$refs.danmuPopup.close(),this.activeDanmus=[],this.$refs.danmuBox.activeDanmus=[],this.$refs.danmuBox.initTracks())},getScrollTop:function(e){2==this.currentTab?this.scrollTop=e:this.scrollTop=0},handleTab:function(e){var t=this;this.currentTab=e,2==this.currentTab?this.$refs.commentBox&&(this.$refs.commentBox.msgs=[],this.$refs.commentBox.pageNum=1,this.$refs.commentBox.getComments()):setTimeout((function(){t.scrollTop=0}),100)},handleRefresher:function(){var e=this;this.triggered=!0,this.isMore||2!=this.currentTab||1!=this.openCommentStatus||this.$nextTick((function(){e.$refs.commentBox&&e.$refs.commentBox.getComments()})),setTimeout((function(){e.triggered=!1}),500)},getMore:function(e){this.triggered=!1,this.isMore=1==e},handleChatInput:function(){this.inputText=this.inputText.trim(),""!=this.inputText&&""!=this.inputText.trim()?1==this.openCommentStatus?this.$refs.commentBox&&this.$refs.commentBox.handleInput(this.inputText):2==this.openCommentStatus&&this.$refs.danmuBox&&this.$refs.danmuBox.handleInput(this.inputText):e.showToast({title:"请输入评论",icon:"none"})},setInputText:function(){this.inputText="",2==this.openCommentStatus&&this.$refs.danmuPopup.close()},getActiveDanmus:function(e){this.activeDanmus=e.map((function(e){return f(f({},e),{},{danmustyle:f(f({top:e.top+"px"},e.style),{},{"animation-duration":"8s"})})}))},animationend:function(e,t){2==this.openCommentStatus&&this.$refs.danmuBox&&this.$refs.danmuBox.animationend(e,t)},feedback:function(){var t=this.user.userId||"",n=this.urlOption.courseId||"",i=this.urlOption.videoId||"";e.navigateTo({url:"./feedback?userId="+t+"&courseId="+n+"&videoId="+i})},getBox:function(e){var t=this;if(e.fsUserCourseRewardRoundStatusVO&&e.fsUserCourseRewardRoundStatusVO.length>0){var n=e.fsUserCourseRewardRoundStatusVO.map((function(e){return f(f({},e),{},{time:Math.round(t.duration*Number(e.question||0)*.01)})}));return n}return[]},claimFun:function(t){var n=this;(0,l.claim)(f(f({},this.urlOption),{},{second:t.time,rewardId:t.rewardId,status:t.status})).then((function(i){200==i.code?n.$refs.treasureChest.claimSuccess(t.status):n.$refs.treasureChest.close(),"success"!=i.msg&&e.showToast({title:i.msg,icon:"none",duration:3e3})}))},showBtnType:function(e){this.showBtn=e,this.getHeight()},getUserPhoneDeviceType:function(){e.getSystemInfo({success:function(e){var t={os:e.osName||"",deviceId:e.deviceId||"",appId:getApp().globalData.appId};(0,l.getUserPhoneDeviceType)({param:JSON.stringify(t)})},fail:function(e){console.log("获取型号失败",JSON.stringify(e))}})},initSocket:function(e){var t=this.user.userId,n=this;if(this.socket)return this.socket.onClose((function(){console.log("旧的 WebSocket 连接已完全关闭"),n.socket=null,n.pingpangTimes&&(clearInterval(n.pingpangTimes),n.pingpangTimes=null),n.createNewSocket(e,t)})),void this.socket.close();this.createNewSocket(e,t)},createNewSocket:function(t,n){if(3!=this.openCommentStatus){var i=this;this.socket=e.connectSocket({url:getApp().globalData.wsUrl+"/app/webSocket/"+n,multiple:!0,success:function(e){i.isSocketOpen=!0,console.log("WebSocket连接已打开1!"),i.pingpangTimes&&(clearInterval(i.pingpangTimes),i.pingpangTimes=null),i.pingpangTimes=setInterval((function(){var e={userId:n||"",userType:2,courseId:i.urlOption.courseId,videoId:i.urlOption.videoId,type:1,cmd:"heartbeat"};i.socket.send({data:JSON.stringify(e),success:function(){},fail:function(){i.isSocketOpen=!1}})}),15e3)},error:function(e){console.log(e)}}),this.socket.onMessage((function(e){var t=JSON.parse(e.data);"heartbeat"==t.cmd||"sendMsg"==t.cmd&&(1==i.openCommentStatus?(i.$refs.commentBox.isSend=!0,i.$refs.commentBox.addMsg(t)):2==i.openCommentStatus&&(i.$refs.danmuBox.isSend=!0,i.$refs.danmuBox.addMsg(t)))})),this.socket.onOpen((function(){i.isSocketOpen=!0,console.log("WebSocket连接已打开2!"),1==i.openCommentStatus?i.$refs.commentBox.isSend=!0:2==i.openCommentStatus&&(i.$refs.danmuBox.isSend=!0),"reStart"==t&&(1==i.openCommentStatus?i.$refs.commentBox.saveMsg():2==i.openCommentStatus&&i.$refs.danmuBox.saveMsg())})),this.socket.onClose((function(){i.isSocketOpen=!1,i.socket=null,console.log("WebSocket连接已关闭!"),i.pingpangTimes&&(clearInterval(i.pingpangTimes),i.pingpangTimes=null)})),this.socket.onError((function(e){console.log("socket err:",e),i.isSocketOpen=!1,i.socket=null,i.pingpangTimes&&(clearInterval(i.pingpangTimes),i.pingpangTimes=null)}))}},socketSend:function(e){var t=this;this.socket.send({data:JSON.stringify(e),success:function(){console.log("发送成功"),1==t.openCommentStatus?t.$refs.commentBox.isSend=!1:2==t.openCommentStatus&&(t.$refs.danmuBox.isSend=!1)},fail:function(){console.log("发送失败")}})},closeSocket:function(){this.socket&&this.socket.close(),this.pingpangTimes&&(clearInterval(this.pingpangTimes),this.pingpangTimes=null)}}};t.default=b}).call(this,n(2)["default"])},914:function(e,t,n){"use strict";n.r(t);var i=n(915),s=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=s.a},915:function(e,t,n){},916:function(e,t,n){"use strict";n.r(t);var i=n(917),s=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=s.a},917:function(e,t,n){}},[[905,"common/runtime","common/vendor","pages_course/common/vendor"]]]);
- //# sourceMappingURL=../../.sourcemap/mp-weixin/pages_course/videoDetail.js.map
|