index.489d6c10.js 12 KB

1
  1. var k=Object.defineProperty,O=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var F=(e,t,i)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,b=(e,t)=>{for(var i in t||(t={}))V.call(t,i)&&F(e,i,t[i]);if(_)for(var i of _(t))P.call(t,i)&&F(e,i,t[i]);return e},M=(e,t)=>O(e,H(t));import{C as B}from"./index.ba731085.js";import{r as y,c as L}from"./index.6fc5f983.js";import{v as w}from"./toolsValidate.add49407.js";import{ak as h,au as D,av as A,d as T,c as s,a as c,G as S,H as f,l as j,f as C,F as J,K as q,L as p,ab as g,ac as v,I as x,al as U,am as N,W as $,ai as R}from"./vendor.63aa8b19.js";const G="_timer_t2oca_1",W="_tips_t2oca_5",z="_tipsTitle_t2oca_11",K="_tipsTime_t2oca_17",Q="_timerContainer_t2oca_26",X="_tag_t2oca_34",Y="_active_t2oca_45",Z="_select_t2oca_49";var l={timer:G,tips:W,tipsTitle:z,tipsTime:K,timerContainer:Q,tag:X,active:Y,select:Z};h.extend(D);h.extend(A);var tt=T({name:"practice-timer",props:{timerObject:{type:Object,default:{}},onClose:{type:Function,default:()=>{}},onChoice:{type:Function,default:e=>{}},courseMinutes:{type:Number,default:25},freeMinutes:{type:Number,default:5},startSetting:{type:String,default:"08:00"},endSetting:{type:String,default:"18:00"}},data(){return{timerList:[],list:[],weekList:["\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D","\u5468\u65E5"],weekType:["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]}},mounted(){this.list=this.timerInit(this.startSetting,this.endSetting,this.courseMinutes+this.freeMinutes||30)},methods:{timerInit(e,t,i){let a=h(e,"HH:mm");const r=h(t,"HH:mm"),u=[];for(;a.add(i,"minute").isSameOrBefore(h(r));){const o={startTime:a.format("HH:mm"),endTime:a.add(i,"minute").format("HH:mm"),status:!1};u.push(o),a=a.add(i,"minute")}const n=[];return u.forEach(o=>{const m=[];for(let E=0;E<7;E++)m.push(b({},o));n.push(m)}),this._initData(n)},_initData(e){const t=this.weekType,i=this.timerObject;return e.forEach(a=>{a.forEach((r,u)=>{const n=i[t[u]],d=h(r.startTime,"HH:mm").format("HH:mm:ss");(n==null?void 0:n.some(m=>m.startTime===d))&&(r.status=!0)})}),e},btnStatus(e,t){if(t==="row")return this.list.every(i=>i[e].status);if(t=="col")return this.list[e].every(i=>i.status)},choice(e,t,i){t==="row"&&this.list.forEach((a,r)=>{const u=!i;a[e].status=u}),t=="col"&&this.list[e].forEach((a,r)=>{const u=!i;a.status=u})},onSubmit(){const e=this.list,t={monday:[],tuesday:[],wednesday:[],thursday:[],friday:[],saturday:[],sunday:[]},i=this.weekType;let a=!1;e.forEach((r,u)=>{r.forEach((n,d)=>{n.status&&(a=!0,t[i[d]].push({startTime:h(n.startTime,"HH:mm").format("HH:mm:ss"),endTime:h(n.endTime,"HH:mm").subtract(this.freeMinutes,"minute").format("HH:mm:ss")}))})}),this.onChoice&&this.onChoice(t,a)}},render(){return s("div",{class:l.timer},[s("div",{class:l.tips},[s("div",{class:l.tipsTitle},[c("\u8BF7\u9009\u62E9\u966A\u7EC3\u5F00\u59CB\u65F6\u95F4")]),s("div",{class:l.tipsTime},[c("\u966A\u7EC3\u8BFE\u5355\u8BFE\u65F6\u65F6\u957F\u4E3A "),s("span",null,[this.courseMinutes]),c(" \u5206\u949F")])]),s("div",{class:[l.timerContainer,"mb12"]},[s(S,{gutter:5,class:"pr-2"},{default:()=>[s(f,{span:3},null),this.weekList.map(e=>s(f,{span:3},{default:()=>[s("span",{class:l.tag},[e])]}))]}),s(S,{gutter:5,class:"pt-1 pr-2"},{default:()=>[s(f,{span:3},null),this.weekList.map((e,t)=>s(f,{span:3},{default:()=>[s("span",{class:[l.tag,"cursor-pointer",this.btnStatus(t,"row")&&l.active],onClick:()=>this.choice(t,"row",this.btnStatus(t,"row"))},[c("\u5168\u9009")])]}))]}),s("div",{class:"h-72 overflow-y-auto overflow-x-hidden"},[this.list.map((e,t)=>s(S,{gutter:5,class:"pt-1"},{default:()=>[s(f,{span:3},{default:()=>[s("span",{class:[l.tag,"cursor-pointer",this.btnStatus(t,"col")&&l.active],onClick:()=>this.choice(t,"col",this.btnStatus(t,"col"))},[c("\u5168\u9009")])]}),e.map(i=>s(f,{span:3},{default:()=>[s("span",{class:[l.tag,"cursor-pointer",i.status&&l.select],style:{color:"#333333"},onClick:()=>i.status=!i.status},[i.startTime])]}))]}))])]),s("div",{class:"text-center pt-3 pb-5"},[s(j,{class:"!w-40 !h-[48px] !text-base",round:!0,onClick:()=>{this.onClose()}},{default:()=>[c("\u53D6\u6D88")]}),s(j,{type:"primary",class:"!w-40 !h-[48px] !text-base",onClick:this.onSubmit,round:!0},{default:()=>[c("\u4FDD\u5B58\u8BBE\u7F6E")]})])])}});const et="_setting_1il54_1";var st={setting:et};function I(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!R(e)}var ot=T({name:"practice-setting",data(){return{subjectList:[],chargeTypeArr:{0:"\u5426",1:"\u662F"},classTimeStatus:!1,subjectStatus:!1,timerStatus:!1,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:"\u672A\u8BBE\u7F6E"},minutes:[],rate:0}},async mounted(){try{((await y.get("/api-website/sysConfig/queryByParamNameList",{params:{paramNames:"practice_times_setting,practice_service_fee,course_start_setting,course_end_setting"}})).data||[]).forEach(u=>{if(u.paramName==="practice_times_setting"){const n=u.paramValue?JSON.parse(u.paramValue):[],d=[];n.forEach(o=>{d.push(M(b({},o),{name:o.courseMinutes}))}),this.minutes=[...d]}u.paramName==="practice_service_fee"&&(this.rate=u.paramValue),u.paramName==="course_start_setting"&&(this.timeSetting.startSetting=u.paramValue),u.paramName==="course_end_setting"&&(this.timeSetting.endSetting=u.paramValue)});const i=await y.post("/api-website/teacher/querySubject");this.subjectList=i.data||[];const r=(await y.post("/api-website/teacherFreeTime/getDetail",{data:{defaultFlag:1}})).data;if(r){this.timeSetting.courseMinutes=r.courseMinutes,this.timeSetting.freeMinutes=r.freeMinutes,this.timerObject={monday:r.monday?JSON.parse(r.monday):[],tuesday:r.tuesday?JSON.parse(r.tuesday):[],wednesday:r.wednesday?JSON.parse(r.wednesday):[],thursday:r.thursday?JSON.parse(r.thursday):[],friday:r.friday?JSON.parse(r.friday):[],saturday:r.saturday?JSON.parse(r.saturday):[],sunday:r.sunday?JSON.parse(r.sunday):[]};const u=[],n=[];(r.subjectPrice||[]).forEach(m=>{u.push(m.subjectId),n.push({subjectId:m.subjectId,subjectPrice:m.subjectPrice,subjectName:m.subjectName})});const o=this.timerObject;this.form={enableFlag:r.enableFlag?1:0,courseMinutes:r.courseMinutes,freeMinutes:r.freeMinutes,subjectIdTemp:u.join(","),subjectId:u,subjectPrice:n,skipHolidayFlag:r.skipHolidayFlag?1:0,setting:o.monday.length>0||o.tuesday.length>0||o.wednesday.length>0||o.thursday.length>0||o.friday.length>0||o.saturday.length>0||o.sunday.length>0?"\u5DF2\u8BBE\u7F6E":"\u672A\u8BBE\u7F6E"}}}catch{}},methods:{onSelect(e){this.form.courseMinutes!==e.courseMinutes&&(this.timerObject={},this.form.setting="\u672A\u8BBE\u7F6E"),this.form.courseMinutes=e.courseMinutes,this.form.freeMinutes=e.freeMinutes},async onTimer(){try{const e=this.form;if(!e.courseMinutes){C.error("\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u65F6\u957F");return}this.timeSetting.courseMinutes=Number(e.courseMinutes),this.timeSetting.freeMinutes=Number(e.freeMinutes),this.timerStatus=!0}catch{}},onChoiceTimer(e,t){this.form.setting=t?"\u5DF2\u8BBE\u7F6E":"",this.timerObject=e,this.timerStatus=!1},onChoice(e){const t=e||[];this.form.subjectId=t,this.form.subjectIdTemp=t.join(",")||"";const i=[...this.form.subjectPrice];t.forEach(r=>{i.findIndex(n=>n.subjectId===r)===-1&&i.push({subjectId:r,subjectPrice:null,subjectName:""})});const a=[];i.forEach(r=>{t.some(n=>n===r.subjectId)&&a.push(r)}),this.form.subjectPrice=a,this.subjectStatus=!1},getSubjectName(e){const t=this.subjectList.find(i=>i.id===e);return t?t.name:""},onFormatter(e,t){w(e)},async onSubmit(){this.$refs.form.validate(async e=>{if(e)try{const t=this.form;t.subjectPrice.forEach(i=>{i.subjectName=this.getSubjectName(i.subjectId)}),t.setting=t.setting==="\u672A\u8BBE\u7F6E"?"":t.setting,await y.post("/api-website/teacherFreeTime/upSet",{data:b(b({},t),this.timerObject)}),C.success("\u8BBE\u7F6E\u6210\u529F"),setTimeout(()=>{postMessage({api:"back",content:{}})},500)}catch{}else return this.$nextTick(()=>{document.getElementsByClassName("is-error")[0].scrollIntoView({block:"center",behavior:"smooth"})}),!1})}},render(){var i;let e,t;return s("div",{class:st.setting},[s("div",{class:"text-2xl font-semibold text-black leading-none px-6 py-5 "},[c("\u966A\u7EC3\u8BFE\u8BBE\u7F6E")]),((i=L.user.data)==null?void 0:i.entryFlag)?s(J,null,[s(q,{labelPosition:"left",labelWidth:"188px",size:"large",model:this.form,ref:"form",class:"px-6 py-5"},{default:()=>[s(p,{label:"\u662F\u5426\u5F00\u542F\u966A\u7EC3",prop:"enableFlag",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u5F00\u542F\u966A\u7EC3"}]},{default:()=>[s(g,{class:"w-full",modelValue:this.form.enableFlag,"onUpdate:modelValue":a=>this.form.enableFlag=a},{default:()=>[s(g.Option,{value:1,label:"\u662F"},{default:()=>[c("\u662F")]}),s(g.Option,{value:0,label:"\u5426"},{default:()=>[c("\u5426")]})]})]}),s(p,{label:"\u53EF\u6559\u6388\u58F0\u90E8",prop:"subjectId",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u53EF\u6559\u6388\u58F0\u90E8",trigger:"change"}]},{default:()=>[s(g,{multiple:!0,filterable:!0,placeholder:"\u8BF7\u9009\u62E9\u53EF\u6559\u6388\u58F0\u90E8",class:"w-full",multipleLimit:5,modelValue:this.form.subjectId,"onUpdate:modelValue":a=>this.form.subjectId=a,onChange:this.onChoice},I(e=this.subjectList.map(a=>s(v,{key:a.id,value:a.id,label:a.name},null)))?e:{default:()=>[e]})]}),s(p,{label:"\u5355\u8BFE\u65F6\u957F",prop:"courseMinutes",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u957F",trigger:"change"}]},{default:()=>[s(g,{class:"w-full",placeholder:"\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u65F6\u957F",modelValue:this.form.courseMinutes,"onUpdate:modelValue":a=>this.form.courseMinutes=a,onChange:a=>{this.timerObject={},this.form.setting="\u672A\u8BBE\u7F6E",this.minutes.forEach(r=>{r.courseMinutes===a&&(this.form.freeMinutes=r.freeMinutes)})}},I(t=this.minutes.map(a=>s(v,{key:a.courseMinutes,value:a.courseMinutes},{default:()=>[a.name]})))?t:{default:()=>[t]})]}),this.form.subjectPrice.map((a,r)=>s(p,{label:`${this.getSubjectName(a.subjectId)}\u966A\u7EC3\u4EF7\u683C`,prop:`subjectPrice.${r}.subjectPrice`,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u58F0\u90E8\u966A\u7EC3\u4EF7\u683C"}]},{default:()=>[s(x,{onInput:u=>{a.subjectPrice=w(u)},type:"text",placeholder:"\u8BF7\u8F93\u5165\u966A\u7EC3\u4EF7\u683C",modelValue:a.subjectPrice,"onUpdate:modelValue":u=>a.subjectPrice=u,maxlength:8},{suffix:()=>s("span",{class:"text-base text-[#999]"},[c("\u5143")])})]})),s(p,{label:"\u662F\u5426\u8DF3\u8FC7\u8282\u5047\u65E5"},{default:()=>[s(U,{modelValue:this.form.skipHolidayFlag,"onUpdate:modelValue":a=>this.form.skipHolidayFlag=a},{default:()=>[s(N,{label:1,class:"mr-3 w-24"},{default:()=>[c("\u662F")]}),s(N,{label:0,class:"w-24"},{default:()=>[c("\u5426")]})]})]}),s(p,{label:"\u966A\u7EC3\u65F6\u95F4\u6BB5"},{default:()=>[s("div",{onClick:this.onTimer,class:"w-full"},[s(x,{readonly:!0,class:"cursor-pointer",modelValue:this.form.setting,"onUpdate:modelValue":a=>this.form.setting=a,placeholder:"\u8BF7\u9009\u62E9\u966A\u7EC3\u65F6\u95F4\u6BB5",suffixIcon:"ArrowDown"},null)])]})]}),s("div",{class:"text-center pt-6 pb-7"},[s(j,{class:"!w-44 !h-[48px] !text-base",round:!0,onClick:()=>{this.form={enableFlag:1,courseMinutes:null,freeMinutes:0,subjectIdTemp:"",subjectId:[],subjectPrice:[],skipHolidayFlag:1,setting:"\u672A\u8BBE\u7F6E"},this.$refs.form.resetFields()}},{default:()=>[c("\u91CD\u7F6E")]}),s(j,{type:"primary",class:"!w-44 !h-[48px] !text-base",round:!0,onClick:this.onSubmit},{default:()=>[c("\u4FDD\u5B58\u8BBE\u7F6E")]})])]):s(B,{type:"teacherCert",message:"\u60A8\u8FD8\u672A\u5B8C\u6210\u8FBE\u4EBA\u8BA4\u8BC1\uFF0C\u8BA4\u8BC1\u540E\u624D\u53EF\u8BBE\u7F6E\u966A\u7EC3\u8BFE\u54E6~",buttonVisibility:!0,buttonText:"\u53BB\u8BA4\u8BC1",onDetail:()=>{this.$router.push("/teacherAuth")}},null),s($,{modelValue:this.timerStatus,"onUpdate:modelValue":a=>this.timerStatus=a,showClose:!0,width:"488px"},{default:()=>[this.timerStatus&&s(tt,{onChoice:this.onChoiceTimer,onClose:()=>{this.timerStatus=!1},timerObject:this.timerObject,courseMinutes:Number(this.timeSetting.courseMinutes),freeMinutes:Number(this.timeSetting.freeMinutes),startSetting:this.timeSetting.startSetting,endSetting:this.timeSetting.endSetting},null)]})])}});export{ot as default};