1 |
- import{d as S,ag as g,r as y,f as m,R as c,$ as v,k as E,a_ as R,c as a,a5 as w,q as C,ai as L,ak as O,m as T,o as U}from"./index.ffe80dbe.js";import{O as k}from"./index.a0ef77e4.js";import{O as x}from"./index.c7af3af2.js";import{O as I}from"./index.4ddd16f0.js";import{s as u,U as P}from"./unit-list-item.ce50717f.js";import{O as V}from"./index.45b38760.js";import{O as b}from"./index.6daa5b04.js";import{L as N}from"./index.cafcb8b5.js";import"./index.1d5c6f70.js";import"./index.92ec0bf4.js";import"./index.ea031708.js";import"./icon-edit.664c5ff1.js";import"./icon-muit-message.0a72e92d.js";import"./index.914765a1.js";import"./index.7e972106.js";import"./index.84851ef1.js";import"./use-tab-status.5a3cd090.js";var B="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAAAXNSR0IArs4c6QAAALtJREFUWEftmNENwyAMRPEgyRJmiUzSmTpJlsBLlEGokKiEojTSxVRC1fFtH9YDzIGEASPGuJVSnlVKRB4ppd0rK16Bmq+qrxDC0rSyma1e3VGFlb4QM3PrugUaMRYGbRFVJTES+0aApxLaG/UGQRPO4nkqUYokRmIXBKQzeR8/hQIbHZ+r2ZSDyRs9yV29PG9h0y7lXdZ9HvsYSpHESOyq86N06MdIDCRAzw8C4ysJBfb/xOb86vzF5/AbfM2i57toBH8AAAAASUVORK5CYII=";function G(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!O(o)}var te=S({name:"unit-list",setup(){const o=g(),e=y({oPopover:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},statusText:"\u73ED\u7EA7\u7C7B\u578B",params:{keyword:null,classTypeCode:null,page:1,rows:20},isClick:!1,action:[{name:"\u73ED\u7EA7\u7C7B\u578B",id:"ALL",selected:!0},{name:"\u5355\u6280\u73ED",id:"SINGLE"},{name:"\u4E50\u7406\u73ED",id:"MUSIC_THEORY"},{name:"\u5408\u594F\u73ED",id:"INSTRUMENTAL_ENSEMBLE"}]}),n=m.platformApi,i=c(!1),l=c(!1),r=async()=>{if(!e.isClick){e.isClick=!0,l.value=!0;try{i.value&&(e.params.page=1,e.list=[],i.value=!1);const s=m.platformType==="TEACHER"?`${n}/studentUnitExamination/queryPageByTeacher`:`${n}/studentUnitExamination/queryPageByManage`,t=await T.post(s,{data:{...e.params}});if(e.list.length>0&&t.data.pages===1)return;e.params.page=t.data.current+1,e.list=t.data.rows,e.listState.dataShow=e.list.length>0,l.value=!1,e.listState.finished=t.data.current>=t.data.pages}catch(s){const t=s.message;U(t),e.listState.dataShow=!1,e.listState.finished=!0}e.isClick=!1}},f=()=>{e.listState.finished=!0,l.value=!0,r()},p=()=>{e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,r()};v(()=>{r(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",d,!1)});const d=()=>{E({api:"back"})};R(()=>{window.removeEventListener("popstate",d)});const h=()=>{sessionStorage.removeItem("unit-create"),o.push("/unit-create")};return()=>{let s;return a("div",{class:u.unitTest},[a(I,{position:"top",onGetHeight:t=>{document.documentElement.style.setProperty("--header-height",t+"px")}},{default:()=>[a(k,{border:!1},{right:()=>n=="/api-teacher"?a(w,{name:B,size:19,onClick:h},null):null}),a(x,{placeholder:"\u8BF7\u8F93\u5165\u6D4B\u9A8C\u540D\u79F0",onSearch:t=>{e.params.keyword=t,p()}},{left:()=>a("div",{class:["searchItem-left",e.oPopover?"searchItem-active":""],onClick:()=>e.oPopover=!0},[a("span",null,[e.statusText,C(" ")])])})]}),e.listState.dataShow?a(V,{modelValue:i.value,"onUpdate:modelValue":t=>i.value=t,onRefresh:f,style:"min-height: calc(100vh - var(--header-height));"},{default:()=>[a(N,{finished:e.listState.finished,finishedText:" ",class:[u.liveList],onLoad:r,style:{paddingTop:"12px"},immediateCheck:!1},G(s=e.list.map(t=>a(P,{item:t},null)))?s:{default:()=>[s]})]}):a(L,{tips:"\u6682\u65E0\u9636\u6BB5\u81EA\u6D4B"},null),a(b,{show:e.oPopover,"onUpdate:show":t=>e.oPopover=t,actions:e.action,onSelect:t=>{e.action.forEach(A=>{A.selected=!1}),t.selected=!0,e.statusText=t.name,e.params.classTypeCode=t.id==="ALL"?null:t.id,e.oPopover=!1,p()}},null)])}}});export{te as default};
|