index.80b426ea.js 1.7 KB

1
  1. import{d as m,aV as g,ag as p,r as y,$ as _,c as s,q as c,ai as f,ak as h,m as u,f as i}from"./index.ffe80dbe.js";import{G as v,a as I}from"./index.72ca63b9.js";const q="_grid_15ttl_1",w="_gridItem_15ttl_8",C="_cover_15ttl_16",N="_title_15ttl_27",b="_num_15ttl_34",k="_look_15ttl_49";var a={grid:q,gridItem:w,cover:C,title:N,num:b,look:k};function x(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!h(r)}var V=m({name:"lessonCourseware",setup(){const r=g(),l=p(),o=y({loading:!0,list:[]}),n=async()=>{if(o.loading=!0,r.query.code==="select")try{const t=await u.post(i.platformApi+`/courseSchedule/getCourseware/${r.query.courseScheduleId}`);Array.isArray(t==null?void 0:t.data)&&(o.list=t.data.map(e=>({coverImg:e.coverImg,name:e.coursewareName,id:e.lessonCoursewareId,courseNum:e.coursewareNum})))}catch{}else try{const t=await u.post(i.platformApi+"/courseSchedule/myCourseware");Array.isArray(t==null?void 0:t.data)&&(o.list=t.data)}catch{}o.loading=!1};_(()=>{n()});const d=t=>{if(r.query.code==="select"){l.push({path:"/courseList",query:{...r.query,id:t.id}});return}l.push({path:"/courseList",query:{id:t.id}})};return()=>{let t;return s("div",{style:{paddingTop:"14px",boxSizing:"border-box"},class:!o.list.length&&"emptyRootContainer"},[s(v,{gutter:14,columnNum:3,class:a.grid},x(t=o.list.map(e=>s(I,null,{default:()=>[s("div",{class:a.gridItem,style:{background:e.coverImg?"":`hsla(${Math.floor(Math.random()*360)},50%,50%,.8)`},onClick:()=>d(e)},[s("img",{src:e.coverImg,class:a.cover},null),s("div",{class:a.num},[c("\u5171"),e.courseNum,c("\u8BFE")])])]})))?t:{default:()=>[t]}),!o.loading&&!o.list.length&&s(f,{tips:"\u6CA1\u6709\u8BFE\u4EF6"},null)])}}});export{V as default};