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:
@@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<GiPageLayout>
|
||||
<!-- 欢迎条 -->
|
||||
<a-card :bordered="false" class="dash__welcome">
|
||||
<div class="dash__hello">
|
||||
<a-avatar :size="46" class="dash__avatar">{{ avatarText }}</a-avatar>
|
||||
<div>
|
||||
<h3 class="dash__name">{{ userStore.name || '—' }},欢迎回来</h3>
|
||||
<p class="dash__meta">
|
||||
{{ userStore.tenantName || '平台运营' }} ·
|
||||
{{ roleLabel || '—' }}
|
||||
</p>
|
||||
</div>
|
||||
<a-tag class="dash__scope" color="arcoblue">一期范围:学校收集 + 自主认定</a-tag>
|
||||
</div>
|
||||
</a-card>
|
||||
|
||||
<!-- 统计 -->
|
||||
<a-row :gutter="14" class="dash__stats">
|
||||
<a-col v-for="s in stats" :key="s.label" :xs="12" :sm="12" :md="6">
|
||||
<a-card :bordered="false" class="dash__stat">
|
||||
<div class="dash__stat-label">
|
||||
<component :is="s.icon" />
|
||||
<span>{{ s.label }}</span>
|
||||
</div>
|
||||
<div class="dash__stat-num" :class="s.tone">
|
||||
{{ s.value }}<small v-if="s.unit">{{ s.unit }}</small>
|
||||
</div>
|
||||
<div class="dash__stat-foot">{{ s.foot }}</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<!-- 快捷入口 -->
|
||||
<a-card :bordered="false">
|
||||
<template #title>快捷入口</template>
|
||||
<template #extra>
|
||||
<span class="dash__hint">当前角色可访问的页面</span>
|
||||
</template>
|
||||
<a-space wrap>
|
||||
<a-button v-for="m in shortcuts" :key="m.key" @click="router.push(m.path)">
|
||||
<template #icon>
|
||||
<component :is="m.icon" />
|
||||
</template>
|
||||
{{ m.title }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-card>
|
||||
|
||||
<!-- 进度 -->
|
||||
<a-card :bordered="false">
|
||||
<template #title>开发进度</template>
|
||||
<template #extra>
|
||||
<span class="dash__hint">M0 后端已完成,界面建设中</span>
|
||||
</template>
|
||||
|
||||
<a-alert type="success" :show-icon="false" class="dash__note">
|
||||
<template #title>
|
||||
<strong>M0 后端已通过验收(36/36)。</strong>
|
||||
租户开通、组织架构、登录鉴权、跨租户隔离、权限菜单均已可用;
|
||||
数据库由 Flyway 管理,26 张表(20 业务 + 5 标准 + 1 迁移记录)。
|
||||
</template>
|
||||
</a-alert>
|
||||
|
||||
<a-alert type="info" :show-icon="false" class="dash__note">
|
||||
<template #title>
|
||||
界面按里程碑推进:<strong>M1</strong> 任务与表单配置 → <strong>M2</strong> 名册与门禁 →
|
||||
<strong>M3</strong> 填报主流程(改名 / 压缩)→ <strong>M5</strong> 审核 → <strong>M6</strong> 导出打包。
|
||||
左侧标「待建」的菜单点进去能看到它属于哪个里程碑。
|
||||
</template>
|
||||
</a-alert>
|
||||
</a-card>
|
||||
</GiPageLayout>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { IconCheckCircle, IconFolder, IconIdcard, IconSafe, IconStamp } from '@arco-design/web-vue/es/icon'
|
||||
import * as orgApi from '@/apis/xt/org'
|
||||
import * as tenantApi from '@/apis/xt/tenant'
|
||||
import type { OrgTreeVO } from '@/apis/xt/org'
|
||||
import { XT_MENUS, ROLE_NAMES } from '@/config/xt-routes'
|
||||
import { useUserStore } from '@/stores'
|
||||
|
||||
/**
|
||||
* 工作台。
|
||||
*
|
||||
* 取舍:**只显示真实能查到的数字**。
|
||||
* 原型里的「异常待处理」这类统计需要 M1/M2 的任务与校验数据,
|
||||
* 现在没有对应接口,所以不做假数据充数 —— 空着比编数字诚实。
|
||||
*/
|
||||
defineOptions({ name: 'Dashboard' })
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const orgCount = ref<number | null>(null)
|
||||
const tenantCount = ref<number | null>(null)
|
||||
const loading = ref(true)
|
||||
|
||||
const avatarText = computed(() => (userStore.name || '—').slice(0, 1))
|
||||
const roleLabel = computed(() =>
|
||||
userStore.roles.map((c) => ROLE_NAMES[c] ?? c).join(' / ')
|
||||
)
|
||||
const isPlatform = computed(() => userStore.menus?.includes('tenant') ?? false)
|
||||
|
||||
/** 已实现且当前角色可访问的页面 */
|
||||
const shortcuts = computed(() =>
|
||||
XT_MENUS.filter((m) => m.ready && userStore.menuKeys.includes(m.key))
|
||||
)
|
||||
|
||||
const stats = computed(() => [
|
||||
{
|
||||
label: '组织节点',
|
||||
icon: IconFolder,
|
||||
value: loading.value ? '—' : (orgCount.value ?? '—'),
|
||||
unit: '个',
|
||||
foot: '学校 / 院系 / 班级',
|
||||
tone: ''
|
||||
},
|
||||
{
|
||||
label: '租户',
|
||||
icon: IconStamp,
|
||||
value: isPlatform.value ? (loading.value ? '—' : (tenantCount.value ?? '—')) : '—',
|
||||
unit: isPlatform.value ? '个' : '',
|
||||
foot: isPlatform.value ? '平台可见' : '仅平台运营可见',
|
||||
tone: 'is-success'
|
||||
},
|
||||
{
|
||||
label: '我的角色',
|
||||
icon: IconSafe,
|
||||
value: userStore.roles.length,
|
||||
unit: '个',
|
||||
foot: roleLabel.value || '—',
|
||||
tone: ''
|
||||
},
|
||||
{
|
||||
label: '可用权限',
|
||||
icon: IconIdcard,
|
||||
value: userStore.permissions.length,
|
||||
unit: '项',
|
||||
foot: '按角色由服务端下发',
|
||||
tone: ''
|
||||
}
|
||||
])
|
||||
|
||||
function countNodes(nodes: OrgTreeVO[]): number {
|
||||
return nodes.reduce((sum, n) => sum + 1 + countNodes(n.children ?? []), 0)
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await orgApi.getOrgTree()
|
||||
orgCount.value = countNodes(res.data ?? [])
|
||||
} catch {
|
||||
orgCount.value = null
|
||||
}
|
||||
if (isPlatform.value) {
|
||||
try {
|
||||
const res = await tenantApi.getTenantList({ pageNum: 1, pageSize: 1 })
|
||||
tenantCount.value = res.data?.total ?? null
|
||||
} catch {
|
||||
tenantCount.value = null
|
||||
}
|
||||
}
|
||||
loading.value = false
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dash {
|
||||
&__welcome {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
&__hello {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__avatar {
|
||||
flex: none;
|
||||
font-size: 18px;
|
||||
background: rgb(var(--primary-6));
|
||||
}
|
||||
|
||||
&__name {
|
||||
margin: 0;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
margin: 5px 0 0;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
&__scope {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
&__stats {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
&__stat {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&__stat-label {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
&__stat-num {
|
||||
margin-top: 8px;
|
||||
font-size: 27px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: var(--color-text-1);
|
||||
|
||||
small {
|
||||
margin-left: 3px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
&.is-success {
|
||||
color: rgb(var(--success-6));
|
||||
}
|
||||
}
|
||||
|
||||
&__stat-foot {
|
||||
margin-top: 7px;
|
||||
font-size: 11px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
&__hint {
|
||||
font-size: 12px;
|
||||
color: var(--color-text-3);
|
||||
}
|
||||
|
||||
&__note:not(:last-child) {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user