var m=Object.defineProperty;var h=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var d=(s,t,e)=>t in s?m(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,u=(s,t)=>{for(var e in t||(t={}))b.call(t,e)&&d(s,e,t[e]);if(h)for(var e of h(t))f.call(t,e)&&d(s,e,t[e]);return s};import{C as j}from"./index.d3c070ae.js";import{C as S}from"./index.a64b1b02.js";import{d as g,a as i,S as I,K as C,M as v,x as y,P as L}from"./vendor.cd162bf7.js";/* empty css               *//* empty css               */import{s as o,r as p,C as N}from"./index.a9c80450.js";import{L as x}from"./live-item.184435e4.js";import{O as _}from"./organ-search.05995c84.js";/* empty css               *//* empty css              *//* empty css               */import"./icon_teacher.cb128c00.js";/* empty css                */const T="_classHeader_y0jt7_1",w="_banner_y0jt7_4",P="_label_y0jt7_8",k="_liveClass_y0jt7_20";var c={classHeader:T,banner:w,label:P,liveClass:k};function D(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!y(s)}var Y=g({name:"liveClass",data(){var a;const s=Number(sessionStorage.getItem("liveClassSubjectId")),t=((a=o.user.data)==null?void 0:a.subjectId)||"",e=t?Number(t.split(",")[0]):null;return console.log(s,e,"subject"),{apiSuffix:o.platformType==="STUDENT"?"/api-student":"/api-teacher",list:[],dataShow:!0,loading:!1,finished:!1,searchStatus:!1,openStatus:!1,subjectList:[],sessionSubjectId:s,params:{search:"",subjectId:s||e||null,subjectName:"\u5168\u90E8",groupStatus:"APPLY",page:1,rows:20}}},async mounted(){var a;try{const r=await p.get(`${this.apiSuffix}/subject/subjectSelect?type=LIVE`);this.subjectList=r.data||[]}catch{}const s=this.subjectList,t=this.params.subjectId?[this.params.subjectId]:((a=o.user.data)==null?void 0:a.subjectId.split(",").map(r=>parseInt(r)))||[this.params.subjectId];let e=!0;for(let r=0;r<s.length;r++){const n=s[r].subjects||[];for(let l=0;l<n.length;l++)if(t.includes(n[l].id)){this.params.subjectId=n[l].id,this.params.subjectName=n[l].name,e=!1;break}}e&&s.length&&s[0].subjects&&(this.params.subjectId=s[0].subjects[0].id,this.params.subjectName=s[0].subjects[0].name),sessionStorage.removeItem("liveClassSubjectId"),this.getList()},methods:{onSort(){this.params.page=1,this.list=[],this.dataShow=!0,this.loading=!1,this.finished=!1,this.searchStatus=!1,this.getList()},onSearch(s){this.params.search=s,this.onSort()},async getList(){try{const s=u({},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 p.post(t,{data:u({},s)});this.loading=!1;const a=e.data||{};if(this.list.length>0&&a.pageNo===1)return;this.list=this.list.concat(a.rows||[]),this.finished=a.pageNo>=a.totalPage,this.params.page=a.pageNo+1,this.dataShow=this.list.length>0}catch{this.dataShow=!1,this.finished=!0}},onDetail(s){this.params.subjectId&&sessionStorage.setItem("liveClassSubjectId",this.params.subjectId);const t={groupId:s.courseGroupId};o.platformType==="TEACHER"&&(t.share=1),this.$router.push({path:"/liveDetail",query:t})}},render(){let s;return i("div",{class:c.liveClass},[i(I,{offsetTop:0,position:"top"},{default:()=>[i(j,{class:c.classHeader,border:!1,isFixed:!1,background:"transparent"},null),i(S,{placeholder:"\u8BF7\u8F93\u5165\u8001\u5E08\u540D\u79F0/\u8BFE\u7A0B\u540D\u79F0",onSearch:this.onSearch},{left:()=>i("div",{class:c.label,onClick:()=>{this.searchStatus=!this.searchStatus,this.openStatus=!this.openStatus}},[this.params.subjectName,i(C,{classPrefix:"iconfont",name:"down",size:12,color:"#333"},null)])})]}),this.dataShow?i(v,{loading:this.loading,"onUpdate:loading":t=>this.loading=t,finished:this.finished,finishedText:" ",class:[c.liveList],onLoad:this.getList,immediateCheck:!1},D(s=this.list.map(t=>i(x,{onClick:this.onDetail,liveInfo:t},null)))?s:{default:()=>[s]}):i(N,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u76F4\u64AD\u8BFE"},null),i(L,{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&&i(_,{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{Y as default};
