track-song.477a00c5.js 4.5 KB

1
  1. import{_ as r,a as l,b as u,c as d,d as g,e as _,f as h,g as m,h as b,i as p,j as f,k as y,l as v,s}from"./index.module.1e3f21b8.js";import{_ as C,c as k,d as I}from"./icon_level3.5bff162c.js";import{d as S,x as w,w as E,f as L,y as F,n as j,j as t,X as V,z as a,B,Z as N}from"./index.e6d6174e.js";import{C as M}from"./index.045f03fd.js";import{u as H,a as P}from"./index.684ca989.js";import{C as A}from"./index.af99cf22.js";import{C as D}from"./index.4aea64de.js";import{I as n}from"./index.67c54471.js";import"./index.d8c651bf.js";import"./use-height.8140ea04.js";function T(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!N(e)}const x=e=>{const i=`./images/${e}`;return{"./images/icon-lv.png":r,"./images/icon_arrow_left.png":l,"./images/icon_arrow_right.png":u,"./images/icon_close.png":d,"./images/icon_king.png":g,"./images/icon_level.png":C,"./images/icon_level2.png":k,"./images/icon_level3.png":I,"./images/icon_music.png":_,"./images/icon_no_level.png":h,"./images/icon_score.png":m,"./images/icon_subject.png":b,"./images/icon_time.png":p,"./images/star_bg.png":f,"./images/title_bg.png":y,"./images/wx_bg.png":v}[i].default};var X=S({name:"track-song",data(){const e=this.$route.query;console.log(e);const i=e.subjectName||"";return{id:e.id,subjectId:e.subjectId,background:"rgba(55, 205, 177, 0)",headColor:"#fff",height:"auto",backIconColor:"white",title:i+"\u66F2\u76EE\u8BC4\u6D4B",behaviorId:w(),musicList:[],rankingScore:0,hiddenProperty:null,evaluationDifficulty:""}},async mounted(){H(document,"scroll",()=>{const{y:i}=P();i.value>52?(this.headColor="#000",this.background="#fff",this.backIconColor="black"):(this.background="transparent",this.headColor="#fff",this.backIconColor="white")}),await this.getMusicInfo(),this.hiddenProperty="hidden"in document?"hidden":"webkitHidden"in document?"webkitHidden":"mozHidden"in document?"mozHidden":null;const e=this.hiddenProperty.replace(/hidden/i,"visibilitychange");document.addEventListener(e,this.onVisibilityChange)},unmounted(){if(this.hiddenProperty){const e=this.hiddenProperty.replace(/hidden/i,"visibilitychange");document.removeEventListener(e,this.onVisibilityChange)}},methods:{onVisibilityChange(){document[this.hiddenProperty]||this.getMusicInfo()},async getMusicInfo(){try{const{data:e}=await E.post("/api-student/open/activity/info/"+this.id),o=(e.activityMusicVoList||[]).filter(c=>c.subjectId==this.subjectId);this.musicList=o,this.rankingScore=e.rankingScore||0,this.evaluationDifficulty=e.evaluationDifficulty}catch{}},onOpenMusic(e){try{const i=L(),o=F.stringifyUrl({url:location.origin+"/accompany",query:{id:e.musicSheetId,behaviorId:this.behaviorId,client:i.isTeacher?"teacher":"student",setting:JSON.stringify({mode:"EVALUATING",resets:["SPEED"],difficulty:e.evaluationDifficulty||this.evaluationDifficulty,feeType:"FREE",submitData:{evaluationId:e.evaluationId}})}});console.log(o,"url"),j({api:"openAccompanyWebView",content:{url:o,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}})}catch{}}},computed:{allScore(){const e=this.musicList||[];let i=0;return e.forEach(o=>{i+=o.score}),i},calcScore(){const e=this.allScore,i=this.rankingScore;return Number(i-e)}},render(){let e;return t("div",{class:s.trackSong},[t("div",{ref:"headers"},[t(M,{title:this.title,background:this.background,border:!1,color:this.headColor,backIconColor:this.backIconColor,onHeaderBack:()=>{this.$nextTick(()=>{const{height:i}=V(this.$refs.headers);this.height=i})}},{default:()=>[t("div",{class:s.trackScore},[t("div",{class:s.trackCountScore},[a("\u6211\u7684\u603B\u5206 "),t("span",null,[this.allScore])]),t("div",{class:s.trackIf},[this.calcScore<=0?"\u606D\u559C\u60A8\u5DF2\u8FBE\u5230\u83B7\u5956\u5206\u6570\uFF01":`\u8DDD\u79BB\u8981\u6C42\u5206\u6570\u8FD8\u6709${this.calcScore}\u5206\uFF0C\u7EE7\u7EED\u52A0\u6CB9\uFF01`]),t(n,{class:s.trackImg,src:x("icon_score.png")},null)])]})]),t("div",{class:s.bg},null),t(D,{class:s.cellGroup},T(e=this.musicList.map(i=>t(A,{center:!0},{icon:()=>t(n,{src:i.musicImage,class:s.musicPic},null),title:()=>t("div",{class:s.musicName},[i.musicSheetName]),label:()=>i.score?t("div",{class:[s.labelClass,s.labelScore]},[a("\u6211\u7684\u8BC4\u5206\uFF1A"),i.score]):t("div",{class:s.labelClass},[a("\u6682\u65E0\u8BC4\u5206\uFF0C\u5FEB\u6765\u6311\u6218\u5427\uFF5E")]),value:()=>t("div",{class:s.valueClass},[t(B,{type:"primary",size:"small",round:!0,color:"linear-gradient(180deg, #FFA200 0%, #FF6900 100%)",onClick:()=>{this.onOpenMusic(i)}},{default:()=>[a("\u7ACB\u523B\u6311\u6218")]})])})))?e:{default:()=>[e]})])}});export{X as default,x as getAssetsHomeFile};