1 |
- import{d as t,f as s,u as e,r as a,k as i,o,c as n,a as r,O as c,T as l,b as u,F as d,i as m,e as p,s as y,p as g}from"./index-232a7449.js";import{O as v}from"./index-3a61b26a.js";import{C as f}from"./index-c79a83ad.js";import{O as h}from"./index-1122f646.js";import{T as _,a as b}from"./index-c6e67a85.js";import{I as w}from"./index-4d5d4bfb.js";import"./index-725b9e0a.js";import"./use-tab-status-ce3b98bb.js";import"./index-0f37f75c.js";const x=t({name:"courseList",setup(){const t=s(),x=e(),j=t.query.type;let L="music";"onlymusic"!==j&&(L=j);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=n((()=>{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 r("div",{"class":"_choiseHomework_uxrta_1"},[r(v,{position:"top"},{"default":()=>{return[r(c,{border:!1,background:"transparent",color:"#131415"},null),"onlymusic"!==j&&r("div",{"class":"_topTabs_uxrta_14"},[r(_,{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":()=>[r(b,{title:"云练习",name:"music"},null),r(b,{title:"云课堂",name:"courseware"},null)]}),"courseware"===C.topKey&&r(_,{"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=>r(b,{title:t.text,name:t.value},null))),"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!m(t)?s:{"default":()=>[s]}))])];var t}}),r("div",{"class":["_container_uxrta_50","courseware"===C.topKey?"_containerClass_uxrta_56":"","onlymusic"===j?"_containerClassOnly_uxrta_71":""]},["music"===C.topKey?r(l,{name:"van-fade"},{"default":()=>[r("div",{"class":"_items_uxrta_77"},[C.show?C.list.map((s=>r("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?x.push({path:"/classify",query:{parentId:s.id,...t.query}}):x.push({path:"/music-list/"+(1==a?null==(e=s.sysMusicScoreCategoriesList[0])?void 0:e.id:s.id),query:{...t.query}})})(s)},[r("div",{"class":"_inner_uxrta_87"},[r(w,{src:s.coverImg,"class":"_img_uxrta_91"},null)])]))):r(u,{tips:"暂无数据"},null)])]}):r(d,null,[r(l,{name:"van-fade"},{"default":()=>[!C.loading&&Object.values(C.classList).length>0&&r(f,{list:C.classList,onItemClick:t=>{return s=t,void x.push({path:"/classroom-detail",query:{id:s.lessonCoursewareId}});var s}},null)]}),C.loading&&r(h,null,null),!C.loading&&!Object.values(C.classList).length&&r("div",{style:{minHeight:"calc(100vh - var(--header-height))",display:"flex",alignItems:"center"}},[r(u,{tips:"暂无课件"},null)])])])])}}});export{x as default};
|