1 |
- import{d,ag as f,r as m,$ as S,e as g,b7 as w,c as s,aj as v,a5 as y,q as n,ak as L,al as O,m as E,g as k}from"./index.5f7ffb46.js";import{O as C}from"./index.7790de2a.js";import{s as i}from"./index.module.9976e9f3.js";import{d as R}from"./index.b28db9f5.js";import{O as I}from"./index.1d6ac2c5.js";import{O as T}from"./index.fdad9231.js";import{L as P}from"./index.9ef28852.js";import{C as V}from"./index.abd668f7.js";import{T as b}from"./index.ab2541bb.js";import"./index.78e196a2.js";import"./use-tab-status.69b57a37.js";function x(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!O(o)}var G=d({name:"my-orchestra",setup(){const o=f(),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",u=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 E.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}},p=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(C,{position:"top",onGetHeight:e=>{t.listState.height=e}},{default:()=>[s(v,null,{right:()=>s(y,{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(P,{finished:t.listState.finished,finishedText:" ",class:[i.liveList],onLoad:l,immediateCheck:!1},x(a=t.list.map(e=>s(V,{isLink:!0,center:!0,class:i.oCell,onClick:()=>p(e)},{title:()=>s("div",{class:i.oTitle},[s("div",null,[e.name]),s(b,{style:{marginLeft:"6px",flexShrink:0},color:e.type==="DELIVERY"?"#FF8057":"#64A9FF"},{default:()=>[R[e.type]]})]),label:()=>s("p",null,[n("\u5B66\u5458\u4EBA\u6570\uFF1A"),e.currentStudentNum||0,n("\u4EBA")])})))?a:{default:()=>[a]})]}):s(L,{btnStatus:!1,tips:"\u6682\u65E0\u4E50\u56E2"},null),s(T,{show:t.showPopover,"onUpdate:show":e=>t.showPopover=e,actions:t.actions,onSelect:u},null)])}}});export{G as default};
|