fix(admin): 头像上传基线只回写持久化字段(防脏检测假阴性)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-14 21:14:23 +08:00
parent e2aa166701
commit 26dc93bc31
+6 -2
View File
@@ -904,8 +904,12 @@
form.avatar = res.avatar
version.value = res.version
avatarImgFailed.value = false
// 上传即落库(版本 +1 热生效)——刷新基线,防后续导航误报假脏
brandBaseline.value = JSON.stringify(form)
// 上传仅落库 avatar——基线只回写该持久化字段(整表快照会把未保存的
// 标题等编辑吞进基线 → dirty 假阴性 → 静默丢失;其余基线刷新点均为
// 服务端权威态整表回写,不适用此顾虑)
const persisted = JSON.parse(brandBaseline.value) as BrandGroupValue
persisted.avatar = res.avatar
brandBaseline.value = JSON.stringify(persisted)
ElMessage.success(`头像已上传(版本 v${res.version},热生效)`)
} catch {
// 后端兜底提示:400 魔数不符 / 413 超限(全局拦截器弹出)