index.73b1e898.js 4.1 KB

1
  1. import{d as M,w as h,g as o,S as i,P,O as G,Q as A,j as t,M as O,C as x,aR as B,F as q}from"./index.b4531198.js";import{L as D}from"./index.b5819b48.js";import"./index.73160658.js";import"./index.d0bdd5a8.js";import{T as F,a as w}from"./index.15fb2c22.js";import{S as U}from"./index.bbe7ba02.js";import{S as V}from"./select-subject.fa443634.js";import{a as d,S as p}from"./hooks.2880a1c8.js";import{M as z}from"./index.ddd1ea77.js";import{c as J}from"./index.f05535c0.js";import{C as Q}from"./index.ab25f43b.js";import{T as $}from"./index.c3df6f19.js";import"./use-tab-status.bdd6555b.js";import"./use-id.4e73f8c4.js";import"./use-refs.f52c22b8.js";import"./index.fe40bde8.js";import"./index.73f964f0.js";import"./index.7a6f9280.js";import"./index.c4d0c53c.js";import"./index.f6fab4f3.js";import"./icon-xin.df8ab2d7.js";const K="_sticky_1evma_1",W="_label_1evma_4",X="_musicGrid_1evma_16",Y="_tagTabs_1evma_19";var b={sticky:K,label:W,musicGrid:X,tagTabs:Y},Te=M({name:"Album",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})}},setup({hideSearch:g,defauleParams:R},{expose:H}){const{isLoading:Z,state:S}=J(h(o.platformApi+"/MusicTag/tree",{params:{type:"ALBUM"}}),null),n=i({id:"",name:""});if(o.platformType==="TEACHER"){const e=o.user.data;n.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else if(!d(p.SEARCH).id){const a=o.user.data,f=a.subjectId?Number(a.subjectId.split(",")[0]):"",k=a.subjectName?a.subjectName.split(",")[0]:"";f&&d(p.SEARCH,JSON.stringify({id:f,name:k}),"set")}const I=P(),y=G(),u={};if(o.version&&(u.version=o.version||"",u.platform=o.platformType==="STUDENT"?"ios-student":"ios-teacher"),u.myself=!1,!g)if(o.platformType==="TEACHER")u.subjectIds=n.value.id;else{const e=d(p.SEARCH);u.subjectIds=e.id}const l=A({search:y.query.search||"",albumTagIds:y.query.tagids||"",page:1,...R,...u}),s=i(null),c=i(!1),T=i(!1),v=i(!1),N=i(!1),j=e=>{l.page=1,l.search=e,s.value=null,m()},m=async()=>{var e;if(!c.value){c.value=!0,v.value=!1;try{const a=await h.post("/music/album/list",{prefix:o.platformType==="TEACHER"?"/api-teacher":"/api-student",data:{...l,idAndName:l.search}});if(s.value){const f=(((e=s.value)==null?void 0:e.rows)||[]).concat(a.data.rows||[]);s.value.rows=f}s.value=s.value||a.data,l.page=a.data.pageNo+1,T.value=a.data.pageNo>=a.data.totalPage}catch{v.value=!0}c.value=!1}},_=async e=>{try{await h.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:e}})}catch{}},L=e=>{const a=Object.values(e).flat().filter(Boolean).join(",");l.albumTagIds=a,l.page=1,s.value=null,m(),N.value=!1},C=e=>{l.page=1,l.subjectIds=e.id,s.value=null,o.platformType==="TEACHER"?(n.value={name:e.name,id:e.id},_(e.id)):(r.id=e.id,r.name=e.name,d(p.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set")),m(),r.show=!1};H({onSearch:j,onComfirm:L,onComfirmSubject:C});const E=d(p.SEARCH),r=A({show:!1,name:E.name||"\u5168\u90E8\u58F0\u90E8",id:E.id||""});return()=>{const e=S.value&&S.value.data||[];return t(q,null,[t(D,{loading:c.value,finished:T.value,"finished-text":s.value&&s.value.rows.length?"\u6CA1\u6709\u66F4\u591A\u4E86":"",onLoad:m,error:v.value},{default:()=>[!g&&t($,{class:b.sticky},{default:()=>[t(Q,{border:!1},null),t(U,{modelValue:l.search,onSearch:j,placeholder:"\u8BF7\u8F93\u5165\u4E13\u8F91\u540D\u79F0 "},{left:()=>t("div",{class:b.label,onClick:()=>r.show=!0},[o.platformType==="TEACHER"?n.value.name:r.name,t(O,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])}),t(F,{shrink:!0,class:b.tagTabs,lineHeight:0,"onClick-tab":a=>{l.albumTagIds=a.name,s.value=null,l.page=1,m()}},{default:()=>[t(w,{title:"\u5168\u90E8",name:""},null),e.map(a=>t(w,{title:a.name,name:a.id},null))]})]}),s.value&&s.value.rows.length?t("div",{class:b.musicGrid},[t(z,{list:s.value.rows,onGoto:a=>{I.push({name:"music-album-detail",params:{id:a.id}})}},null)]):!c.value&&t(x,{tips:"\u6682\u65E0\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)]}),t(B,{show:r.show,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>r.show=!1,onClosed:()=>r.show=!1},{default:()=>[t(V,{type:"ALBUM",searchParams:o.platformType==="TEACHER"?n.value:r,onComfirm:C},null)]})])}}});export{Te as default};