feat(ui): 标题改为天豹云OMS订单管理系统,登录页作为首页

- 浏览器标题、侧边栏 logo、登录页品牌名统一为「天豹云OMS订单管理系统」
- 登录页底部新增备案号(可点击跳转工信部核验)与版权信息;窄屏/极矮屏改为
  常规流排布,避免页脚压在登录卡片上
- 路由调整:根路径 / 直接渲染登录页(首页即登录),/login 重定向到 /;
  登录成功后进仪表盘 /dashboard,已登录访问 / 或 /login 同样回仪表盘
- 退出登录、401 失效统一回到首页(登录页)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liufumingren 2026-11-07 08:51:53 +08:00
parent 6facd9c6f3
commit 9826de2ad1
6 changed files with 88 additions and 17 deletions

View File

@ -7,7 +7,7 @@
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<title>OMS 管理系统</title>
<title>天豹云OMS订单管理系统</title>
</head>
<body>
<div id="app">

View File

@ -142,7 +142,7 @@ function logout() {
}
function goLogin() {
router.push('/login')
router.push('/')
}
// 进入导出任务页(全局任务池:提交后后台异步处理,完成后自动下载)
@ -167,7 +167,7 @@ function onPrincipalChange(id: number) {
<template>
<el-container class="app-container">
<el-aside width="220px" class="app-aside">
<div class="logo">OMS 管理系统</div>
<div class="logo">天豹云OMS订单管理系统</div>
<el-menu :router="true" class="app-menu" :default-active="router.currentRoute.value.path">
<SideMenu :menus="menuStore.menus" />
</el-menu>
@ -281,10 +281,12 @@ function onPrincipalChange(id: number) {
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
font-size: 15px;
font-weight: 600;
letter-spacing: 0.5px;
color: var(--el-color-primary);
border-bottom: 1px solid var(--el-border-color);
white-space: nowrap;
}
.app-menu {

View File

@ -5,18 +5,22 @@ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/login',
// 登录页即首页:根路径直接渲染登录页,登录成功后进仪表盘
path: '/',
name: 'login',
component: () => import('@/views/Login.vue'),
meta: { public: true },
},
// 兼容旧地址 / 旧书签:/login 统一回到首页(登录页)
{ path: '/login', redirect: { path: '/' } },
{
// 后台布局容器:只用于承载带侧边栏的子路由(/dashboard、/order 等由菜单动态注册)。
// 与登录页同 path 不影响匹配:根路径 '/' 先命中上面的登录页,子路由按各自全路径命中这里。
path: '/',
component: () => import('@/layouts/BasicLayout.vue'),
name: 'layout',
redirect: { path: '/dashboard' },
children: [
{ path: '', name: 'home', component: () => import('@/views/Home.vue'), meta: { title: '首页' } },
{ path: 'about', name: 'about', component: () => import('@/views/About.vue'), meta: { title: '关于' } },
{
path: 'export-tasks',
@ -42,7 +46,8 @@ const router = createRouter({
router.beforeEach(async (to) => {
const token = getToken()
if (!to.meta.public && !token) {
return { name: 'login', query: { redirect: to.fullPath } }
// 首页(/)本身就是登录页,无需再带 redirect 参数
return to.fullPath === '/' ? { name: 'login' } : { name: 'login', query: { redirect: to.fullPath } }
}
if (to.name === 'login' && token) {
return { path: '/dashboard' }
@ -64,7 +69,7 @@ router.beforeEach(async (to) => {
}
// 动态路由是运行期注册的,深链接刷新时早于匹配阶段:
// 当前 to 尚未匹配到任何路由 → 用新的路由表重新解析当前目标;
// 重新解析后仍无匹配(地址不存在或当前权限不可见)则回首页,避免反复重定向
// 重新解析后仍无匹配(地址不存在或当前权限不可见)则回仪表盘,避免反复重定向
if (to.matched.length === 0) {
if (to.redirectedFrom && to.redirectedFrom.matched.length === 0) {
return { path: '/dashboard' }

View File

@ -97,7 +97,7 @@ export const useAuthStore = defineStore('auth', () => {
token.value = ''
user.value = null
ElMessage.success('已退出登录')
router.replace('/login')
router.replace('/')
}
function applyToken(value: string) {

View File

@ -96,8 +96,8 @@ service.interceptors.response.use(
// 登录页内(正在登录):直接提示后端返回的具体错误,如「账号或密码错误」
ElMessage.error(message || '登录失败,请检查账号或密码')
} else {
// 登录失效:清空本地登录态(token 与所选主体)并返回首页
// (未登录会被路由守卫转到登录页,登录成功后再回到首页)
// 登录失效:清空本地登录态(token 与所选主体)并返回首页(登录页)
// (首页即登录页,登录成功后直接进仪表盘)
clearToken()
usePrincipalStore().setCurrentId(null)
if (!redirectingToHome) {

View File

@ -39,10 +39,16 @@ function startCountdown(counter: { value: number }, timerRef: { value?: ReturnTy
}, 1000)
}
/** 登录成功后的落地页:仪表盘(首页 / 已是登录页,不再回到根路径) */
function goAfterLogin() {
router.replace((route.query.redirect as string) || '/')
const redirect = (route.query.redirect as string) || ''
const target = redirect && redirect !== '/' && !redirect.startsWith('/login') ? redirect : '/dashboard'
router.replace(target)
}
/** 页脚版权年份 */
const year = new Date().getFullYear()
/* -------------------- 账号登录 -------------------- */
const loginFormRef = ref<FormInstance>()
const loginForm = reactive({
@ -431,7 +437,7 @@ onUnmounted(() => {
<section class="login-panel">
<el-card class="login-card" shadow="never">
<div class="login-brand">
<div class="login-brand__title">天豹 OMS 管理系统</div>
<div class="login-brand__title">天豹云OMS订单管理系统</div>
<div class="login-brand__subtitle">仓储与订单协同平台</div>
</div>
@ -520,6 +526,15 @@ onUnmounted(() => {
</section>
</div>
<!-- 页脚:备案号可点击跳转工信部核验(备案要求) -->
<footer class="login-footer">
<a class="login-footer__link" href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer">
粤ICP备2023091787号-1
</a>
<span class="login-footer__sep">·</span>
<span>© {{ year }} 广州天豹云仓供应链管理有限公司</span>
</footer>
<!-- 微信扫码登录 -->
<el-dialog
v-model="wechatVisible"
@ -651,9 +666,10 @@ onUnmounted(() => {
position: relative;
width: 100%;
height: 100%;
padding: 24px 40px;
padding: 24px 40px 64px;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #071224;
@ -686,6 +702,40 @@ onUnmounted(() => {
gap: 48px;
}
/* 页脚:固定在页面底部居中,不参与左右分栏布局 */
.login-footer {
position: absolute;
left: 0;
right: 0;
bottom: 18px;
z-index: 1;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 6px;
padding: 0 16px;
font-size: 13px;
line-height: 1.6;
color: rgba(203, 220, 246, 0.6);
text-align: center;
}
.login-footer__link {
color: inherit;
text-decoration: none;
transition: color 0.2s;
}
.login-footer__link:hover {
color: #e8f1ff;
text-decoration: underline;
}
.login-footer__sep {
opacity: 0.6;
}
/* 左侧插画(inline SVG,按宽度等比缩放,不会把页面撑高) */
.login-visual {
flex: 1 1 auto;
@ -885,13 +935,20 @@ onUnmounted(() => {
/* 极矮窗口(如被压缩的预览窗):交给页面整体滚动,避免卡片内部再滚动导致点不到按钮 */
@media (max-height: 560px) {
.login-page {
align-items: flex-start;
align-items: center;
justify-content: flex-start;
height: auto;
min-height: 100%;
overflow-y: auto;
padding: 16px 24px;
}
/* 会出现滚动时页脚改为常规流,避免压在登录卡片上 */
.login-footer {
position: static;
margin-top: 18px;
}
.login-shell {
max-height: none;
}
@ -904,11 +961,18 @@ onUnmounted(() => {
/* 窄屏 / 移动端:上下布局,插画在上、表单卡片在下;此时允许页面纵向滚动 */
@media (max-width: 960px) {
.login-page {
align-items: flex-start;
align-items: center;
justify-content: flex-start;
height: auto;
min-height: 100%;
overflow: visible;
padding: 24px 18px 32px;
padding: 24px 18px 20px;
}
/* 窄屏内容会超出一屏,页脚跟着内容往下排,不叠在卡片上 */
.login-footer {
position: static;
margin-top: 18px;
}
.login-shell {