practice-setting.3f83c993.js 16 KB

1
  1. import{C as q,a as O}from"./index.f9e55fe3.js";import{S as Mt}from"./index.cb7569ce.js";import{C as rt}from"./index.895996db.js";import{bd as nt,x as C,d as ct,i as e,A as v,B as lt,e as U,T as at,p as _t,D as vt,$ as Tt}from"./index.7994470a.js";import{R as ot,a as ut}from"./index.9dc8689d.js";import"./index.c9af17c2.js";import{T as tt}from"./index.0262b810.js";import{S as mt}from"./index.6449f9de.js";import"./index.777f4790.js";import{F as J}from"./index.3dd26d27.js";import{A as xt}from"./index.e11930ae.js";import{C as kt}from"./index.29eb1675.js";import{v as Ct}from"./toolsValidate.add49407.js";import{R as et,C as P}from"./index.80389b79.js";import{C as Ft}from"./index.2e766b01.js";import{F as wt}from"./index.a241f507.js";import"./index.2fbdc579.js";import"./checkbox_default.8d9b037b.js";import"./index.570461cd.js";import"./use-id.117b75b2.js";const It="_select_kcj91_1",Nt="_radio_kcj91_12",Lt="_checkbox_kcj91_13";var H={select:It,"tag-list":"_tag-list_kcj91_5","radio-group":"_radio-group_kcj91_12","checkbox-group":"_checkbox-group_kcj91_13",radio:Nt,checkbox:Lt};const Dt="_timer_vlxou_1",Ot="_tips_vlxou_7",Pt="_tipsTitle_vlxou_13",Ht="_tipsTime_vlxou_19",Yt="_timerContainer_vlxou_28",Et="_tag_vlxou_36",Vt="_active_vlxou_47",At="_select_vlxou_51";var p={timer:Dt,tips:Ot,tipsTitle:Pt,tipsTime:Ht,timerContainer:Yt,tag:Et,active:Vt,select:At},dt={exports:{}};(function(s,r){(function(a,n){s.exports=n()})(nt,function(){return function(a,n){n.prototype.isSameOrBefore=function(t,i){return this.isSame(t,i)||this.isBefore(t,i)}}})})(dt);var $t=dt.exports,ht={exports:{}};(function(s,r){(function(a,n){s.exports=n()})(nt,function(){var a={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,t=/\d\d/,i=/\d\d?/,u=/\d*[^-_:/,()\s\d]+/,f={},m=function(o){return(o=+o)+(o>68?1900:2e3)},l=function(o){return function(c){this[o]=+c}},Y=[/[+-]\d\d:?(\d\d)?|Z/,function(o){(this.zone||(this.zone={})).offset=function(c){if(!c||c==="Z")return 0;var d=c.match(/([+-]|\d\d)/g),h=60*d[1]+(+d[2]||0);return h===0?0:d[0]==="+"?-h:h}(o)}],z=function(o){var c=f[o];return c&&(c.indexOf?c:c.s.concat(c.f))},st=function(o,c){var d,h=f.meridiem;if(h){for(var j=1;j<=24;j+=1)if(o.indexOf(h(j,0,c))>-1){d=j>12;break}}else d=o===(c?"pm":"PM");return d},ft={A:[u,function(o){this.afternoon=st(o,!1)}],a:[u,function(o){this.afternoon=st(o,!0)}],S:[/\d/,function(o){this.milliseconds=100*+o}],SS:[t,function(o){this.milliseconds=10*+o}],SSS:[/\d{3}/,function(o){this.milliseconds=+o}],s:[i,l("seconds")],ss:[i,l("seconds")],m:[i,l("minutes")],mm:[i,l("minutes")],H:[i,l("hours")],h:[i,l("hours")],HH:[i,l("hours")],hh:[i,l("hours")],D:[i,l("day")],DD:[t,l("day")],Do:[u,function(o){var c=f.ordinal,d=o.match(/\d+/);if(this.day=d[0],c)for(var h=1;h<=31;h+=1)c(h).replace(/\[|\]/g,"")===o&&(this.day=h)}],M:[i,l("month")],MM:[t,l("month")],MMM:[u,function(o){var c=z("months"),d=(z("monthsShort")||c.map(function(h){return h.slice(0,3)})).indexOf(o)+1;if(d<1)throw new Error;this.month=d%12||d}],MMMM:[u,function(o){var c=z("months").indexOf(o)+1;if(c<1)throw new Error;this.month=c%12||c}],Y:[/[+-]?\d+/,l("year")],YY:[t,function(o){this.year=m(o)}],YYYY:[/\d{4}/,l("year")],Z:Y,ZZ:Y};function pt(o){var c,d;c=o,d=f&&f.formats;for(var h=(o=c.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(w,T,y){var b=y&&y.toUpperCase();return T||d[y]||a[y]||d[b].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(x,k,I){return k||I.slice(1)})})).match(n),j=h.length,S=0;S<j;S+=1){var E=h[S],F=ft[E],M=F&&F[0],_=F&&F[1];h[S]=_?{regex:M,parser:_}:E.replace(/^\[|\]$/g,"")}return function(w){for(var T={},y=0,b=0;y<j;y+=1){var x=h[y];if(typeof x=="string")b+=x.length;else{var k=x.regex,I=x.parser,A=w.slice(b),L=k.exec(A)[0];I.call(T,L),w=w.replace(L,"")}}return function(N){var g=N.afternoon;if(g!==void 0){var D=N.hours;g?D<12&&(N.hours+=12):D===12&&(N.hours=0),delete N.afternoon}}(T),T}}return function(o,c,d){d.p.customParseFormat=!0,o&&o.parseTwoDigitYear&&(m=o.parseTwoDigitYear);var h=c.prototype,j=h.parse;h.parse=function(S){var E=S.date,F=S.utc,M=S.args;this.$u=F;var _=M[1];if(typeof _=="string"){var w=M[2]===!0,T=M[3]===!0,y=w||T,b=M[2];T&&(b=M[2]),f=this.$locale(),!w&&b&&(f=d.Ls[b]),this.$d=function(A,L,N){try{if(["x","X"].indexOf(L)>-1)return new Date((L==="X"?1e3:1)*A);var g=pt(L)(A),D=g.year,$=g.month,bt=g.day,gt=g.hours,yt=g.minutes,jt=g.seconds,St=g.milliseconds,it=g.zone,Z=new Date,G=bt||(D||$?1:Z.getDate()),R=D||Z.getFullYear(),B=0;D&&!$||(B=$>0?$-1:Z.getMonth());var X=gt||0,W=yt||0,K=jt||0,Q=St||0;return it?new Date(Date.UTC(R,B,G,X,W,K,Q+60*it.offset*1e3)):N?new Date(Date.UTC(R,B,G,X,W,K,Q)):new Date(R,B,G,X,W,K,Q)}catch{return new Date("")}}(E,_,F),this.init(),b&&b!==!0&&(this.$L=this.locale(b).$L),y&&E!=this.format(_)&&(this.$d=new Date("")),f={}}else if(_ instanceof Array)for(var x=_.length,k=1;k<=x;k+=1){M[1]=_[k-1];var I=d.apply(this,M);if(I.isValid()){this.$d=I.$d,this.$L=I.$L,this.init();break}k===x&&(this.$d=new Date(""))}else j.call(this,S)}}})})(ht);var Bt=ht.exports;C.extend(Bt);C.extend($t);var qt=ct({name:"timer",props:{timerObject:{type:Object,default:{}},onChoice:{type:Function,default:s=>{}},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),console.log(this.endSetting)},methods:{timerInit(s,r,a){let n=C(s,"HH:mm");const t=C(r,"HH:mm"),i=[];for(;n.add(a,"minute").isSameOrBefore(C(t));){const m={startTime:n.format("HH:mm"),endTime:n.add(a,"minute").format("HH:mm"),status:!1};i.push(m),n=n.add(a,"minute")}const u=[];return i.forEach(m=>{const l=[];for(let Y=0;Y<7;Y++)l.push({...m});u.push(l)}),this._initData(u)},_initData(s){const r=this.weekType,a=this.timerObject;return s.forEach(n=>{n.forEach((t,i)=>{const u=a[r[i]],f=C(t.startTime,"HH:mm").format("HH:mm:ss");(u==null?void 0:u.some(l=>l.startTime===f))&&(t.status=!0)})}),s},btnStatus(s,r){if(r==="row")return this.list.every(a=>a[s].status);if(r=="col")return this.list[s].every(a=>a.status)},choice(s,r,a){r==="row"&&this.list.forEach((n,t)=>{const i=!a;n[s].status=i}),r=="col"&&this.list[s].forEach((n,t)=>{const i=!a;n.status=i})},onSubmit(){const s=this.list,r={monday:[],tuesday:[],wednesday:[],thursday:[],friday:[],saturday:[],sunday:[]},a=this.weekType;let n=!1;s.forEach((t,i)=>{t.forEach((u,f)=>{u.status&&(n=!0,r[a[f]].push({startTime:C(u.startTime,"HH:mm").format("HH:mm:ss"),endTime:C(u.endTime,"HH:mm").subtract(this.freeMinutes,"minute").format("HH:mm:ss")}))})}),this.onChoice&&this.onChoice(r,n)}},render(){return e("div",{class:p.timer},[e("div",{class:p.tips},[e("div",{class:p.tipsTitle},[v("\u8BF7\u9009\u62E9\u966A\u7EC3\u5F00\u59CB\u65F6\u95F4")]),e("div",{class:p.tipsTime},[v("\u966A\u7EC3\u8BFE\u5355\u8BFE\u65F6\u65F6\u957F\u4E3A "),e("span",null,[this.courseMinutes]),v(" \u5206\u949F")])]),e("div",{class:[p.timerContainer,"mb12"]},[e(et,{gutter:5},{default:()=>[e(P,{span:3},null),this.weekList.map(s=>e(P,{span:3},{default:()=>[e("span",{class:p.tag},[s])]}))]}),e(et,{gutter:5},{default:()=>[e(P,{span:3},null),this.weekList.map((s,r)=>e(P,{span:3},{default:()=>[e("span",{class:[p.tag,this.btnStatus(r,"row")&&p.active],onClick:()=>this.choice(r,"row",this.btnStatus(r,"row")),title:s},[v("\u5168\u9009")])]}))]}),this.list.map((s,r)=>e(et,{gutter:5},{default:()=>[e(P,{span:3},{default:()=>[e("span",{class:[p.tag,this.btnStatus(r,"col")&&p.active],onClick:()=>this.choice(r,"col",this.btnStatus(r,"col"))},[v("\u5168\u9009")])]}),s.map(a=>e(P,{span:3},{default:()=>[e("span",{class:[p.tag,a.status&&p.select],title:a,style:{color:"#333333"},onClick:()=>a.status=!a.status},[a.startTime])]}))]}))]),e(mt,{offsetBottom:0,position:"bottom"},{default:()=>[e("div",{class:"btnGroup"},[e(lt,{block:!0,round:!0,type:"primary",onClick:this.onSubmit},{default:()=>[v("\u786E\u5B9A")]})])]})])}});function V(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!Tt(s)}var me=ct({name:"PracticeSetting",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:""},minutes:[],rate:0}},computed:{choiceSubjectId(){const s=this.form;return(s.subjectIdTemp?s.subjectIdTemp.split(","):[]).map(a=>Number(a))||[]}},async mounted(){try{((await U.get("/api-teacher/sysConfig/queryByParamNameList",{params:{paramNames:"practice_times_setting,practice_service_fee,course_start_setting,course_end_setting"}})).data||[]).forEach(i=>{if(i.paramName==="practice_times_setting"){let u=i.paramValue?JSON.parse(i.paramValue):[],f=[];u.forEach(m=>{f.push({...m,name:m.courseMinutes})}),this.minutes=[...f]}i.paramName==="practice_service_fee"&&(this.rate=i.paramValue),i.paramName==="course_start_setting"&&(this.timeSetting.startSetting=i.paramValue),i.paramName==="course_end_setting"&&(this.timeSetting.endSetting=i.paramValue)});let a=await U.post("/api-teacher/teacher/querySubject");this.subjectList=a.data||[];const t=(await U.post("/api-teacher/teacherFreeTime/getDetail",{data:{defaultFlag:1}})).data;if(t){this.timeSetting.courseMinutes=t.courseMinutes,this.timeSetting.freeMinutes=t.freeMinutes,this.timerObject={monday:t.monday?JSON.parse(t.monday):[],tuesday:t.tuesday?JSON.parse(t.tuesday):[],wednesday:t.wednesday?JSON.parse(t.wednesday):[],thursday:t.thursday?JSON.parse(t.thursday):[],friday:t.friday?JSON.parse(t.friday):[],saturday:t.saturday?JSON.parse(t.saturday):[],sunday:t.sunday?JSON.parse(t.sunday):[]};let i=[],u=[];(t.subjectPrice||[]).forEach(l=>{i.push(l.subjectId),u.push({subjectId:l.subjectId,subjectPrice:l.subjectPrice,subjectName:l.subjectName})});const m=this.timerObject;this.form={enableFlag:t.enableFlag,courseMinutes:t.courseMinutes,freeMinutes:t.freeMinutes,subjectIdTemp:i.join(","),subjectId:i,subjectPrice:u,skipHolidayFlag:t.skipHolidayFlag,setting:m.monday.length>0||m.tuesday.length>0||m.wednesday.length>0||m.thursday.length>0||m.friday.length>0||m.saturday.length>0||m.sunday.length>0?"\u5DF2\u8BBE\u7F6E":""}}}catch{}},methods:{onSelect(s){this.form.courseMinutes!==s.courseMinutes&&(this.timerObject={},this.form.setting=""),this.form.courseMinutes=s.courseMinutes,this.form.freeMinutes=s.freeMinutes},async onTimer(){try{const s=this.form;if(!s.courseMinutes){at("\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u65F6\u957F");return}this.timeSetting.courseMinutes=Number(s.courseMinutes),this.timeSetting.freeMinutes=Number(s.freeMinutes),this.timerStatus=!0}catch{}},onChoiceTimer(s,r){this.form.setting=r?"\u5DF2\u8BBE\u7F6E":"",this.timerObject=s,this.timerStatus=!1},onChoice(s){console.log(s);const r=s||[];this.form.subjectId=r,this.form.subjectIdTemp=r.join(",")||"";let a=[...this.form.subjectPrice];r.forEach(t=>{a.findIndex(u=>u.subjectId===t)===-1&&a.push({subjectId:t,subjectPrice:null,subjectName:""})});const n=[];a.forEach(t=>{r.some(u=>u===t.subjectId)&&n.push(t)}),this.form.subjectPrice=n,this.subjectStatus=!1},getSubjectName(s){const r=this.subjectList.find(a=>a.id===s);return r?r.name:""},onFormatter(s){return Ct(s)},async onSubmit(){try{const s=this.form;s.subjectPrice.forEach(r=>{r.subjectName=this.getSubjectName(r.subjectId)}),await U.post("/api-teacher/teacherFreeTime/upSet",{data:{...s,...this.timerObject}}),at("\u8BBE\u7F6E\u6210\u529F"),setTimeout(()=>{_t({api:"back",content:{}})},500)}catch{}}},render(){let s,r,a,n;return e(wt,{style:{paddingTop:"15px"},onSubmit:this.onSubmit},{default:()=>[e(q,null,{default:()=>[e(O,{title:"\u662F\u5426\u5F00\u542F\u966A\u7EC3\u8BFE",required:!0,border:!1},{default:()=>[e(ot,{class:H["radio-group"],modelValue:this.form.enableFlag,"onUpdate:modelValue":t=>this.form.enableFlag=t},V(s=["1","0"].map(t=>{const i=Number(t)===Number(this.form.enableFlag),u=i?"primary":"default";return e(ut,{class:H.radio,name:t},{default:()=>[e(tt,{size:"large",plain:i,type:u},{default:()=>[this.chargeTypeArr[t]]})]})}))?s:{default:()=>[s]})]}),e(O,{title:"\u53EF\u6559\u6388\u4E50\u5668",required:!0},{default:()=>[this.form.subjectPrice&&this.form.subjectPrice.length>0&&e(Ft,{modelValue:this.form.subjectId,class:H["checkbox-group"],disabled:!0,onClick:()=>{this.subjectStatus=!0}},V(r=this.form.subjectPrice.map(t=>{let i;return e(kt,{class:H.checkbox},{default:()=>[e(tt,{plain:!0,type:"primary",round:!0,closeable:!0,size:"large",style:{backgroundColor:"#E9FFF8"},onClick:u=>{u.stopPropagation(),u.preventDefault()},onClose:u=>{u.stopPropagation(),u.preventDefault(),vt.confirm({title:"\u63D0\u793A",message:"\u60A8\u662F\u5426\u8981\u5220\u9664\u9009\u62E9\u7684\u4E50\u5668\uFF1F",confirmButtonColor:"var(--van-primary)"}).then(()=>{const f=this.form.subjectId.indexOf(t.subjectId);f!==-1&&this.form.subjectId.splice(f,1);const m=this.form.subjectPrice.findIndex(l=>l.subjectId===t.subjectId);m!==-1&&this.form.subjectPrice.splice(m,1),this.form.subjectIdTemp=this.form.subjectId.join(",")})}},V(i=this.getSubjectName(t.subjectId))?i:{default:()=>[i]})]})}))?r:{default:()=>[r]}),!this.form.subjectPrice.length&&e(J,{modelValue:this.form.subjectIdTemp,"onUpdate:modelValue":t=>this.form.subjectIdTemp=t,name:"courseMinutes",readonly:!0,onClick:()=>{this.subjectStatus=!0},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u53EF\u6559\u6388\u4E50\u5668"}],placeholder:"\u8BF7\u9009\u62E9\u53EF\u6559\u6388\u4E50\u5668"},null)]}),e(O,{title:"\u5355\u8BFE\u65F6\u65F6\u957F",required:!0},{default:()=>[e(J,{modelValue:this.form.courseMinutes,"onUpdate:modelValue":t=>this.form.courseMinutes=t,name:"courseMinutes",readonly:!0,isLink:!0,onClick:()=>{this.classTimeStatus=!0},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u65F6\u957F"}],placeholder:"\u8BF7\u9009\u62E9\u5355\u8BFE\u65F6\u65F6\u957F"},{button:()=>e("span",null,[v("\u5206\u949F")])})]})]}),this.form.subjectPrice&&this.form.subjectPrice.length>0&&e(q,null,V(a=this.form.subjectPrice.map(t=>e(O,{title:`${this.getSubjectName(t.subjectId)}\u58F0\u90E8\u966A\u7EC3\u4EF7\u683C`,required:!0},{default:()=>[e(J,{modelValue:t.subjectPrice,"onUpdate:modelValue":i=>t.subjectPrice=i,name:"singleMins",type:"number",labelWidth:"auto",label:`${this.form.courseMinutes||0}\u5206\u949F / `,rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u58F0\u90E8\u966A\u7EC3\u4EF7\u683C"}],formatter:this.onFormatter,maxlength:8,placeholder:"\u8BF7\u9009\u62E9\u58F0\u90E8\u966A\u7EC3\u4EF7\u683C"},{button:()=>e("span",null,[v("\u5143")])})]})))?a:{default:()=>[a]}),e(q,null,{default:()=>[e(O,{title:"\u53EF\u966A\u7EC3\u65F6\u95F4\u6BB5"},{default:()=>[e(J,{modelValue:this.form.setting,name:"singleMins",readonly:!0,isLink:!0,onClick:this.onTimer,placeholder:"\u672A\u8BBE\u7F6E"},null)]})]}),e(q,null,{default:()=>[e(O,{required:!0,title:"\u662F\u5426\u8DF3\u8FC7\u8282\u5047\u65E5",border:!1},{default:()=>[e(ot,{class:H["radio-group"],modelValue:this.form.skipHolidayFlag,"onUpdate:modelValue":t=>this.form.skipHolidayFlag=t},V(n=["1","0"].map(t=>{const i=Number(t)===Number(this.form.skipHolidayFlag),u=i?"primary":"default";return e(ut,{class:H.radio,name:t},{default:()=>[e(tt,{size:"large",plain:i,type:u},{default:()=>[this.chargeTypeArr[t]]})]})}))?n:{default:()=>[n]})]})]}),e(mt,{offsetBottom:0,position:"bottom"},{default:()=>[e("div",{class:"btnGroup"},[e(lt,{block:!0,round:!0,type:"primary","native-type":"submit"},{default:()=>[v("\u63D0\u4EA4")]})])]}),e(rt,{modelValue:this.subjectStatus,"onUpdate:modelValue":t=>this.subjectStatus=t,destroy:!0},{default:()=>[e(Mt,{max:5,single:!0,subjectList:this.subjectList,choiceSubjectIds:this.choiceSubjectId,onChoice:this.onChoice},null)]}),e(rt,{modelValue:this.timerStatus,"onUpdate:modelValue":t=>this.timerStatus=t,destroy:!0},{default:()=>[e(qt,{onChoice:this.onChoiceTimer,timerObject:this.timerObject,courseMinutes:Number(this.timeSetting.courseMinutes),freeMinutes:Number(this.timeSetting.freeMinutes),startSetting:this.timeSetting.startSetting,endSetting:this.timeSetting.endSetting},null)]}),e(xt,{show:this.classTimeStatus,"onUpdate:show":t=>this.classTimeStatus=t,actions:this.minutes,cancelText:"\u53D6\u6D88",closeOnClickAction:!0,onSelect:this.onSelect},null)]})}});export{me as default};