|
|
@@ -4,7 +4,7 @@
|
|
|
<h5 class="lessonName">
|
|
|
{{ lessonName }}
|
|
|
</h5>
|
|
|
- <mu-tabs :value.sync="active" color="#F2F2F2" indicator-color="#33CAF7">
|
|
|
+ <mu-tabs :value.sync="active" color="#F2F2F2" indicator-color="#33CAF7" v-if="reFresh">
|
|
|
<mu-tab v-for="(day,i) in weeks">{{ day.name }} <br> <em>{{ day.data }}</em></mu-tab>
|
|
|
</mu-tabs>
|
|
|
|
|
|
@@ -32,6 +32,7 @@
|
|
|
import bottomTab from '../components/bottomTab'
|
|
|
import {
|
|
|
SchoolTimeQueryByDate,
|
|
|
+ QueryNextWeek,
|
|
|
} from '../api/getApiRes.js'
|
|
|
|
|
|
let qs = require('qs');
|
|
|
@@ -46,6 +47,7 @@
|
|
|
active: 0,
|
|
|
sum: 0,
|
|
|
openAlert: false,
|
|
|
+ reFresh: true,
|
|
|
list: [],
|
|
|
previewDate: [],
|
|
|
weeks: [],
|
|
|
@@ -57,12 +59,21 @@
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getFurtherDays();
|
|
|
+ this.getQueryNextWeek();
|
|
|
+ },
|
|
|
+ beforeRouteEnter(to, from, next) {
|
|
|
+ next(vm => {
|
|
|
+ //因为当钩子执行前,组件实例还没被创建
|
|
|
+ // vm 就是当前组件的实例相当于上面的 this,所以在 next 方法里你就可以把 vm 当 this 来用了。
|
|
|
+ if (to.name == 'appoint') {
|
|
|
+ this.getQueryNextWeek();
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
watch: {
|
|
|
'$route'(to) {
|
|
|
if (to.name == 'lesson') {
|
|
|
- this.getList();
|
|
|
+ this.getQueryNextWeek();
|
|
|
}
|
|
|
},
|
|
|
'active'() {
|
|
|
@@ -70,8 +81,28 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ getQueryNextWeek() {
|
|
|
+ console.log(333);
|
|
|
+ let that = this;
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ shopId: this.$route.query.shopId,
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ this.weeks = [];
|
|
|
+ QueryNextWeek(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ this.HaveDays = json.Rs;
|
|
|
+ this.getFurtherDays(json.Rs);
|
|
|
+ } else {
|
|
|
+ that.list = [];
|
|
|
+ that.$message.error(json.Memo);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取未来7天的
|
|
|
- getFurtherDays() {
|
|
|
+ getFurtherDays(HaveDays) {
|
|
|
let now = new Date();
|
|
|
let nowTime = now.getTime();
|
|
|
let oneDayTime = 24 * 60 * 60 * 1000;
|
|
|
@@ -79,7 +110,8 @@
|
|
|
let item = [];
|
|
|
let month = 0;
|
|
|
let day = 0;
|
|
|
- for (let i = 0; i < 7; i++) {
|
|
|
+ this.weeks = [];
|
|
|
+ for (let i = 0; i < HaveDays; i++) {
|
|
|
days = new Date(nowTime + (i) * oneDayTime);//显示周日
|
|
|
month = days.getMonth() + 1;
|
|
|
day = days.getDate();
|
|
|
@@ -88,10 +120,11 @@
|
|
|
item = {
|
|
|
name: this.numberToWeek(days.getDay()),
|
|
|
data: days.getMonth() + 1 + '月' + days.getDate() + '日',
|
|
|
- orderDate: new Date().getFullYear() + '-' + month + '-' + day
|
|
|
+ orderDate: days.getFullYear() + '-' + month + '-' + day
|
|
|
};
|
|
|
this.weeks.push(item);
|
|
|
}
|
|
|
+ this.today = this.weeks[0].name;
|
|
|
this.getList();
|
|
|
},
|
|
|
numberToWeek(val) {
|
|
|
@@ -142,15 +175,6 @@
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
- beforeRouteEnter(to, from, next) {
|
|
|
- next(vm => {
|
|
|
- //因为当钩子执行前,组件实例还没被创建
|
|
|
- // vm 就是当前组件的实例相当于上面的 this,所以在 next 方法里你就可以把 vm 当 this 来用了。
|
|
|
- if (to.name == 'appoint') {
|
|
|
- vm.getList();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
components: {
|
|
|
bottomTab
|
|
|
}
|