!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(),g=0;i&&!a||(g=a>0?a-1:m.getMonth());var b=o||0,_=s||0,y=c||0,j=f||0;return l?new Date(Date.UTC(h,g,p,b,_,y,j+60*l.offset*1e3)):n?new Date(Date.UTC(h,g,p,b,_,y,j)):new Date(h,g,p,b,_,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)}}}()}(q);var B=q.exports;s.extend(B),s.extend(U);var J=c({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,n){for(var r=s(e,"HH:mm"),i=s(t,"HH:mm"),u=[];r.add(n,"minute").isSameOrBefore(s(i));){var o={startTime:r.format("HH:mm"),endTime:r.add(n,"minute").format("HH:mm"),status:!1};u.push(o),r=r.add(n,"minute")}var c=[];return u.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,n=this.timerObject;return e.forEach((function(e){e.forEach((function(e,r){var i=n[t[r]],a=s(e.startTime,"HH:mm").format("HH:mm:ss");(null==i?void 0:i.some((function(e){return e.startTime===a})))&&(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,n={monday:[],tuesday:[],wednesday:[],thursday:[],friday:[],saturday:[],sunday:[]},r=this.weekType,i=!1;t.forEach((function(t,a){t.forEach((function(t,a){t.status&&(i=!0,n[r[a]].push({startTime:s(t.startTime,"HH:mm").format("HH:mm:ss"),endTime:s(t.endTime,"HH:mm").subtract(e.freeMinutes,"minute").format("HH:mm:ss")}))}))})),this.onChoice&&this.onChoice(n,i)}},render:function(){var e=this;return f("div",{class:H},[f("div",{class:L},[f("div",{class:Y},[l("请选择陪练开始时间")]),f("div",{class:F},[l("陪练课单课时时长为 "),f("span",null,[this.courseMinutes]),l(" 分钟")])]),f("div",{class:[V,"mb12"]},[f(w,{gutter:5},{default:function(){return[f(T,{span:3},null),e.weekList.map((function(e){return f(T,{span:3},{default:function(){return[f("span",{class:A},[e])]}})}))]}}),f(w,{gutter:5},{default:function(){return[f(T,{span:3},null),e.weekList.map((function(t,n){return f(T,{span:3},{default:function(){return[f("span",{class:[A,e.btnStatus(n,"row")&&E],onClick:function(){return e.choice(n,"row",e.btnStatus(n,"row"))},title:t},[l("全选")])]}})}))]}}),this.list.map((function(t,n){return f(w,{gutter:5},{default:function(){return[f(T,{span:3},{default:function(){return[f("span",{class:[A,e.btnStatus(n,"col")&&E],onClick:function(){return e.choice(n,"col",e.btnStatus(n,"col"))}},[l("全选")])]}}),t.map((function(e){return f(T,{span:3},{default:function(){return[f("span",{class:[A,e.status&&$],title:e,style:{color:"#333333"},onClick:function(){return e.status=!e.status}},[e.startTime])]}})}))]}})}))]),f(v,{offsetBottom:0,position:"bottom"},{default:function(){return[f("div",{class:"btnGroup"},[f(d,{block:!0,round:!0,type:"primary",onClick:e.onSubmit},{default:function(){return[l("确定")]}})])]}})])}});function R(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!b(e)}t("default",c({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,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m.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,m.post("/api-teacher/teacher/querySubject");case 8:return r=t.sent,e.subjectList=r.data||[],t.next=12,m.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})})),c=e.timerObject,e.form={enableFlag:u.enableFlag,courseMinutes:u.courseMinutes,freeMinutes:u.freeMinutes,subjectIdTemp:o.join(","),subjectId:o,subjectPrice:s,skipHolidayFlag:u.skipHolidayFlag,setting:c.monday.length>0||c.tuesday.length>0||c.wednesday.length>0||c.thursday.length>0||c.friday.length>0||c.saturday.length>0||c.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 p("请选择单课时时长"),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,m.post("/api-teacher/teacherFreeTime/upSet",{data:a(a({},n),e.timerObject)});case 5:p("设置成功"),setTimeout((function(){h({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,r,a,s=this;return f(D,{style:{paddingTop:"15px"},onSubmit:this.onSubmit},{default:function(){return[f(n,null,{default:function(){return[f(i,{title:"是否开启陪练课",required:!0,border:!1},{default:function(){return[f(_,{class:I,modelValue:s.form.enableFlag,"onUpdate:modelValue":function(e){return s.form.enableFlag=e}},R(e=["1","0"].map((function(e){var t=Number(e)===Number(s.form.enableFlag),n=t?"primary":"default";return f(y,{class:C,name:e},{default:function(){return[f(j,{size:"large",plain:t,type:n},{default:function(){return[s.chargeTypeArr[e]]}})]}})})))?e:{default:function(){return[e]}})]}}),f(i,{title:"可教授乐器",required:!0},{default:function(){return[s.form.subjectPrice&&s.form.subjectPrice.length>0&&f(O,{modelValue:s.form.subjectId,class:P,disabled:!0,onClick:function(){s.subjectStatus=!0}},R(t=s.form.subjectPrice.map((function(e){var t;return f(k,{class:N},{default:function(){return[f(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(),g.confirm({title:"提示",message:"您是否要删除选择的乐器?",confirmButtonColor:"var(--van-primary)"}).then((function(){var t=s.form.subjectId.indexOf(e.subjectId);-1!==t&&s.form.subjectId.splice(t,1);var n=s.form.subjectPrice.findIndex((function(t){return t.subjectId===e.subjectId}));-1!==n&&s.form.subjectPrice.splice(n,1),s.form.subjectIdTemp=s.form.subjectId.join(",")}))}},R(t=s.getSubjectName(e.subjectId))?t:{default:function(){return[t]}})]}})})))?t:{default:function(){return[t]}}),!s.form.subjectPrice.length&&f(x,{modelValue:s.form.subjectIdTemp,"onUpdate:modelValue":function(e){return s.form.subjectIdTemp=e},name:"courseMinutes",readonly:!0,onClick:function(){s.subjectStatus=!0},rules:[{required:!0,message:"请选择可教授乐器"}],placeholder:"请选择可教授乐器"},null)]}}),f(i,{title:"单课时时长",required:!0},{default:function(){return[f(x,{modelValue:s.form.courseMinutes,"onUpdate:modelValue":function(e){return s.form.courseMinutes=e},name:"courseMinutes",readonly:!0,isLink:!0,onClick:function(){s.classTimeStatus=!0},rules:[{required:!0,message:"请选择单课时时长"}],placeholder:"请选择单课时时长"},{button:function(){return f("span",null,[l("分钟")])}})]}})]}}),s.form.subjectPrice&&s.form.subjectPrice.length>0&&f(n,null,R(r=s.form.subjectPrice.map((function(e){return f(i,{title:"".concat(s.getSubjectName(e.subjectId),"声部陪练价格"),required:!0},{default:function(){return[f(x,{modelValue:e.subjectPrice,"onUpdate:modelValue":function(t){return e.subjectPrice=t},name:"singleMins",type:"number",labelWidth:"auto",label:"".concat(s.form.courseMinutes||0,"分钟 / "),rules:[{required:!0,message:"请选择声部陪练价格"}],formatter:s.onFormatter,maxlength:8,placeholder:"请选择声部陪练价格"},{button:function(){return f("span",null,[l("元")])}})]}})})))?r:{default:function(){return[r]}}),f(n,null,{default:function(){return[f(i,{title:"可陪练时间段"},{default:function(){return[f(x,{modelValue:s.form.setting,name:"singleMins",readonly:!0,isLink:!0,onClick:s.onTimer,placeholder:"未设置"},null)]}})]}}),f(n,null,{default:function(){return[f(i,{required:!0,title:"是否跳过节假日",border:!1},{default:function(){return[f(_,{class:I,modelValue:s.form.skipHolidayFlag,"onUpdate:modelValue":function(e){return s.form.skipHolidayFlag=e}},R(a=["1","0"].map((function(e){var t=Number(e)===Number(s.form.skipHolidayFlag),n=t?"primary":"default";return f(y,{class:C,name:e},{default:function(){return[f(j,{size:"large",plain:t,type:n},{default:function(){return[s.chargeTypeArr[e]]}})]}})})))?a:{default:function(){return[a]}})]}})]}}),f(v,{offsetBottom:0,position:"bottom"},{default:function(){return[f("div",{class:"btnGroup"},[f(d,{block:!0,round:!0,type:"primary","native-type":"submit"},{default:function(){return[l("提交")]}})])]}}),f(o,{modelValue:s.subjectStatus,"onUpdate:modelValue":function(e){return s.subjectStatus=e},destroy:!0},{default:function(){return[f(u,{max:5,single:!0,subjectList:s.subjectList,choiceSubjectIds:s.choiceSubjectId,onChoice:s.onChoice},null)]}}),f(o,{modelValue:s.timerStatus,"onUpdate:modelValue":function(e){return s.timerStatus=e},destroy:!0},{default:function(){return[f(J,{onChoice:s.onChoiceTimer,timerObject:s.timerObject,courseMinutes:Number(s.timeSetting.courseMinutes),freeMinutes:Number(s.timeSetting.freeMinutes),startSetting:s.timeSetting.startSetting,endSetting:s.timeSetting.endSetting},null)]}}),f(S,{show:s.classTimeStatus,"onUpdate:show":function(e){return s.classTimeStatus=e},actions:s.minutes,cancelText:"取消",closeOnClickAction:!0,onSelect:s.onSelect},null)]}})}}))}}}))}();