zhangjf 47703e40c4 feat: 移动端完善与操作日志审计功能
1. 移动端fund-mobile完善:
   - 新增项目列表页面 (project/List.vue)
   - 新增客户列表页面 (customer/List.vue)
   - 新增统一API文件 (api/index.ts)
   - 更新路由配置,新增项目和客户路由
   - 首页增加项目和客户快捷入口

2. 操作日志审计功能:
   - OperationLog实体类: 操作日志数据模型
   - OperationLogMapper: MyBatis-Plus Mapper
   - OperationLogService: 日志服务接口和实现
   - OperationLogController: 日志查询API
   - OperationLogAspect: AOP切面自动记录操作日志
   - 支持异步保存,只记录写操作(增删改)

3. 操作日志功能特性:
   - 自动拦截Controller层方法
   - 记录用户ID、用户名、操作描述、请求参数
   - 记录IP、UserAgent、操作时间、耗时
   - 支持成功/失败状态记录
   - 支持分页查询和历史日志清理
2026-02-20 09:16:00 +08:00

80 lines
1.9 KiB
TypeScript

import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
name: 'Home',
component: () => import('@/views/Home.vue'),
meta: { title: '首页', requiresAuth: true }
},
{
path: '/expense/add',
name: 'ExpenseAdd',
component: () => import('@/views/expense/Add.vue'),
meta: { title: '新增支出', requiresAuth: true }
},
{
path: '/receivable',
name: 'ReceivableList',
component: () => import('@/views/receivable/List.vue'),
meta: { title: '应收款列表', requiresAuth: true }
},
{
path: '/project',
name: 'ProjectList',
component: () => import('@/views/project/List.vue'),
meta: { title: '项目列表', requiresAuth: true }
},
{
path: '/customer',
name: 'CustomerList',
component: () => import('@/views/customer/List.vue'),
meta: { title: '客户列表', requiresAuth: true }
},
{
path: '/my',
name: 'My',
component: () => import('@/views/my/Index.vue'),
meta: { title: '我的', requiresAuth: true }
},
{
path: '/login',
name: 'Login',
component: () => import('@/views/Login.vue'),
meta: { title: '登录', requiresAuth: false }
}
]
})
// 路由守卫
router.beforeEach((to, _from, next) => {
// 设置页面标题
if (to.meta.title) {
document.title = to.meta.title as string
}
// 检查是否需要登录
if (to.meta.requiresAuth) {
const token = localStorage.getItem('token')
if (!token) {
next('/login')
return
}
}
// 已登录用户不能访问登录页
if (to.path === '/login') {
const token = localStorage.getItem('token')
if (token) {
next('/')
return
}
}
next()
})
export default router