var b=Object.defineProperty;var d=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var c=(s,t,e)=>t in s?b(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,l=(s,t)=>{for(var e in t||(t={}))j.call(t,e)&&c(s,e,t[e]);if(d)for(var e of d(t))S.call(t,e)&&c(s,e,t[e]);return s};import{C as g}from"./index.9a4c80cd.js";import{C as v}from"./index.2d1e9e4b.js";import{d as N,a,S as x,K as C,M as L,x as _,P as y}from"./vendor.3506a68e.js";/* empty css               *//* empty css               */import{V as T}from"./video-item.671e0008.js";import{s as o,r as h,C as w}from"./index.9e4b607f.js";import{O as E}from"./organ-search.5633eb2e.js";import{u,S as p}from"./hooks.6a14d51f.js";/* empty css               *//* empty css              *//* empty css               *//* empty css               *//* empty css                */const I="_videoClass_1udm0_1",V="_label_1udm0_9",D="_classHeader_1udm0_21",O="_banner_1udm0_24",k="_videoList_1udm0_28";var r={videoClass:I,label:V,classHeader:D,banner:O,videoList:k};function H(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!_(s)}var Y=N({name:"VideoClass",data(){return{apiSuffix:o.platformType==="STUDENT"?"/api-student":"/api-teacher",search:"",list:[],dataShow:!0,loading:!1,finished:!1,params:{search:"",lessonSubject:null,subjectName:"\u5168\u90E8\u58F0\u90E8",page:1,rows:20},searchStatus:!1,openStatus:!1,subjectList:[]}},async mounted(){var t;try{const e=await h.get(`${this.apiSuffix}/subject/subjectSelect?type=VIDEO`);this.subjectList=e.data||[]}catch{}const s=u(p.VIDEO);if(s.id)this.params.lessonSubject=Number(s.id),this.params.subjectName=s.name;else{const e=this.subjectList,i=((t=o.user.data)==null?void 0:t.subjectId)||"",m=i?Number(i.split(",")[0]):null;e.forEach(f=>{(f.subjects||[]).forEach(n=>{n.id===Number(m)&&(this.params.lessonSubject=n.id,this.params.subjectName=n.name)})})}this.getList()},methods:{async getList(){try{const s=l({},this.params);o.version&&(s.version=o.version||"",s.platform=o.platformType==="STUDENT"?"ios-student":"ios-teacher");const t=o.platformType==="STUDENT"?"/api-student/videoLesson/selectGroup":"/api-teacher/videoLessonGroup/page";s.myself=!1;const e=await h.post(t,{data:l({},s)});this.loading=!1;const i=e.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}},onSort(){this.params.page=1,this.list=[],this.dataShow=!0,this.loading=!1,this.finished=!1,this.searchStatus=!1,this.params.lessonSubject&&u(p.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};o.platformType==="TEACHER"&&(t.share=1),this.$router.push({path:"/videoDetail",query:t})}},render(){let s;return a("div",{class:r.videoClass},[a(x,{offsetTop:0,position:"top"},{default:()=>[a(g,{class:r.classHeader,border:!1,isFixed:!1,background:"transparent"},null),a(v,{placeholder:"\u8BF7\u8F93\u5165\u8001\u5E08\u540D\u79F0/\u8BFE\u7A0B\u540D\u79F0",onSearch:this.onSearch},{left:()=>a("div",{class:r.label,onClick:()=>{this.searchStatus=!this.searchStatus,this.openStatus=!this.openStatus}},[this.params.subjectName,a(C,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])})]}),a("div",null,[this.dataShow?a(L,{class:r.videoList,loading:this.loading,"onUpdate:loading":t=>this.loading=t,finished:this.finished,finishedText:"\u6CA1\u6709\u66F4\u591A\u4E86",onLoad:this.getList,immediateCheck:!1},H(s=this.list.map(t=>a(T,{item:t,onClick:this.onDetail},null)))?s:{default:()=>[s]}):a(w,{btnStatus:!1,tips:"\u6682\u65E0\u89C6\u9891\u8BFE"},null)]),a(y,{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&&a(E,{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{Y as default};
