unit-Lesson.5ff6a9f8.js 1.7 KB

1
  1. import{d as m,ah as d,ag as g,R as p,r as f,$ as h,c as o,aj as y,ak as N,m as I,g as C}from"./index.5f7ffb46.js";import{C as v}from"./index.07ad7331.js";import{O as w}from"./index.7790de2a.js";const O="_unitLesson_qa46k_1";var b={unitLesson:O},q=m({name:"unit-Lesson",setup(){const u=d(),n=g(),a=p({}),t=f({loading:!0,list:[]}),l=e=>{const r={};for(let s=0;s<e.length;s++)r[e[s].sortNo]?r[e[s].sortNo].push(e[s]):r[e[s].sortNo]=[e[s]];return r},c=async()=>{t.loading=!0;try{const e=await I.post(C.platformApi+"/courseSchedule/getCoursewareByClassId",{requestType:"form",data:{classGroupId:u.query.classGroupId}});if(Array.isArray(e==null?void 0:e.data)){const r=e.data.filter(s=>s.unitTestNum).map(s=>({...s,coverImg:s.coverImg,name:s.coursewareName,id:s.lessonCoursewareId,courseNum:s.coursewareNum,courseNumName:`\u5171${s.coursewareNum}\u6B21\u6D4B\u9A8C`}));t.list=l(r)}}catch(e){console.log(e)}t.loading=!1};h(()=>{a.value={...JSON.parse(sessionStorage.getItem("unit-create")||"{}")},c()});const i=e=>{a.value.coursewareName=e.coursewareName,a.value.lessonCoursewareId=e.lessonCoursewareId,sessionStorage.setItem("unit-create",JSON.stringify(a.value)),n.push({path:"/uni-test",query:{lessonCoursewareId:e.lessonCoursewareId}})};return()=>o("div",{class:[b.unitLesson,Object.values(t.list).length?"":"emptyRootContainer"]},[o(w,{onGetHeight:e=>{document.documentElement.style.setProperty("--header-height",e+"px")}},{default:()=>[o(y,{border:!1,background:"rgba(255, 232, 206, 1)",color:"rgba(124, 61, 18, 1)",title:"\u9009\u62E9\u6559\u6750"},null)]}),Object.keys(t.list).map(e=>o(v,{term:e,list:t.list[e],onItemClick:r=>i(r)},null)),!t.loading&&!Object.values(t.list).length&&o(N,{btnStatus:!1,tips:"\u6682\u65E0\u6559\u6750"},null)])}});export{q as default};