PeriodAdjust.8f5282a0.js 16 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["PeriodAdjust"],{"075e":function(t,e,r){"use strict";r("a573")},"87d4":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"periodadjust"},[r("div",{class:[t.dataShow?"container":""]},[r("m-calendar",{attrs:{dayList:t.getMonthDay},on:{onSelectDay:t.onSelectDay,onChangeMonth:t.onChangeMonth}}),t.dataShow?r("van-radio-group",{key:"data",staticClass:"cellList",model:{value:t.radioSelect,callback:function(e){t.radioSelect=e},expression:"radioSelect"}},t._l(t.dataList,(function(e,n){return r("van-cell-group",{key:n},[r("van-cell",{staticClass:"titleCell",on:{click:function(r){return t.onCheckRadio(e)}}},[r("template",{slot:"default"},[r("div",{staticClass:"signImgBox"},[r("img",{staticClass:"signImg",attrs:{src:t.getSignInIcon(e.isSignIn),alt:""}})])]),r("template",{slot:"title"},[r("div",{staticClass:"classTitleWrap",staticStyle:{"word-break":"break-all"}},[r("img",{staticClass:"teacherModelImg",attrs:{src:t.getTeacherImg(e.teachMode),alt:""}}),r("img",{staticClass:"courseImg",attrs:{src:t.squrtList.squrt2,alt:""}}),t._v("\n "+t._s(e.name)+"\n ")])])],2),r("van-cell",[r("template",{slot:"title"},[e.schoolName?r("p",{staticClass:"studentTitle",staticStyle:{"word-break":"break-all"}},[t._v("\n 上课地点 :  "+t._s(e.schoolName)+"\n ")]):t._e(),r("p",{staticClass:"studentTitle",staticStyle:{"word-break":"break-all"}},[t._v("\n 上课学生 :  "+t._s(e.studentNames)+"\n ")])])],2),r("van-cell",{staticClass:"input-cell",attrs:{"title-class":"title-content","value-class":"value-content",center:!0},on:{click:function(r){return t.onCheckRadio(e)}}},[r("template",{slot:"title"},[r("div",{staticClass:"chioseWrap"},[r("img",{staticClass:"clockIcon",attrs:{src:t.squrtList.squrt8,alt:""}}),r("p",{staticClass:"timer"},[t._v("\n "+t._s(t._f("formatDate")(e.startClassTime))+"-"+t._s(t._f("formatDate")(e.endClassTime))+"\n ")])])]),r("template",{slot:"default"},[r("van-radio",{ref:"radioes",refInFor:!0,attrs:{disabled:t.radioDisabled,name:e.id}})],1)],2)],1)})),1):r("m-empty",{key:"data"})],1),t.dataShow?r("van-sticky",[r("div",{staticClass:"button-group"},[r("van-button",{staticClass:"changeBtn",attrs:{type:"default",size:"large"},on:{click:t.onDateChange}},[t._v("课时调整")]),r("van-button",{attrs:{type:"primary",size:"large"},on:{click:t.onSubmit}},[t._v("去换课")])],1)]):t._e(),r("van-popup",{attrs:{position:"bottom"},model:{value:t.dataForm.status,callback:function(e){t.$set(t.dataForm,"status",e)},expression:"dataForm.status"}},[r("van-datetime-picker",{attrs:{type:"datetime","min-date":t.dataForm.minDate,"max-date":t.dataForm.maxDate,formatter:t.formatter},on:{cancel:function(e){t.dataForm.status=!1},confirm:t.onCurrentConfirm},model:{value:t.dataForm.currentDate,callback:function(e){t.$set(t.dataForm,"currentDate",e)},expression:"dataForm.currentDate"}})],1)],1)},a=[],o=r("47ad"),i=r("d678"),s=r("5a0c"),c=r.n(s),u=r("ff51"),l=r("9afb"),h=r("3908");function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach((function(e){m(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function m(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function g(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */g=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(I){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var a=e&&e.prototype instanceof h?e:h,o=Object.create(a.prototype),i=new O(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return x()}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=S(i,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,i),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(I){return{type:"throw",arg:I}}}t.wrap=c;var l={};function h(){}function d(){}function p(){}var m={};s(m,a,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&r.call(y,a)&&(m=y);var b=p.prototype=h.prototype=Object.create(m);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function D(t,e){function n(a,o,i,s){var c=u(t[a],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==f(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,i,s)}),(function(t){n("throw",t,i,s)})):e.resolve(h).then((function(t){l.value=t,i(l)}),(function(t){return n("throw",t,i,s)}))}s(c.arg)}var a;this._invoke=function(t,r){function o(){return new e((function(e,a){n(t,r,e,a)}))}return a=a?a.then(o,o):o()}}function S(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:x}}function x(){return{value:void 0,done:!0}}return d.prototype=p,s(b,"constructor",p),s(p,"constructor",d),d.displayName=s(p,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,s(t,i,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(D.prototype),s(D.prototype,o,(function(){return this})),t.AsyncIterator=D,t.async=function(e,r,n,a,o){void 0===o&&(o=Promise);var i=new D(c(e,r,n,a),o);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},w(b),s(b,i,"Generator"),s(b,a,(function(){return this})),s(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;C(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}function v(t,e,r,n,a,o,i){try{var s=t[o](i),c=s.value}catch(u){return void r(u)}s.done?e(c):Promise.resolve(c).then(n,a)}function y(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function i(t){v(o,n,a,i,s,"next",t)}function s(t){v(o,n,a,i,s,"throw",t)}i(void 0)}))}}var b={name:"periodadjust",components:{MCalendar:o["a"],MEmpty:i["a"]},data:function(){return{dataForm:{status:!1,minDate:new Date(2018,0,1),maxDate:new Date(2035,10,1),currentDate:new Date},radioSelect:null,radioSelectList:[],dataList:[],dataShow:!0,radioDisabled:!0,getMonthDay:[],squrtList:{squrt2:r("8b84"),squrt3:r("c040"),squrt4:r("5fcb"),squrt5:r("261c"),squrt6:r("5dc1"),squrt7:r("1367"),squrt8:r("430b")}}},created:function(){},mounted:function(){var t=this.$route.query;t.Authorization&&(localStorage.setItem("Authorization",decodeURI(t.Authorization)),localStorage.setItem("userInfo",decodeURI(t.Authorization))),document.title="课程调整";var e=this.getFormartDate(new Date);this.getCourseDate(e),this.getCourseMonth(e)},methods:{onSelectDay:function(t){new Date(this.getFormartDateIOS(new Date))>=new Date(this.getFormartDateIOS(t))?this.radioDisabled=!0:this.radioDisabled=!1,this.getCourseDate(this.getFormartDate(t))},onChangeMonth:function(t){this.getCourseMonth(c()(t).format("YYYY-MM-DD"))},onCheckRadio:function(t){console.log("点击",this.radioDisabled),this.radioDisabled||(this.radioSelect=t.id,this.radioSelectList=t)},getCourseMonth:function(){var t=y(g().mark((function t(e){var r=this;return g().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(l["p"])({month:e,type:"VIP"}).then((function(t){var e=t.data;200==e.code&&(r.getMonthDay=[],e.data.forEach((function(t){r.getMonthDay.push(c()(t).format("DD"))})),r.isCalendar=!0)}));case 2:case"end":return t.stop()}}),t)})));function e(e){return t.apply(this,arguments)}return e}(),getCourseDate:function(){var t=y(g().mark((function t(e){var r=this;return g().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return Object(h["a"])(!0),t.prev=1,this.dataList=[],t.next=5,Object(l["q"])({date:e,type:"VIP"}).then((function(t){var e=t.data;200==e.code&&e.data&&(r.dataList=e.data.rows.map((function(t){var e=[];return t.students&&(e=t.students.map((function(t){return t.userName}))),p(p({},t),{},{studentNames:e.join(",")})})),r.dataShow=e.data.rows.length>0),Object(h["a"])(!1)}));case 5:t.next=10;break;case 7:t.prev=7,t.t0=t["catch"](1),Object(h["a"])(!1);case 10:case"end":return t.stop()}}),t,this,[[1,7]])})));function e(e){return t.apply(this,arguments)}return e}(),onSubmit:function(){if(this.radioSelect){var t=this.radioSelectList,e=t.classDate.split(" ")[0],r=t.startClassTime.split(" ")[1];this.$router.push({path:"/PeriodChange",query:{checkId:this.radioSelect,classDate:e,startTime:r,name:t.name}})}else this.$toast("请选择需要交换的课程")},getFormartDateIOS:function(t){var e=new Date(t),r=e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate();return r},getFormartDate:function(t){var e=new Date(t),r=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return r},onDateChange:function(){this.radioSelect?this.dataForm.status=!0:this.$toast("请选择需要调整的课程")},onCurrentConfirm:function(t){var e=this,r=[];this.dataList.forEach((function(t){t.id==e.radioSelect&&(r=t)}));var n="2019/12/18 "+this.getDateInfo(r.startClassTime),a="2019/12/18 "+this.getDateInfo(r.endClassTime),o=new Date(n),i=new Date(a),s=parseInt(Math.abs(i.getTime()-o.getTime())/1e3/60),c=new Date(t),h=new Date(t);if(h.setMinutes(c.getMinutes()+s),c.toDateString()===h.toDateString()){console.log(this.getDateInfo(c),this.getDateInfo(h));var f=this.getDateInfo(c),d=this.getDateInfo(h),p=d?Number(d.split(":")[0]):0,m=d?Number(d.split(":")[1]):0;if(p>=21&&m>0)this.$toast("课程安排结束时间不可超过21:00");else{var g=f?Number(f.split(":")[0]):0;f&&Number(f.split(":")[1]);g<6?this.$toast("课程安排开始时间不可早于06:00"):Object(l["e"])({actualTeacherId:r.actualTeacherId,id:this.radioSelect,classDate:this.getFormartDate(c),startClassTimeStr:this.getDateInfo(c),endClassTimeStr:this.getDateInfo(h)}).then((function(t){var r=t.data;200==r.code?(e.$toast("调整成功"),setTimeout((function(){Object(u["b"])().iPhone?window.webkit.messageHandlers.DAYA.postMessage(JSON.stringify({api:"back"})):Object(u["b"])().android?DAYA.postMessage(JSON.stringify({api:"back"})):e.$router.push("/business")}),500)):e.$toast(r.msg)}))}}else this.$toast("课时调整不允许跨天调整")},getDateInfo:function(t){var e=t;"object"!==f(t)&&(e=t.replace(/-/gi,"/"));var r=new Date(e),n=r.getHours()>=10?r.getHours():"0"+r.getHours(),a=r.getMinutes()>=10?r.getMinutes():"0"+r.getMinutes();return n+":"+a+":00"},formatter:function(t,e){return"year"===t?"".concat(e,"年"):"month"===t?"".concat(e,"月"):"day"===t?"".concat(e,"日"):"hour"===t?"".concat(e,"时"):"minute"===t?"".concat(e,"分"):e},getSignInIcon:function(t){return 1==t?this.squrtList.squrt3:0==t?this.squrtList.squrt5:this.squrtList.squrt4},getTeacherImg:function(t){return"ONLINE"==t?this.squrtList.squrt6:this.squrtList.squrt7}}},w=b,D=(r("075e"),r("2877")),S=Object(D["a"])(w,n,a,!1,null,"c2c7fc50",null);e["default"]=S.exports},a573:function(t,e,r){}}]);