Browse Source

bug fix

master
kola-web 3 days ago
parent
commit
d529768a0f
  1. 6
      src/doctor/pages/home/index.ts
  2. 20
      src/ground/pages/home/index.ts

6
src/doctor/pages/home/index.ts

@ -389,6 +389,8 @@ Page({
nextDate() { nextDate() {
const isMonth = this.data.statType === 'month' const isMonth = this.data.statType === 'month'
const today = new Date() const today = new Date()
// 今天的 23:59:59,只要新日期小于等于这个时间就可以选择
const todayEnd = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59)
let newDate: Date let newDate: Date
let startDate: string let startDate: string
let startMonth: string let startMonth: string
@ -415,8 +417,8 @@ Page({
const currentDate = new Date(this.data.startDate) const currentDate = new Date(this.data.startDate)
newDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000) newDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000)
// 最大日期不能大于当前日期 // 最大日期不能大于今天 23:59:59(今天及之前的日期都可以选择)
if (newDate > today) { if (newDate > todayEnd) {
wx.showToast({ wx.showToast({
title: '不能选择未来日期', title: '不能选择未来日期',
icon: 'none', icon: 'none',

20
src/ground/pages/home/index.ts

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

Loading…
Cancel
Save