Files
Pine 258bccfad3 chore: 初始化云超服运营管理平台(admin-portal)
- 脚手架:Vite6 + React18 + TypeScript(strict) + Tailwind4
- shadcn/ui 基座(依 design/installation.md):components.json + src/components/ui/* + cn(),radix-ui 单片
- 认证:登录(密码+多身份选择 select-identity),lib/auth.tsx(上下文+localStorage)
- RBAC:lib/rbac.tsx 八端口导航过滤 + App.tsx RequireAuth/RoleRoute
- 布局:AppShell(侧边栏+顶栏+身份切换+用户菜单)
- API:client.ts(fetch+token+401登出) + resources.ts(用户/课程/活动/报名/测评/算力/园区)
- 页面:登录/总览 + 用户/课程/活动/报名/测评/算力/园区 7 个管理页(未实现端点优雅降级)
- npm run build 通过;.env.example / README.md / .gitignore
2026-08-24 13:07:09 +08:00

51 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 云超服 · 运营管理平台(admin-portal
> React 18 + TypeScript + Vite 6 + Tailwind v4 + **shadcn/ui**radix-ui,严格遵循
> `design/installation.md`)。面向云超服所有管理功能(运营/政务/企业/载体/服务商/投资人/OPC)。
> 前端接入 `server-core``/auth`、`/admin/*`),经统一身份与八端口 RBAC 隔离。
## 技术栈 / 规范
- Vite 6、React 18、TypeScriptstrict
- Tailwind v4`@tailwindcss/vite`+ shadcn 组件(`components.json``src/components/ui/*``cn()`
- Radix UIradix-ui 单片)+ lucide 图标 + class-variance-authority
- React Router 7;认证经 `/auth/login` + `/auth/select-identity`
## 启动
```bash
cd code/admin-portal
npm install
cp .env.example .env # 如需覆盖后端地址
npm run dev # 默认 http://localhost:5175/auth /admin 代理到 :8090
npm run build # 类型检查 + 产物
```
## 目录
```
src/
api/ client.ts(fetch+token) · auth.ts · resources.ts(业务模块)
components/ ui/(shadcn) · generic/(DataTable/PageHeader/StatusBadge/useResource) · layout/AppShell
lib/ utils.ts(cn) · auth.tsx(认证上下文) · rbac.tsx(八端口导航/权限)
pages/ login · overview · users · courses · activities · bookings · tests · compute · park
types.ts
```
## 身份与权限
- 登录:账号密码 → 返回多端口身份 → 多身份时进入「选择身份」。
- 路由按 **identity.role** 守卫(`RoleRoute`);侧边栏导航由 `navForRole` 过滤。
- 需要 `operator`(部分 `carrier`)身份访问管理页。
## 与后端现状
部分 `/admin/*` 端点(课程/活动/报名/测评/园区)仍在 server-core **阶段2-3 建设中**,本次前端已铺好
列表/详情/审核骨架并**优雅降级**(未实现时提示「暂未接入」,后端补齐即自动生效)。算力页 `ping/provision`
已在 server-core 阶段0-1 落地,可直接联调。
## 约定
- 端点路径集中在 `src/api/resources.ts`;后端路径调整仅改该文件。
- 前端 UI 基调沿用仓库主基调(shadcn + 云超服品牌 `--mascot-accent`)。