diff --git a/src/doctor/pages/home/index.ts b/src/doctor/pages/home/index.ts index 2af5242..9ed64a4 100644 --- a/src/doctor/pages/home/index.ts +++ b/src/doctor/pages/home/index.ts @@ -389,6 +389,8 @@ Page({ nextDate() { const isMonth = this.data.statType === 'month' const today = new Date() + // 今天的 23:59:59,只要新日期小于等于这个时间就可以选择 + const todayEnd = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59) let newDate: Date let startDate: string let startMonth: string @@ -415,8 +417,8 @@ Page({ const currentDate = new Date(this.data.startDate) newDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000) - // 最大日期不能大于当前日期 - if (newDate > today) { + // 最大日期不能大于今天 23:59:59(今天及之前的日期都可以选择) + if (newDate > todayEnd) { wx.showToast({ title: '不能选择未来日期', icon: 'none', diff --git a/src/ground/pages/home/index.ts b/src/ground/pages/home/index.ts index 429c0de..d39b4cf 100644 --- a/src/ground/pages/home/index.ts +++ b/src/ground/pages/home/index.ts @@ -587,6 +587,8 @@ Page({ nextDate() { const isMonth = this.data.statType === 'month' const today = new Date() + // 今天的 23:59:59,只要新日期小于等于这个时间就可以选择 + const todayEnd = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59) let newDate: Date let startDate: string let startMonth: string @@ -613,8 +615,8 @@ Page({ const currentDate = new Date(this.data.startDate) newDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000) - // 最大日期不能大于当前日期 - if (newDate > today) { + // 最大日期不能大于今天 23:59:59(今天及之前的日期都可以选择) + if (newDate > todayEnd) { wx.showToast({ title: '不能选择未来日期', icon: 'none', @@ -646,10 +648,10 @@ Page({ const y2: number[] = [] const y3: number[] = [] list.forEach((item) => { - x.push(item.date || item.StatMonth) - y1.push(item.inviteCount || item.count || item.MonthInvitePCount || 0) - y2.push(item.jumpCount || 0) - y3.push(item.enrollCount || 0) + x.push(item.date || item.StatMonth || '') + y1.push(Number(item.inviteCount || item.count || item.MonthInvitePCount || 0)) + y2.push(Number(item.jumpCount || 0)) + y3.push(Number(item.enrollCount || 0)) }) const option = { @@ -777,10 +779,10 @@ Page({ }) canvas.setChart(chart) const x: string[] = [] - const y1: string[] = [] + const y1: number[] = [] list.forEach((item) => { - x.push(item.date || item.StatMonth) - y1.push(item.count || item.MonthInvitePCount) + x.push(item.date || item.StatMonth || '') + y1.push(Number(item.count || item.MonthInvitePCount || 0)) }) const option = {