修复规划页错误展示和迁移发布包
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
const planningApi = require('../../api/planning')
|
||||
const dateUtil = require('../../utils/date')
|
||||
|
||||
const CALENDAR_ERROR_FALLBACK_MESSAGE = '规划数据暂时不可用,请稍后重试'
|
||||
const TECHNICAL_ERROR_PATTERNS = [
|
||||
/###\s*Error/i,
|
||||
/SQLSyntaxErrorException/i,
|
||||
/bad\s+SQL\s+grammar/i,
|
||||
/Unknown\s+column/i,
|
||||
/mapper\//i,
|
||||
/java\./i
|
||||
]
|
||||
|
||||
function canCreateAppointment() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
@@ -8,7 +18,12 @@ function canCreateAppointment() {
|
||||
}
|
||||
|
||||
function resolveCalendarErrorMessage(error) {
|
||||
return error && error.message ? error.message : '规划数据加载失败'
|
||||
const message = error && error.message ? String(error.message).trim() : ''
|
||||
if (!message) {
|
||||
return CALENDAR_ERROR_FALLBACK_MESSAGE
|
||||
}
|
||||
const hasTechnicalMessage = TECHNICAL_ERROR_PATTERNS.some(pattern => pattern.test(message))
|
||||
return hasTechnicalMessage ? CALENDAR_ERROR_FALLBACK_MESSAGE : message
|
||||
}
|
||||
|
||||
function toLocalDate(value) {
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
|
||||
.calendar-error-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 16rpx;
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx;
|
||||
@@ -52,15 +52,18 @@
|
||||
}
|
||||
|
||||
.calendar-error-message {
|
||||
display: block;
|
||||
color: #b06a52;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.calendar-error-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-self: flex-end;
|
||||
width: 96rpx;
|
||||
min-width: 96rpx;
|
||||
height: 52rpx;
|
||||
|
||||
Reference in New Issue
Block a user