|
@@ -2,7 +2,7 @@
|
|
|
<div class="periodadjust">
|
|
|
<div :class="[dataShow ? 'container' : '']">
|
|
|
<!-- <m-header /> -->
|
|
|
- <m-calendar @onSelectDay="onSelectDay" />
|
|
|
+ <m-calendar @onSelectDay="onSelectDay" :dayList="getMonthDay" @onChangeMonth="onChangeMonth" />
|
|
|
<van-radio-group v-if="dataShow" key="data" v-model="radioSelect">
|
|
|
<van-cell-group v-for="(item, index) in dataList" :key="index">
|
|
|
<van-cell icon="underway-o" :center="true" @click="onCheckRadio(item)">
|
|
@@ -10,7 +10,7 @@
|
|
|
<template slot="default">{{ item.signInStatus ? '已签到' : '未签到' }}</template>
|
|
|
<template slot="title">{{item.startClassTime | formatDate}}-{{item.endClassTime | formatDate}}</template>
|
|
|
</van-cell>
|
|
|
- <van-cell class="input-cell" title-class="title-content" :center="true" @click="onCheckRadio(item)">
|
|
|
+ <van-cell class="input-cell" title-class="title-content" value-class="value-content" :center="true" @click="onCheckRadio(item)">
|
|
|
<template slot="default">
|
|
|
<van-radio ref="radioes" :disabled="radioDisabled" :name="item.id"></van-radio>
|
|
|
</template>
|
|
@@ -37,10 +37,12 @@
|
|
|
// import MHeader from '@/components/MHeader' courseSwap
|
|
|
import MCalendar from '@/components/MCalendar'
|
|
|
import MEmpty from '@/components/MEmpty'
|
|
|
+import dayjs from 'dayjs'
|
|
|
import { browser } from '@/common/common'
|
|
|
-import { getCourseSchedulesWithDate,
|
|
|
+import { getCourseSchedulesWithDate,
|
|
|
getCourseScheduleDateByMonth,
|
|
|
classStartDateAdjust } from '@/api/teacher'
|
|
|
+import setLoading from '@/utils/loading'
|
|
|
export default {
|
|
|
name: 'periodadjust',
|
|
|
components: { MCalendar, MEmpty },
|
|
@@ -57,10 +59,10 @@ export default {
|
|
|
dataList: [],
|
|
|
dataShow: true, // 是否有数据
|
|
|
radioDisabled: true, // 今天或今天之前的数据禁用
|
|
|
+ getMonthDay: [], // 当月有月份列表
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
},
|
|
|
mounted() {
|
|
|
let params = this.$route.query
|
|
@@ -68,10 +70,10 @@ export default {
|
|
|
localStorage.setItem('Authorization', decodeURI(params.Authorization))
|
|
|
localStorage.setItem('userInfo', decodeURI(params.Authorization))
|
|
|
}
|
|
|
- // this.getCourseMonth(toDay)
|
|
|
document.title = '课程调整'
|
|
|
let toDay = this.getFormartDate(new Date())
|
|
|
this.getCourseDate(toDay)
|
|
|
+ this.getCourseMonth(toDay)
|
|
|
},
|
|
|
methods: {
|
|
|
onSelectDay(value) {
|
|
@@ -82,31 +84,46 @@ export default {
|
|
|
}
|
|
|
this.getCourseDate(this.getFormartDate(value))
|
|
|
},
|
|
|
+ onChangeMonth(value) {
|
|
|
+ this.getCourseMonth(dayjs(value).format('YYYY-MM-DD'))
|
|
|
+ },
|
|
|
onCheckRadio(item) { // 单选按钮选中
|
|
|
if(this.radioDisabled) return
|
|
|
this.radioSelect = item.id
|
|
|
this.radioSelectList = item
|
|
|
},
|
|
|
- getCourseMonth(month) {
|
|
|
- getCourseScheduleDateByMonth({ month: month, type: 'VIP' }).then(res => {
|
|
|
- let result = res.data
|
|
|
- if(result.code == 200) {
|
|
|
- result.data.forEach(item => {
|
|
|
- let tempDate = new Date(item)
|
|
|
- this.getMonthDay.push(tempDate.getDate())
|
|
|
- })
|
|
|
- this.isCalendar = true
|
|
|
- }
|
|
|
- })
|
|
|
+ async getCourseMonth(month) {
|
|
|
+ setLoading(true)
|
|
|
+ try {
|
|
|
+ await getCourseScheduleDateByMonth({ month: month, type: 'VIP' }).then(res => {
|
|
|
+ let result = res.data
|
|
|
+ if(result.code == 200) {
|
|
|
+ this.getMonthDay = []
|
|
|
+ result.data.forEach(item => {
|
|
|
+ this.getMonthDay.push(dayjs(item).format('DD'))
|
|
|
+ })
|
|
|
+ this.isCalendar = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setLoading(false)
|
|
|
+ } catch(err) {
|
|
|
+ setLoading(false)
|
|
|
+ }
|
|
|
},
|
|
|
- getCourseDate(date) {
|
|
|
- getCourseSchedulesWithDate({ date: date, type: 'VIP' }).then(res => {
|
|
|
- let result = res.data
|
|
|
- if(result.code == 200 && result.data) {
|
|
|
- this.dataList = result.data.rows
|
|
|
- this.dataShow = result.data.rows.length > 0 ? true : false
|
|
|
- }
|
|
|
- })
|
|
|
+ async getCourseDate(date) {
|
|
|
+ setLoading(true)
|
|
|
+ try {
|
|
|
+ await getCourseSchedulesWithDate({ date: date, type: 'VIP' }).then(res => {
|
|
|
+ let result = res.data
|
|
|
+ if(result.code == 200 && result.data) {
|
|
|
+ this.dataList = result.data.rows
|
|
|
+ this.dataShow = result.data.rows.length > 0 ? true : false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setLoading(false)
|
|
|
+ } catch(err) {
|
|
|
+ setLoading(false)
|
|
|
+ }
|
|
|
},
|
|
|
onSubmit() {
|
|
|
if(!this.radioSelect) {
|
|
@@ -274,9 +291,13 @@ export default {
|
|
|
margin-right: .05rem;
|
|
|
}
|
|
|
}
|
|
|
+.value-content {
|
|
|
+ width: 50px;
|
|
|
+}
|
|
|
/deep/.van-cell__value, /deep/.van-cell__label {
|
|
|
color: #444;
|
|
|
font-size: .14rem;
|
|
|
+ flex: 1 auto;
|
|
|
span {
|
|
|
padding-right: .1rem;
|
|
|
}
|