track-song.2cb24474.js 4.6 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 v,l as y,s}from"./index.module.1e3f21b8.js";import{_ as C,c as k,d as I}from"./icon_level3.5bff162c.js";import{C as S}from"./index.33f0ddb9.js";import{d as E,z as L,e as w,b as F,p as j,i as t,Y as V,A as a,B,$ as N}from"./index.6b776f4b.js";import{u as M,a as A}from"./index.46520b6f.js";import{C as H}from"./index.7486196c.js";import{C as P}from"./index.aa464e80.js";import{I as n}from"./index.7cc0b0e7.js";import{q as D}from"./index.c3591af3.js";import"./index.f0306d29.js";import"./use-height.c83159bc.js";function T(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!N(e)}const q=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":v,"./images/wx_bg.png":y}[i].default};var Q=E({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:L(),musicList:[],rankingScore:0,hiddenProperty:null,evaluationDifficulty:""}},async mounted(){M(document,"scroll",()=>{const{y:i}=A();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 w.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=F(),o=D.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(S,{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:q("icon_score.png")},null)])]})]),t("div",{class:s.bg},null),t(P,{class:s.cellGroup},T(e=this.musicList.map(i=>t(H,{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{Q as default,q as getAssetsHomeFile};