index.3ec484b0.js 4.4 KB

1
  1. import{C as p}from"./index.c5bf3ab5.js";import{C as m}from"./index.0f4f72db.js";import{d as f,s as a,e as n,i as e,N as b,C as S,aT as j,$ as g}from"./index.7994470a.js";import{S as N}from"./index.6449f9de.js";import{L}from"./index.ec643df3.js";import{V as y}from"./video-item.d15b57fc.js";import{O as v}from"./organ-search.a3a0b5a1.js";import{a as c,u as C,S as u}from"./hooks.04c1f931.js";import"./index.0a2aeb2c.js";import"./use-height.ffa5a0f3.js";import"./index.777f4790.js";import"./index.3dd26d27.js";import"./use-id.117b75b2.js";import"./use-tab-status.00d7316c.js";import"./index.2fbdc579.js";import"./index.0262b810.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]"&&!g(t)}var M=f({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(N,{offsetTop:0,position:"top"},{default:()=>[e(p,{class:o.classHeader,border:!1,isFixed:!1,background:"transparent"},null),e(m,{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(b,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])})]}),e("div",null,[this.dataShow?e(L,{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(S,{btnStatus:!1,tips:"\u6682\u65E0\u89C6\u9891\u8BFE"},null)]),e(j,{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};