feat(weapp): 新增开发者中心与平台管理入口及相关功能

- 小程序端新增开发者中心和平台管理页面模块,完善功能入口
- 新增开发者中心页面(概览、我的应用、API Key和工单)
- 新增平台管理页面(管理首页、应用审核、Git权限审核、域名绑定审核和工单处理)
- 复刻PC端/api/app/*相关API接口,基地址使用WEBSOPY_API_BASE_URL
- 增加公共组件StatCard、EntryGrid、CellRow以支持新页面UI
- 修改首页增加开发者中心和平台管理角色入口,仅对对应用户显示
- 用户页面菜单新增开发者中心和平台管理入口条件展示
- 约定开发者身份使用sys_user.is_developer布尔字段,不再依赖角色表
- 更新登录态业务,菜单是否显示基于登录接口返回
This commit is contained in:
2026-07-22 16:02:21 +08:00
parent 5b5b7c9a90
commit ab1b32af68
4 changed files with 51 additions and 11 deletions

22
.idea/workspace.xml generated
View File

@@ -57,7 +57,7 @@
<recent name="$PROJECT_DIR$" /> <recent name="$PROJECT_DIR$" />
</key> </key>
</component> </component>
<component name="RunManager" selected="npm.dev:weapp"> <component name="RunManager" selected="npm.build:weapp">
<configuration name="build:weapp" type="js.build_tools.npm" temporary="true" nameIsGenerated="true"> <configuration name="build:weapp" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" /> <package-json value="$PROJECT_DIR$/package.json" />
<command value="run" /> <command value="run" />
@@ -115,15 +115,7 @@
<workItem from="1784131049625" duration="2304000" /> <workItem from="1784131049625" duration="2304000" />
<workItem from="1784133736973" duration="4614000" /> <workItem from="1784133736973" duration="4614000" />
<workItem from="1784585070286" duration="3047000" /> <workItem from="1784585070286" duration="3047000" />
<workItem from="1784638429525" duration="10599000" /> <workItem from="1784638429525" duration="11203000" />
</task>
<task id="LOCAL-00014" summary="fix(invite): 修正邀请接口路径以支持小程序专用前缀&#10;&#10;- 将请求邀请信息接口路径改为使用 /api/_app 前缀,确保小程序免登录访问&#10;- 修改接受邀请接口路径,统一使用小程序专用 API 域名和前缀&#10;- 更新邀请相关接口注释,明确小程序专用接口前缀含义&#10;- 在专家历史数据中添加高级开发工程师 Will 的条目并更新时间戳">
<option name="closed" value="true" />
<created>1775909013060</created>
<option name="number" value="00014" />
<option name="presentableId" value="LOCAL-00014" />
<option name="project" value="LOCAL" />
<updated>1775909013060</updated>
</task> </task>
<task id="LOCAL-00015" summary="fix(passport): 添加邀请接受接口调试日志&#10;&#10;- 在接受邀请请求前打印token和请求URL、参数&#10;- 在请求响应后输出接口响应及返回数据&#10;- 在调用失败时打印错误信息及异常日志&#10;- 保持请求流程和状态管理不变,增强调试能力"> <task id="LOCAL-00015" summary="fix(passport): 添加邀请接受接口调试日志&#10;&#10;- 在接受邀请请求前打印token和请求URL、参数&#10;- 在请求响应后输出接口响应及返回数据&#10;- 在调用失败时打印错误信息及异常日志&#10;- 保持请求流程和状态管理不变,增强调试能力">
<option name="closed" value="true" /> <option name="closed" value="true" />
@@ -509,7 +501,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1784703425108</updated> <updated>1784703425108</updated>
</task> </task>
<option name="localTasksCounter" value="63" /> <task id="LOCAL-00063" summary="refactor(user): 将VIP身份统一改为开发者标记&#10;&#10;- 审核通过时不再新增角色而是更新用户isDeveloper布尔标记&#10;- 后端UserService新增markAsDeveloper方法通过updateById设置isDeveloper&#10;- UserController新增PUT接口更新开发者标记权限使用sys:userRole:save&#10;- 前端api新增setUserDeveloper调用新的审核接口&#10;- vip-review页面移除角色相关代码改为调用setUserDeveloper方法&#10;- 约定开发者身份即sys_user.is_developer字段不再依赖角色表记录&#10;- app.config.ts追加开发者中心与平台管理相关页面路由&#10;- 新增开发者中心、平台管理的多个API模块apikey、appProduct、appDomain、developer请求等&#10;- 添加公共工具方法和复用组件用于开发者中心及平台管理功能&#10;- 统一品牌名称为“威数谱软件”,更新文案及界面展现一致性">
<option name="closed" value="true" />
<created>1784704220175</created>
<option name="number" value="00063" />
<option name="presentableId" value="LOCAL-00063" />
<option name="project" value="LOCAL" />
<updated>1784704220175</updated>
</task>
<option name="localTasksCounter" value="64" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">

View File

@@ -45,3 +45,14 @@
- `@/api/system/user/index.ts` 新增 `setUserDeveloper(userId)``PUT /system/user/developer/{userId}` - `@/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!)` - `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 - 约定:**开发者身份 = `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 进行中),待确认无报错。

View File

@@ -255,6 +255,31 @@ const IndexPage: React.FC = () => {
</View> </View>
<ScrollView scrollY style={{ height: scrollHeight }}> <ScrollView scrollY style={{ height: scrollHeight }}>
{/* 角色工作台入口:仅开发者 / 平台管理员可见 */}
{(isLoggedIn && ((user as any)?.isDeveloper || (user as any)?.isAdmin)) && (
<View className='mx-3 mt-2 grid grid-cols-2 gap-2'>
{(user as any)?.isDeveloper && (
<View
className='flex items-center justify-center py-3 rounded-lg border border-blue-100'
style={{ background: 'linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%)' }}
onClick={() => Taro.navigateTo({ url: '/pages/developer/index/index' })}
>
<Text className='text-lg mr-2'>🛠</Text>
<Text className='text-sm font-medium text-blue-700'></Text>
</View>
)}
{(user as any)?.isAdmin && (
<View
className='flex items-center justify-center py-3 rounded-lg border border-purple-100'
style={{ background: 'linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%)' }}
onClick={() => Taro.navigateTo({ url: '/pages/admin/index/index' })}
>
<Text className='text-lg mr-2'>🛡</Text>
<Text className='text-sm font-medium text-purple-700'></Text>
</View>
)}
</View>
)}
{/* 轮播图 */} {/* 轮播图 */}
<View className='mx-3 mt-2 rounded-lg overflow-hidden index-banner-wrap'> <View className='mx-3 mt-2 rounded-lg overflow-hidden index-banner-wrap'>
{bannerSlides.length > 0 ? ( {bannerSlides.length > 0 ? (

View File

@@ -103,6 +103,10 @@ const UserPage: React.FC = () => {
const menuItems = [ const menuItems = [
// 申请成为开发者 - 醒目样式 // 申请成为开发者 - 醒目样式
{ icon: '🔰', label: '申请成为开发者', url: '/pages/user/vip-upgrade/index', highlight: true, requireAuth: true }, { 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 判断) // 门店中心:仅门店店员/店长显示(通过 /shop/shop-store-user/my 判断)
...(storeInfo ? [{ icon: '🏪', label: '门店中心', url: '/pages/store/center/index', requireAuth: true }] : []), ...(storeInfo ? [{ icon: '🏪', label: '门店中心', url: '/pages/store/center/index', requireAuth: true }] : []),
{ icon: '💰', label: '我的钱包', url: '/pages/user/wallet', requireAuth: true }, { icon: '💰', label: '我的钱包', url: '/pages/user/wallet', requireAuth: true },