;(function(){function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i0){state$1.activeRow=res.data.background[0];state$1.subjectId=res.data.background[0].id;}state$1.teacherDetail=res.data.teacher;if(res.data.musicImg){// 有图片 state$1.showImg=res.data.musicImg;}else{window.addEventListener('message',/*#__PURE__*/function(){var _ref4=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(e){var tempCanvas,showImg;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:console.log(e);state$1.imgData=e.data;// alert(e.data); _context3.next=4;return imgToCanvas(state$1.imgData);case 4:tempCanvas=_context3.sent;showImg=convasToImg(tempCanvas);// 开始上传图片 uploadFunction(showImg);case 7:case"end":return _context3.stop();}}},_callee3);}));return function(_x4){return _ref4.apply(this,arguments);};}(),false);}setAccompanyUrl();setUser();_context4.next=19;break;case 16:_context4.prev=16;_context4.t0=_context4["catch"](0);console.log(_context4.t0);case 19:case"end":return _context4.stop();}}},_callee4,null,[[0,16]]);}));return function getMusicList(){return _ref3.apply(this,arguments);};}();var followVideo=/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee5(){var res;return regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_context5.prev=0;_context5.next=3;return request.get('/api-website/student/starOrUnStar',{params:{userId:state$1.teacherDetail.userId,starStatus:state$1.teacherDetail.star?0:1}});case 3:res=_context5.sent;getMusicList();// state.otherVideoList = res.data _context5.next=10;break;case 7:_context5.prev=7;_context5.t0=_context5["catch"](0);console.log(_context5.t0);case 10:case"end":return _context5.stop();}}},_callee5,null,[[0,7]]);}));return function followVideo(){return _ref5.apply(this,arguments);};}();var getDetail=function getDetail(val){state$1.id=val;router.push({query:_objectSpread(_objectSpread({},route.query),{},{id:state$1.id})});state$1.showImg='';getMusicList();};watch(function(){return state$1.accompanyUrl;},function(accompanyUrl){state$1.accompanyUrl=accompanyUrl;});var setAccompanyUrl=function setAccompanyUrl(){var url=vaildTeachingUrl();state$1.accompanyUrl=url+"/accompany/colxiu-website.html?id=".concat(state$1.id,"&part-index=").concat(state$1.subjectId);// state.accompanyUrl = `http://192.168.3.8:3000/colxiu-website.html?id=${state.id}&part-index=${state.subjectId}` };var goIndex=function goIndex(){router.push({name:'searchdetail',params:{type:'music'}});};onMounted(function(){// window.setSvg = (val)=>{ // setSvg(val) // } getMusicList();state$1.userType=getUserType();state$1.showCode=state$1.userType=='STUDENT'||!state$1.userType?true:false;if(window.history&&window.history.pushState){history.pushState(null,'',document.URL);window.addEventListener('popstate',goIndex,false);}// 拼链接 });onDeactivated(function(){window.removeEventListener('popstate',goIndex,false);});var base64ToBlob=function base64ToBlob(data){var arr=data.split(','),mime=arr[0].match(/:(.*?);/)[1];var bstr=atob(arr[1]);var n=bstr.length;var u8arr=new Uint8Array(n);while(n--){u8arr[n]=bstr.charCodeAt(n);}return new Blob([u8arr],{type:mime});};var uploadFunction=/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee6(file){var formData,fileName,key,obj,res,_key,files,imgurl,ress;return regeneratorRuntime.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.prev=0;formData=new FormData();fileName=new Date().getTime()+state$1.musicDetail.musicSheetName.replaceAll(' ','_')+'.png';key=new Date().getTime()+fileName;obj={filename:fileName,bucketName:'cloud-coach',postData:{filename:fileName,acl:'public-read',key:key,unknowValueField:[]}};_context6.next=7;return request.post('/api-website/open/getUploadSign',{data:obj});case 7:res=_context6.sent;state$1.dataObj={policy:res.data.policy,signature:res.data.signature,key:key,KSSAccessKeyId:res.data.kssAccessKeyId,acl:'public-read',name:fileName};for(_key in state$1.dataObj){formData.append(_key,state$1.dataObj[_key]);}// const imgRes = await fetch(file) files=base64ToBlob(file);// const files = await imgRes.blob() formData.append('file',files,fileName);_context6.next=14;return request$1(state$1.ossUploadUrl,{method:'POST',data:formData});case 14:imgurl=state$1.ossUploadUrl+'/'+key;_context6.next=17;return request.post('/api-website/open/music/sheet/img',{data:{musicSheetId:state$1.musicDetail.id,musicImg:imgurl}});case 17:ress=_context6.sent;console.log('赋值');state$1.showImg=imgurl;_context6.next=25;break;case 22:_context6.prev=22;_context6.t0=_context6["catch"](0);console.log(_context6.t0);case 25:case"end":return _context6.stop();}}},_callee6,null,[[0,22]]);}));return function uploadFunction(_x5){return _ref6.apply(this,arguments);};}();var setUser=function setUser(){state$1.iconList=[];if(state$1.teacherDetail.tag.indexOf('STYLE')!=-1){state$1.iconList.push(styleIcon);}else{state$1.iconList.push(nostyleIcon);}if(state$1.teacherDetail.tag.indexOf('VIDEO')!=-1){state$1.iconList.push(videoIcon);}else{state$1.iconList.push(noVideoIcon);}if(state$1.teacherDetail.tag.indexOf('LIVE')!=-1){state$1.iconList.push(onlineIcon);}else{state$1.iconList.push(noOnlineIcon);}if(state$1.teacherDetail.tag.indexOf('MUSIC')!=-1){state$1.iconList.push(ablumIcon);}else{state$1.iconList.push(noAblumIcon);}};var printHander=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee7(){var tempCanvas,showImg,titleCanvas,canvas,imgUrl,link;return regeneratorRuntime.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return imgToCanvas(state$1.showImg);case 2:tempCanvas=_context7.sent;showImg=convasToImg(tempCanvas);state$1.showImg=showImg;titleCanvas=addMusicTitle(tempCanvas,{title:state$1.musicDetail.musicSheetName,size:18});_context7.next=8;return addWatermark(titleCanvas);case 8:canvas=_context7.sent;imgUrl=convasToImg(canvas);link=document.createElement('a');link.setAttribute('download',state$1.musicDetail.musicSheetName+'.png');// 添加时间戳,防止浏览器缓存图片 // console.log(imgUrl,'imgUrl') state$1.imgUrl=imgUrl;link.href=imgUrl;link.click();case 15:case"end":return _context7.stop();}}},_callee7);}));return function printHander(){return _ref7.apply(this,arguments);};}();var gotoMusic=function gotoMusic(){router.push({name:'searchdetail',params:{search:state$1.teacherDetail.userName,type:'music'}});};var favoriteMusic=/*#__PURE__*/function(){var _ref8=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee9(){var tockn;return regeneratorRuntime.wrap(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:tockn=getAuth();if(tockn){_context9.next=4;break;}state.loginPopupStatus=true;return _context9.abrupt("return");case 4:ElMessageBox.confirm("\u662F\u5426".concat(state$1.musicDetail.favorite?'取消收藏':'收藏',"\u8BE5\u66F2\u76EE\uFF1F"),'提示',{type:'warning'}).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee8(){var res;return regeneratorRuntime.wrap(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:_context8.prev=0;_context8.next=3;return request.post("/api-website/music/sheet/favorite/".concat(state$1.id));case 3:res=_context8.sent;getMusicList();// state.otherVideoList = res.data _context8.next=10;break;case 7:_context8.prev=7;_context8.t0=_context8["catch"](0);console.log(_context8.t0);case 10:case"end":return _context8.stop();}}},_callee8,null,[[0,7]]);})));case 5:case"end":return _context9.stop();}}},_callee9);}));return function favoriteMusic(){return _ref8.apply(this,arguments);};}();return function(){return createVNode(Fragment,null,[createVNode("div",{"class":classes$1.wallWrap},[createVNode("div",{"class":classes$1.wall},null),createVNode("div",{"class":classes$1.musicWraps},[createVNode("div",{"class":[classes$1.width1200]},[createVNode("div",{"class":[classes$1.musicWrap]},[createVNode("div",{"class":classes$1.left},[createVNode("div",{"class":classes$1.title},[createVNode("div",{"class":classes$1.titleRight,"onClick":function onClick(){return printHander();}},[createVNode("img",{"src":printIcon,"alt":""},null),createVNode("p",null,[createTextVNode("\u4E0B\u8F7D\u4E50\u8C31")])])]),createVNode("div",{"class":classes$1.musicContent},[createVNode("img",{"class":classes$1.musicStag,"src":chargeImg[state$1.musicDetail.chargeType],"alt":""},null),createVNode("iframe",{"id":"containerPrint","ref":"print","style":"width: 538px;page-break-after:always; ","src":state$1.accompanyUrl,"class":classes$1.iframe},null),createVNode("p",{"class":classes$1.musicTitle},[state$1.musicDetail.musicSheetName]),state$1.showImg?createVNode("img",{"src":state$1.showImg,"alt":""},null):createVNode("div",null,[createVNode(Vue3Lottie,{"animationData":AstronautJSON,"class":classes$1.finch},null),createVNode("p",{"class":classes$1.finchLoad},[createTextVNode("\u52A0\u8F7D\u4E2D...")])])]),state$1.mp3Type=='MP3'?createVNode(ColVideo,{"src":state$1.activeRow.audioFileUrl,"styleValue":{height:'68px',bacground:'#333'},"type":'audto',"settings":['captions','quality','speed','loop','title'],"class":classes$1.audios,"poster":state$1.activeRow.title},null):createVNode(Fragment,null,[createVNode("div",{"class":classes$1.noMoreWrap},[createVNode("img",{"src":noMore,"alt":""},null),createVNode("p",null,[createTextVNode("\u6E29\u99A8\u63D0\u793A\uFF1A\u8BE5\u66F2\u76EE\u6682\u4E0D\u652F\u6301\u64AD\u653E\u5594\uFF5E")])])]),state$1.showCode?createVNode("div",{"class":classes$1.showCode},[createVNode("div",{"class":classes$1.showCodeWrap},[createVNode("img",{"class":classes$1.close,"src":iconClose,"alt":"","onClick":function onClick(){state$1.showCode=false;}},null),createVNode("img",{"class":classes$1.code,"src":sutdentDownLoad,"alt":""},null),createVNode("img",{"src":banner,"class":classes$1.banner,"alt":""},null)])]):null]),createVNode("div",{"class":classes$1.right},[createVNode("div",{"class":classes$1.musicInfo},[createVNode("h2",null,[createVNode("span",{"class":[classes$1.musicTag,classes$1[chargeClass[state$1.musicDetail.chargeType]]]},[chargeTypes[state$1.musicDetail.chargeType]]),state$1.musicDetail.musicSheetName]),createVNode("div",{"class":classes$1.collectWrap},[createVNode("div",{"class":classes$1.masker,"onClick":favoriteMusic},[createVNode("img",{"src":state$1.musicDetail.favorite?lineStart:start$1,"alt":""},null)]),createVNode("img",{"src":state$1.musicDetail.titleImg||music,"class":classes$1.musiceIcon,"alt":""},null),createVNode("div",null,[createVNode("div",{"class":classes$1.collect,"onClick":favoriteMusic},[createVNode("img",{"src":state$1.musicDetail.favorite?oLineStart:oStart,"class":classes$1.start,"alt":""},null),createVNode("p",null,[state$1.musicDetail.favoriteNum,createTextVNode("\u4EBA\u6536\u85CF")])]),createVNode("div",{"class":classes$1.tagList},[state$1.tagList.map(function(item){return createVNode("div",{"class":classes$1.tag},[item]);})]),createVNode("p",{"class":classes$1.subTitle},[createTextVNode("\u4F5C\u66F2\u4EBA\uFF1A"),createVNode("span",null,[state$1.musicDetail.composer])]),createVNode("p",{"class":classes$1.subTitle},[createTextVNode("\u58F0\u90E8\uFF1A"),createVNode("span",null,[state$1.musicDetail.subjectNames])])])])]),createVNode("div",{"class":classes$1.btooom},[state$1.teacherDetail.userId?createVNode("div",{"class":classes$1.teacherInfo},[createVNode("h2",null,[createTextVNode("\u4E0A\u4F20\u8005")]),createVNode("div",{"class":classes$1.teacherHeadWrap},[createVNode("div",{"class":classes$1.teacherHeadLeft},[createVNode("img",{"src":state$1.teacherDetail.userAvatar?state$1.teacherDetail.userAvatar:iconTeacher,"alt":"","class":classes$1.teacherHeader},null),createVNode("div",{"class":classes$1.teacherHeadInfo},[createVNode("div",{"class":classes$1.teacherHeadName},[createVNode("p",null,[state$1.teacherDetail.userName]),state$1.userType=='STUDENT'?createVNode("div",{"class":[classes$1.teacherHeadRight,state$1.teacherDetail.star?classes$1.isStart:''],"onClick":function onClick(){return followVideo();}},[state$1.teacherDetail.star?'已关注':'+ 关注']):createVNode("div",{"class":classes$1.iconWrapList},[createVNode("img",{"src":state$1.teacherDetail.isVip?vipIcon$1:noVipIcon,"class":classes$1.vipIcon,"alt":""},null),state$1.iconList.map(function(item){return createVNode("img",{"class":classes$1.teacherDetailIcon,"src":item,"alt":""},null);})])])])]),createVNode("div",null,[createVNode("p",{"class":classes$1.fensNum},[state$1.teacherDetail.fansNum]),createVNode("p",{"class":classes$1.fens},[createTextVNode("\u7C89\u4E1D\u6570")])])])]):null,state$1.musicList.length>0&&createVNode("div",{"class":classes$1.otherMusic},[createVNode("div",{"class":classes$1.videoNav},[createVNode("h5",null,[createTextVNode("TA\u7684\u66F2\u8C31")]),createVNode("div",{"class":classes$1.wrapRight,"onClick":function onClick(){return gotoMusic();}},[createVNode("span",null,[createTextVNode("\u66F4\u591A")]),createVNode("img",{"class":classes$1.arrow,"src":arrow$1,"alt":""},null)])]),createVNode("div",{"class":classes$1.otherMusicList},[state$1.musicList.map(function(item){return createVNode(musicItem,{"item":item,"onMusicDetail":function onMusicDetail(val){return getDetail(val);}},null);})])])])])])])])])]);};}}));}};});})();