|
@@ -2,7 +2,7 @@
|
|
|
activeInfo:{},popupStatus:false,wxStatus:false,behaviorId:getRandomKey(),selectMusic:{},hiddenProperty:null};},computed:{activityMusic:function activityMusic(){var activeInfo=this.activeInfo;return activeInfo.activityMusicVoList||[];},// 用户是否有中选的曲子
|
|
|
userSelectMusic:function userSelectMusic(){var status=false;this.activityMusic.forEach(function(item){if(item.join===1){status=true;}});return status;}},mounted:function mounted(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var visibilityChangeEvent;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this.getMusicInfo();case 2:if(browser().isApp){_context.next=8;break;}_this.popupStatus=true;removeAuth();return _context.abrupt("return");case 8:if(!(state.platformType==='TEACHER')){_context.next=13;break;}_this.onBackDialog('请使用酷乐秀学生端扫码打开');return _context.abrupt("return");case 13:_this.hiddenProperty='hidden'in document?'hidden':'webkitHidden'in document?'webkitHidden':'mozHidden'in document?'mozHidden':null;visibilityChangeEvent=_this.hiddenProperty.replace(/hidden/i,'visibilitychange');document.addEventListener(visibilityChangeEvent,_this.onVisibilityChange);case 16:// 判断活动状态的活动时间
|
|
|
_this.checkActivityTime();case 17:case"end":return _context.stop();}}},_callee);}))();},methods:{onVisibilityChange:function onVisibilityChange(){if(!document[this.hiddenProperty]){this.getMusicInfo();}},getMusicInfo:function getMusicInfo(){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var res;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return request.post('/api-student/open/activity/info/'+_this2.id);case 3:res=_context2.sent;_this2.activeInfo=res.data;document.title=_this2.activeInfo.activityName;_context2.next=10;break;case 8:_context2.prev=8;_context2.t0=_context2["catch"](0);case 10:case"end":return _context2.stop();}}},_callee2,null,[[0,8]]);}))();},checkActivityTime:function checkActivityTime(){// 判断活动状态的活动时间
|
|
|
-try{var activeInfo=this.activeInfo;if(activeInfo.activityState===0){Dialog.alert({message:'活动已结束,感谢你的关注!',theme:'round-button',confirmButtonColor:'#2dc7aa'});this.onBackDialog('活动已结束,感谢你的关注!');return false;}var nowTime=dayjs();var startTime=dayjs(activeInfo.activityStart);var endTime=dayjs(activeInfo.activityEnd);if(dayjs(nowTime).isBefore(dayjs(startTime))){this.onBackDialog('活动尚未开始,请您耐心等待!');return false;}else if(!dayjs(nowTime).isBefore(dayjs(endTime))){this.onBackDialog('活动已结束,感谢你的关注!');return false;}return true;}catch(_unused2){//
|
|
|
+try{var activeInfo=this.activeInfo;if(activeInfo.activityState!==1){Dialog.alert({message:'活动已结束,感谢你的关注!',theme:'round-button',confirmButtonColor:'#2dc7aa'});this.onBackDialog('活动已结束,感谢你的关注!');return false;}var nowTime=dayjs();var startTime=dayjs(activeInfo.activityStart);var endTime=dayjs(activeInfo.activityEnd);if(dayjs(nowTime).isBefore(dayjs(startTime))){this.onBackDialog('活动尚未开始,请您耐心等待!');return false;}else if(!dayjs(nowTime).isBefore(dayjs(endTime))){this.onBackDialog('活动已结束,感谢你的关注!');return false;}return true;}catch(_unused2){//
|
|
|
}},onBackDialog:function onBackDialog(str){Dialog.alert({message:str,theme:'round-button',confirmButtonColor:'#2dc7aa'}).then(function(){postMessage({api:'back'});});},onJoinActve:function onJoinActve(){var _this3=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var activeInfo,_res$data,res;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:activeInfo=_this3.activeInfo;_context3.prev=1;if(_this3.checkActivityTime()){_context3.next=4;break;}return _context3.abrupt("return");case 4:if(!(activeInfo.registrationMethod==='CHARGE')){_context3.next=18;break;}_context3.next=7;return request.post('/api-student/userOrder/getPendingOrder',{data:{goodType:'ACTI_REGIST',bizId:activeInfo.id}});case 7:res=_context3.sent;// 判断是否是收费活动
|
|
|
orderStatus.orderObject.orderType='ACTI_REGIST';orderStatus.orderObject.orderName=activeInfo.activityName;orderStatus.orderObject.orderDesc=activeInfo.activityName;orderStatus.orderObject.actualPrice=activeInfo.registrationPrice;orderStatus.orderObject.orderNo=((_res$data=res.data)===null||_res$data===void 0?void 0:_res$data.orderNo)||'';orderStatus.orderObject.recomUserId=_this3.recomUserId;orderStatus.orderObject.orderList=[{orderType:'ACTI_REGIST',goodsName:activeInfo.activityName,activityId:activeInfo.id,actualPrice:activeInfo.registrationPrice,recomUserId:_this3.recomUserId}];_this3.$router.push({path:'/orderDetail',query:{orderType:'ACTI_REGIST',activityId:activeInfo.id}});_context3.next=22;break;case 18:_context3.next=20;return request.post("/api-student/activity/joinActivity/".concat(activeInfo.id));case 20:// 成功通知
|
|
|
Notify({type:'success',message:'报名成功'});_this3.getMusicInfo();case 22:_context3.next=26;break;case 24:_context3.prev=24;_context3.t0=_context3["catch"](1);case 26:case"end":return _context3.stop();}}},_callee3,null,[[1,24]]);}))();},onOpenMusic:function onOpenMusic(){var _this4=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(){var selectMusic,browserInfo,url;return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.prev=0;selectMusic=_this4.selectMusic;if(!(selectMusic.join!==1)){_context4.next=6;break;}_context4.next=5;return request.post("/api-student/activity/evaluation/".concat(selectMusic.evaluationId));case 5:_this4.selectMusic.join=1;case 6:_this4.popupStatus=false;browserInfo=browser();url=qs.stringifyUrl({url:location.origin+'/accompany',query:{id:selectMusic.musicSheetId,behaviorId:_this4.behaviorId,client:browserInfo.isTeacher?'teacher':'student',setting:JSON.stringify({mode:'EVALUATING',resets:['SPEED'],difficulty:_this4.activeInfo.evaluationDifficulty,feeType:'FREE',submitData:{evaluationId:_this4.selectMusic.evaluationId}})}});postMessage({api:'openAccompanyWebView',content:{url:url,orientation:0,isHideTitle:true,statusBarTextColor:false,isOpenLight:true}});_context4.next=14;break;case 12:_context4.prev=12;_context4.t0=_context4["catch"](0);case 14:case"end":return _context4.stop();}}},_callee4,null,[[0,12]]);}))();},onOpenApp:function onOpenApp(){//
|