修复回归安全问题并补充验证

This commit is contained in:
xiaowang
2026-06-05 16:10:58 +08:00
parent 784bb0a965
commit 74f8fa5f4e
46 changed files with 917 additions and 311 deletions
@@ -1,5 +1,6 @@
const planningApi = require('../../api/planning')
const dateUtil = require('../../utils/date')
const config = require('../../utils/config')
const mock = require('../../utils/mock')
Page({
@@ -40,7 +41,9 @@ Page({
dayTotal: 0,
freeArtistCount: 0,
pendingCount: 0,
loading: false
loading: false,
loadError: false,
errorMessage: ''
},
onLoad() {
@@ -130,9 +133,25 @@ Page({
endDate: range.end,
artistId: this.data.selectedArtistId || undefined
})
this.setData({ loadError: false, errorMessage: '' })
this.applyCalendar(data)
} catch (error) {
this.applyCalendar(mock.buildCalendar(this.data.currentDateText))
if (config.USE_DEV_MOCK_DATA) {
this.setData({ loadError: false, errorMessage: '' })
this.applyCalendar(mock.buildCalendar(this.data.currentDateText))
} else {
this.setData({
loadError: true,
errorMessage: error.message || '规划数据加载失败,请检查服务连接后重试'
})
this.applyCalendar({
businessStartTime: this.data.businessStartTime,
businessEndTime: this.data.businessEndTime,
artists: this.data.artists,
appointments: [],
daySummaries: []
})
}
} finally {
this.setData({ loading: false })
}