|
|
@ -57,7 +57,8 @@ Component({ |
|
|
/** 视图收起/展开 */ |
|
|
/** 视图收起/展开 */ |
|
|
toggleMode() { |
|
|
toggleMode() { |
|
|
const { year, month} = this.data |
|
|
const { year, month} = this.data |
|
|
if ((this.data.currentViewType === 'week' && this.data.weekDay.some(s => s.year === (year+1))) || (this.data.currentViewType === 'week' && this.data.weekDay.some(s => s.year === (year-1)))) { |
|
|
let nowYear = parseInt(new Date().getFullYear()) |
|
|
|
|
|
if ((this.data.currentViewType === 'week' && year != nowYear)) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
@ -189,6 +190,7 @@ Component({ |
|
|
}, |
|
|
}, |
|
|
/** 切换月份 */ |
|
|
/** 切换月份 */ |
|
|
changeMonthFun(e){ |
|
|
changeMonthFun(e){ |
|
|
|
|
|
let nowYear = parseInt(new Date().getFullYear()) |
|
|
if (this.data.currentViewType === "month") { |
|
|
if (this.data.currentViewType === "month") { |
|
|
let { |
|
|
let { |
|
|
year, |
|
|
year, |
|
|
@ -203,7 +205,7 @@ Component({ |
|
|
year = (parseInt(month) + 1) > 12 ? year + 1 : year |
|
|
year = (parseInt(month) + 1) > 12 ? year + 1 : year |
|
|
month = (parseInt(month) + 1) > 12 ? 1 : parseInt(month) + 1 |
|
|
month = (parseInt(month) + 1) > 12 ? 1 : parseInt(month) + 1 |
|
|
} |
|
|
} |
|
|
if (year != this.data.year) { |
|
|
if (year != nowYear) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
@ -220,7 +222,7 @@ Component({ |
|
|
nowDay |
|
|
nowDay |
|
|
} = this.data |
|
|
} = this.data |
|
|
let type = e.currentTarget.dataset.type //类型
|
|
|
let type = e.currentTarget.dataset.type //类型
|
|
|
if ((type == 'next' && this.data.weekDay[0].year === (year+1)) || (type == 'prev' && this.data.weekDay[0].year === (year-1))) { |
|
|
if ((type == 'next' && this.data.weekDay[6].year === (nowYear+1)) || (type == 'prev' && this.data.weekDay[0].year === (nowYear-1))) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
// if (type == 'next' && this.data.weekDay[0].year === 2025) {
|
|
|
// if (type == 'next' && this.data.weekDay[0].year === 2025) {
|
|
|
|