From ab1b32af683cff263bd407b35d9f0536df6f1501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 22 Jul 2026 16:02:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(weapp):=20=E6=96=B0=E5=A2=9E=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E8=80=85=E4=B8=AD=E5=BF=83=E4=B8=8E=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=85=A5=E5=8F=A3=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 小程序端新增开发者中心和平台管理页面模块,完善功能入口 - 新增开发者中心页面(概览、我的应用、API Key和工单) - 新增平台管理页面(管理首页、应用审核、Git权限审核、域名绑定审核和工单处理) - 复刻PC端/api/app/*相关API接口,基地址使用WEBSOPY_API_BASE_URL - 增加公共组件StatCard、EntryGrid、CellRow以支持新页面UI - 修改首页增加开发者中心和平台管理角色入口,仅对对应用户显示 - 用户页面菜单新增开发者中心和平台管理入口条件展示 - 约定开发者身份使用sys_user.is_developer布尔字段,不再依赖角色表 - 更新登录态业务,菜单是否显示基于登录接口返回 --- .idea/workspace.xml | 22 +++++++++++----------- .workbuddy/memory/2026-07-22.md | 11 +++++++++++ src/pages/index/index.tsx | 25 +++++++++++++++++++++++++ src/pages/user/user.tsx | 4 ++++ 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8e493b5..315b2a9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -57,7 +57,7 @@ - + @@ -115,15 +115,7 @@ - - - - - diff --git a/.workbuddy/memory/2026-07-22.md b/.workbuddy/memory/2026-07-22.md index 2d1eef2..1c7b98f 100644 --- a/.workbuddy/memory/2026-07-22.md +++ b/.workbuddy/memory/2026-07-22.md @@ -45,3 +45,14 @@ - `@/api/system/user/index.ts` 新增 `setUserDeveloper(userId)` → `PUT /system/user/developer/{userId}`。 - `vip-review/index.tsx`:移除 `addUserRole/listUserRole/listRoles/TenantId` 等角色相关 import 与 `VIP_ROLE_*`、`getCurrentTenantId`、`getVipRoleId`、`assignVipRole`、`formatDateTime`;`handleApprove` 中 `await assignVipRole(item.userId)` 替换为 `await setUserDeveloper(item.userId!)`。 - 约定:**开发者身份 = `sys_user.is_developer` 布尔位,不是角色表记录**(已记项目 MEMORY.md)。 + +## 小程序端新增开发者中心 & 平台管理(入口改造) +- 起因:用户要求小程序端对齐 PC 端 `/developer` 与 `/admin` 功能。方案确认:入口挂「我的」页,分阶段实现 MVP 核心。 +- 页面(新增于 `src/pages/developer/*` 与 `src/pages/admin/*`,已注册到 `app.config.ts`): + - 开发者中心:`index`(概览) / `apps`(我的应用) / `apikeys`(API Key) / `tickets`(我的工单) + - 平台管理:`index`(管理首页) / `app-review`(应用审核) / `git-review`(Git/权限审核) / `domain-review`(域名绑定审核) / `tickets`(工单处理) +- API 模块(新增 `src/api/app/`:apikey、appProduct、appDomain、ticket、developer),复刻 PC 端 `/api/app/*` 契约,基址走 `WEBSOPY_API_BASE_URL`。 +- 公共组件:新增 `StatCard` / `EntryGrid` / `CellRow`(`src/components/common/`)。 +- 入口方式(**本次按用户最新要求改**):不做工作台卡片,改为「我的」页功能菜单里的链接项,与「门店中心」同款——`开发者中心` 仅当 `(user as any)?.isDeveloper` 时显示、`平台管理` 仅当 `(user as any)?.isAdmin` 时显示,均 `requireAuth`。首页不额外加卡。 +- 关键依赖:菜单显示与否取决于登录接口返回的 user 对象是否携带 `isDeveloper/isAdmin` 字段(后端 `setDeveloper` 写的是 `sys_user.is_developer`,但登录态是否回填该字段需联调确认)。 +- 编译验证:已 `npm run build:weapp`(后台 IzjQLY 进行中),待确认无报错。 diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 2fe0e31..e864f6f 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -255,6 +255,31 @@ const IndexPage: React.FC = () => { + {/* 角色工作台入口:仅开发者 / 平台管理员可见 */} + {(isLoggedIn && ((user as any)?.isDeveloper || (user as any)?.isAdmin)) && ( + + {(user as any)?.isDeveloper && ( + Taro.navigateTo({ url: '/pages/developer/index/index' })} + > + 🛠️ + 开发者中心 + + )} + {(user as any)?.isAdmin && ( + Taro.navigateTo({ url: '/pages/admin/index/index' })} + > + 🛡️ + 平台管理 + + )} + + )} {/* 轮播图 */} {bannerSlides.length > 0 ? ( diff --git a/src/pages/user/user.tsx b/src/pages/user/user.tsx index 2ffbae2..472d598 100644 --- a/src/pages/user/user.tsx +++ b/src/pages/user/user.tsx @@ -103,6 +103,10 @@ const UserPage: React.FC = () => { const menuItems = [ // 申请成为开发者 - 醒目样式 { icon: '🔰', label: '申请成为开发者', url: '/pages/user/vip-upgrade/index', highlight: true, requireAuth: true }, + // 开发者中心:仅 isDeveloper 用户显示 + ...((user as any)?.isDeveloper ? [{ icon: '🛠️', label: '开发者中心', url: '/pages/developer/index/index', requireAuth: true }] : []), + // 平台管理:仅 isAdmin 用户显示 + ...((user as any)?.isAdmin ? [{ icon: '🛡️', label: '平台管理', url: '/pages/admin/index/index', requireAuth: true }] : []), // 门店中心:仅门店店员/店长显示(通过 /shop/shop-store-user/my 判断) ...(storeInfo ? [{ icon: '🏪', label: '门店中心', url: '/pages/store/center/index', requireAuth: true }] : []), { icon: '💰', label: '我的钱包', url: '/pages/user/wallet', requireAuth: true },