feat(frontend): 管理端改用 Gi Admin Pro 框架 + 腾讯云主题

前端此前只有本地实现、从未入库,本次首次纳入版本管理。

框架切换
  · 以 Gi Admin Pro(Vue3 + Vite + TS + Arco Design Vue + Pinia)为底
  · 剥离 14 个演示页面目录 / 121 个文件(demo 28、file 20、form 19、system 18…)
  · 依赖 dependencies 35 → 19,devDependencies 31 → 27
  · 保留框架核心:layout、Gi* 组件库、hooks、权限指令、错误页、登录页

主题:腾讯云 / TDesign 官方色板
  · 主色 #0052D9(腾讯蓝)、成功 #00A870、警告 #ED7B2F、危险 #E34D59
  · 页面底色 #f3f3f3、文字 rgba(0,0,0,90/60/40/26%)
  · 覆盖 Arco 底层色板 + 显式语义别名(primary/success/warning/danger/link/neutral)
  · 三个改了不生效也不报错的坑已记入注释:
      1) Arco 色值是逗号分隔 RGB 三元组,不是 #RRGGBB
      2) Arco 把色板定义在 body 而非 :root,必须写 `:root, body`
      3) setting.json 的 themeColor 会以内联样式写进 body,优先级高于样式表

对接后端(三处契约差异在 @/utils/http 统一适配)
  · 响应信封 {code,msg,data} → {code,success,message,data}
  · Token 头 token → Authorization: Bearer
  · 分页 {list,total} → 补一份 records,list 原样保留
  · 40101 → 登录页;登录密码 RSA 加密(公钥走 /auth/public-key,轮换无需重建前端)
  · 路由:后端只下发菜单键,前端在本地路由表上过滤(有哪些页面归代码,谁能看归后端)

已实现页面(浏览器实测通过)
  · 登录:RSA 加密 + 自适应验证码/租户码 + 账号锁定提示
  · 工作台:真实数据(组织 6 个 / 角色 1 个 / 权限 25 项)
  · 组织架构:三级树 + CRUD + 占用校验
  · 租户管理:开通租户 + 初始密码只显示一次的强确认
  · 待建页:未实现菜单显示所属里程碑
  · 权限菜单:学校管理员看不到「租户管理」

视觉资产按腾讯云主题重做
  · logo.svg(渐变圆角方 + 填)、favicon.svg(小尺寸做减法)、login-hero.svg(材料归集)
  · 登录页点阵纹理走主题变量,换主色自动跟随
  · 文案改为产品实际能力:自动改名 / 强制压缩 / 隐私保护

清理模板遗留(约 17MB + 三处外部依赖)
  · 百度统计脚本(上报到 gi-demo 作者的统计账号)
  · 用户菜单「项目地址」(跳转模板作者的 Gitee 仓库)
  · 两份 8.8MB mp3、388KB favicon.ico、57KB 模板插画、未引用字体与 loading.gif
  · 「个人中心」指向已删除的 /system/account(点了 404)
  · 头部头像在无 avatarUrl 时渲染成裂图 → 改为姓名首字兜底

后端修复
  · 新增 GET /auth/public-key(前端加密登录密码用)
  · DataSeeder.ancestor_path 生成错误:子节点本该是 /16/17/ 却写成 /17/
    该字段是「按院系统计」的索引,错了会漏人/多人且不报错 —— 改为从库里读父节点路径
  · seedDemoOrgs 曾放在租户作用域外 + admin 早退分支之后,导致启动失败 / 永不执行
  · 示范租户补一套三级组织树(1 学校 / 2 院系 / 3 班级),供界面演示
