1 |
- import{d as t,u as e,r as a,o as s,s as o,c as i,a as n,O as r,T as l,b as c,i as u,e as d}from"./index-81a4e71e.js";import{C as m}from"./index-9ac54cf3.js";import{O as p}from"./index-74ca1941.js";import{O as j}from"./index-a43b7d41.js";import{T as b,a as y}from"./index-58f4f4cf.js";import"./index-4b58cac2.js";import"./use-tab-status-897a9431.js";import"./index-677657d2.js";const f=t({name:"lessonCourseware",setup(){const t=e(),f=a({loading:!0,list:[],subjectList:[],actionShow:!1,actionKey:0}),g=async()=>{f.loading=!0;try{const t=(await d.post(o.platformApi+"/lessonCourseware/queryLessonCourseware",{data:{subjectId:f.actionKey?f.actionKey:null,page:1,rows:999}})).data.rows.map((t=>({...t,coverImg:t.cover,name:t.name,id:t.id,courseNum:t.courseNum})));f.list=t}catch(t){}f.loading=!1};s((async()=>{try{await(async()=>{try{const t=await d.get(o.platformApi+"/lessonCourseware/getLessonCoursewareSubjectList");f.subjectList=t.data||[]}catch(t){}})();const t="TEACHER"===o.platformType?o.user.data.subjectId:o.user.data.student.subjectIdList,e=t?t.split(",")[0]:0;f.subjectList.forEach((t=>{Number(e)===t.id&&(f.actionKey=Number(e))})),await g()}catch(t){}f.loading=!1}));const v=i((()=>{const t=f.subjectList.map((t=>({id:t.id,name:t.name,text:t.name,value:t.id})));return t.unshift({id:"",name:"课程类型",text:"全部",value:0}),t}));return()=>{let e;return n("div",{"class":["_lessonCourseware_1jqzi_1"]},[n(j,{position:"top"},{"default":()=>{return[n(r,{border:!1,background:"transparent",color:"#131415"},null),n(b,{active:f.actionKey,"onUpdate:active":t=>f.actionKey=t,shrink:!0,onClickTab:t=>{f.actionKey=t.name,g()}},(t=e=v.value.map((t=>n(y,{title:t.text,name:t.value},null))),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!u(t)?e:{"default":()=>[e]}))];var t}}),n(l,{name:"van-fade"},{"default":()=>[!f.loading&&Object.values(f.list).length>0&&n(m,{list:f.list,onItemClick:e=>{return a=e,void t.push({path:"/courseList",query:{id:a.lessonCoursewareId}});var a}},null)]}),f.loading&&n(p,null,null),!f.loading&&!Object.values(f.list).length&&n("div",{style:{minHeight:"calc(100vh - var(--header-height))",display:"flex",alignItems:"center"}},[n(c,{tips:"暂无课件"},null)])])}}});export{f as default};
|