index.0962fc25.js 8.5 KB

1
  1. import{d as K,y as v,g as l,U as u,P as W,Q as $,S as H,V as ee,f as te,j as a,F as U,A as ae,N as L,be as se,C as le,aS as x}from"./ResizeObserver.es.39b48a47.js";import{S as oe}from"./index.608320e9.js";import{L as ne}from"./index.6c529ad4.js";import{S as re}from"./index.1f05bcbc.js";import"./index.0e35d2fb.js";import{T as ue,a as P}from"./index.5d4d28cc.js";import{S as O}from"./index.e10a1ae2.js";import{S as ie}from"./select-tag.c133608d.js";import{g as ce}from"./music.27f3de35.js";import{S as me}from"./select-subject.5a3e156f.js";import{a as c,S as m}from"./hooks.6df65925.js";import{S as pe}from"./index.fbd2c321.js";import{C as fe}from"./index.970ad07b.js";import{c as de}from"./index.dc19bc54.js";import{T as ge}from"./index.e90d2179.js";import"./use-tab-status.bcc0c503.js";import"./use-id.b004ff17.js";import"./use-refs.07204da6.js";import"./index.db115763.js";import"./index.428ab1a8.js";import"./index.34ac729a.js";import"./index.0a093430.js";import"./index.3c44a6d7.js";import"./index.926ca9c5.js";import"./index.a256e876.js";import"./icon_uploader.21a85a4d.js";import"./icon-xin.797feb04.js";import"./icon_album.4957b8e0.js";import"./icon_album_active.cb923735.js";import"./icon_exquisite.01ddc5aa.js";import"./icon_music_active.f55820b3.js";import"./index.fcbcb027.js";import"./icon-play.bc9e7aab.js";const be="_sticky_lhjbw_1",he="_listContainer_lhjbw_5",Ae="_line_lhjbw_17",Se="_active_lhjbw_23",ve="_searchGroup_lhjbw_26",ye="_label_lhjbw_33",Ie="_searchs_lhjbw_38",we="_alumnList_lhjbw_49",je="_alumnListOnly_lhjbw_55",Ce="_bgImg_lhjbw_58",Ee="_tagTabs_lhjbw_66",Te="_fleg_lhjbw_100";var i={sticky:be,listContainer:he,line:Ae,active:Se,searchGroup:ve,label:ye,searchs:Ie,alumnList:we,alumnListOnly:je,bgImg:Ce,tagTabs:Ee,fleg:Te},Be="./assets/bgImg.2964f21d.png",Re="data:image/png;base64,iVBORw0KGgoAAAANSU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zu8egRx40i+atFzm23fR9wU4kRj5Y5kj5qYnZ7mBwB3AAsBk7qAhJNJprOeklRvCH14mFT95NfgYskhbruOHYjxi+quX6a/QbEXRJPs62SInhnBdq3xyOlGo7tmStpy4grMIqlb51iezlwV/WH40RdMSYAZTtuBEKQ5pwbxwygQFwX/QSIR0wopfljClAgFgDnAwsl7f0PfUtCHGOyShkAAAAASUVORK5CYII=";const F=()=>{};var ct=K({name:"MusicList",props:{hideSearch:{type:Boolean,default:!1},onlySearch:{type:Boolean,default:!1},height:{type:Number,default:0},defauleParams:{type:Object,default:()=>({})},onItemClick:{type:Function,default:F},teacherId:{type:String||Number,default:""},myself:{type:Boolean,default:!1}},setup({hideSearch:B,onlySearch:y,height:V,defauleParams:z,onItemClick:A,teacherId:M,myself:J},{expose:X}){const{isLoading:Ne,state:R}=de(v(l.platformApi+"/MusicTag/tree",{params:{type:"MUSIC"}}),null),N=u(V||0),q=e=>{N.value=e},d=u({id:"",name:""});if(l.platformType==="TEACHER"){const e=l.user.data;d.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else if(!c(m.SEARCH).id){const t=l.user.data,n=t.subjectId?Number(t.subjectId.split(",")[0]):"",f=t.subjectName?t.subjectName.split(",")[0]:"",Z=t.instrumentId;localStorage.setItem("userInstrumentId",Z),n&&c(m.SEARCH,JSON.stringify({id:n,name:f}),"set")}localStorage.setItem("behaviorId",ce());const I=W(),G=$(),g={};l.version&&(g.version=l.version||"",g.platform=l.platformType==="STUDENT"?"ios-student":"ios-teacher");const p=u(!1);if(!B){if(l.platformType==="TEACHER")g.subjectIds=d.value.id;else{const t=c(m.SEARCH);g.subjectIds=t.id}const e=c(m.MUSIC_FREE);p.value=e.chargeType}if(y){const e=c(m.SEARCH);g.subjectIds=e.id}const r=H({search:I.query.search||"",musicTagIds:I.query.tagids||"",page:1,...z,...g}),s=u(null),h=u(!1),_=u(!1),w=u(!1),j=u(!1),S=u(!0),Q=u(l.platformType==="STUDENT"?"/api-student":"/api-teacher"),C=e=>{r.page=1,r.search=e,s.value=null,b()},b=async()=>{var t;if(h.value)return;h.value=!0,w.value=!1;const e={...r,auditStatus:"PASS",idAndName:r.search,createBy:M};p.value&&(e.chargeType="FREE"),J?e.myself=!0:e.myself=!1;try{const n=await v.post(`${Q.value}/music/sheet/list`,{data:e});if(s.value){const f=(((t=s.value)==null?void 0:t.rows)||[]).concat(n.data.rows||[]);s.value.rows=f}s.value=s.value||n.data,r.page=n.data.pageNo+1,_.value=n.data.pageNo>=n.data.totalPage}catch{w.value=!0}h.value=!1},Y=async e=>{try{await v.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:e}})}catch{}},k=e=>{const t={};for(const f in e)Number(f)===-1?p.value=!!e[f][0]:t[f]=e[f];const n=Object.values(t).flat().filter(Boolean).join(",");r.musicTagIds=n,r.page=1,s.value=null,b(),j.value=!1},D=e=>{r.page=1,r.subjectIds=e.id,s.value=null,o.instrumentId=e.instrumentId,localStorage.setItem("userInstrumentId",e.instrumentId||""),l.platformType==="TEACHER"?(d.value={name:e.name,id:e.id},Y(e.id)):(o.id=e.id,o.name=e.name,c(m.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set")),b(),o.show=!1},E=c(m.SEARCH);let T=localStorage.getItem("userInstrumentId")||"";T==="undefined"&&(c(m.SEARCH,"","remove"),T="");const o=H({show:!1,name:E.id?E.name:"\u5168\u90E8\u58F0\u90E8",id:E.id||"",instrumentId:T});return ee(async()=>{try{if(!te().iPhone){S.value=!1;return}const{data:e}=await v.get("/api-admin/appVersionInfo/queryByPlatform",{params:{platform:l.platformType==="TEACHER"?"ios-teacher":"ios-student"}});l.version>e.version?S.value=!0:S.value=!1}catch{}}),X({onSearch:C,onComfirm:k,updateStickyHeight:q,onComfirmSubject:D}),()=>{const e=R.value&&R.value.data||[];return a(U,null,[!B&&a(U,null,[a(ge,{class:i.sticky},{default:()=>[a(fe,{background:"transparent",isFixed:!1,border:!1,backIconColor:"white",color:"#fff"},{right:()=>!S.value&&a("span",{class:i.fleg,onClick:()=>{p.value!=p.value,c(m.MUSIC_FREE,JSON.stringify({chargeType:p.value}),"set"),s.value=null,r.page=1,b()}},[a(re,{modelValue:p.value,"onUpdate:modelValue":t=>p.value=t,size:"20px"},null),a("span",null,[ae("\u514D\u8D39")])])}),a(O,{onSearch:C,background:"transparent",inputBackground:"transparent",leftIcon:Re},{left:()=>a("div",{class:i.label,onClick:()=>o.show=!0},[l.platformType==="TEACHER"?d.value.name:o.name,a(L,{classPrefix:"iconfont",name:"down",size:12,color:"#fff"},null)])}),a(ue,{shrink:!0,class:i.tagTabs,lineHeight:0,"onClick-tab":t=>{r.musicTagIds=t.name,s.value=null,r.page=1,b()}},{default:()=>[a(P,{title:"\u5168\u90E8",name:""},null),e.map(t=>a(P,{title:t.name,name:t.id},null))]})]}),a("img",{class:i.bgImg,src:Be},null)]),y?a(oe,{position:"top",offsetTop:N.value},{default:()=>[a(O,{onSearch:C,background:"transparent",inputBackground:"white",class:i.searchGroup},{left:()=>a("div",{class:[i.label,i.searchs],onClick:()=>o.show=!0},[l.platformType==="TEACHER"?d.value.name:o.name,a(L,{classPrefix:"iconfont",name:"down",size:12,color:"#949597"},null)])})]}):"",a("div",{class:[i.alumnList,y&&i.alumnListOnly]},[a(ne,{loading:h.value,finished:_.value,"finished-text":(s.value&&s.value.rows.length,""),onLoad:b,error:w.value},{default:()=>[s.value&&s.value.rows.length?a(pe,{list:s.value.rows,onDetail:t=>{if(A===F){const n=location.origin+location.pathname+"#/music-detail?id="+t.id+"&instrumentId="+o.instrumentId;se(n,()=>{G.push({path:"/music-detail",query:{id:t.id,instrumentId:o.instrumentId}})})}else A==null||A(t)}},null):!h.value&&a(le,{tips:"\u6682\u65E0\u66F2\u76EE",classImgSize:"SMALL",btnStatus:!1},null)]})]),a(x,{show:j.value,round:!0,closeable:!0,position:"bottom",style:{height:"60%"},teleport:"body","onUpdate:show":t=>j.value=t},{default:()=>[a(ie,{exquisiteFlag:!0,onConfirm:k,onCancel:()=>{},defaultValue:I.query.tagids},null)]}),a(x,{show:o.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>o.show=!1,onClosed:()=>o.show=!1},{default:()=>[a(me,{type:"MUSIC",searchParams:l.platformType==="TEACHER"?d.value:o,onComfirm:D},null)]})])}}});export{ct as default};