diff --git a/CLAUDE.md b/CLAUDE.md index 9a09e15..a0fe622 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -68,10 +68,14 @@ client/src/ │ ├── stats/ # 统计分析 │ ├── bills/ # 全部账单 (下拉刷新/上拉加载) │ ├── profile/ # 我的(身份切换入口) -│ ├── profile-edit/ # 编辑资料(昵称+头像) +│ ├── profile-edit/ # 编辑资料(昵称+头像+签名) │ ├── group-manage/ # 群组管理(创建/加入/退出/解散) │ ├── category-manage/ # 分类管理 -│ └── budget/ # 预算设置 +│ ├── budget/ # 预算设置 +│ ├── notifications/ # 通知中心 +│ ├── feedback/ # 意见反馈 +│ ├── privacy/ # 隐私政策 +│ └── admin/ # 管理后台 (index/users/notifications/feedback/config) ├── components/ # 公共组件 │ ├── BudgetBar/ # 预算进度条 │ ├── CategoryIcon/ # 分类图标 (首字+颜色) @@ -96,6 +100,11 @@ client/src/ │ ├── stats.ts # 统计接口 │ ├── user.ts # 用户信息接口 (含头像上传) │ ├── group.ts # 群组接口 +│ ├── notification.ts # 通知接口 +│ ├── filter.ts # 筛选方案接口 +│ ├── feedback.ts # 反馈接口 +│ ├── config.ts # 系统配置接口 +│ ├── admin.ts # 管理后台接口 │ └── index.ts # barrel 导出 ├── utils/ │ ├── format.ts # 金额/日期格式化 @@ -116,6 +125,11 @@ server/src/ │ ├── stats.ts # 统计查询 (支持 group_id) │ ├── user.ts # 用户信息 + 头像上传 │ ├── group.ts # 群组 CRUD (创建/加入/退出/解散) +│ ├── notification.ts # 通知/公告 CRUD +│ ├── filter.ts # 筛选方案 CRUD +│ ├── feedback.ts # 用户反馈 (提交/查询/处理) +│ ├── config.ts # 系统配置 (公开读/管理员写) +│ ├── admin.ts # 管理后台 (仪表盘/用户管理) │ └── backup.ts # 备份 API ├── utils/ │ ├── backup.ts # Node.js 数据库备份 (gzip) @@ -124,16 +138,21 @@ server/src/ ├── connection.ts # MySQL 连接池 ├── init.ts # 建表 + seed + 迁移 (幂等) ├── schema.sql # 表结构 - └── seed.sql # 默认分类数据 + └── seed.sql # 默认分类数据 + 系统配置 ``` ### 数据库表 -- `users` — 用户 (openid, nickname, avatar_url) +- `users` — 用户 (openid, nickname, avatar_url, slogan, role) - `categories` — 分类 (user_id=0 默认, 其他=自定义) - `transactions` — 交易记录 (user_id, group_id, amount 分) - `budgets` — 预算 (user_id, month, amount) - `groups` — 群组 (name, invite_code, created_by) - `group_members` — 群组成员 (group_id, user_id, role) +- `notifications` — 通知/公告 (type, title, content, is_pinned, is_urgent) +- `notification_reads` — 公告已读记录 (notification_id, user_id) +- `saved_filters` — 保存的筛选方案 (user_id, name, filters) +- `feedbacks` — 用户反馈 (user_id, type, content, status) +- `sys_config` — 系统配置 (config_key, config_value) ### 金额处理 - 存储单位: 分 (整数,避免浮点精度问题) diff --git a/client/src/api/config.ts b/client/src/api/config.ts new file mode 100644 index 0000000..63f69b6 --- /dev/null +++ b/client/src/api/config.ts @@ -0,0 +1,11 @@ +import { request } from '@/utils/request' + +/** 获取系统配置 */ +export function getConfig(): Promise> { + return request('/config') +} + +/** 更新系统配置(管理员) */ +export function updateConfig(data: Record) { + return request('/config', { method: 'PUT', data }) +} diff --git a/client/src/api/user.ts b/client/src/api/user.ts index 39fdfbb..e77d21d 100644 --- a/client/src/api/user.ts +++ b/client/src/api/user.ts @@ -6,6 +6,7 @@ export interface UserInfo { id: number nickname: string avatar_url: string + slogan: string role: 'user' | 'admin' created_at: string } @@ -15,9 +16,11 @@ export function getUserInfo() { return request({ url: '/user/me' }) } -/** 更新昵称 */ -export function updateNickname(nickname: string) { - return request({ url: '/user/me', method: 'PUT', data: { nickname } }) +/** 更新昵称/签名 */ +export function updateNickname(nickname: string, slogan?: string) { + const data: any = { nickname } + if (slogan !== undefined) data.slogan = slogan + return request({ url: '/user/me', method: 'PUT', data }) } /** 上传头像(返回新 URL) */ diff --git a/client/src/pages.json b/client/src/pages.json index c03dba8..e0b8cbc 100644 --- a/client/src/pages.json +++ b/client/src/pages.json @@ -117,6 +117,13 @@ "navigationStyle": "custom", "navigationBarTitleText": "反馈管理" } + }, + { + "path": "pages/admin/config", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "系统配置" + } } ], "globalStyle": { diff --git a/client/src/pages/admin/config.vue b/client/src/pages/admin/config.vue new file mode 100644 index 0000000..99d6c3f --- /dev/null +++ b/client/src/pages/admin/config.vue @@ -0,0 +1,239 @@ + + + + + diff --git a/client/src/pages/admin/index.vue b/client/src/pages/admin/index.vue index bdab582..60c0655 100644 --- a/client/src/pages/admin/index.vue +++ b/client/src/pages/admin/index.vue @@ -77,6 +77,11 @@ 反馈管理 + + + 系统配置 + + @@ -120,6 +125,7 @@ function goBack() { uni.navigateBack() } function goUsers() { uni.navigateTo({ url: '/pages/admin/users' }) } function goNotificationManage() { uni.navigateTo({ url: '/pages/admin/notifications' }) } function goFeedbackManage() { uni.navigateTo({ url: '/pages/admin/feedback' }) } +function goConfig() { uni.navigateTo({ url: '/pages/admin/config' }) }