track-song.d4c1446b.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 f,j as p,k as y,l as v,s as t}from"./index.module.1e3f21b8.js";import{_ as k,c as C,d as S}from"./icon_level3.5bff162c.js";import{d as I,z as E,y as L,f as w,v as F,n as j,j as s,Y as V,A as n,B,$ as N}from"./ResizeObserver.es.b7226882.js";import{C as M}from"./index.969bba7f.js";import{a as P,b as A}from"./index.1eaf642c.js";import{C as H}from"./index.40f703b6.js";import{C as T}from"./index.9269bf1e.js";import{I as c}from"./index.20c0f4c5.js";function D(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":k,"./images/icon_level2.png":C,"./images/icon_level3.png":S,"./images/icon_music.png":_,"./images/icon_no_level.png":h,"./images/icon_score.png":m,"./images/icon_subject.png":b,"./images/icon_time.png":f,"./images/star_bg.png":p,"./images/title_bg.png":y,"./images/wx_bg.png":v}[i].default};var J=I({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:E(),musicList:[],rankingScore:0,hiddenProperty:null,evaluationDifficulty:""}},async mounted(){P(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 L.post("/api-student/open/activity/info/"+this.id),o=(e.activityMusicVoList||[]).filter(a=>a.subjectId==this.subjectId);this.musicList=o,this.rankingScore=e.rankingScore||0,this.evaluationDifficulty=e.evaluationDifficulty}catch{}},onOpenMusic(e){try{const i=w(),o="/klx-music-score/",a=F.stringifyUrl({url:location.origin+o,query:{id:e.musicSheetId,behaviorId:this.behaviorId,systemType:i.isTeacher?"teacher":"student",setting:JSON.stringify({mode:"EVALUATING",resets:["SPEED"],difficulty:e.evaluationDifficulty||this.evaluationDifficulty,feeType:"FREE",submitData:{evaluationId:e.evaluationId}})}});console.log(a,"url"),j({api:"openAccompanyWebView",content:{url:a,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 s("div",{class:t.trackSong},[s("div",{ref:"headers"},[s(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:()=>[s("div",{class:t.trackScore},[s("div",{class:t.trackCountScore},[n("\u6211\u7684\u603B\u5206 "),s("span",null,[this.allScore])]),s("div",{class:t.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`]),s(c,{class:t.trackImg,src:x("icon_score.png")},null)])]})]),s("div",{class:t.bg},null),s(T,{class:t.cellGroup},D(e=this.musicList.map(i=>s(H,{center:!0},{icon:()=>s(c,{src:i.musicImage,class:t.musicPic},null),title:()=>s("div",{class:t.musicName},[i.musicSheetName]),label:()=>i.score?s("div",{class:[t.labelClass,t.labelScore]},[n("\u6211\u7684\u8BC4\u5206\uFF1A"),i.score]):s("div",{class:t.labelClass},[n("\u6682\u65E0\u8BC4\u5206\uFF0C\u5FEB\u6765\u6311\u6218\u5427\uFF5E")]),value:()=>s("div",{class:t.valueClass},[s(B,{type:"primary",size:"small",round:!0,color:"linear-gradient(180deg, #FFA200 0%, #FF6900 100%)",onClick:()=>{this.onOpenMusic(i)}},{default:()=>[n("\u7ACB\u523B\u6311\u6218")]})])})))?e:{default:()=>[e]})])}});export{J as default,x as getAssetsHomeFile};