From 4466e28b3b5eea8a6e20798b94a5e9be01478e8f Mon Sep 17 00:00:00 2001 From: aid Date: Mon, 30 Mar 2026 18:03:44 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B6=85=E7=AE=A1=E7=AB=AF=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=AE=A1=E7=90=86=EF=BC=9A=E3=80=8C=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E3=80=8D=E6=9B=B4=E5=90=8D=E4=B8=BA=E3=80=8C=E8=BF=90=E8=90=A5?= =?UTF-8?q?=E5=9B=A2=E9=98=9F=E3=80=8D+=20=E5=AD=90=E5=A5=B3=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=80=82=E9=85=8D=E7=8B=AC=E7=AB=8B=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 统计卡片和用户类型Tag从「平台」改为「运营团队」,避免命名歧义 - 公众用户详情从旧版Child模型(姓名/年级/学校)改为UserParentChild关系,展示子女独立账号信息 - 后端详情接口和列表_count同步从children切换到parentRelations - 更新统一用户管理设计文档,补充实施记录 Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/src/users/users.service.ts | 16 ++++- .../super-admin/unified-user-management.md | 28 ++++++-- frontend/src/api/users.ts | 25 ++++--- frontend/src/views/system/users/Index.vue | 66 ++++++++++++++----- 4 files changed, 102 insertions(+), 33 deletions(-) diff --git a/backend/src/users/users.service.ts b/backend/src/users/users.service.ts index a5a890e..f923258 100644 --- a/backend/src/users/users.service.ts +++ b/backend/src/users/users.service.ts @@ -125,7 +125,7 @@ export class UsersService { select: { id: true, name: true, code: true, tenantType: true, isSuper: true }, }; include._count = { - select: { children: true, contestRegistrations: true }, + select: { parentRelations: true, contestRegistrations: true }, }; } @@ -194,8 +194,18 @@ export class UsersService { tenant: { select: { id: true, name: true, code: true, tenantType: true, isSuper: true }, }, - children: isSuperTenant - ? { where: { isDeleted: 0 }, orderBy: { createTime: 'desc' } } + parentRelations: isSuperTenant + ? { + include: { + child: { + select: { + id: true, username: true, nickname: true, avatar: true, + gender: true, birthday: true, city: true, status: true, createTime: true, + }, + }, + }, + orderBy: { createTime: 'desc' }, + } : false, contestRegistrations: isSuperTenant ? { diff --git a/docs/design/super-admin/unified-user-management.md b/docs/design/super-admin/unified-user-management.md index a648d6a..5bacfd7 100644 --- a/docs/design/super-admin/unified-user-management.md +++ b/docs/design/super-admin/unified-user-management.md @@ -1,9 +1,9 @@ # 统一用户管理 — 设计方案 > 所属端:超管端 -> 状态:已实现(待验收) +> 状态:已实现(迭代中) > 创建日期:2026-03-27 -> 最后更新:2026-03-27 +> 最后更新:2026-03-30 --- @@ -101,6 +101,7 @@ GET /api/public/users/:id — 公众用户详情(含子女+报名) #### 统计卡片 - 5 张卡片横排,每张显示:类型图标 + 类型名称 + 数量 +- 类型命名:全部 / **运营团队** / 机构 / 评委 / 公众(~~平台~~ → 运营团队,2026-03-30 更名) - 选中的卡片高亮(主色边框),点击 = 设置 userType 筛选 - 点"全部"清除类型筛选 - 数据来源:`GET /api/users/stats` @@ -151,8 +152,8 @@ GET /api/public/users/:id — 公众用户详情(含子女+报名) **公众用户额外区域**: ``` -子女信息(N个) -├── 姓名 / 年龄 / 年级 / 城市 / 学校 +子女账号(N个)— 基于 UserParentChild 关系,子女为独立 User +├── 头像 / 昵称 / @用户名 / 性别 / 城市 / 关系(父亲/母亲/监护人) / 状态 报名记录(近20条) ├── 活动名称 / 报名状态 / 参与者(本人/子女名) / 报名时间 @@ -188,7 +189,7 @@ GET /api/public/users/:id — 公众用户详情(含子女+报名) - 返回字段增加: - `tenant: { id, name, code, tenantType, isSuper }`(用于前端推导用户类型) - - `_count: { children, contestRegistrations }`(公众用户的子女数和报名数) + - `_count: { parentRelations, contestRegistrations }`(公众用户的子女账号数和报名数) 普通租户调用时:保持现有逻辑不变。 @@ -220,7 +221,7 @@ public → tenant.code = 'public' 超管调用时: - 不做 tenantId 过滤 -- 公众用户额外返回:`children`(子女列表)、`contestRegistrations`(近20条报名记录,含活动名和子女名) +- 公众用户额外返回:`parentRelations`(子女账号列表,含 child User 信息)、`contestRegistrations`(近20条报名记录,含活动名和子女名) - 评委额外返回:`contestJudges`(参与的评审活动列表) #### 3.3.4 新增 PATCH /api/users/:id/status @@ -292,3 +293,18 @@ public → tenant.code = 'public' **验证结果:** - 后端 TSC 编译通过,NestJS 启动成功,/api/users/stats 和 /api/users/:id/status 路由注册正常 - 前端无新增 TS 错误(原有错误均为已有代码) + +### 2026-03-30 — 命名优化 + 子女账号独立化适配 + +**问题:** +1. 统计卡片和 Tag 中「平台」命名易误解为"平台全部用户",实际指运营管理人员 +2. 公众用户详情仍展示旧版 `Child` 模型(姓名/年级/学校),子女已独立为 `User` 后应使用 `UserParentChild` 关系 + +**改动(3 个文件):** +- `backend/src/users/users.service.ts` — findOne 详情查询:`children`(旧 Child 表)→ `parentRelations`(UserParentChild + child User);列表 `_count.children` → `_count.parentRelations` +- `frontend/src/api/users.ts` — User 类型定义:`children` 数组 → `parentRelations` 数组(含 child 独立用户信息 + relationship + controlMode) +- `frontend/src/views/system/users/Index.vue` — 统计卡片和 Tag 标签:「平台」→「运营团队」;详情 Drawer 子女区域:旧版姓名/年级/学校列表 → 新版子女账号卡片(头像+昵称+用户名+关系+状态) + +**验证结果:** +- 后端重启成功,编译无错误 +- 前端 HMR 热更新生效,无新增 TS 错误 diff --git a/frontend/src/api/users.ts b/frontend/src/api/users.ts index f0481c0..a74dcdf 100644 --- a/frontend/src/api/users.ts +++ b/frontend/src/api/users.ts @@ -48,18 +48,25 @@ export interface User { }; }>; _count?: { - children: number; + parentRelations: number; contestRegistrations: number; }; - // 详情接口返回 - children?: Array<{ + // 详情接口返回 — 子女账号(独立用户) + parentRelations?: Array<{ id: number; - name: string; - gender?: string; - birthday?: string; - grade?: string; - city?: string; - schoolName?: string; + relationship?: string; + controlMode: string; + child: { + id: number; + username: string; + nickname: string; + avatar?: string; + gender?: string; + birthday?: string; + city?: string; + status?: string; + createTime?: string; + }; }>; contestRegistrations?: Array<{ id: number; diff --git a/frontend/src/views/system/users/Index.vue b/frontend/src/views/system/users/Index.vue index d5fc3c7..d907063 100644 --- a/frontend/src/views/system/users/Index.vue +++ b/frontend/src/views/system/users/Index.vue @@ -194,19 +194,29 @@ {{ detailData.organization }} - + @@ -69,27 +88,38 @@ diff --git a/frontend/src/views/content/WorkManagement.vue b/frontend/src/views/content/WorkManagement.vue index b789a48..1dbe71b 100644 --- a/frontend/src/views/content/WorkManagement.vue +++ b/frontend/src/views/content/WorkManagement.vue @@ -4,11 +4,21 @@ - +
-
-
{{ item.value }}
-
{{ item.label }}
+
+
+ +
+
+ {{ item.value }} + {{ item.label }} +
@@ -18,8 +28,16 @@ + + + 全部 + 正常 + 已下架 + 推荐中 + + - + 最新发布 最多点赞 最多浏览 @@ -40,6 +58,13 @@ + + + + +

+ 下架后作品「{{ takedownTarget?.title }}」将不再公开展示,请填写下架原因: +

+ + 含不适宜内容 + 涉嫌抄袭/侵权 + 用户投诉/举报 + 违反平台规范 + 其他 + + +
+ + + + +
diff --git a/frontend/src/views/content/WorkReview.vue b/frontend/src/views/content/WorkReview.vue index 0b6a479..89bdecb 100644 --- a/frontend/src/views/content/WorkReview.vue +++ b/frontend/src/views/content/WorkReview.vue @@ -21,7 +21,8 @@
- + + 全部 待审核 已通过 已拒绝 @@ -39,26 +40,61 @@
+ +
+ + 勾选表格中的待审核作品可进行批量操作 +
+ - + - -
+ +
- + - + - - - 已发布 - 未发布 - - - - + + + 全部 未发布 报名中 征稿中 @@ -74,70 +49,34 @@ - + 个人参与 团队参与 - - - 公开 - 定向推送 - 指定机构 - 仅内部 - - - + - - 搜索 + 搜索 - - 重置 + 重置 - + + @@ -233,7 +232,7 @@ diff --git a/frontend/src/views/contests/registrations/Index.vue b/frontend/src/views/contests/registrations/Index.vue index 1f4404c..543985c 100644 --- a/frontend/src/views/contests/registrations/Index.vue +++ b/frontend/src/views/contests/registrations/Index.vue @@ -213,35 +213,51 @@ - + @@ -277,38 +161,10 @@ @@ -432,12 +288,18 @@ diff --git a/frontend/src/views/contests/results/Detail.vue b/frontend/src/views/contests/results/Detail.vue index 3da294b..9c5a3d6 100644 --- a/frontend/src/views/contests/results/Detail.vue +++ b/frontend/src/views/contests/results/Detail.vue @@ -1,397 +1,444 @@ - - - - - + + + + + diff --git a/frontend/src/views/contests/results/Index.vue b/frontend/src/views/contests/results/Index.vue index 3b76ab7..07611a8 100644 --- a/frontend/src/views/contests/results/Index.vue +++ b/frontend/src/views/contests/results/Index.vue @@ -126,48 +126,60 @@ - +