zhangjf 4b4fcf2ead feat: 完成阶段四前端开发和阶段五部署准备
阶段四:前端开发
- 管理后台 (worklog-web): Vue 3 + Element Plus
  - 登录页面、主布局、人员管理、模板管理、工作日志
  - baseURL: /wladmin/api/v1

- 移动端 H5 (worklog-mobile): Vue 3 + Vant 4
  - 登录、首页、日志列表、新建/编辑/详情页
  - baseURL: /wlmobile/api/v1

阶段五:部署准备
- 后端打包: worklog-api-1.0.0.jar (48MB)
- 前端打包: worklog-web (1.6MB), worklog-mobile (632KB)
- 单元测试: 29个测试全部通过
- API端口调整为 8200
- Nginx配置更新

配置变更
- 后端端口: 8080 → 8200
- 前端 baseURL: /wlog → /wladmin, /wlmobile
- Nginx 代理路径更新
2026-02-24 17:33:16 +08:00

61 lines
1.4 KiB
TypeScript

import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import { TOKEN_KEY } from '@/utils/constants'
const routes: RouteRecordRaw[] = [
{
path: '/login',
name: 'Login',
component: () => import('@/views/login/index.vue'),
meta: { requiresAuth: false }
},
{
path: '/',
name: 'Layout',
component: () => import('@/views/layout/index.vue'),
redirect: '/log',
children: [
{
path: 'user',
name: 'User',
component: () => import('@/views/user/index.vue'),
meta: { title: '人员管理', icon: 'User' }
},
{
path: 'template',
name: 'Template',
component: () => import('@/views/template/index.vue'),
meta: { title: '模板管理', icon: 'Document' }
},
{
path: 'log',
name: 'Log',
component: () => import('@/views/log/index.vue'),
meta: { title: '工作日志', icon: 'Notebook' }
}
]
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
// 路由守卫
router.beforeEach((to, _from, next) => {
const token = localStorage.getItem(TOKEN_KEY)
if (to.meta.requiresAuth === false) {
next()
} else if (!token && to.path !== '/login') {
next('/login')
} else if (token && to.path === '/login') {
next('/')
} else {
next()
}
})
export default router