1 |
- import{d,g as a,w as c,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 y}from"./index.9093bc60.js";import{L}from"./index.f904775d.js";import{L as N}from"./live-item.7738586b.js";import{O as I}from"./organ-search.02ca21ae.js";import{a as u,S as n,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"./icon_teacher.40b6f077.js";import"./index.05f2b7dd.js";const T="_classHeader_y0jt7_1",v="_banner_y0jt7_4",E="_label_y0jt7_8",_="_liveClass_y0jt7_20";var o={classHeader:T,banner:v,label:E,liveClass:_};function w(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!S(s)}var Y=d({name:"liveClass",data(){return{apiSuffix:a.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 s;try{const t=await c.get(`${this.apiSuffix}/subject/subjectSelect?type=LIVE`);this.subjectList=t.data||[]}catch{}if(a.platformType==="TEACHER"){const t=a.user.data;t.defaultSubject&&(this.params.subjectId=t.defaultSubject,this.params.subjectName=t.defaultSubjectName)}else{const t=u(n.LIVE);if(t.id)this.params.subjectId=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(p=>{(p.subjects||[]).forEach(l=>{l.id===Number(h)&&(this.params.subjectId=l.id,this.params.subjectName=l.name)})})}}this.getList(),C("\u76F4\u64AD\u8BFE")},methods:{async setDefaultSubject(s){try{await c.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.subjectId):this.params.subjectId&&u(n.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={...this.params};a.version&&(s.version=a.version||"",s.platform=a.platformType==="STUDENT"?"ios-student":"ios-teacher");const t=a.platformType==="STUDENT"?"/api-student/courseGroup/queryPageCourseGroup":"/api-teacher/courseGroup/queryPageCourseGroup";s.myself=!1;const r=await c.post(t,{data:{...s}});this.lockLoading=!1,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,this.lockLoading=!1}},onDetail(s){const t={groupId:s.courseGroupId};a.platformType==="TEACHER"&&(t.share=1),this.$router.push({path:"/liveDetail",query:t})}},render(){let s;return e("div",{class:o.liveClass},[e(y,{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)])})]}),this.dataShow?e(L,{loading:this.loading,"onUpdate:loading":t=>this.loading=t,finished:this.finished,finishedText:" ",class:[o.liveList],onLoad:this.getList,immediateCheck:!1},w(s=this.list.map(t=>e(N,{onClick:this.onDetail,liveInfo:t},null)))?s:{default:()=>[s]}):e(f,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u76F4\u64AD\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(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};
|