Browse Source

活动日历修复

master
jiazhipeng 1 year ago
parent
commit
d909b863c2
  1. 2
      app.js
  2. 8
      pages/component/newCalendar/index.js

2
app.js

@ -21,7 +21,7 @@ App({
unique_key: "wechatxcx" unique_key: "wechatxcx"
}).then(res => { }).then(res => {
let data = JSON.parse(res.data); let data = JSON.parse(res.data);
data.isTest = data.isTest163? true : false; data.isTest = data.isTest164? true : false;
this.globalData.configJson = data this.globalData.configJson = data
}).then(() => { }).then(() => {
// 获取ui配置文件 // 获取ui配置文件

8
pages/component/newCalendar/index.js

@ -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) {

Loading…
Cancel
Save