1 |
- import{d as h,ah as y,ag as g,r as w,f as C,$ as v,y as b,c as r,aj as N,F as S,q,a5 as _,b5 as O,ak as I,P as A,m as l,g as u}from"./index.1c621181.js";import{C as K}from"./index.409c892b.js";import{c as j}from"./index.38b203e1.js";import{O as x}from"./index.35327acc.js";import{P as R}from"./index.53518914.js";import"./Picker.9bc4331c.js";import"./index.88a00aa9.js";import"./use-tab-status.40058c51.js";import"./index.78a302c3.js";import"./index.d5b73933.js";const T="_lessonCourseware_hwgf4_1",k="_filter_hwgf4_7";var d={lessonCourseware:T,filter:k},U=h({name:"lessonCourseware",setup(){const s=y(),n=g(),o=w({loading:!0,list:[],actionShow:!1,actionName:"\u8BFE\u7A0B\u7C7B\u578B",actionKey:"",showRight:s.query.code!="select"&&C().isTeacher}),i=e=>{const a={};for(let t=0;t<e.length;t++)a[e[t].sortNo]?a[e[t].sortNo].push(e[t]):a[e[t].sortNo]=[e[t]];return a},c=async()=>{if(o.loading=!0,s.query.code==="select")try{const e=await l.post(u.platformApi+`/courseSchedule/getCourseware/${s.query.courseScheduleId}`);if(Array.isArray(e==null?void 0:e.data)){const a=e.data.map(t=>({...t,coverImg:t.coverImg,name:t.coursewareName,id:t.lessonCoursewareId,courseNum:t.coursewareNum}));o.list=i(a),console.log("\u{1F680} ~ data.list:",o.list)}}catch{}else try{const e=await l.post(u.platformApi+"/courseSchedule/myCourseware");if(Array.isArray(e==null?void 0:e.data)){const a=o.actionKey?e.data.filter(t=>t.courseTypeCode===o.actionKey):e.data;o.list=i(a)}}catch{}o.loading=!1};v(()=>{c()});const m=e=>{if(s.query.code==="select"){n.push({path:"/courseList",query:{...s.query,id:e.id}});return}n.push({path:"/courseList",query:{id:e.id}})},p=b(()=>{const e=Object.entries(j).map(([a,t])=>({id:a,name:t,text:t,value:a,color:a===o.actionKey?"var(--van-primary)":""}));return e.unshift({id:"",name:"\u8BFE\u7A0B\u7C7B\u578B",text:"\u5168\u90E8",value:"",color:o.actionKey===""?"var(--van-primary)":""}),e}),f=e=>{o.actionKey=e.id,o.actionName=e.name,o.actionShow=!1,c()};return()=>r("div",{class:[d.lessonCourseware,!Object.values(o.list).length&&"emptyRootContainer"]},[r(N,{border:!1,background:"rgba(255, 232, 206, 1)",color:"rgba(124, 61, 18, 1)",title:"\u4E91\u6559\u6750"},{right:()=>r(S,null,[o.showRight&&r("div",{class:d.filter,onClick:()=>o.actionShow=!0},[o.actionName,q(" "),r(_,{style:{transform:"rotate(90deg)"},name:"play"},null)," "])])}),r(O,{name:"van-fade"},{default:()=>[!o.loading&&Object.keys(o.list).map(e=>r(K,{term:e,list:o.list[e],onItemClick:a=>m(a)},null))]}),o.loading&&r(x,null,null),!o.loading&&!Object.values(o.list).length&&r(I,{tips:"\u6CA1\u6709\u8BFE\u4EF6"},null),r(A,{position:"bottom",round:!0,show:o.actionShow,"onUpdate:show":e=>o.actionShow=e},{default:()=>[r(R,{class:"popupBottomSearch",columns:p.value,onCancel:()=>o.actionShow=!1,onConfirm:({selectedOptions:e})=>{f(e[0])}},null)]})])}});export{U as default};
|