1 |
- import{d as M,w as v,g as r,S as u,P,O as G,Q as _,j as t,F as x,M as O,C as B,aR as F}from"./index.e6d6174e.js";import{L as q}from"./index.f904775d.js";import"./index.9093bc60.js";import"./index.b4a53c6a.js";import{T as D,a as E}from"./index.54627972.js";import{I as U}from"./index.67c54471.js";import{S as V}from"./index.c42f80e3.js";import{S as z}from"./select-subject.f61520d8.js";import{a as p,S as f}from"./hooks.00b5b341.js";import{M as J}from"./index.94d44218.js";import{b as Q}from"./index.684ca989.js";import{C as $}from"./index.045f03fd.js";import{T as K}from"./index.275665ec.js";import{b as W}from"./bg-image.e9966434.js";import"./use-tab-status.e9ba8498.js";import"./use-id.f239f36f.js";import"./use-refs.eb803454.js";import"./index.af99cf22.js";import"./index.17d70acf.js";import"./index.05f2b7dd.js";import"./index.c3601b28.js";import"./icon-xin.18c43f84.js";import"./index.d8c651bf.js";import"./use-height.8140ea04.js";const X="_memberHeader_8rwah_1",Y="_headerImg_8rwah_7",Z="_headerContent_8rwah_16",ee="_sticky_8rwah_28",ae="_label_8rwah_31",te="_musicGrid_8rwah_43",se="_tagTabs_8rwah_46";var i={memberHeader:X,headerImg:Y,headerContent:Z,sticky:ee,label:ae,musicGrid:te,tagTabs:se},He=M({name:"Album",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})}},setup({hideSearch:g,defauleParams:A},{expose:I}){const{isLoading:oe,state:S}=Q(v(r.platformApi+"/MusicTag/tree",{params:{type:"ALBUM"}}),null),c=u({id:"",name:""});if(r.platformType==="TEACHER"){const e=r.user.data;c.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else if(!p(f.SEARCH).id){const a=r.user.data,b=a.subjectId?Number(a.subjectId.split(",")[0]):"",k=a.subjectName?a.subjectName.split(",")[0]:"";b&&p(f.SEARCH,JSON.stringify({id:b,name:k}),"set")}const H=P(),y=G(),n={};if(r.version&&(n.version=r.version||"",n.platform=r.platformType==="STUDENT"?"ios-student":"ios-teacher"),n.myself=!1,!g)if(r.platformType==="TEACHER")n.subjectIds=c.value.id;else{const e=p(f.SEARCH);n.subjectIds=e.id}const o=_({search:y.query.search||"",albumTagIds:y.query.tagids||"",page:1,...A,...n}),s=u(null),m=u(!1),T=u(!1),h=u(!1),R=u(!1),j=e=>{o.page=1,o.search=e,s.value=null,d()},d=async()=>{var e;if(!m.value){m.value=!0,h.value=!1;try{const a=await v.post("/music/album/list",{prefix:r.platformType==="TEACHER"?"/api-teacher":"/api-student",data:{...o,idAndName:o.search}});if(s.value){const b=(((e=s.value)==null?void 0:e.rows)||[]).concat(a.data.rows||[]);s.value.rows=b}s.value=s.value||a.data,o.page=a.data.pageNo+1,T.value=a.data.pageNo>=a.data.totalPage}catch{h.value=!0}m.value=!1}},N=async e=>{try{await v.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:e}})}catch{}},L=e=>{const a=Object.values(e).flat().filter(Boolean).join(",");o.albumTagIds=a,o.page=1,s.value=null,d(),R.value=!1},C=e=>{o.page=1,o.subjectIds=e.id,s.value=null,r.platformType==="TEACHER"?(c.value={name:e.name,id:e.id},N(e.id)):(l.id=e.id,l.name=e.name,p(f.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set")),d(),l.show=!1};I({onSearch:j,onComfirm:L,onComfirmSubject:C});const w=p(f.SEARCH),l=_({show:!1,name:w.name||"\u5168\u90E8\u58F0\u90E8",id:w.id||""});return()=>{const e=S.value&&S.value.data||[];return t("div",null,[t(q,{loading:m.value,finished:T.value,"finished-text":s.value&&s.value.rows.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:d,error:h.value},{default:()=>[!g&&t(x,null,[t(K,{position:"top"},{default:()=>[t($,{class:i.memberHeader,background:"transparent",border:!1,isFixed:!1,color:"#131415"},{default:()=>t("div",{class:i.headerContent},[t(V,{type:"tenant",modelValue:o.search,onSearch:j,placeholder:"\u8BF7\u8F93\u5165\u4E13\u8F91\u540D\u79F0 ",background:"transparent"},{left:()=>t("div",{class:i.label,onClick:()=>l.show=!0},[r.platformType==="TEACHER"?c.value.name:l.name,t(O,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])}),t(D,{shrink:!0,class:i.tagTabs,lineHeight:0,"onClick-tab":a=>{o.albumTagIds=a.name,s.value=null,o.page=1,d()}},{default:()=>[t(E,{title:"\u5168\u90E8",name:""},null),e.map(a=>t(E,{title:a.name,name:a.id},null))]})])})]}),t(U,{class:i.headerImg,src:W},null)]),s.value&&s.value.rows.length?t("div",{class:i.musicGrid},[t(J,{list:s.value.rows,onGoto:a=>{H.push({name:"music-album-detail",params:{id:a.id}})}},null)]):!m.value&&t(B,{tips:"\u6682\u65E0\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)]}),t(F,{show:l.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>l.show=!1,onClosed:()=>l.show=!1},{default:()=>[t(z,{type:"ALBUM",searchParams:r.platformType==="TEACHER"?c.value:l,onComfirm:C},null)]})])}}});export{He as default};
|