index.04d11e11.js 3.4 KB

12
  1. import{d,ag as f,r as m,$ as S,e as g,b3 as w,c as s,aj as v,a5 as y,q as n,ak as L,al as O,m as k,g as C}from"./index.1c621181.js";import{O as E}from"./index.b491c24a.js";import{s as i}from"./index.module.9976e9f3.js";import{d as R}from"./index.38b203e1.js";import{O as I}from"./index.b0685ec5.js";import{O as T}from"./index.ff934114.js";import{L as P}from"./index.d5ee0b18.js";import{C as V}from"./index.fd5ae97b.js";import{T as b}from"./index.4e64eb97.js";import"./index.7c36c16c.js";import"./use-tab-status.40058c51.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",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 k.post("/api-school/orchestra/page",{data:{...t.params,schoolId:C.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(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:()=>u(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:p},null)])}}});export{G as default};