var b=Object.defineProperty;var c=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var h=(s,t,e)=>t in s?b(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,n=(s,t)=>{for(var e in t||(t={}))j.call(t,e)&&h(s,e,t[e]);if(c)for(var e of c(t))S.call(t,e)&&h(s,e,t[e]);return s};import{C as g}from"./index.9a4c80cd.js";import{C as L}from"./index.2d1e9e4b.js";import{d as y,a,S as N,K as C,M as I,x as v,P as x}from"./vendor.3506a68e.js";/* empty css               *//* empty css               */import{s as o,r as u,C as _}from"./index.9e4b607f.js";import{L as T}from"./live-item.4c8a6f40.js";import{O as k}from"./organ-search.5633eb2e.js";import{u as d,S as p}from"./hooks.6a14d51f.js";/* empty css               *//* empty css              *//* empty css               */import"./icon_teacher.cb128c00.js";/* empty css                */const w="_classHeader_y0jt7_1",E="_banner_y0jt7_4",P="_label_y0jt7_8",V="_liveClass_y0jt7_20";var r={classHeader:w,banner:E,label:P,liveClass:V};function D(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!v(s)}var W=y({name:"liveClass",data(){return{apiSuffix:o.platformType==="STUDENT"?"/api-student":"/api-teacher",list:[],dataShow:!0,loading:!1,finished:!1,searchStatus:!1,openStatus:!1,subjectList:[],lockLoading:!1,params:{search:"",subjectId:null,subjectName:"\u5168\u90E8\u58F0\u90E8",groupStatus:"APPLY",page:1,rows:20}}},async mounted(){var t;try{const e=await u.get(`${this.apiSuffix}/subject/subjectSelect?type=LIVE`);this.subjectList=e.data||[]}catch{}const s=d(p.LIVE);if(s.id)this.params.subjectId=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(l=>{l.id===Number(m)&&(this.params.subjectId=l.id,this.params.subjectName=l.name)})})}this.getList()},methods:{onSort(){this.params.page=1,this.list=[],this.dataShow=!0,this.loading=!1,this.finished=!1,this.searchStatus=!1,this.params.subjectId&&d(p.LIVE,JSON.stringify({id:this.params.subjectId,name:this.params.subjectName}),"set"),this.getList()},onSearch(s){this.params.search=s,this.onSort()},async getList(){try{if(this.lockLoading)return;this.lockLoading=!0;const s=n({},this.params);o.version&&(s.version=o.version||"",s.platform=o.platformType==="STUDENT"?"ios-student":"ios-teacher");const t=o.platformType==="STUDENT"?"/api-student/courseGroup/queryPageCourseGroup":"/api-teacher/courseGroup/queryPageCourseGroup";s.myself=!1;const e=await u.post(t,{data:n({},s)});this.lockLoading=!1,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,this.lockLoading=!1}},onDetail(s){const t={groupId:s.courseGroupId};o.platformType==="TEACHER"&&(t.share=1),this.$router.push({path:"/liveDetail",query:t})}},render(){let s;return a("div",{class:r.liveClass},[a(N,{offsetTop:0,position:"top"},{default:()=>[a(g,{class:r.classHeader,border:!1,isFixed:!1,background:"transparent"},null),a(L,{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)])})]}),this.dataShow?a(I,{loading:this.loading,"onUpdate:loading":t=>this.loading=t,finished:this.finished,finishedText:" ",class:[r.liveList],onLoad:this.getList,immediateCheck:!1},D(s=this.list.map(t=>a(T,{onClick:this.onDetail,liveInfo:t},null)))?s:{default:()=>[s]}):a(_,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u76F4\u64AD\u8BFE"},null),a(x,{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(k,{subjectList:this.subjectList,onSort:this.onSort,modelValue:this.params.subjectId,"onUpdate:modelValue":t=>this.params.subjectId=t,subjectName:this.params.subjectName,"onUpdate:subjectName":t=>this.params.subjectName=t},null)]})])}});export{W as default};
