index.ebfd4646.js 2.8 KB

1
  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 _,b9 as O,ak as A,P as I,m as l,g as u}from"./index.5f7ffb46.js";import{C as K}from"./index.07ad7331.js";import{c as j}from"./index.b28db9f5.js";import{O as x}from"./index.05515b24.js";import{P as E}from"./index.de1f78a6.js";import"./Picker.148c9d83.js";import"./index.6bbd7daa.js";import"./use-tab-status.69b57a37.js";import"./index.99e0cf1f.js";import"./index.61ab9823.js";const R="_lessonCourseware_hwgf4_1",T="_filter_hwgf4_7";var d={lessonCourseware:R,filter:T},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(A,{tips:"\u6CA1\u6709\u8BFE\u4EF6"},null),r(I,{position:"bottom",round:!0,show:o.actionShow,"onUpdate:show":e=>o.actionShow=e},{default:()=>[r(E,{class:"popupBottomSearch",columns:p.value,onCancel:()=>o.actionShow=!1,onConfirm:({selectedOptions:e})=>{f(e[0])}},null)]})])}});export{U as default};