<<<<<<<< HEAD:dist/assets/index-legacy.a0e8b4a5.js ;(function(){function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);iarr.length)len=arr.length;for(var i=0,arr2=new Array(len);i>>>>>>> online:dist/assets/index-legacy.76382051.js type:Object,default:{}},onClose:{type:Function,default:function _default(){}},onChoice:{// 点击选择时间 type:Function,default:function _default(item){}},courseMinutes:{// 课程时长 type:Number,default:25},freeMinutes:{// 空余时长 type:Number,default:5},startSetting:{// 开始设置时间 type:String,default:'08:00'},endSetting:{// 结束设置时间 type:String,default:'18:00'}},data:function data(){return{timerList:[],list:[],weekList:['周一','周二','周三','周四','周五','周六','周日'],weekType:['monday','tuesday','wednesday','thursday','friday','saturday','sunday']};},mounted:function mounted(){this.list=this.timerInit(this.startSetting,this.endSetting,this.courseMinutes+this.freeMinutes||30);},methods:{timerInit:function timerInit(startTime,endTime,space){var start=dayjs(startTime,'HH:mm');var end=dayjs(endTime,'HH:mm');var timerList=[];// 生成一天的时间段 while(start.add(space,'minute').isSameOrBefore(dayjs(end))){var item={startTime:start.format('HH:mm'),endTime:start.add(space,'minute').format('HH:mm'),status:false};// 一周 timerList.push(item);start=start.add(space,'minute');}var list=[];// 生成一周的时间段 timerList.forEach(function(item){var weekList=[];for(var i=0;i<7;i++){weekList.push(_objectSpread({},item));}list.push(weekList);});var tempList=this._initData(list);return tempList;},_initData:function _initData(list){// 回显数据 var weekType=this.weekType;var timerObject=this.timerObject;list.forEach(function(item){item.forEach(function(slot,slotIndex){var dayList=timerObject[weekType[slotIndex]];var startTime=dayjs(slot.startTime,'HH:mm').format('HH:mm:ss');var isExist=dayList===null||dayList===void 0?void 0:dayList.some(function(course){return course.startTime===startTime;});isExist&&(slot.status=true);});});return list;},btnStatus:function btnStatus(index,type){if(type==='row'){return this.list.every(function(item){return item[index].status;});}if(type=='col'){return this.list[index].every(function(item){return item.status;});}},choice:function choice(index,type,status){if(type==='row'){this.list.forEach(function(item,i){var type=!status?true:false;item[index].status=type;});}if(type=='col'){this.list[index].forEach(function(item,i){var type=!status?true:false;item.status=type;});}},onSubmit:function onSubmit(){var _this=this;var list=this.list;var weekList={monday:[],tuesday:[],wednesday:[],thursday:[],friday:[],saturday:[],sunday:[]};var weekType=this.weekType;var status=false;list.forEach(function(item,i){item.forEach(function(times,j){if(times.status){status=true;weekList[weekType[j]].push({startTime:dayjs(times.startTime,'HH:mm').format('HH:mm:ss'),endTime:dayjs(times.endTime,'HH:mm').subtract(_this.freeMinutes,'minute').format('HH:mm:ss')});}});});this.onChoice&&this.onChoice(weekList,status);}},render:function render(){var _this2=this;return createVNode("div",{"class":styles$1.timer},[createVNode("div",{"class":styles$1.tips},[createVNode("div",{"class":styles$1.tipsTitle},[createTextVNode("\u8BF7\u9009\u62E9\u966A\u7EC3\u5F00\u59CB\u65F6\u95F4")]),createVNode("div",{"class":styles$1.tipsTime},[createTextVNode("\u966A\u7EC3\u8BFE\u5355\u8BFE\u65F6\u65F6\u957F\u4E3A "),createVNode("span",null,[this.courseMinutes]),createTextVNode(" \u5206\u949F")])]),createVNode("div",{"class":[styles$1.timerContainer,'mb12']},[createVNode(ElRow,{"gutter":5,"class":"pr-2"},{default:function _default(){return[createVNode(ElCol,{"span":3},null),_this2.weekList.map(function(item){return createVNode(ElCol,{"span":3},{default:function _default(){return[createVNode("span",{"class":styles$1.tag},[item])];}});})];}}),createVNode(ElRow,{"gutter":5,"class":"pt-1 pr-2"},{default:function _default(){return[createVNode(ElCol,{"span":3},null),_this2.weekList.map(function(item,index){return createVNode(ElCol,{"span":3},{default:function _default(){return[createVNode("span",{"class":[styles$1.tag,'cursor-pointer',_this2.btnStatus(index,'row')&&styles$1.active],"onClick":function onClick(){return _this2.choice(index,'row',_this2.btnStatus(index,'row'));}},[createTextVNode("\u5168\u9009")])];}});})];}}),createVNode("div",{"class":"h-72 overflow-y-auto overflow-x-hidden"},[this.list.map(function(item,index){return createVNode(ElRow,{"gutter":5,"class":"pt-1"},{default:function _default(){return[createVNode(ElCol,{"span":3},{default:function _default(){return[createVNode("span",{"class":[styles$1.tag,'cursor-pointer',_this2.btnStatus(index,'col')&&styles$1.active],"onClick":function onClick(){return _this2.choice(index,'col',_this2.btnStatus(index,'col'));}},[createTextVNode("\u5168\u9009")])];}}),item.map(function(week){return createVNode(ElCol,{"span":3},{default:function _default(){return[createVNode("span",{"class":[styles$1.tag,'cursor-pointer',week.status&&styles$1.select],"style":{color:'#333333'},"onClick":function onClick(){return week.status=!week.status;}},[week.startTime])];}});})];}});})])]),createVNode("div",{"class":"text-center pt-3 pb-5"},[createVNode(ElButton,{"class":"!w-40 !h-[48px] !text-base","round":true,"onClick":function onClick(){_this2.onClose();}},{default:function _default(){return[createTextVNode("\u53D6\u6D88")];}}),createVNode(ElButton,{"type":"primary","class":"!w-40 !h-[48px] !text-base","onClick":this.onSubmit,"round":true},{default:function _default(){return[createTextVNode("\u4FDD\u5B58\u8BBE\u7F6E")];}})])]);}});var setting="_setting_1il54_1";var styles={setting:setting};function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var index=exports('default',defineComponent({name:'practice-setting',data:function data(){return{subjectList:[],chargeTypeArr:{0:'否',1:'是'},classTimeStatus:false,subjectStatus:false,timerStatus:false,timeSetting:{courseMinutes:25,freeMinutes:5,startSetting:'08:00',endSetting:'18:00'},timerObject:{},form:{enableFlag:1,courseMinutes:null,freeMinutes:0,subjectIdTemp:'',subjectId:[],subjectPrice:[],skipHolidayFlag:1,setting:'未设置'},minutes:[],rate:0};},mounted:function mounted(){var _this3=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var config,configData,teacher,_setting,sr,tempIds,tempPrices,subjectPrice,to;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return request.get('/api-website/sysConfig/queryByParamNameList',{params:{paramNames:'practice_times_setting,practice_service_fee,course_start_setting,course_end_setting'}});case 3:config=_context.sent;configData=config.data||[];configData.forEach(function(item){if(item.paramName==='practice_times_setting'){var mins=item.paramValue?JSON.parse(item.paramValue):[];var tempArr=[];mins.forEach(function(item){tempArr.push(_objectSpread(_objectSpread({},item),{},{name:item.courseMinutes}));});_this3.minutes=[].concat(tempArr);}if(item.paramName==='practice_service_fee'){_this3.rate=item.paramValue;}if(item.paramName==='course_start_setting'){_this3.timeSetting.startSetting=item.paramValue;}if(item.paramName==='course_end_setting'){_this3.timeSetting.endSetting=item.paramValue;}});_context.next=8;return request.post('/api-website/teacher/querySubject');case 8:teacher=_context.sent;_this3.subjectList=teacher.data||[];// 获取课程设置 _context.next=12;return request.post('/api-website/teacherFreeTime/getDetail',{data:{defaultFlag:1}});case 12:_setting=_context.sent;sr=_setting.data;if(sr){_this3.timeSetting.courseMinutes=sr.courseMinutes;_this3.timeSetting.freeMinutes=sr.freeMinutes;_this3.timerObject={monday:sr.monday?JSON.parse(sr.monday):[],tuesday:sr.tuesday?JSON.parse(sr.tuesday):[],wednesday:sr.wednesday?JSON.parse(sr.wednesday):[],thursday:sr.thursday?JSON.parse(sr.thursday):[],friday:sr.friday?JSON.parse(sr.friday):[],saturday:sr.saturday?JSON.parse(sr.saturday):[],sunday:sr.sunday?JSON.parse(sr.sunday):[]};tempIds=[];tempPrices=[];subjectPrice=sr.subjectPrice||[];subjectPrice.forEach(function(item){tempIds.push(item.subjectId);tempPrices.push({subjectId:item.subjectId,subjectPrice:item.subjectPrice,subjectName:item.subjectName});});to=_this3.timerObject;_this3.form={enableFlag:sr.enableFlag?1:0,courseMinutes:sr.courseMinutes,freeMinutes:sr.freeMinutes,subjectIdTemp:tempIds.join(','),subjectId:tempIds,subjectPrice:tempPrices,skipHolidayFlag:sr.skipHolidayFlag?1:0,setting:to.monday.length>0||to.tuesday.length>0||to.wednesday.length>0||to.thursday.length>0||to.friday.length>0||to.saturday.length>0||to.sunday.length>0?'已设置':'未设置'};}_context.next=19;break;case 17:_context.prev=17;_context.t0=_context["catch"](0);case 19:case"end":return _context.stop();}}},_callee,null,[[0,17]]);}))();},methods:{onSelect:function onSelect(item){// 如果分钟数不同,则清空 if(this.form.courseMinutes!==item.courseMinutes){this.timerObject={};this.form.setting='未设置';}this.form.courseMinutes=item.courseMinutes;this.form.freeMinutes=item.freeMinutes;},onTimer:function onTimer(){var _this4=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var form;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;form=_this4.form;if(form.courseMinutes){_context2.next=5;break;}// Toast('请选择单课时时长') ElMessage.error('请选择单课时时长');return _context2.abrupt("return");case 5:_this4.timeSetting.courseMinutes=Number(form.courseMinutes);_this4.timeSetting.freeMinutes=Number(form.freeMinutes);_this4.timerStatus=true;_context2.next=12;break;case 10:_context2.prev=10;_context2.t0=_context2["catch"](0);case 12:case"end":return _context2.stop();}}},_callee2,null,[[0,10]]);}))();},onChoiceTimer:function onChoiceTimer(item,status){// console.log(item, 'item') this.form.setting=status?'已设置':'';this.timerObject=item;this.timerStatus=false;},onChoice:function onChoice(item){var tempItem=item||[];this.form.subjectId=tempItem;this.form.subjectIdTemp=tempItem.join(',')||'';var subjectPriceList=_toConsumableArray(this.form.subjectPrice);tempItem.forEach(function(item){var index=subjectPriceList.findIndex(function(subject){return subject.subjectId===item;});if(index===-1){subjectPriceList.push({subjectId:item,subjectPrice:null,subjectName:''});}});var temp=[];subjectPriceList.forEach(function(item){var isExist=tempItem.some(function(subjectId){return subjectId===item.subjectId;});isExist&&temp.push(item);});this.form.subjectPrice=temp;this.subjectStatus=false;},getSubjectName:function getSubjectName(id){var subject=this.subjectList.find(function(item){return item.id===id;});return subject?subject.name:'';},onFormatter:function onFormatter(e,item){// console.log(verifyNumberIntegerAndFloat(e.target.value), e) // e.target.value = verifyNumberIntegerAndFloat(e.target.value) verifyNumberIntegerAndFloat(e);},onSubmit:function onSubmit(){var _this5=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(){return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_this5.$refs.form.validate(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(_){var form;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:if(!_){_context3.next=15;break;}_context3.prev=1;form=_this5.form;form.subjectPrice.forEach(function(item){item.subjectName=_this5.getSubjectName(item.subjectId);});form.setting=form.setting==='未设置'?'':form.setting;_context3.next=7;return request.post('/api-website/teacherFreeTime/upSet',{data:_objectSpread(_objectSpread({},form),_this5.timerObject)});case 7:ElMessage.success('设置成功');setTimeout(function(){postMessage({api:'back',content:{}});},500);_context3.next=13;break;case 11:_context3.prev=11;_context3.t0=_context3["catch"](1);case 13:_context3.next=17;break;case 15:_this5.$nextTick(function(){var isError=document.getElementsByClassName('is-error');isError[0].scrollIntoView({block:'center',behavior:'smooth'});});return _context3.abrupt("return",false);case 17:case"end":return _context3.stop();}}},_callee3,null,[[1,11]]);}));return function(_x){return _ref.apply(this,arguments);};}());case 1:case"end":return _context4.stop();}}},_callee4);}))();}},render:function render(){var _state$user$data,_this6=this;var _slot,_slot2;return createVNode("div",{"class":styles.setting},[createVNode("div",{"class":"text-2xl font-semibold text-black leading-none px-6 py-5 "},[createTextVNode("\u966A\u7EC3\u8BFE\u8BBE\u7F6E")]),(_state$user$data=state.user.data)!==null&&_state$user$data!==void 0&&_state$user$data.entryFlag?createVNode(Fragment,null,[createVNode(ElForm,{"labelPosition":"left","labelWidth":'188px',"size":"large","model":this.form,"ref":"form","class":"px-6 py-5"},{default:function _default(){return[createVNode(ElFormItem,{"label":"是否开启陪练","prop":"enableFlag","rules":[{required:true,message:'请选择是否开启陪练'}]},{default:function _default(){return[createVNode(ElSelect,{"class":"w-full","modelValue":_this6.form.enableFlag,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.form.enableFlag=$event;}},{default:function _default(){return[createVNode(ElSelect.Option,{"value":1,"label":'是'},{default:function _default(){return[createTextVNode("\u662F")];}}),createVNode(ElSelect.Option,{"value":0,"label":'否'},{default:function _default(){return[createTextVNode("\u5426")];}})];}})];}}),createVNode(ElFormItem,{"label":"可教授声部","prop":'subjectId',"rules":[{required:true,message:'请选择可教授声部',trigger:'change'}]},{default:function _default(){return[createVNode(ElSelect,{"multiple":true,"filterable":true,"placeholder":"请选择可教授声部","class":"w-full","multipleLimit":5,"modelValue":_this6.form.subjectId,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.form.subjectId=$event;},"onChange":_this6.onChoice},_isSlot(_slot=_this6.subjectList.map(function(item){return createVNode(ElOption,{"key":item.id,"value":item.id,"label":item.name},null);}))?_slot:{default:function _default(){return[_slot];}})];}}),createVNode(ElFormItem,{"label":"单课时长","prop":"courseMinutes","rules":[{required:true,message:'请选择单课时长',trigger:'change'}]},{default:function _default(){return[createVNode(ElSelect,{"class":"w-full","placeholder":"请选择单课时时长","modelValue":_this6.form.courseMinutes,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.form.courseMinutes=$event;},"onChange":function onChange(item){// 如果分钟数不同,则清空 _this6.timerObject={};_this6.form.setting='未设置';// 设置空余时间 _this6.minutes.forEach(function(mins){if(mins.courseMinutes===item){_this6.form.freeMinutes=mins.freeMinutes;}});}},_isSlot(_slot2=_this6.minutes.map(function(item){return createVNode(ElOption,{"key":item.courseMinutes,"value":item.courseMinutes},{default:function _default(){return[item.name];}});}))?_slot2:{default:function _default(){return[_slot2];}})];}}),_this6.form.subjectPrice.map(function(item,index){return createVNode(ElFormItem,{"label":"".concat(_this6.getSubjectName(item.subjectId),"\u966A\u7EC3\u4EF7\u683C"),"prop":"subjectPrice.".concat(index,".subjectPrice"),"rules":[{required:true,message:"\u8BF7\u9009\u62E9\u58F0\u90E8\u966A\u7EC3\u4EF7\u683C"}]},{default:function _default(){return[createVNode(ElInput,{"onInput":function onInput(value){item.subjectPrice=verifyNumberIntegerAndFloat(value);},"type":"text","placeholder":"请输入陪练价格","modelValue":item.subjectPrice,"onUpdate:modelValue":function onUpdateModelValue($event){return item.subjectPrice=$event;},"maxlength":8},{suffix:function suffix(){return createVNode("span",{"class":"text-base text-[#999]"},[createTextVNode("\u5143")]);}})];}});}),createVNode(ElFormItem,{"label":"是否跳过节假日"},{default:function _default(){return[createVNode(ElRadioGroup,{"modelValue":_this6.form.skipHolidayFlag,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.form.skipHolidayFlag=$event;}},{default:function _default(){return[createVNode(ElRadioButton,{"label":1,"class":"mr-3 w-24"},{default:function _default(){return[createTextVNode("\u662F")];}}),createVNode(ElRadioButton,{"label":0,"class":"w-24"},{default:function _default(){return[createTextVNode("\u5426")];}})];}})];}}),createVNode(ElFormItem,{"label":"陪练时间段"},{default:function _default(){return[createVNode("div",{"onClick":_this6.onTimer,"class":"w-full"},[createVNode(ElInput,{"readonly":true,"class":"cursor-pointer","modelValue":_this6.form.setting,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.form.setting=$event;},"placeholder":"请选择陪练时间段","suffixIcon":'ArrowDown'},null)])];}})];}}),createVNode("div",{"class":"text-center pt-6 pb-7"},[createVNode(ElButton,{"class":"!w-44 !h-[48px] !text-base","round":true,"onClick":function onClick(){// 重置数据 _this6.form={enableFlag:1,courseMinutes:null,freeMinutes:0,subjectIdTemp:'',subjectId:[],subjectPrice:[],skipHolidayFlag:1,setting:'未设置'};_this6.$refs.form.resetFields();}},{default:function _default(){return[createTextVNode("\u91CD\u7F6E")];}}),createVNode(ElButton,{"type":"primary","class":"!w-44 !h-[48px] !text-base","round":true,"onClick":this.onSubmit},{default:function _default(){return[createTextVNode("\u4FDD\u5B58\u8BBE\u7F6E")];}})])]):createVNode(ColEmpty,{"type":"teacherCert","message":"您还未完成达人认证,认证后才可设置陪练课哦~","buttonVisibility":true,"buttonText":"去认证","onDetail":function onDetail(){_this6.$router.push('/teacherAuth');}},null),createVNode(ElDialog,{"modelValue":this.timerStatus,"onUpdate:modelValue":function onUpdateModelValue(val){return _this6.timerStatus=val;},"showClose":true,"width":'488px'},{default:function _default(){return[_this6.timerStatus&&createVNode(PracticeTimer,{"onChoice":_this6.onChoiceTimer,"onClose":function onClose(){_this6.timerStatus=false;},"timerObject":_this6.timerObject,"courseMinutes":Number(_this6.timeSetting.courseMinutes),"freeMinutes":Number(_this6.timeSetting.freeMinutes),"startSetting":_this6.timeSetting.startSetting,"endSetting":_this6.timeSetting.endSetting},null)];}})]);}}));}};});})();