- 实验类型:新增独立创建、数据格式、默认值、调用示例和接入验收页 - 测试方案:按类型编辑 A/B 返回值,统一百分比并保留生命周期和效果审计 - 用户管理:新增分页查人、方案分组预览、人工指定和恢复自动分组 - 文档:同步菜单与组件职责,移除固定业务接入点场景弹窗
role-admin
English | 中文
Store employee access-management admin UI, based on the pure-admin-thin template and customized for store, role, and employee CRUD workflows.
Stack
Vue 3+TypeScriptViteElement PlusPiniaVue RouterAxios
Requirements
Node.js:^20.19.0 || >=22.13.0pnpm:>=9- Local backend:
/Users/mac033/Desktop/my-project/access-manage
Local Development
Start the backend first:
cd /Users/mac033/Desktop/my-project/access-manage
pnpm mysql:up
pnpm db:migrate
pnpm dev
Then start this admin UI:
cd /Users/mac033/Desktop/my-project/role-admin
pnpm install
pnpm dev
Open:
http://localhost:8848/
Project Structure
.
├── .codex/skills/ # Repository-local skill for keeping README.md in sync
├── .husky/ # Git hooks for lint-staged and commitlint
├── build/ # Vite plugin, CDN, compression, and build helpers
├── public/ # Static assets and runtime platform config
├── src/
│ ├── api/ # HTTP API wrappers; business APIs live in access.ts
│ ├── assets/ # Images, SVG files, and iconfont assets
│ ├── components/ # Shared template components
│ ├── config/ # Runtime config loader
│ ├── directives/ # Custom Vue directives
│ ├── layout/ # Admin layout, menu, tabs, navbar, and hooks
│ ├── plugins/ # Plugin registration
│ ├── router/ # Static routes, remaining routes, router instance, guards
│ ├── store/ # Pinia stores
│ ├── style/ # Global styles and themes
│ ├── utils/ # Auth, HTTP, storage, message, progress, and tree helpers
│ └── views/ # Pages; business pages live in employees, roles, stores, permissions
├── types/ # Global TypeScript declarations
├── AGENTS.md # Agent entrypoint that delegates to RTK.md
├── RTK.md # Repository collaboration rules
├── package.json # Dependencies, scripts, engines, and pnpm guard
└── vite.config.ts # Vite dev proxy, plugins, and build output config
This repository is not a monorepo and has no packages/ directory. Important scripts are defined in package.json.
Important Scripts
| Script | Purpose |
|---|---|
pnpm dev |
Start the Vite dev server on the configured port |
pnpm build |
Clean dist and build for production |
pnpm build:staging |
Build with staging mode |
pnpm report |
Build and open a Rollup visualizer report |
pnpm preview |
Preview an existing dist build |
pnpm preview:build |
Build first, then preview |
pnpm typecheck |
Run TypeScript and Vue type checks |
pnpm lint |
Run ESLint, Prettier, and Stylelint fixes |
pnpm svgo |
Compress SVG files recursively |
pnpm clean:cache |
Reinstall dependencies after clearing local caches |
Backend Proxy
Development mode proxies /api to VITE_API_PROXY_TARGET, defaulting to http://localhost:3500. The relevant files are .env.development and vite.config.ts.
Login uses POST /api/auth/admin/login, then the app validates the token through GET /api/auth/me and loads menus/actions through GET /api/permissions/me. The backend does not expose refresh-token; local 401 or token expiry clears auth state and redirects to /login.
List search, reset, pagination, status changes, deletes, and save refreshes should go through the API layer. Store, role, and employee list requests send their current filters and pagination to the backend.
Documentation Sync Rule
When files, folders, package scripts, API modules, route modules, or key config files change, update README.md in the same change. The local skill is stored at .codex/skills/readme-structure-sync/SKILL.md.
Verification
pnpm typecheck
pnpm build