fix(admin): 脏保护三缺陷(brand 丢弃空操作/头像假脏/取消高亮错位)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -99,7 +99,7 @@
|
|||||||
<div v-else class="config-body">
|
<div v-else class="config-body">
|
||||||
<!-- 左侧组导航 -->
|
<!-- 左侧组导航 -->
|
||||||
<ElCard shadow="never" class="nav-card" body-class="nav-card-body">
|
<ElCard shadow="never" class="nav-card" body-class="nav-card-body">
|
||||||
<ElMenu :default-active="activeGroup" class="group-nav" @select="onGroupSelect">
|
<ElMenu :key="menuKey" :default-active="activeGroup" class="group-nav" @select="onGroupSelect">
|
||||||
<template v-for="section in NAV_SECTIONS" :key="section.title">
|
<template v-for="section in NAV_SECTIONS" :key="section.title">
|
||||||
<div class="nav-section-title">
|
<div class="nav-section-title">
|
||||||
<ArtSvgIcon :icon="section.icon" class="nav-section-icon" />
|
<ArtSvgIcon :icon="section.icon" class="nav-section-icon" />
|
||||||
@@ -652,14 +652,25 @@
|
|||||||
|
|
||||||
const activeGroup = ref<GroupKey>('brand')
|
const activeGroup = ref<GroupKey>('brand')
|
||||||
|
|
||||||
|
/** ElMenu 强制重挂 key:menu item 点击在 select 事件前已内置 activeIndex——
|
||||||
|
* 「留下」取消后 activeGroup 未变、default-active 无变化,ElMenu 不会
|
||||||
|
* 重同步(高亮停在被点项而内容还在旧组);bump key 重建即恢复 */
|
||||||
|
const menuKey = ref(0)
|
||||||
|
|
||||||
/** 六 pane 的 dirty 上报值(pane 卸载不触发 emit——切组/切租户放行时
|
/** 六 pane 的 dirty 上报值(pane 卸载不触发 emit——切组/切租户放行时
|
||||||
* 手动清残留;brand 内联表单不入此列,直接并入 paneDirty) */
|
* 手动清残留;brand 内联表单不入此列,直接并入 paneDirty) */
|
||||||
const childPaneDirty = ref(false)
|
const childPaneDirty = ref(false)
|
||||||
|
|
||||||
async function onGroupSelect(index: string): Promise<void> {
|
async function onGroupSelect(index: string): Promise<void> {
|
||||||
if (index === activeGroup.value) return
|
if (index === activeGroup.value) return
|
||||||
if (!(await confirmDiscard())) return
|
if (!(await confirmDiscard())) {
|
||||||
|
menuKey.value++ // 取消——高亮重同步回 activeGroup(内容未动)
|
||||||
|
return
|
||||||
|
}
|
||||||
childPaneDirty.value = false
|
childPaneDirty.value = false
|
||||||
|
// 确认丢弃:brand 表单是本组件内存态(切组不卸载)——回写基线值,
|
||||||
|
// 让丢弃语义与 pane 卸载重建一致(否则 brandDirty 残留反复误弹)
|
||||||
|
Object.assign(form, JSON.parse(brandBaseline.value))
|
||||||
activeGroup.value = index as GroupKey
|
activeGroup.value = index as GroupKey
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -893,6 +904,8 @@
|
|||||||
form.avatar = res.avatar
|
form.avatar = res.avatar
|
||||||
version.value = res.version
|
version.value = res.version
|
||||||
avatarImgFailed.value = false
|
avatarImgFailed.value = false
|
||||||
|
// 上传即落库(版本 +1 热生效)——刷新基线,防后续导航误报假脏
|
||||||
|
brandBaseline.value = JSON.stringify(form)
|
||||||
ElMessage.success(`头像已上传(版本 v${res.version},热生效)`)
|
ElMessage.success(`头像已上传(版本 v${res.version},热生效)`)
|
||||||
} catch {
|
} catch {
|
||||||
// 后端兜底提示:400 魔数不符 / 413 超限(全局拦截器弹出)
|
// 后端兜底提示:400 魔数不符 / 413 超限(全局拦截器弹出)
|
||||||
|
|||||||
Reference in New Issue
Block a user