This commit is contained in:
2026-09-28 20:49:55 +08:00
parent 9d7a8ca845
commit 87ece5a971
237 changed files with 25215 additions and 26 deletions
@@ -0,0 +1,85 @@
<!--
@file Message 组件
@description 消息通知组件,包含通知、关注和待办三个标签页
-->
<template>
<div class="message">
<!-- 消息标签页 -->
<a-tabs :active-key="activeTab" style="background-color: transparent;" @change="handleTabChange">
<a-tab-pane v-for="tab in tabs" :key="tab.key">
<template #title>{{ tab.title }}({{ tab.count }})</template>
</a-tab-pane>
</a-tabs>
<!-- 消息列表 -->
<section class="message-list">
<a-comment v-for="item in messageList" :key="item.id" :author="item.name" :content="item.content"
:datetime="item.datetime">
<template #avatar>
<a-avatar>
<img :src="item.avatar" :alt="item.name">
</a-avatar>
</template>
</a-comment>
</section>
</div>
</template>
<script setup lang="ts">
import type { TabsInstance } from '@arco-design/web-vue'
/** 组件名称 */
defineOptions({ name: 'Message' })
/** 消息类型定义 */
interface MessageItem {
id?: string | number
name: string
datetime: string
content: string
avatar: string
actionText?: string
}
/** 标签页配置 */
const tabs = [
{ key: '1', title: '通知', count: 1 },
{ key: '2', title: '关注', count: 1 },
{ key: '3', title: '待办', count: 2 }
]
/** 组件状态 */
const activeTab = ref('1')
/** 消息列表数据 */
const messageList = ref<MessageItem[]>([
{
id: 1,
name: 'Socrates',
datetime: '1小时之前',
content: 'Comment body content.',
avatar: 'https://img1.baidu.com/it/u=1817951587,3188870642&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500'
},
{
id: 2,
name: '木木糖醇',
datetime: '2小时之前',
content: '关注了你',
avatar: 'https://s1.ax1x.com/2022/06/14/XhteeO.jpg'
},
{
id: 3,
name: '徐欣',
datetime: '2个半小时之前',
content: '收藏了你的文章',
avatar: 'https://s1.ax1x.com/2022/06/14/XhtSwF.jpg'
}
])
/** 处理标签页切换 */
const handleTabChange: TabsInstance['onChange'] = (key) => {
activeTab.value = key as string
}
</script>
<style lang="scss" scoped></style>
@@ -0,0 +1,168 @@
<!--
@file SettingDrawer 组件
@description 系统设置抽屉组件,用于配置系统主题、布局、动画等全局设置
-->
<template>
<div>
<a-space :size="15" direction="vertical" fill>
<section>
<a-divider orientation="center">系统布局</a-divider>
<a-row :gutter="[8, 8]">
<a-col v-for="item in LAYOUT_OPTIONS" :key="item.value" :span="8">
<LayoutModeItem :mode="item.value" :name="item.label" @click="toggleLayout(item.value)"></LayoutModeItem>
</a-col>
</a-row>
</section>
<!-- 系统主题设置 -->
<section>
<a-divider orientation="center">系统主题</a-divider>
<a-row justify="center">
<ColorPicker theme="dark" :color="appStore.themeColor" :sucker-hide="true" :colors-default="defaultColorList"
@change-color="changeColor"></ColorPicker>
</a-row>
</section>
<!-- 界面显示设置 -->
<section>
<a-divider orientation="center">界面显示</a-divider>
<a-descriptions :column="1" :align="{ value: 'right' }" :value-style="{ paddingRight: 0 }">
<!-- 页签设置 -->
<a-descriptions-item label="页签显示">
<a-switch v-model="appStore.isTabVisible" />
</a-descriptions-item>
<a-descriptions-item label="页签风格">
<a-select v-model="appStore.tabStyle" placeholder="请选择" :options="TAB_MODE_OPTIONS"
:disabled="!appStore.isTabVisible" :trigger-props="{ autoFitPopupMinWidth: true }"
:style="{ width: '120px' }">
</a-select>
</a-descriptions-item>
<!-- 动画设置 -->
<a-descriptions-item label="动画显示">
<a-switch v-model="appStore.isTransitionEnabled" />
</a-descriptions-item>
<a-descriptions-item label="动画效果">
<a-select v-model="appStore.transitionName" placeholder="请选择" :options="ANIMATE_MODE_OPTIONS"
:disabled="!appStore.isTransitionEnabled" :style="{ width: '120px' }">
</a-select>
</a-descriptions-item>
<!-- 菜单设置 -->
<a-descriptions-item label="深色菜单">
<a-switch v-model="appStore.isMenuDark" />
</a-descriptions-item>
<a-descriptions-item label="手风琴效果">
<a-switch v-model="appStore.isMenuAccordion" />
</a-descriptions-item>
</a-descriptions>
</section>
</a-space>
</div>
</template>
<script setup lang="ts">
import { ColorPicker } from 'vue-color-kit'
import AppSetting from '@/config/setting.json'
import { useTheme } from '@/hooks'
import { useAppStore } from '@/stores'
import LayoutModeItem from './components/LayoutModeItem.vue'
import 'vue-color-kit/dist/vue-color-kit.css'
/** 组件名称 */
defineOptions({ name: 'SettingDrawerPanel' })
/** 状态管理 */
const appStore = useAppStore()
const { setThemeColor } = useTheme()
type LayoutItem = { label: string, value: App.SettingConfig['layout'] }
/** 布局选项 */
const LAYOUT_OPTIONS: LayoutItem[] = [
{ label: '默认布局', value: 'left' },
{ label: '顶部布局', value: 'top' },
{ label: '混合布局', value: 'mix' },
{ label: '双列布局', value: 'columns' }
]
type TabItem = { label: string, value: App.SettingConfig['tabStyle'] }
/** 页签模式选项 */
const TAB_MODE_OPTIONS: TabItem[] = [
{ label: '卡片', value: 'card' },
{ label: '间隔卡片', value: 'card-gutter' },
{ label: '圆角', value: 'rounded' },
{ label: '自定义1', value: 'custom1' },
{ label: '自定义2', value: 'custom2' }
]
type AnimateItem = { label: string, value: App.SettingConfig['transitionName'] }
/** 动画模式选项 */
const ANIMATE_MODE_OPTIONS: AnimateItem[] = [
{ label: '默认', value: 'zoom-fade' },
{ label: '滑动', value: 'fade-slide' },
{ label: '渐变', value: 'fade' },
{ label: '底部滑出', value: 'fade-bottom' },
{ label: '缩放消退', value: 'fade-scale' }
]
/** 初始化设置 */
const initSetting = () => {
const layouts = LAYOUT_OPTIONS.map((i) => i.value)
if (!layouts.includes(appStore.layout)) {
appStore.layout = AppSetting.layout as App.SettingConfig['layout']
}
const tabs = TAB_MODE_OPTIONS.map((i) => i.value)
if (!tabs.includes(appStore.tabStyle)) {
appStore.tabStyle = AppSetting.tabStyle as App.SettingConfig['tabStyle']
}
const animates = ANIMATE_MODE_OPTIONS.map((i) => i.value)
if (!animates.includes(appStore.transitionName)) {
appStore.transitionName = AppSetting.transitionName as App.SettingConfig['transitionName']
}
}
initSetting()
/** 默认主题色列表 */
const defaultColorList = [
'#165DFF',
'#409EFF',
'#18A058',
'#2d8cf0',
'#007AFF',
'#5ac8fa',
'#5856D6',
'#536dfe',
'#9c27b0',
'#AF52DE',
'#0096c7',
'#00C1D4',
'#43a047',
'#e53935',
'#f4511e',
'#6d4c41'
]
/** 颜色选择器返回值类型 */
interface ColorObj {
hex: string
hsv: { h: number, s: number, v: number }
rgba: { r: number, g: number, b: number, a: number }
}
/** 更改主题色 */
const changeColor = (colorObj: ColorObj) => {
if (!/^#[0-9A-Z]{6}/i.test(colorObj.hex)) return
setThemeColor(colorObj.hex)
}
/** 切换布局 */
const toggleLayout = (layout: App.SettingConfig['layout']) => {
appStore.layout = layout
}
</script>
<style lang="scss" scoped>
:deep(.arco-descriptions-item-label-block) {
color: var(--color-text-1);
}
</style>
@@ -0,0 +1,270 @@
<!--
@file LayoutItem 组件
@description 布局切换选项组件,支持左侧布局、顶部布局和混合布局三种模式
-->
<template>
<div class="layout-mode-item-wrapper w-full">
<!-- 布局预览 -->
<div class="layout-mode-item"
:class="[{ 'is-active': appStore.layout === props.mode }, `layout-mode-item__${props.mode}`]"
@click="emit('click')">
<!-- 默认布局 -->
<template v-if="props.mode === 'left'">
<div class="preview-side preview-side--main">
<span class="preview-line"></span>
<span class="preview-line"></span>
<span class="preview-line"></span>
<span class="preview-line"></span>
</div>
<div class="preview-main">
<div class="preview-header"></div>
<div class="preview-content">
<span class="preview-line"></span>
<span class="preview-line is-short"></span>
<span class="preview-line is-short"></span>
</div>
</div>
</template>
<!-- 顶部布局 -->
<template v-if="props.mode === 'top'">
<div class="preview-topbar">
<span class="preview-pill"></span>
<span class="preview-pill"></span>
<span class="preview-pill"></span>
<span class="preview-pill"></span>
</div>
<div class="preview-content">
<span class="preview-line"></span>
<span class="preview-line is-short"></span>
<span class="preview-line is-short"></span>
</div>
</template>
<!-- 混合布局 -->
<template v-if="props.mode === 'mix'">
<div class="preview-topbar">
<span class="preview-pill"></span>
<span class="preview-pill"></span>
<span class="preview-pill"></span>
<span class="preview-pill"></span>
</div>
<div class="preview-main preview-main--row">
<div class="preview-side preview-side--main">
<span class="preview-line"></span>
<span class="preview-line"></span>
<span class="preview-line"></span>
</div>
<div class="preview-content">
<span class="preview-line"></span>
<span class="preview-line is-short"></span>
<span class="preview-line is-short"></span>
</div>
</div>
</template>
<!-- 双列布局 -->
<template v-if="props.mode === 'columns'">
<div class="preview-side preview-side--ghost"></div>
<div class="preview-side preview-side--main">
<span class="preview-line"></span>
<span class="preview-line"></span>
<span class="preview-line"></span>
<span class="preview-line"></span>
</div>
<div class="preview-main">
<div class="preview-content">
<span class="preview-line"></span>
<span class="preview-line is-short"></span>
<span class="preview-line is-short"></span>
<span class="preview-line is-short"></span>
</div>
</div>
</template>
</div>
<!-- 布局名称 -->
<p class="layout-mode-item__text">{{ props.name }}</p>
</div>
</template>
<script setup lang="ts">
import { useAppStore } from '@/stores'
defineOptions({
name: 'LayoutModeItem'
})
/** Props 默认值 */
const props = withDefaults(defineProps<Props>(), {
mode: 'left'
})
/** Emits 定义 */
const emit = defineEmits<{
(e: 'click'): void
}>()
/** 布局模式类型 */
type LayoutMode = 'left' | 'top' | 'mix' | 'columns'
/** Props 类型定义 */
interface Props {
/** 布局模式 */
mode?: LayoutMode
/** 布局名称 */
name: string
}
/** 应用状态 */
const appStore = useAppStore()
</script>
<style lang="scss" scoped>
.layout-mode-item-wrapper {
width: 100%;
}
.layout-mode-item {
box-sizing: border-box;
display: flex;
width: 100%;
height: 58px;
padding: 6px;
gap: 4px;
overflow: hidden;
cursor: pointer;
background-color: var(--color-bg-1);
border: 2px solid var(--color-border-2);
border-radius: 6px;
transition: border-color 0.25s ease, box-shadow 0.25s ease;
&.is-active {
border-color: rgb(var(--primary-6));
box-shadow: 0 0 5px 3px rgb(var(--primary-2));
}
&__text {
margin-top: 5px;
font-size: 12px;
color: var(--color-text-2);
text-align: center;
}
}
.preview-main {
display: flex;
flex: 1;
flex-direction: column;
min-width: 0;
gap: 4px;
}
.preview-side {
display: flex;
flex-direction: column;
flex-shrink: 0;
width: 12px;
padding: 3px 2px;
gap: 3px;
background-color: var(--color-fill-3);
border-radius: 2px;
box-sizing: border-box;
}
.preview-side--main {
background-color: var(--color-fill-4);
}
.preview-side--ghost {
width: 11px;
background-color: var(--color-fill-2);
}
.preview-header {
width: 100%;
height: 8px;
background-color: var(--color-fill-3);
border-radius: 2px;
}
.preview-topbar {
display: flex;
width: 100%;
height: 10px;
padding: 2px 3px;
gap: 3px;
background-color: var(--color-fill-3);
border-radius: 2px;
box-sizing: border-box;
}
.preview-pill {
flex: 1;
background-color: var(--color-bg-1);
border-radius: 1px;
}
.preview-content {
display: flex;
flex: 1;
flex-direction: column;
justify-content: flex-start;
gap: 4px;
min-width: 0;
padding-right: 1px;
box-sizing: border-box;
.preview-line {
height: 6px;
}
}
.preview-line {
display: block;
height: 5px;
width: 100%;
background-color: var(--color-fill-2);
border-radius: 1px;
&.is-short {
width: 70%;
}
}
.layout-mode-item__top {
flex-direction: column;
.preview-content {
padding-top: 2px;
}
}
.layout-mode-item__mix {
flex-direction: column;
.preview-topbar {
flex-shrink: 0;
}
.preview-main {
flex: 1;
}
.preview-side {
width: 12px;
}
}
.preview-main--row {
flex-direction: row;
gap: 4px;
}
.layout-mode-item__columns {
.preview-main .preview-content {
justify-content: center;
padding-top: 0;
}
}
</style>
@@ -0,0 +1,184 @@
<!--
@file HeaderRightBar 组件
@description 头部右侧工具栏组件,包含项目配置、消息通知、全屏切换、主题切换和用户菜单等功能
-->
<template>
<a-row justify="end" align="center" class="header-right-bar">
<a-space size="medium">
<!-- 项目配置按钮 -->
<a-tooltip content="项目配置" position="bl">
<a-button size="mini" class="g-hover-btn" @click="handleOpenSettings">
<template #icon>
<icon-settings :size="18" />
</template>
</a-button>
</a-tooltip>
<!-- 消息通知下拉框 -->
<a-popover position="bottom" trigger="click">
<a-badge :count="9" dot>
<a-button size="mini" class="g-hover-btn">
<template #icon>
<icon-notification :size="18" />
</template>
</a-button>
</a-badge>
<template #content>
<Notice></Notice>
</template>
</a-popover>
<!-- 全屏切换按钮 -->
<a-tooltip v-if="!['xs', 'sm'].includes(breakpoint)" content="全屏切换" position="bottom">
<a-button size="mini" class="g-hover-btn" @click="toggle">
<template #icon>
<icon-fullscreen v-if="!isFullscreen" :size="18" />
<icon-fullscreen-exit v-else :size="18" />
</template>
</a-button>
</a-tooltip>
<!-- 暗黑模式切换 -->
<a-tooltip content="主题切换" position="bottom">
<GiThemeBtn></GiThemeBtn>
</a-tooltip>
<!-- 管理员账户 -->
<a-dropdown trigger="hover">
<a-row align="center" :wrap="false" class="header-right-bar__user">
<!-- 头像:后端未下发 avatarUrl(本项目用姓名首字兜底,避免渲染成裂图) -->
<a-avatar :size="32" :style="{ backgroundColor: 'rgb(var(--primary-6))' }">
<img v-if="userStore.avatar" :src="userStore.avatar" alt="" />
<template v-else>{{ avatarText }}</template>
</a-avatar>
<span class="header-right-bar__username">{{ userStore.name }}</span>
<icon-down />
</a-row>
<template #content>
<a-doption v-for="item in USER_MENUS" :key="item.key" @click="item.onClick">
<template #icon>
<GiIconBox :color="item.iconColor">
<component :is="item.icon" />
</GiIconBox>
</template>
<span>{{ item.label }}</span>
</a-doption>
<a-divider :margin="0" />
<a-doption @click="handleLogout">
<template #icon>
<GiIconBox color="warning">
<icon-export />
</GiIconBox>
</template>
<span>退出登录</span>
</a-doption>
</template>
</a-dropdown>
</a-space>
</a-row>
</template>
<script setup lang="ts">
import { Button, Drawer, Message, Modal } from '@arco-design/web-vue'
import { useFullscreen } from '@vueuse/core'
import { useBreakpoint, useTheme } from '@/hooks'
import { useAppStore, useUserStore } from '@/stores'
import Notice from './Notice.vue'
import SettingDrawerPanel from './SettingDrawerPanel.vue'
/** 组件名称 */
defineOptions({ name: 'HeaderRight' })
/** 路由实例 */
const router = useRouter()
/** 状态管理 */
const userStore = useUserStore()
const appStore = useAppStore()
const { setThemeColor } = useTheme()
/** 响应式断点 */
const { breakpoint } = useBreakpoint()
/** 全屏控制 */
const { isFullscreen, toggle } = useFullscreen()
/** 头像兜底文案:取姓名首字 */
const avatarText = computed(() => (userStore.name || '—').slice(0, 1))
/** 用户菜单配置 */
const USER_MENUS = [
{
key: 'password',
label: '修改密码',
icon: 'icon-unlock',
iconColor: 'primary',
onClick: () => {
// 后端 PUT /auth/password 尚未实现(属 M0 剩余任务),
// 这里给明确提示,而不是像模板那样假装成功
Message.info('修改密码功能待接入后端 PUT /auth/password')
}
}
]
/** 恢复默认项目配置 */
const handleResetSettings = () => {
appStore.resetSettings()
setThemeColor(appStore.themeColor)
Message.success('已恢复默认配置')
}
/** 打开设置抽屉 */
const handleOpenSettings = () => {
Drawer.open({
title: '项目配置',
width: 300,
content: () => h(SettingDrawerPanel),
footer: () => h(Button, { type: 'primary', long: true, style: { margin: 0 }, onClick: handleResetSettings }, { default: () => '恢复默认配置' })
})
}
/** 处理退出登录 */
const handleLogout = () => {
Modal.warning({
title: '提示',
content: '确认退出登录?',
hideCancel: false,
closable: true,
onBeforeOk: async () => {
try {
await userStore.logout()
router.replace('/login')
return true
} catch {
Message.error('退出登录失败')
return false
}
}
})
}
</script>
<style lang="scss" scoped>
.arco-dropdown-open .arco-icon-down {
transform: rotate(180deg);
}
.header-right-bar {
&__user {
color: var(--color-text-1);
cursor: pointer;
}
&__username {
margin-left: 10px;
white-space: nowrap;
.arco-icon-down {
margin-left: 2px;
transition: all 0.3s;
}
}
}
</style>