index-f0c3f95e.js 4.1 KB

1
  1. import{d as t,f as s,u as e,r as a,W as i,o,c as r,a as n,O as c,T as l,b as u,F as d,i as m,e as p,s as y,t as g}from"./index-d31722d5.js";import{O as v}from"./index-c77244c9.js";import{C as f}from"./index-76e8a1aa.js";import{O as h}from"./index-f2a9f072.js";import{T as _,a as w}from"./index-61fa7ae7.js";import{I as b}from"./index-59a10749.js";import"./index-aec66e25.js";import"./index-1f639c9e.js";import"./use-tab-status-fc601ac5.js";import"./index-fd20d453.js";const j=t({name:"courseList",setup(){const t=s(),j=e(),x=t.query.type;let L="music";"onlymusic"!==x&&(L=x);const C=a({topKey:L||"music",list:[],show:!0,actionKey:0,loading:!0,subjectList:[],classList:[],titleOpacity:0}),K=async()=>{try{const t=await p.get(y.platformApi+"/sysMusicScoreCategories/queryTree");C.list=t.data||[],C.show=C.list.length>0}catch(t){}},I=async()=>{C.loading=!0;try{const t=(await p.post(y.platformApi+"/lessonCourseware/queryLessonCourseware",{data:{subjectId:C.actionKey?C.actionKey:null,page:1,rows:999}})).data.rows.map((t=>({...t,coverImg:t.cover,name:t.name,id:t.id,courseNum:t.courseNum})));C.classList=t}catch(t){}C.loading=!1},O=async()=>{try{await(async()=>{try{const t=await p.get(y.platformApi+"/lessonCourseware/getLessonCoursewareSubjectList");C.subjectList=t.data||[]}catch(t){}})();const t="TEACHER"===y.platformType?y.user.data.subjectId:y.user.data.student.subjectIdList,s=t?t.split(",")[0]:0;C.subjectList.forEach((t=>{Number(s)===t.id&&(C.actionKey=Number(s))})),await I()}catch(t){}C.loading=!1,g({api:"getCoursewareSelectResult"},(t=>{if(null==t?void 0:t.content)return y.max=t.content.max,void(y.vIds=t.content.coursewareIds||[])}))};i("scroll",(()=>{const t=window.scrollY||window.pageYOffset||document.documentElement.scrollTop;C.titleOpacity=t>100?1:t/100})),o((async()=>{"music"===C.topKey?K():O()}));const S=r((()=>{const t=C.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 s;return n("div",{"class":"_choiseHomework_uxrta_1"},[n(v,{position:"top"},{"default":()=>{return[n(c,{border:!1,background:"transparent",color:"#131415"},null),"onlymusic"!==x&&n("div",{"class":"_topTabs_uxrta_14"},[n(_,{border:!1,active:C.topKey,"onUpdate:active":t=>C.topKey=t,onClickTab:t=>{C.topKey=t.name,"music"===C.topKey?C.list.length<=0&&K():"courseware"===C.topKey&&(C.subjectList.length<=0||C.classList.length<=0)&&O()}},{"default":()=>[n(w,{title:"云练习",name:"music"},null),n(w,{title:"云课堂",name:"courseware"},null)]}),"courseware"===C.topKey&&n(_,{"class":"_classroomTab_uxrta_35",active:C.actionKey,"onUpdate:active":t=>C.actionKey=t,shrink:!0,onClickTab:t=>{C.actionKey=t.name,I()}},(t=s=S.value.map((t=>n(w,{title:t.text,name:t.value},null))),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!m(t)?s:{"default":()=>[s]}))])];var t}}),n("div",{"class":["_container_uxrta_50","courseware"===C.topKey?"_containerClass_uxrta_56":"","onlymusic"===x?"_containerClassOnly_uxrta_71":""]},["music"===C.topKey?n(l,{name:"van-fade"},{"default":()=>[n("div",{"class":"_items_uxrta_77"},[C.show?C.list.map((s=>n("div",{key:s.id,onClick:()=>(s=>{var e;const a=s.sysMusicScoreCategoriesList?s.sysMusicScoreCategoriesList.length:0;sessionStorage.setItem("musicScoreList",JSON.stringify(s.sysMusicScoreCategoriesList)),a>1?j.push({path:"/classify",query:{parentId:s.id,...t.query}}):j.push({path:"/music-list/"+(1==a?null==(e=s.sysMusicScoreCategoriesList[0])?void 0:e.id:s.id),query:{...t.query}})})(s)},[n("div",{"class":"_inner_uxrta_87"},[n(b,{src:s.coverImg,"class":"_img_uxrta_91"},null)])]))):n(u,{tips:"暂无数据"},null)])]}):n(d,null,[n(l,{name:"van-fade"},{"default":()=>[!C.loading&&Object.values(C.classList).length>0&&n(f,{list:C.classList,onItemClick:t=>{return s=t,void j.push({path:"/classroom-detail",query:{id:s.lessonCoursewareId}});var s}},null)]}),C.loading&&n(h,null,null),!C.loading&&!Object.values(C.classList).length&&n("div",{style:{minHeight:"calc(100vh - var(--header-height))",display:"flex",alignItems:"center"}},[n(u,{tips:"暂无课件"},null)])])])])}}});export{j as default};