index.963b9a9d.js 4.4 KB

1
  1. import{d as p,g as a,w as n,j as e,M as m,C as f,aR as b,Z as S}from"./index.394decd7.js";import{C as j}from"./index.e6e212d8.js";import{S as g}from"./index.ada5e712.js";import{S as L}from"./index.3bbf4ddb.js";import{L as N}from"./index.dc786267.js";import{V as y}from"./video-item.cf39bfa9.js";import{O as v}from"./organ-search.9a8e75c7.js";import{a as c,S as u,u as C}from"./hooks.9e5ee122.js";import"./index.9e0d46e4.js";import"./index.224299a1.js";import"./use-id.e2f22365.js";import"./use-tab-status.723110ee.js";import"./index.ae2dd816.js";import"./index.dab716ce.js";const T="_videoClass_1udm0_1",_="_label_1udm0_9",E="_classHeader_1udm0_21",w="_banner_1udm0_24",D="_videoList_1udm0_28";var o={videoClass:T,label:_,classHeader:E,banner:w,videoList:D};function I(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!S(t)}var M=p({name:"VideoClass",data(){return{apiSuffix:a.platformType==="STUDENT"?"/api-student":"/api-teacher",search:"",list:[],dataShow:!0,loading:!1,finished:!1,listLoading:!0,params:{search:"",lessonSubject:null,subjectName:"\u5168\u90E8\u58F0\u90E8",page:1,rows:20},searchStatus:!1,openStatus:!1,subjectList:[]}},async mounted(){var t;try{const s=await n.get(`${this.apiSuffix}/subject/subjectSelect?type=VIDEO`);this.subjectList=s.data||[]}catch{}if(a.platformType==="TEACHER"){const s=a.user.data;s.defaultSubject&&(this.params.lessonSubject=s.defaultSubject,this.params.subjectName=s.defaultSubjectName)}else{const s=c(u.VIDEO);if(s.id)this.params.lessonSubject=Number(s.id),this.params.subjectName=s.name;else{const r=this.subjectList,i=((t=a.user.data)==null?void 0:t.subjectId)||"",h=i?Number(i.split(",")[0]):null;r.forEach(d=>{(d.subjects||[]).forEach(l=>{l.id===Number(h)&&(this.params.lessonSubject=l.id,this.params.subjectName=l.name)})})}}this.listLoading=!1,this.getList(),C("\u89C6\u9891\u8BFE")},methods:{async getList(){try{if(this.listLoading)return;this.listLoading=!0;const t={...this.params};a.version&&(t.version=a.version||"",t.platform=a.platformType==="STUDENT"?"ios-student":"ios-teacher");const s=a.platformType==="STUDENT"?"/api-student/videoLesson/selectGroup":"/api-teacher/videoLessonGroup/page";t.myself=!1;const r=await n.post(s,{data:{...t}});this.loading=!1;const i=r.data||{};if(this.list.length>0&&i.pageNo===1)return;this.list=this.list.concat(i.rows||[]),this.finished=i.pageNo>=i.totalPage,this.params.page=i.pageNo+1,this.dataShow=this.list.length>0}catch{this.dataShow=!1,this.finished=!0}finally{this.listLoading=!1}},async setDefaultSubject(t){try{await n.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:t}})}catch{}},onSort(){this.params.page=1,this.list=[],this.dataShow=!0,this.loading=!1,this.finished=!1,this.searchStatus=!1,a.platformType==="TEACHER"?this.setDefaultSubject(this.params.lessonSubject):this.params.lessonSubject&&c(u.VIDEO,JSON.stringify({id:this.params.lessonSubject,name:this.params.subjectName}),"set"),this.getList()},onSearch(t){this.params.search=t,this.onSort()},onDetail(t){const s={groupId:t.id};a.platformType==="TEACHER"&&(s.share=1),this.$router.push({path:"/videoDetail",query:s})}},render(){let t;return e("div",{class:o.videoClass},[e(L,{offsetTop:0,position:"top"},{default:()=>[e(j,{class:o.classHeader,border:!1,isFixed:!1,background:"transparent"},null),e(g,{placeholder:"\u8BF7\u8F93\u5165\u8001\u5E08\u540D\u79F0/\u8BFE\u7A0B\u540D\u79F0",onSearch:this.onSearch},{left:()=>e("div",{class:o.label,onClick:()=>{this.searchStatus=!this.searchStatus,this.openStatus=!this.openStatus}},[this.params.subjectName,e(m,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])})]}),e("div",null,[this.dataShow?e(N,{class:o.videoList,loading:this.loading,"onUpdate:loading":s=>this.loading=s,finished:this.finished,finishedText:"\u6CA1\u6709\u66F4\u591A\u4E86",onLoad:this.getList,immediateCheck:!1},I(t=this.list.map(s=>e(y,{item:s,onClick:this.onDetail},null)))?t:{default:()=>[t]}):e(f,{btnStatus:!1,tips:"\u6682\u65E0\u89C6\u9891\u8BFE"},null)]),e(b,{show:this.searchStatus,position:"bottom",round:!0,closeable:!0,"safe-area-inset-bottom":!0,onClose:()=>this.searchStatus=!1,onClosed:()=>this.openStatus=!1},{default:()=>[this.openStatus&&e(v,{subjectList:this.subjectList,onSort:this.onSort,modelValue:this.params.lessonSubject,"onUpdate:modelValue":s=>this.params.lessonSubject=s,subjectName:this.params.subjectName,"onUpdate:subjectName":s=>this.params.subjectName=s},null)]})])}});export{M as default};