index.1ef16482.js 4.7 KB

1
  1. import{d as G,U as u,y as v,g as l,Q as B,P,S as I,j as t,F,C as O}from"./ResizeObserver.es.b7226882.js";import{L as U}from"./index.9fec2202.js";import"./index.f6c44874.js";import"./index.cf00521e.js";import{T as V,a as H}from"./index.dc988884.js";import{I as J}from"./index.20c0f4c5.js";import{D as z,a as Q}from"./index.287fb1bf.js";import"./index.40f703b6.js";import{S as $}from"./index.521acd0b.js";import{S as K}from"./select-subject.355ffa48.js";import{a as f,S as p}from"./hooks.a4ed20cb.js";import{M as W}from"./index.03e3393d.js";import{c as X}from"./index.1eaf642c.js";import{C as Y}from"./index.969bba7f.js";import{T as Z}from"./index.1743594f.js";import{b as ee}from"./bg-image.e9966434.js";import"./use-tab-status.db1f6d2e.js";import"./use-id.5d5e6e63.js";import"./use-refs.428b450a.js";import"./index.021f1c7b.js";import"./index.ed3a5560.js";import"./index.023f50db.js";import"./icon-xin2.4ab2a52d.js";const ae="_memberHeader_12ffq_1",te="_headerImg_12ffq_7",se="_headerContent_12ffq_16",le="_sticky_12ffq_51",re="_label_12ffq_54",oe="_musicGrid_12ffq_66",ue="_tagTabs_12ffq_69";var n={memberHeader:ae,headerImg:te,headerContent:se,sticky:le,label:re,musicGrid:oe,tagTabs:ue},Ne=G({name:"Album",props:{hideSearch:{type:Boolean,default:!1},defauleParams:{type:Object,default:()=>({})},showLight:{type:Boolean,default:!1},lightText:{type:String,default:""}},setup({hideSearch:y,defauleParams:R,showLight:w,lightText:L},{expose:N}){const g=u(L),{isLoading:ie,state:S}=X(v(l.platformApi+"/MusicTag/tree",{params:{type:"ALBUM"}}),null),c=u({id:"",name:""});if(l.platformType==="TEACHER"){const e=l.user.data;c.value={name:e.defaultSubjectName||"\u5168\u90E8\u58F0\u90E8",id:e.defaultSubject||""}}else if(!f(p.SEARCH).id){const a=l.user.data,o=a.subjectId?Number(a.subjectId.split(",")[0]):"",D=a.subjectName?a.subjectName.split(",")[0]:"";o&&f(p.SEARCH,JSON.stringify({id:o,name:D}),"set")}const q=B(),T=P(),i={};if(l.version&&(i.version=l.version||"",i.platform=l.platformType==="STUDENT"?"ios-student":"ios-teacher"),i.myself=!1,!y)if(l.platformType==="TEACHER")i.subjectIds=c.value.id;else{const e=f(p.SEARCH);i.subjectIds=e.id}const r=I({search:T.query.search||"",albumTagIds:T.query.tagids||"",page:1,...R,...i}),s=u(null),b=u(!1),j=u(!1),h=u(!1),k=u(!1),C=e=>{r.page=1,r.search=e,g.value=e,s.value=null,m()},m=async()=>{var e;if(!b.value){b.value=!0,h.value=!1;try{const a=await v.post("/music/album/list",{prefix:l.platformType==="TEACHER"?"/api-teacher":"/api-student",data:{...r,idAndName:g.value}});if(s.value){const o=(((e=s.value)==null?void 0:e.rows)||[]).concat(a.data.rows||[]);s.value.rows=o}s.value=s.value||a.data,r.page=a.data.pageNo+1,j.value=a.data.pageNo>=a.data.totalPage}catch{h.value=!0}b.value=!1}},x=async e=>{try{await v.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:e}})}catch{}},M=e=>{const a=Object.values(e).flat().filter(Boolean).join(",");r.albumTagIds=a,r.page=1,s.value=null,m(),k.value=!1},_=u(),A=e=>{r.page=1,r.subjectIds=e.id,_.value.toggle(),s.value=null,l.platformType==="TEACHER"?(c.value={name:e.name,id:e.id},x(e.id)):(d.id=e.id,d.name=e.name,f(p.SEARCH,JSON.stringify({id:e.id,name:e.name}),"set")),m(),d.show=!1};N({onSearch:C,onComfirm:M,onComfirmSubject:A});const E=f(p.SEARCH),d=I({show:!1,name:E.name||"\u5168\u90E8\u58F0\u90E8",id:E.id||""});return()=>{const e=S.value&&S.value.data||[];return t("div",null,[t(U,{finished:j.value,"finished-text":s.value&&s.value.rows.length?" ":"",onLoad:m,error:h.value},{default:()=>[!y&&t(F,null,[t(Z,{position:"top"},{default:()=>[t(Y,{class:n.memberHeader,background:"transparent",border:!1,isFixed:!1,color:"#131415"},{default:()=>t("div",{class:n.headerContent},[t($,{type:"tenant",modelValue:r.search,onSearch:C,placeholder:"\u8BF7\u8F93\u5165\u4E13\u8F91\u540D\u79F0 ",background:"transparent"},{left:()=>t(z,null,{default:()=>[t(Q,{titleClass:n.titleActive,title:"\u7B5B\u9009",ref:_},{default:()=>[t(K,{type:"ALBUM",isReset:!0,searchParams:l.platformType==="TEACHER"?c.value:d,onComfirm:A},null)]})]})}),t(V,{shrink:!0,class:n.tagTabs,lineHeight:0,"onClick-tab":a=>{r.albumTagIds=a.name,s.value=null,r.page=1,m()}},{default:()=>[t(H,{title:"\u5168\u90E8",name:""},null),e.map(a=>t(H,{title:a.name,name:a.id},null))]})])})]}),t(J,{class:n.headerImg,src:ee},null)]),s.value&&s.value.rows.length?t("div",{class:n.musicGrid},[t(W,{showLight:w,lightText:g.value,list:s.value.rows,onGoto:a=>{const o=l.platformType==="TEACHER"?c.value:d;console.log(o),q.push({name:"music-album-detail",params:{id:a.id},query:{subjectId:o.id,subjectName:o.name}})}},null)]):!b.value&&t("div",{style:"height: calc(100vh - var(--header-height));display: flex;align-items: center;"},[t(O,{tips:"\u6682\u65E0\u4E13\u8F91",classImgSize:"SMALL",btnStatus:!1},null)])]})])}}});export{Ne as default};