feat(admin): 配置中心导航分层双模式(常用/高级/版本独立)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
配置中心(Phase 3 Task 7a:品牌与嵌入代码;Task 7b:提示词四件套与
|
||||
安全词表试金石;Task 7c:凭据表单与测试端点;Task 7d:版本历史与重置)
|
||||
- 页骨架:左侧组导航(品牌/提示词/安全词表/凭据/版本实装)
|
||||
- 页骨架:左侧组导航分层双模式(常用配置 / 高级配置 + 版本历史救援入口);
|
||||
- 租户上下文:超管下拉切换(复用会话页模式);租户管理员固定自己
|
||||
- 品牌表单:GET config 整组读 → 表单编辑 → PUT config/brand 整组提交
|
||||
(整组替换语义——字段清单 title/color/avatar/welcome/topics/placeholder/
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="page-header">
|
||||
<div>
|
||||
<h2 class="page-title">配置中心</h2>
|
||||
<p class="page-sub">品牌门面与嵌入代码(提示词 / 安全词表 / 凭据 / 版本见左侧导航)</p>
|
||||
<p class="page-sub">按左侧分组编辑——保存后立即生效并产生新版本,历史可随时回滚</p>
|
||||
</div>
|
||||
<div class="header-side">
|
||||
<ElTag v-if="version !== null" type="info" size="large">当前版本 v{{ version }}</ElTag>
|
||||
@@ -86,9 +86,27 @@
|
||||
<!-- 左侧组导航 -->
|
||||
<ElCard shadow="never" class="nav-card" body-class="nav-card-body">
|
||||
<ElMenu :default-active="activeGroup" class="group-nav" @select="onGroupSelect">
|
||||
<ElMenuItem v-for="item in GROUP_NAV" :key="item.key" :index="item.key">
|
||||
<span class="nav-label">{{ item.label }}</span>
|
||||
<span v-if="IMPLEMENTED_GROUPS.has(item.key)" class="nav-badge">已实装</span>
|
||||
<template v-for="section in NAV_SECTIONS" :key="section.title">
|
||||
<div class="nav-section-title">
|
||||
<ArtSvgIcon :icon="section.icon" class="nav-section-icon" />
|
||||
{{ section.title }}
|
||||
</div>
|
||||
<ElMenuItem v-for="item in section.items" :key="item.key" :index="item.key">
|
||||
<div class="nav-item-text">
|
||||
<span class="nav-label">{{ item.label }}</span>
|
||||
<span class="nav-sub">{{ item.sub }}</span>
|
||||
</div>
|
||||
</ElMenuItem>
|
||||
</template>
|
||||
<div class="nav-section-title nav-versions-title">
|
||||
<ArtSvgIcon icon="solar:history-line-duotone" class="nav-section-icon" />
|
||||
救援
|
||||
</div>
|
||||
<ElMenuItem :index="VERSIONS_NAV.key">
|
||||
<div class="nav-item-text">
|
||||
<span class="nav-label">{{ VERSIONS_NAV.label }}</span>
|
||||
<span class="nav-sub">{{ VERSIONS_NAV.sub }}</span>
|
||||
</div>
|
||||
</ElMenuItem>
|
||||
</ElMenu>
|
||||
<p class="nav-tip">版本只增不改——回滚/重置都产生新版本,历史可随时回看。</p>
|
||||
@@ -514,30 +532,54 @@
|
||||
const AVATAR_MAX_BYTES = 2 * 1024 * 1024
|
||||
const AVATAR_EXTS = ['png', 'jpg', 'jpeg', 'webp']
|
||||
|
||||
// ---- 左侧组导航(Task 7a 品牌 / 7b 提示词+词表 / 7c 凭据 / 7d 版本实装) ----------------
|
||||
// ---- 左侧组导航(常用/高级两层 + 版本历史救援入口——spec §3) -------------------------
|
||||
|
||||
const GROUP_NAV = [
|
||||
{ key: 'brand', label: '品牌' },
|
||||
{ key: 'prompts', label: '提示词' },
|
||||
{ key: 'wall', label: '安全词表' },
|
||||
{ key: 'contact', label: '联系方式' },
|
||||
{ key: 'creds', label: '凭据' },
|
||||
{ key: 'engine', label: '引擎' },
|
||||
{ key: 'misc', label: '杂项' },
|
||||
{ key: 'versions', label: '版本' }
|
||||
] as const
|
||||
type GroupKey =
|
||||
| 'brand' | 'wall' | 'prompts' | 'contact' | 'creds'
|
||||
| 'engine' | 'misc' | 'versions'
|
||||
|
||||
/** 已实装组(导航徽标) */
|
||||
const IMPLEMENTED_GROUPS = new Set<GroupKey>([
|
||||
'brand',
|
||||
'prompts',
|
||||
'wall',
|
||||
'contact',
|
||||
'creds',
|
||||
'engine',
|
||||
'misc',
|
||||
'versions'
|
||||
])
|
||||
/** 导航项:任务名 + 副标题(导航与卡头共用文案源) */
|
||||
interface NavItem {
|
||||
key: GroupKey
|
||||
label: string
|
||||
sub: string
|
||||
}
|
||||
|
||||
/** 分层双模式(spec §3):常用 = 日常自助;高级 = 引擎级参数 */
|
||||
const NAV_SECTIONS: Array<{ title: string; icon: string; items: NavItem[] }> = [
|
||||
{
|
||||
title: '常用配置',
|
||||
icon: 'solar:star-line-duotone',
|
||||
items: [
|
||||
{ key: 'brand', label: '品牌与外观', sub: '聊天窗标题/颜色/头像/欢迎语' },
|
||||
{ key: 'wall', label: 'AI 话术', sub: '问价格/要联系方式时 AI 怎么回' },
|
||||
{ key: 'prompts', label: '公司资料', sub: 'AI 介绍你公司时依据的内容' },
|
||||
{ key: 'contact', label: '联系方式', sub: '要 WhatsApp/邮箱的行为开关' },
|
||||
{ key: 'creds', label: '凭据与通知', sub: '邮件/推送/AI 密钥 + 连通测试' }
|
||||
]
|
||||
},
|
||||
{
|
||||
title: '高级配置',
|
||||
icon: 'solar:settings-minimalistic-line-duotone',
|
||||
items: [
|
||||
{ key: 'engine', label: '聊天限流', sub: '每 IP 发言/连接上限' },
|
||||
{ key: 'misc', label: '国家区号映射', sub: '国名 → 区号补全规则' }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
/** 版本历史:独立于两层之外的救援入口(spec §3) */
|
||||
const VERSIONS_NAV: NavItem = {
|
||||
key: 'versions',
|
||||
label: '版本历史',
|
||||
sub: '改坏了?这里一键回滚'
|
||||
}
|
||||
|
||||
/** 全部导航项扁平表(activeGroupLabel / 查找用) */
|
||||
const ALL_NAV_ITEMS: NavItem[] = [
|
||||
...NAV_SECTIONS.flatMap((s) => s.items),
|
||||
VERSIONS_NAV
|
||||
]
|
||||
|
||||
/** 通用 JSON 组(终审 I-1:contact/engine/misc 走 JsonGroupPane 一份实现) */
|
||||
const JSON_GROUPS = new Set<GroupKey>(['contact', 'engine', 'misc'])
|
||||
@@ -549,8 +591,6 @@
|
||||
: 'contact'
|
||||
)
|
||||
|
||||
type GroupKey = (typeof GROUP_NAV)[number]['key']
|
||||
|
||||
const activeGroup = ref<GroupKey>('brand')
|
||||
|
||||
function onGroupSelect(index: string): void {
|
||||
@@ -558,7 +598,7 @@
|
||||
}
|
||||
|
||||
const activeGroupLabel = computed(
|
||||
() => GROUP_NAV.find((g) => g.key === activeGroup.value)?.label ?? ''
|
||||
() => ALL_NAV_ITEMS.find((i) => i.key === activeGroup.value)?.label ?? ''
|
||||
)
|
||||
|
||||
// ---- 租户上下文(超管可切换;租户管理员固定自己——useTenantOptions 收拢) ----------------
|
||||
@@ -951,17 +991,42 @@
|
||||
.group-nav {
|
||||
border-right: none;
|
||||
|
||||
.nav-label {
|
||||
font-size: 14px;
|
||||
.nav-section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 12px 4px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--art-gray-500);
|
||||
|
||||
.nav-section-icon {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-badge {
|
||||
margin-left: 6px;
|
||||
padding: 0 6px;
|
||||
font-size: 11px;
|
||||
color: var(--el-color-success);
|
||||
background: var(--el-color-success-light-9);
|
||||
border-radius: 8px;
|
||||
.nav-versions-title {
|
||||
margin-top: 8px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px dashed var(--el-border-color-lighter);
|
||||
}
|
||||
|
||||
.nav-item-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
line-height: 1.4;
|
||||
|
||||
.nav-sub {
|
||||
font-size: 11px;
|
||||
color: var(--art-gray-400);
|
||||
// el-menu-item 自带 white-space:nowrap——放行副标题换行,防溢出菜单项内容框
|
||||
white-space: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-label {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user