index.89d9dcbb.js 4.3 KB

1
  1. import{d,g as a,y as c,j as e,N as m,C as f,aS as b,$ as S}from"./ResizeObserver.es.39b48a47.js";import{C as j}from"./index.970ad07b.js";import{S as g}from"./index.e10a1ae2.js";import{S as y}from"./index.608320e9.js";import{L}from"./index.6c529ad4.js";import{L as N}from"./live-item.f6fa9064.js";import{O as I}from"./organ-search.31aca7ed.js";import{a as u,S as n,u as C}from"./hooks.6df65925.js";import"./index.db115763.js";import"./index.428ab1a8.js";import"./use-id.b004ff17.js";import"./use-tab-status.bcc0c503.js";import"./icon_teacher.40b6f077.js";import"./index.34ac729a.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 J=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{J as default};