feat(user-tag): 后台用户列表展示标签 + 小程序用户中心会员等级下方展示标签
后台 msh_single_admin user/list/index.vue: - 在「分组」「推荐人」之间新增「用户标签」列,用 el-tag 渲染(多标签 ',' 切分) - 加入默认显示项 checkedCities / columnData 后端 UserCenterResponse + UserServiceImpl: - UserCenterResponse 新增 tagName 字段 - getUserCenter 在已注入的 userTagService 基础上回填标签名(已存在 getGroupNameInId) 小程序 pages/user/index.vue: - 用户名 + VIP 行下方新增 .user-tags 容器,按 ',' 切分多标签 - 半透明白底胶囊,与顶部渐变橙色背景协调 附带修复: - pages/tool/calculator-history.vue formatTime 兼容 ISO/数组/数字/旧字符串四种来源 - 解决「NaN-NaN-NaN NaN:NaN」问题(ISO 字符串里的 'T' 被替换 / 后变非法日期) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,14 +105,25 @@ export default {
|
||||
uni.navigateTo({ url: '/pages/tool/calculator' })
|
||||
},
|
||||
formatTime(s) {
|
||||
if (!s) return ''
|
||||
try {
|
||||
const d = new Date(typeof s === 'string' ? s.replace(/-/g, '/') : s)
|
||||
const pad = (n) => (n < 10 ? '0' + n : '' + n)
|
||||
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()) + ' ' + pad(d.getHours()) + ':' + pad(d.getMinutes())
|
||||
} catch (e) {
|
||||
return String(s)
|
||||
if (s == null || s === '') return ''
|
||||
// 兼容 4 种来源:
|
||||
// ① 数字时间戳;② Java LocalDateTime 序列化为数组 [y,m,d,h,m,s,nano];
|
||||
// ③ ISO 字符串 "2026-05-03T01:21:18"(含 T,旧版 replace 后变 "2026/05/03T01:21:18" 解析为 Invalid Date → NaN);
|
||||
// ④ 旧式 "2026-05-03 01:21:18"(iOS 需把 - 替换成 /)
|
||||
let d
|
||||
if (typeof s === 'number') {
|
||||
d = new Date(s)
|
||||
} else if (Array.isArray(s) && s.length >= 3) {
|
||||
d = new Date(s[0], (s[1] || 1) - 1, s[2] || 1, s[3] || 0, s[4] || 0, s[5] || 0)
|
||||
} else if (typeof s === 'string') {
|
||||
d = /T/.test(s) ? new Date(s) : new Date(s.replace(/-/g, '/'))
|
||||
} else {
|
||||
d = new Date(s)
|
||||
}
|
||||
if (!d || isNaN(d.getTime())) return String(s)
|
||||
const pad = (n) => (n < 10 ? '0' + n : '' + n)
|
||||
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate())
|
||||
+ ' ' + pad(d.getHours()) + ':' + pad(d.getMinutes())
|
||||
},
|
||||
formatBmi(b) {
|
||||
if (b == null) return '—'
|
||||
|
||||
Reference in New Issue
Block a user