index.ecc6ef6f.js 4.6 KB

1
  1. import{d as G,w as v,g as o,V as u,S as M,Q as P,U as E,j as t,F as x,O,C as B,aT as F}from"./index.c8a33855.js";import{L as U}from"./index.cf2652a7.js";import"./index.e91b3eaf.js";import"./index.3dff5bed.js";import{T as V,a as I}from"./index.42df2d54.js";import{I as q}from"./index.5da3180f.js";import{S as D}from"./index.24110c1a.js";import{S as z}from"./select-subject.862716bd.js";import{a as p,S as f}from"./hooks.88972ca3.js";import{M as J}from"./index.90fccc07.js";import{b as Q}from"./index.ed5eea4e.js";import{C as $}from"./index.00003e8f.js";import{T as K}from"./index.0cb130e9.js";import{b as W}from"./bg-image.e9966434.js";import"./use-tab-status.9eeb64d0.js";import"./use-id.c5c54d4f.js";import"./use-refs.ef9788ce.js";import"./index.89b19a2f.js";import"./index.5792511e.js";import"./index.d9b7361c.js";import"./index.c3e67d80.js";import"./icon-xin.18c43f84.js";import"./index.a0b72ee6.js";import"./use-height.f274d759.js";const X="_memberHeader_rr258_1",Y="_headerImg_rr258_7",Z="_headerContent_rr258_16",ee="_sticky_rr258_28",ae="_label_rr258_31",te="_musicGrid_rr258_43",se="_tagTabs_rr258_46";var i={memberHeader:X,headerImg:Y,headerContent:Z,sticky:ee,label:ae,musicGrid:te,tagTabs:se},He=G({name:"Album",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})}},setup({hideSearch:g,defauleParams:A},{expose:w}){const{isLoading:re,state:S}=Q(v(o.platformApi+"/MusicTag/tree",{params:{type:"ALBUM"}}),null),c=u({id:"",name:""});if(o.platformType==="TEACHER"){const e=o.user.data;c.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else if(!p(f.SEARCH).id){const a=o.user.data,b=a.subjectId?Number(a.subjectId.split(",")[0]):"",L=a.subjectName?a.subjectName.split(",")[0]:"";b&&p(f.SEARCH,JSON.stringify({id:b,name:L}),"set")}const H=M(),T=P(),n={};if(o.version&&(n.version=o.version||"",n.platform=o.platformType==="STUDENT"?"ios-student":"ios-teacher"),n.myself=!1,!g)if(o.platformType==="TEACHER")n.subjectIds=c.value.id;else{const e=p(f.SEARCH);n.subjectIds=e.id}const r=E({search:T.query.search||"",albumTagIds:T.query.tagids||"",page:1,...A,...n}),s=u(null),m=u(!1),y=u(!1),h=u(!1),R=u(!1),C=e=>{r.page=1,r.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:o.platformType==="TEACHER"?"/api-teacher":"/api-student",data:{...r,idAndName:r.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,r.page=a.data.pageNo+1,y.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{}},k=e=>{const a=Object.values(e).flat().filter(Boolean).join(",");r.albumTagIds=a,r.page=1,s.value=null,d(),R.value=!1},j=e=>{r.page=1,r.subjectIds=e.id,s.value=null,o.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};w({onSearch:C,onComfirm:k,onComfirmSubject:j});const _=p(f.SEARCH),l=E({show:!1,name:_.name||"\u5168\u90E8\u58F0\u90E8",id:_.id||""});return()=>{const e=S.value&&S.value.data||[];return t("div",null,[t(U,{loading:m.value,finished:y.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",backIconColor:"white",border:!1,isFixed:!1,color:"#131415"},{default:()=>t("div",{class:i.headerContent},[t(D,{type:"tenant",modelValue:r.search,onSearch:C,placeholder:"\u8BF7\u8F93\u5165\u4E13\u8F91\u540D\u79F0 ",background:"transparent"},{left:()=>t("div",{class:i.label,onClick:()=>l.show=!0},[o.platformType==="TEACHER"?c.value.name:l.name,t(O,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])}),t(V,{shrink:!0,class:i.tagTabs,lineHeight:0,"onClick-tab":a=>{r.albumTagIds=a.name,s.value=null,r.page=1,d()}},{default:()=>[t(I,{title:"\u5168\u90E8",name:""},null),e.map(a=>t(I,{title:a.name,name:a.id},null))]})])})]}),t(q,{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:o.platformType==="TEACHER"?c.value:l,onComfirm:j},null)]})])}}});export{He as default};