!function(){function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e)||function(){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 t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n68?1900:2e3)},o=function(e){return function(t){this[e]=+t}},s=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e)}],c=function(e){var t=a[e];return t&&(t.indexOf?t:t.s.concat(t.f))},f=function(e,t){var n,r=a.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},l={A:[i,function(e){this.afternoon=f(e,!1)}],a:[i,function(e){this.afternoon=f(e,!0)}],S:[/\d/,function(e){this.milliseconds=100*+e}],SS:[n,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[r,o("seconds")],ss:[r,o("seconds")],m:[r,o("minutes")],mm:[r,o("minutes")],H:[r,o("hours")],h:[r,o("hours")],HH:[r,o("hours")],hh:[r,o("hours")],D:[r,o("day")],DD:[n,o("day")],Do:[i,function(e){var t=a.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r)}],M:[r,o("month")],MM:[n,o("month")],MMM:[i,function(e){var t=c("months"),n=(c("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(e){var t=c("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,o("year")],YY:[n,function(e){this.year=u(e)}],YYYY:[/\d{4}/,o("year")],Z:s,ZZ:s};function d(n){var r,i;r=n,i=a&&a.formats;for(var u=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var a=r&&r.toUpperCase();return n||i[r]||e[r]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),o=u.length,s=0;s-1)return new Date(("X"===t?1e3:1)*e);var r=d(t)(e),i=r.year,a=r.month,u=r.day,o=r.hours,s=r.minutes,c=r.seconds,f=r.milliseconds,l=r.zone,m=new Date,p=u||(i||a?1:m.getDate()),h=i||m.getFullYear(),b=0;i&&!a||(b=a>0?a-1:m.getMonth());var g=o||0,_=s||0,y=c||0,j=f||0;return l?new Date(Date.UTC(h,b,p,g,_,y,j+60*l.offset*1e3)):n?new Date(Date.UTC(h,b,p,g,_,y,j)):new Date(h,b,p,g,_,y,j)}catch(e){return new Date("")}}(t,o,r),this.init(),l&&!0!==l&&(this.$L=this.locale(l).$L),f&&t!=this.format(o)&&(this.$d=new Date("")),a={}}else if(o instanceof Array)for(var m=o.length,p=1;p<=m;p+=1){u[1]=o[p-1];var h=n.apply(this,u);if(h.isValid()){this.$d=h.$d,this.$L=h.$L,this.init();break}p===m&&(this.$d=new Date(""))}else i.call(this,e)}}}()}(B);var J=B.exports;n.extend(J),n.extend(q);var R=i({name:"timer",props:{timerObject:{type:Object,default:{}},onChoice:{type:Function,default:function(e){}},courseMinutes:{type:Number,default:25},freeMinutes:{type:Number,default:5},startSetting:{type:String,default:"08:00"},endSetting:{type:String,default:"18:00"}},data:function(){return{timerList:[],list:[],weekList:["周一","周二","周三","周四","周五","周六","周日"],weekType:["monday","tuesday","wednesday","thursday","friday","saturday","sunday"]}},mounted:function(){this.list=this.timerInit(this.startSetting,this.endSetting,this.courseMinutes+this.freeMinutes||30),console.log(this.endSetting)},methods:{timerInit:function(e,t,r){for(var i=n(e,"HH:mm"),u=n(t,"HH:mm"),o=[];i.add(r,"minute").isSameOrBefore(n(u));){var s={startTime:i.format("HH:mm"),endTime:i.add(r,"minute").format("HH:mm"),status:!1};o.push(s),i=i.add(r,"minute")}var c=[];return o.forEach((function(e){for(var t=[],n=0;n<7;n++)t.push(a({},e));c.push(t)})),this._initData(c)},_initData:function(e){var t=this.weekType,r=this.timerObject;return e.forEach((function(e){e.forEach((function(e,i){var a=r[t[i]],u=n(e.startTime,"HH:mm").format("HH:mm:ss");(null==a?void 0:a.some((function(e){return e.startTime===u})))&&(e.status=!0)}))})),e},btnStatus:function(e,t){return"row"===t?this.list.every((function(t){return t[e].status})):"col"==t?this.list[e].every((function(e){return e.status})):void 0},choice:function(e,t,n){"row"===t&&this.list.forEach((function(t,r){var i=!n;t[e].status=i})),"col"==t&&this.list[e].forEach((function(e,t){var r=!n;e.status=r}))},onSubmit:function(){var e=this,t=this.list,r={monday:[],tuesday:[],wednesday:[],thursday:[],friday:[],saturday:[],sunday:[]},i=this.weekType,a=!1;t.forEach((function(t,u){t.forEach((function(t,u){t.status&&(a=!0,r[i[u]].push({startTime:n(t.startTime,"HH:mm").format("HH:mm:ss"),endTime:n(t.endTime,"HH:mm").subtract(e.freeMinutes,"minute").format("HH:mm:ss")}))}))})),this.onChoice&&this.onChoice(r,a)}},render:function(){var e=this;return u("div",{class:L},[u("div",{class:Y},[u("div",{class:F},[o("请选择陪练开始时间")]),u("div",{class:V},[o("陪练课单课时时长为 "),u("span",null,[this.courseMinutes]),o(" 分钟")])]),u("div",{class:[E,"mb12"]},[u(w,{gutter:5},{default:function(){return[u(T,{span:3},null),e.weekList.map((function(e){return u(T,{span:3},{default:function(){return[u("span",{class:A},[e])]}})}))]}}),u(w,{gutter:5},{default:function(){return[u(T,{span:3},null),e.weekList.map((function(t,n){return u(T,{span:3},{default:function(){return[u("span",{class:[A,e.btnStatus(n,"row")&&z],onClick:function(){return e.choice(n,"row",e.btnStatus(n,"row"))},title:t},[o("全选")])]}})}))]}}),this.list.map((function(t,n){return u(w,{gutter:5},{default:function(){return[u(T,{span:3},{default:function(){return[u("span",{class:[A,e.btnStatus(n,"col")&&z],onClick:function(){return e.choice(n,"col",e.btnStatus(n,"col"))}},[o("全选")])]}}),t.map((function(e){return u(T,{span:3},{default:function(){return[u("span",{class:[A,e.status&&$],title:e,style:{color:"#333333"},onClick:function(){return e.status=!e.status}},[e.startTime])]}})}))]}})}))]),u(v,{offsetBottom:0,position:"bottom"},{default:function(){return[u("div",{class:"btnGroup"},[u(s,{block:!0,round:!0,type:"primary",onClick:e.onSubmit},{default:function(){return[o("确定")]}})])]}})])}});function Z(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!m(e)}t("default",i({name:"PracticeSetting",data:function(){return{subjectList:[],chargeTypeArr:{0:"否",1:"是"},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:function(){var e=this.form;return(e.subjectIdTemp?e.subjectIdTemp.split(","):[]).map((function(e){return Number(e)}))||[]}},mounted:function(){var e=this;return r(regeneratorRuntime.mark((function t(){var n,r,i,u,o,s,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,c.get("/api-teacher/sysConfig/queryByParamNameList",{params:{paramNames:"practice_times_setting,practice_service_fee,course_start_setting,course_end_setting"}});case 3:return n=t.sent,(n.data||[]).forEach((function(t){if("practice_times_setting"===t.paramName){var n=t.paramValue?JSON.parse(t.paramValue):[],r=[];n.forEach((function(e){r.push(a(a({},e),{},{name:e.courseMinutes}))})),e.minutes=[].concat(r)}"practice_service_fee"===t.paramName&&(e.rate=t.paramValue),"course_start_setting"===t.paramName&&(e.timeSetting.startSetting=t.paramValue),"course_end_setting"===t.paramName&&(e.timeSetting.endSetting=t.paramValue)})),t.next=8,c.post("/api-teacher/teacher/querySubject");case 8:return r=t.sent,e.subjectList=r.data||[],t.next=12,c.post("/api-teacher/teacherFreeTime/getDetail",{data:{defaultFlag:1}});case 12:i=t.sent,(u=i.data)&&(e.timeSetting.courseMinutes=u.courseMinutes,e.timeSetting.freeMinutes=u.freeMinutes,e.timerObject={monday:u.monday?JSON.parse(u.monday):[],tuesday:u.tuesday?JSON.parse(u.tuesday):[],wednesday:u.wednesday?JSON.parse(u.wednesday):[],thursday:u.thursday?JSON.parse(u.thursday):[],friday:u.friday?JSON.parse(u.friday):[],saturday:u.saturday?JSON.parse(u.saturday):[],sunday:u.sunday?JSON.parse(u.sunday):[]},o=[],s=[],(u.subjectPrice||[]).forEach((function(e){o.push(e.subjectId),s.push({subjectId:e.subjectId,subjectPrice:e.subjectPrice,subjectName:e.subjectName})})),f=e.timerObject,e.form={enableFlag:u.enableFlag,courseMinutes:u.courseMinutes,freeMinutes:u.freeMinutes,subjectIdTemp:o.join(","),subjectId:o,subjectPrice:s,skipHolidayFlag:u.skipHolidayFlag,setting:f.monday.length>0||f.tuesday.length>0||f.wednesday.length>0||f.thursday.length>0||f.friday.length>0||f.saturday.length>0||f.sunday.length>0?"已设置":""}),t.next=19;break;case 17:t.prev=17,t.t0=t.catch(0);case 19:case"end":return t.stop()}}),t,null,[[0,17]])})))()},methods:{onSelect:function(e){this.form.courseMinutes!==e.courseMinutes&&(this.timerObject={},this.form.setting=""),this.form.courseMinutes=e.courseMinutes,this.form.freeMinutes=e.freeMinutes},onTimer:function(){var e=this;return r(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,(n=e.form).courseMinutes){t.next=5;break}return f("请选择单课时时长"),t.abrupt("return");case 5:e.timeSetting.courseMinutes=Number(n.courseMinutes),e.timeSetting.freeMinutes=Number(n.freeMinutes),e.timerStatus=!0,t.next=12;break;case 10:t.prev=10,t.t0=t.catch(0);case 12:case"end":return t.stop()}}),t,null,[[0,10]])})))()},onChoiceTimer:function(e,t){this.form.setting=t?"已设置":"",this.timerObject=e,this.timerStatus=!1},onChoice:function(t){console.log(t);var n=t||[];this.form.subjectId=n,this.form.subjectIdTemp=n.join(",")||"";var r=e(this.form.subjectPrice);n.forEach((function(e){-1===r.findIndex((function(t){return t.subjectId===e}))&&r.push({subjectId:e,subjectPrice:null,subjectName:""})}));var i=[];r.forEach((function(e){n.some((function(t){return t===e.subjectId}))&&i.push(e)})),this.form.subjectPrice=i,this.subjectStatus=!1},getSubjectName:function(e){var t=this.subjectList.find((function(t){return t.id===e}));return t?t.name:""},onFormatter:function(e){return M(e)},onSubmit:function(){var e=this;return r(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,(n=e.form).subjectPrice.forEach((function(t){t.subjectName=e.getSubjectName(t.subjectId)})),t.next=5,c.post("/api-teacher/teacherFreeTime/upSet",{data:a(a({},n),e.timerObject)});case 5:f("设置成功"),setTimeout((function(){l({api:"back",content:{}})}),500),t.next=11;break;case 9:t.prev=9,t.t0=t.catch(0);case 11:case"end":return t.stop()}}),t,null,[[0,9]])})))()}},render:function(){var e,t,n,r,i=this;return u(C,{style:{paddingTop:"15px"},onSubmit:this.onSubmit},{default:function(){return[u(O,null,null),u(p,null,{default:function(){return[u(h,{title:"是否开启陪练课",required:!0,border:!1},{default:function(){return[u(_,{class:I,modelValue:i.form.enableFlag,"onUpdate:modelValue":function(e){return i.form.enableFlag=e}},Z(e=["1","0"].map((function(e){var t=Number(e)===Number(i.form.enableFlag),n=t?"primary":"default";return u(y,{class:N,name:e},{default:function(){return[u(j,{size:"large",plain:t,type:n},{default:function(){return[i.chargeTypeArr[e]]}})]}})})))?e:{default:function(){return[e]}})]}}),u(h,{title:"可教授乐器",required:!0},{default:function(){return[i.form.subjectPrice&&i.form.subjectPrice.length>0&&u(D,{modelValue:i.form.subjectId,class:P,disabled:!0,onClick:function(){i.subjectStatus=!0}},Z(t=i.form.subjectPrice.map((function(e){var t;return u(k,{class:H},{default:function(){return[u(j,{plain:!0,type:"primary",round:!0,closeable:!0,size:"large",style:{backgroundColor:"#E9FFF8"},onClick:function(e){e.stopPropagation(),e.preventDefault()},onClose:function(t){t.stopPropagation(),t.preventDefault(),d.confirm({title:"提示",message:"您是否要删除选择的乐器?",confirmButtonColor:"var(--van-primary)"}).then((function(){var t=i.form.subjectId.indexOf(e.subjectId);-1!==t&&i.form.subjectId.splice(t,1);var n=i.form.subjectPrice.findIndex((function(t){return t.subjectId===e.subjectId}));-1!==n&&i.form.subjectPrice.splice(n,1),i.form.subjectIdTemp=i.form.subjectId.join(",")}))}},Z(t=i.getSubjectName(e.subjectId))?t:{default:function(){return[t]}})]}})})))?t:{default:function(){return[t]}}),!i.form.subjectPrice.length&&u(S,{modelValue:i.form.subjectIdTemp,"onUpdate:modelValue":function(e){return i.form.subjectIdTemp=e},name:"courseMinutes",readonly:!0,onClick:function(){i.subjectStatus=!0},rules:[{required:!0,message:"请选择可教授乐器"}],placeholder:"请选择可教授乐器"},null)]}}),u(h,{title:"单课时时长",required:!0},{default:function(){return[u(S,{modelValue:i.form.courseMinutes,"onUpdate:modelValue":function(e){return i.form.courseMinutes=e},name:"courseMinutes",readonly:!0,isLink:!0,onClick:function(){i.classTimeStatus=!0},rules:[{required:!0,message:"请选择单课时时长"}],placeholder:"请选择单课时时长"},{button:function(){return u("span",null,[o("分钟")])}})]}})]}}),i.form.subjectPrice&&i.form.subjectPrice.length>0&&u(p,null,Z(n=i.form.subjectPrice.map((function(e){return u(h,{title:"".concat(i.getSubjectName(e.subjectId),"声部陪练价格"),required:!0},{default:function(){return[u(S,{modelValue:e.subjectPrice,"onUpdate:modelValue":function(t){return e.subjectPrice=t},name:"singleMins",type:"number",labelWidth:"auto",label:"".concat(i.form.courseMinutes||0,"分钟 / "),rules:[{required:!0,message:"请选择声部陪练价格"}],formatter:i.onFormatter,maxlength:8,placeholder:"请选择声部陪练价格"},{button:function(){return u("span",null,[o("元")])}})]}})})))?n:{default:function(){return[n]}}),u(p,null,{default:function(){return[u(h,{title:"可陪练时间段"},{default:function(){return[u(S,{modelValue:i.form.setting,name:"singleMins",readonly:!0,isLink:!0,onClick:i.onTimer,placeholder:"未设置"},null)]}})]}}),u(p,null,{default:function(){return[u(h,{required:!0,title:"是否跳过节假日",border:!1},{default:function(){return[u(_,{class:I,modelValue:i.form.skipHolidayFlag,"onUpdate:modelValue":function(e){return i.form.skipHolidayFlag=e}},Z(r=["1","0"].map((function(e){var t=Number(e)===Number(i.form.skipHolidayFlag),n=t?"primary":"default";return u(y,{class:N,name:e},{default:function(){return[u(j,{size:"large",plain:t,type:n},{default:function(){return[i.chargeTypeArr[e]]}})]}})})))?r:{default:function(){return[r]}})]}})]}}),u(v,{offsetBottom:0,position:"bottom"},{default:function(){return[u("div",{class:"btnGroup"},[u(s,{block:!0,round:!0,type:"primary","native-type":"submit"},{default:function(){return[o("提交")]}})])]}}),u(g,{modelValue:i.subjectStatus,"onUpdate:modelValue":function(e){return i.subjectStatus=e},destroy:!0},{default:function(){return[u(O,null,null),u(b,{max:5,single:!0,subjectList:i.subjectList,choiceSubjectIds:i.choiceSubjectId,onChoice:i.onChoice},null)]}}),u(g,{modelValue:i.timerStatus,"onUpdate:modelValue":function(e){return i.timerStatus=e},destroy:!0},{default:function(){return[u(O,{title:"设置陪练时间段"},null),u(R,{onChoice:i.onChoiceTimer,timerObject:i.timerObject,courseMinutes:Number(i.timeSetting.courseMinutes),freeMinutes:Number(i.timeSetting.freeMinutes),startSetting:i.timeSetting.startSetting,endSetting:i.timeSetting.endSetting},null)]}}),u(x,{show:i.classTimeStatus,"onUpdate:show":function(e){return i.classTimeStatus=e},actions:i.minutes,cancelText:"取消",closeOnClickAction:!0,onSelect:i.onSelect},null)]}})}}))}}}))}();