index.30618ccd.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.e6d6174e.js";import{C as j}from"./index.045f03fd.js";import{S as g}from"./index.c42f80e3.js";import{S as L}from"./index.9093bc60.js";import{L as N}from"./index.f904775d.js";import{V as y}from"./video-item.589f57ee.js";import{O as v}from"./organ-search.02ca21ae.js";import{a as c,S as u,u as C}from"./hooks.00b5b341.js";import"./index.d8c651bf.js";import"./use-height.8140ea04.js";import"./index.af99cf22.js";import"./index.17d70acf.js";import"./use-id.f239f36f.js";import"./use-tab-status.e9ba8498.js";import"./index.67c54471.js";import"./index.05f2b7dd.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(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!S(s)}var B=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 s;try{const t=await n.get(`${this.apiSuffix}/subject/subjectSelect?type=VIDEO`);this.subjectList=t.data||[]}catch{}if(a.platformType==="TEACHER"){const t=a.user.data;t.defaultSubject&&(this.params.lessonSubject=t.defaultSubject,this.params.subjectName=t.defaultSubjectName)}else{const t=c(u.VIDEO);if(t.id)this.params.lessonSubject=Number(t.id),this.params.subjectName=t.name;else{const r=this.subjectList,i=((s=a.user.data)==null?void 0:s.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 s={...this.params};a.version&&(s.version=a.version||"",s.platform=a.platformType==="STUDENT"?"ios-student":"ios-teacher");const t=a.platformType==="STUDENT"?"/api-student/videoLesson/selectGroup":"/api-teacher/videoLessonGroup/page";s.myself=!1;const r=await n.post(t,{data:{...s}});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(s){try{await n.post("/api-teacher/teacher/defaultSubject",{params:{subjectId:s}})}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(s){this.params.search=s,this.onSort()},onDetail(s){const t={groupId:s.id};a.platformType==="TEACHER"&&(t.share=1),this.$router.push({path:"/videoDetail",query:t})}},render(){let s;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":t=>this.loading=t,finished:this.finished,finishedText:"\u6CA1\u6709\u66F4\u591A\u4E86",onLoad:this.getList,immediateCheck:!1},I(s=this.list.map(t=>e(y,{item:t,onClick:this.onDetail},null)))?s:{default:()=>[s]}):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":t=>this.params.lessonSubject=t,subjectName:this.params.subjectName,"onUpdate:subjectName":t=>this.params.subjectName=t},null)]})])}});export{B as default};