;(function(){function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._classHeader_y0jt7_1{background:linear-gradient(#59e5d5,30%,#ffffff)}._banner_y0jt7_4{background:#fff;padding:.32rem .37333rem}._label_y0jt7_8{margin-right:.21333rem;font-size:.37333rem}._label_y0jt7_8 .van-list__loading,._label_y0jt7_8 .van-list__finished-text,._label_y0jt7_8 .van-list__error-text{width:100%}._label_y0jt7_8 .iconfont-down{margin-left:.10667rem}._liveClass_y0jt7_20 .van-sticky--fixed{box-shadow:.26667rem .26667rem .26667rem var(--box-shadow-color)}\n";document.head.appendChild(__vite_style__);System.register(['./index-legacy.9cbfcbc2.js','./index-legacy.03b70b26.js','./vendor-legacy.b3aeff6a.js','./index-legacy.f25f109a3.js','./index-legacy.f25f109a6.js','./index-legacy.101dd5f6.js','./live-item-legacy.5911ecaf.js','./organ-search-legacy.93e8a7dc.js','./index-legacy.f25f109a8.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a5.js','./icon_teacher-legacy.e765b7f7.js','./index-legacy.f25f109a10.js'],function(exports){'use strict';var ColHeader,ColSearch,defineComponent,createVNode,Sticky,Icon,List,isVNode,Popup,state,request,ColResult,LiveItem,OrganSearch;return{setters:[function(module){ColHeader=module.C;},function(module){ColSearch=module.C;},function(module){defineComponent=module.d;createVNode=module.a;Sticky=module.S;Icon=module.K;List=module.M;isVNode=module.x;Popup=module.P;},function(){},function(){},function(module){state=module.s;request=module.r;ColResult=module.C;},function(module){LiveItem=module.L;},function(module){OrganSearch=module.O;},function(){},function(){},function(){},function(){},function(){}],execute:function execute(){var classHeader="_classHeader_y0jt7_1";var banner="_banner_y0jt7_4";var label="_label_y0jt7_8";var liveClass="_liveClass_y0jt7_20";var styles={classHeader:classHeader,banner:banner,label:label,liveClass:liveClass};function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var index=exports('default',defineComponent({name:'liveClass',data:function data(){var _state$user$data;var sessionSubjectId=Number(sessionStorage.getItem('liveClassSubjectId'));var subjectIds=((_state$user$data=state.user.data)===null||_state$user$data===void 0?void 0:_state$user$data.subjectId)||'';var subjectId=subjectIds?Number(subjectIds.split(',')[0]):null;console.log(sessionSubjectId,subjectId,'subject');return{apiSuffix:state.platformType==='STUDENT'?'/api-student':'/api-teacher',list:[],dataShow:true,// 判断是否有数据
loading:false,finished:false,searchStatus:false,openStatus:false,subjectList:[],sessionSubjectId:sessionSubjectId,params:{search:'',subjectId:sessionSubjectId||subjectId||null,subjectName:'全部',groupStatus:'APPLY',page:1,rows:20}};},mounted:function mounted(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _state$user$data2;var res,list,userSubjectId,isRest,i,subjects,j;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return request.get("".concat(_this.apiSuffix,"/subject/subjectSelect?type=LIVE"));case 3:res=_context.sent;_this.subjectList=res.data||[];_context.next=9;break;case 7:_context.prev=7;_context.t0=_context["catch"](0);case 9:list=_this.subjectList;userSubjectId=_this.params.subjectId?[_this.params.subjectId]:((_state$user$data2=state.user.data)===null||_state$user$data2===void 0?void 0:_state$user$data2.subjectId.split(',').map(function(n){return parseInt(n);}))||[_this.params.subjectId];isRest=true;i=0;case 13:if(!(i<list.length)){_context.next=28;break;}subjects=list[i].subjects||[];j=0;case 16:if(!(j<subjects.length)){_context.next=25;break;}if(!userSubjectId.includes(subjects[j].id)){_context.next=22;break;}_this.params.subjectId=subjects[j].id;_this.params.subjectName=subjects[j].name;isRest=false;return _context.abrupt("break",25);case 22:j++;_context.next=16;break;case 25:i++;_context.next=13;break;case 28:// console.log(isRest, 'isRest')
if(isRest&&list.length&&list[0].subjects){_this.params.subjectId=list[0].subjects[0].id;_this.params.subjectName=list[0].subjects[0].name;}sessionStorage.removeItem('liveClassSubjectId');_this.getList();case 31:case"end":return _context.stop();}}},_callee,null,[[0,7]]);}))();},methods:{onSort:function onSort(){this.params.page=1;this.list=[];this.dataShow=true;// 判断是否有数据
this.loading=false;this.finished=false;this.searchStatus=false;this.getList();},onSearch:function onSearch(value){this.params.search=value;this.onSort();},getList:function getList(){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var params,url,res,result;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;params=_objectSpread({},_this2.params);// 只有学生端会有version
if(state.version){params.version=state.version||'';// 处理ios审核版本
params.platform=state.platformType==='STUDENT'?'ios-student':'ios-teacher';}// 判断是哪个端
url=state.platformType==='STUDENT'?'/api-student/courseGroup/queryPageCourseGroup':'/api-teacher/courseGroup/queryPageCourseGroup';// 处理搜索，老师端分享用
// if (state.platformType === 'TEACHER') {
params.myself=false;// }
_context2.next=7;return request.post(url,{data:_objectSpread({},params)});case 7:res=_context2.sent;_this2.loading=false;result=res.data||{};// 处理重复请求数据
if(!(_this2.list.length>0&&result.pageNo===1)){_context2.next=12;break;}return _context2.abrupt("return");case 12:_this2.list=_this2.list.concat(result.rows||[]);_this2.finished=result.pageNo>=result.totalPage;_this2.params.page=result.pageNo+1;_this2.dataShow=_this2.list.length>0;_context2.next=22;break;case 18:_context2.prev=18;_context2.t0=_context2["catch"](0);_this2.dataShow=false;_this2.finished=true;case 22:case"end":return _context2.stop();}}},_callee2,null,[[0,18]]);}))();},onDetail:function onDetail(item){this.params.subjectId&&sessionStorage.setItem('liveClassSubjectId',this.params.subjectId);var params={groupId:item.courseGroupId};// 判断是否是老师端，如果是，则添加分享按钮
if(state.platformType==='TEACHER'){params.share=1;}this.$router.push({path:'/liveDetail',query:params});}},render:function render(){var _this3=this;var _slot;return createVNode("div",{"class":styles.liveClass},[createVNode(Sticky,{"offsetTop":0,"position":"top"},{default:function _default(){return[createVNode(ColHeader,{"class":styles.classHeader,"border":false,"isFixed":false,"background":"transparent"},null),createVNode(ColSearch,{"placeholder":"请输入老师名称/课程名称","onSearch":_this3.onSearch},{left:function left(){return createVNode("div",{"class":styles.label,"onClick":function onClick(){_this3.searchStatus=!_this3.searchStatus;_this3.openStatus=!_this3.openStatus;}},[_this3.params.subjectName,createVNode(Icon,{"classPrefix":"iconfont","name":"down","size":12,"color":"#333"},null)]);}})];}}),this.dataShow?createVNode(List,{"loading":this.loading,"onUpdate:loading":function onUpdateLoading($event){return _this3.loading=$event;},"finished":this.finished,"finishedText":" ","class":[styles.liveList],"onLoad":this.getList,"immediateCheck":false},_isSlot(_slot=this.list.map(function(item){return createVNode(LiveItem,{"onClick":_this3.onDetail,"liveInfo":item},null);}))?_slot:{default:function _default(){return[_slot];}}):createVNode(ColResult,{"btnStatus":false,"classImgSize":"SMALL","tips":"暂无直播课"},null),createVNode(Popup,{"show":this.searchStatus,"position":"bottom","round":true,"closeable":true,"safe-area-inset-bottom":true,"onClose":function onClose(){return _this3.searchStatus=false;},"onClosed":function onClosed(){return _this3.openStatus=false;}},{default:function _default(){return[_this3.openStatus&&createVNode(OrganSearch,{"subjectList":_this3.subjectList,"onSort":_this3.onSort,"modelValue":_this3.params.subjectId,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.params.subjectId=$event;},"subjectName":_this3.params.subjectName,"onUpdate:subjectName":function onUpdateSubjectName($event){return _this3.params.subjectName=$event;}},null)];}})]);}}));}};});})();
