PeriodAdjust.06d42703.js 5.6 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["PeriodAdjust"],{"0929":function(t,e,a){},"87d4":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"periodadjust"},[a("div",{class:[t.dataShow?"container":""]},[a("m-calendar",{on:{onSelectDay:t.onSelectDay}}),t.dataShow?a("van-radio-group",{key:"data",model:{value:t.radioSelect,callback:function(e){t.radioSelect=e},expression:"radioSelect"}},t._l(t.dataList,function(e,o){return a("van-cell-group",{key:o},[a("van-cell",{attrs:{icon:"underway-o",center:!0},on:{click:function(a){return t.onCheckRadio(e)}}},[a("template",{slot:"default"},[t._v(t._s(e.signInStatus?"已签到":"未签到"))]),a("template",{slot:"title"},[t._v(t._s(t._f("formatDate")(e.startClassTime))+"-"+t._s(t._f("formatDate")(e.endClassTime)))])],2),a("van-cell",{staticClass:"input-cell",attrs:{"title-class":"title-content",center:!0},on:{click:function(a){return t.onCheckRadio(e)}}},[a("template",{slot:"default"},[a("van-radio",{ref:"radioes",refInFor:!0,attrs:{disabled:t.radioDisabled,name:e.id}})],1),a("template",{slot:"title"},[t._v(t._s(e.name))]),a("template",{slot:"label"},[t._v(t._s(t._f("teachModeStatus")(e.teachMode))+"   主讲老师:"+t._s(e.teacherName))])],2)],1)}),1):a("m-empty",{key:"data"})],1),t.dataShow?a("van-sticky",[a("div",{staticClass:"button-group"},[a("van-button",{attrs:{type:"default",size:"large"},on:{click:t.onDateChange}},[t._v("课时调整")]),a("van-button",{attrs:{type:"primary",size:"large"},on:{click:t.onSubmit}},[t._v("去换课")])],1)]):t._e(),a("van-popup",{attrs:{position:"bottom"},model:{value:t.dataForm.status,callback:function(e){t.$set(t.dataForm,"status",e)},expression:"dataForm.status"}},[a("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)},n=[],r=a("47ad"),i=a("d678"),s=a("ff51"),c=a("9afb");function u(t){return u="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},u(t)}var d={name:"periodadjust",components:{MCalendar:r["a"],MEmpty:i["a"]},data:function(){return{dataForm:{status:!1,minDate:new Date(2018,0,1),maxDate:new Date(2025,10,1),currentDate:new Date},radioSelect:null,radioSelectList:[],dataList:[],dataShow:!0,radioDisabled:!0}},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)},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))},onCheckRadio:function(t){this.radioDisabled||(this.radioSelect=t.id,this.radioSelectList=t)},getCourseMonth:function(t){var e=this;Object(c["o"])({month:t,type:"VIP"}).then(function(t){var a=t.data;200==a.code&&(a.data.forEach(function(t){var a=new Date(t);e.getMonthDay.push(a.getDate())}),e.isCalendar=!0)})},getCourseDate:function(t){var e=this;Object(c["p"])({date:t,type:"VIP"}).then(function(t){var a=t.data;200==a.code&&a.data&&(e.dataList=a.data.rows,e.dataShow=a.data.rows.length>0)})},onSubmit:function(){if(this.radioSelect){var t=this.radioSelectList,e=t.classDate.split(" ")[0],a=t.startClassTime.split(" ")[1];this.$router.push({path:"/PeriodChange",query:{checkId:this.radioSelect,classDate:e,startTime:a,name:t.name}})}else this.$toast("请选择需要交换的课程")},getFormartDateIOS:function(t){var e=new Date(t),a=e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate();return a},getFormartDate:function(t){var e=new Date(t),a=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate();return a},onDateChange:function(){this.radioSelect?this.dataForm.status=!0:this.$toast("请选择需要调整的课程")},onCurrentConfirm:function(t){var e=this,a=[];this.dataList.forEach(function(t){t.id==e.radioSelect&&(a=t)});var o="2019/12/18 "+this.getDateInfo(a.startClassTime),n="2019/12/18 "+this.getDateInfo(a.endClassTime),r=new Date(o),i=new Date(n),u=parseInt(Math.abs(i.getTime()-r.getTime())/1e3/60),d=new Date(t),l=new Date(t);l.setMinutes(d.getMinutes()+u),Object(c["e"])({actualTeacherId:a.actualTeacherId,id:this.radioSelect,classDate:this.getFormartDate(d),startClassTimeStr:this.getDateInfo(d),endClassTimeStr:this.getDateInfo(l)}).then(function(t){var a=t.data;200==a.code?(e.$toast("调整成功"),setTimeout(function(){Object(s["b"])().iPhone?window.webkit.messageHandlers.DAYA.postMessage(JSON.stringify({api:"back"})):Object(s["b"])().android?DAYA.postMessage(JSON.stringify({api:"back"})):e.$router.push("/business")},500)):e.$toast(a.msg)})},getDateInfo:function(t){var e=t;"object"!==u(t)&&(e=t.replace(/-/gi,"/"));var a=new Date(e),o=a.getHours()>=10?a.getHours():"0"+a.getHours(),n=a.getMinutes()>=10?a.getMinutes():"0"+a.getMinutes();return o+":"+n+":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}}},l=d,m=(a("a711"),a("2877")),f=Object(m["a"])(l,o,n,!1,null,"c6bd3590",null);e["default"]=f.exports},a711:function(t,e,a){"use strict";var o=a("0929"),n=a.n(o);n.a}}]);