1 |
- import{d as f,ag as d,r as m,$ as S,k as g,a_ as w,c as s,a5 as v,q as n,ai as y,ak as O,m as L,f as k}from"./index.ffe80dbe.js";import{O as C}from"./index.a0ef77e4.js";import{O as E}from"./index.4ddd16f0.js";import{s as i}from"./index.module.9976e9f3.js";import{b as R}from"./index.931cf0b8.js";import{O as I}from"./index.45b38760.js";import{O as T}from"./index.6daa5b04.js";import{L as F}from"./index.cafcb8b5.js";import{C as P}from"./index.ea031708.js";import{T as V}from"./index.55ba7429.js";import"./index.1d5c6f70.js";import"./index.84851ef1.js";import"./use-tab-status.5a3cd090.js";function b(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!O(o)}var $=f({name:"my-orchestra",setup(){const o=d(),t=m({showPopover:!1,actions:[{name:"\u5168\u90E8\u4E50\u56E2",selected:!0,value:"ALL"},{name:"\u4EA4\u4ED8\u56E2",value:"DELIVERY"},{name:"\u664B\u5347\u56E2",value:"PROMOTION"}],isClick:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1,refreshing:!1,height:0},params:{type:null,status:"DONE",page:1,rows:20}}),c=a=>({DELIVERY:"\u4EA4\u4ED8\u56E2",PROMOTION:"\u664B\u5347\u56E2"})[a]||"\u5168\u90E8\u4E50\u56E2",p=a=>{t.actions.forEach(e=>{e.selected=!1}),a.selected=!0,t.params.type=a.value==="ALL"?null:a.value,t.showPopover=!1,t.params.page=1,t.list=[],t.listState.dataShow=!0,t.listState.loading=!1,t.listState.finished=!1,l()},l=async()=>{try{if(t.isClick)return;t.isClick=!0;const a=await L.post("/api-school/orchestra/page",{data:{...t.params,schoolId:k.user.data.school.id}});t.listState.loading=!1,t.listState.refreshing=!1;const e=a.data||{};if(t.list.length>0&&e.current===1)return;t.list=t.list.concat(e.rows||[]),t.listState.finished=e.current>=e.pages,t.params.page=e.current+1,t.listState.dataShow=t.list.length>0,t.isClick=!1}catch{t.listState.dataShow=!1,t.listState.finished=!0,t.listState.refreshing=!1,t.isClick=!1}},u=a=>{console.log(a),o.push({path:"/orchestra-detail",query:{id:a.id}})},h=()=>{t.params.page=1,t.list=[],t.listState.dataShow=!0,t.listState.loading=!1,t.listState.finished=!1,l()};S(()=>{l(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",r,!1)});const r=()=>{g({api:"back"})};return w(()=>{window.removeEventListener("popstate",r)}),()=>{let a;return s("div",{class:!t.listState.dataShow&&"emptyRootContainer"},[s(E,{position:"top",onGetHeight:e=>{t.listState.height=e}},{default:()=>[s(C,null,{right:()=>s(v,{name:"plus",size:19,color:"#333",onClick:()=>{o.push("/create-orchestra")}},null)}),s("div",{class:"searchGroup-single"},[s("span",{onClick:()=>t.showPopover=!0,class:["searchItem",t.showPopover?"searchItem-active":""]},[c(t.params.type)])])]}),t.listState.dataShow?s(I,{modelValue:t.listState.refreshing,"onUpdate:modelValue":e=>t.listState.refreshing=e,onRefresh:h,style:{minHeight:`calc(100vh - ${t.listState.height}px)`}},{default:()=>[s(F,{finished:t.listState.finished,finishedText:" ",class:[i.liveList],onLoad:l,immediateCheck:!1},b(a=t.list.map(e=>s(P,{isLink:!0,center:!0,class:i.oCell,onClick:()=>u(e)},{title:()=>s("div",{class:i.oTitle},[s("div",null,[e.name]),s(V,{style:{marginLeft:"6px",flexShrink:0},color:e.type==="DELIVERY"?"#FF8057":"#64A9FF"},{default:()=>[R[e.type]]})]),label:()=>s("p",null,[n("\u5B66\u751F\u4EBA\u6570\uFF1A"),e.currentStudentNum||0,n("\u4EBA")])})))?a:{default:()=>[a]})]}):s(y,{btnStatus:!1,tips:"\u6682\u65E0\u4E50\u56E2"},null),s(T,{show:t.showPopover,"onUpdate:show":e=>t.showPopover=e,actions:t.actions,onSelect:p},null)])}}});export{$ as default};
|