|  | @@ -2,7 +2,7 @@
 | 
	
		
			
				|  |  |      <div class="periodchange">
 | 
	
		
			
				|  |  |          <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">
 | 
	
	
		
			
				|  | @@ -34,9 +34,11 @@
 | 
	
		
			
				|  |  |  // import MHeader from '@/components/MHeader'
 | 
	
		
			
				|  |  |  import MCalendar from '@/components/MCalendar'
 | 
	
		
			
				|  |  |  import MEmpty from '@/components/MEmpty'
 | 
	
		
			
				|  |  | +import dayjs from 'dayjs'
 | 
	
		
			
				|  |  |  import { browser }  from '@/common/common'
 | 
	
		
			
				|  |  | -import { getCourseSchedulesWithDate, 
 | 
	
		
			
				|  |  | +import { getCourseSchedulesWithDate,
 | 
	
		
			
				|  |  |      getCourseScheduleDateByMonth, courseSwap } from '@/api/teacher'
 | 
	
		
			
				|  |  | +import setLoading from '@/utils/loading'
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |      name: 'periodchange',
 | 
	
		
			
				|  |  |      components: { MCalendar, MEmpty },
 | 
	
	
		
			
				|  | @@ -47,12 +49,13 @@ export default {
 | 
	
		
			
				|  |  |              radioSelect: null,
 | 
	
		
			
				|  |  |              radioSelectList: [], // 选中的列表
 | 
	
		
			
				|  |  |              radioDisabled: true, // 今天或今天之前的数据禁用
 | 
	
		
			
				|  |  | +            getMonthDay: []
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      created() {
 | 
	
		
			
				|  |  | -        document.title = '课程交换'
 | 
	
		
			
				|  |  | -        let toDay = this.getFormartDate(new Date())
 | 
	
		
			
				|  |  | -        this.getCourseDate(toDay)
 | 
	
		
			
				|  |  | +        
 | 
	
		
			
				|  |  | +        // let toDay = this.getFormartDate(new Date())
 | 
	
		
			
				|  |  | +        // this.getCourseDate(toDay)
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      mounted() {
 | 
	
		
			
				|  |  |          let params = this.$route.query
 | 
	
	
		
			
				|  | @@ -60,7 +63,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.getCourseMonth(toDay)
 | 
	
		
			
				|  |  | +        this.getCourseDate(toDay)
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      methods: {
 | 
	
		
			
				|  |  |          onSelectDay(value) {
 | 
	
	
		
			
				|  | @@ -71,31 +77,46 @@ export default {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              this.getCourseDate(this.getFormartDate(value))
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | +        onChangeMonth(value) {
 | 
	
		
			
				|  |  | +            this.getCourseMonth(dayjs(value).format('YYYY-MM-DD'))
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        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)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  |          onCheckRadio(item) { // 单选按钮选中
 | 
	
		
			
				|  |  |              if(this.radioDisabled) return
 | 
	
		
			
				|  |  |              this.radioSelect = item.id
 | 
	
		
			
				|  |  |              this.radioSelectList = item
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | -        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
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            })
 | 
	
		
			
				|  |  | -        },
 | 
	
		
			
				|  |  | -        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 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)
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          getFormartDate(date) {
 | 
	
		
			
				|  |  |              let checkDate = new Date(date)
 |