index-289252d5.js 2.2 KB

1
  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-232a7449.js";import{C as m}from"./index-c79a83ad.js";import{O as p}from"./index-1122f646.js";import{O as j}from"./index-3a61b26a.js";import{T as b,a as y}from"./index-c6e67a85.js";import"./index-725b9e0a.js";import"./use-tab-status-ce3b98bb.js";import"./index-0f37f75c.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};