front/.cursor/rules/frontend-design-spec.mdc
zzh 44d39ffa26
All checks were successful
Build and Deploy Front / deploy (push) Successful in 3m31s
feat: 全局视口适配地基,官网精选线路上移
统一断点/Token 与跨端规范,窄屏收紧页面壳;精选线路区上移 50px。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-12-03 15:38:27 +08:00

55 lines
2.7 KiB
Plaintext
Raw 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.

---
description: 中后台前端页面设计规范 - 布局、色彩、组件、表单、表格、权限、命名
globs: src/**/*.vue, src/**/*.ts
alwaysApply: true
---
# 中后台前端设计规范(itfx-front)
开发新页面或修改现有页面时,必须遵循 `docs/前端页面设计规范.md` 中的约定。
## 关键规则速查
### 布局
- 页面容器使用 `[class$='-container']` 或 `xxx-container`,padding 用 `var(--app-page-padding)`(上 8 / 左右底 16;列表壳可用 `--app-page-padding-list`;窄屏由全局自动收紧 x/底)
- 主背景 `#f0f3f4`,内容区 `#fff`
- 工具栏:`table-toolbar` + `toolbar-left` + `toolbar-right`(窄屏可换行)
- 响应式:断点用 `@screen-*` / `APP_BREAKPOINTS`(与 `--app-bp-*` 同步);按 CSS 视口适配,禁止用 `devicePixelRatio` 改 zoom 反缩放
- 营销宽上限:`var(--app-content-max)`;列表页不要套。平台类 `html.platform-mac` 只修滚动条等,不改布局比例
### 色彩
- 使用 `var(--app-primary-color)`,不硬编码 `#1d7281`(默认主色)
### 组件
- 按钮 32px 高,border-radius 4px,间距 8px
- **禁止** `a-button type="outline"`(Arco 默认描边与主题不搭);主操作用 `primary` / `app-btn-primary-soft`,查询用 `app-btn-search`,次要用默认按钮或抽屉内软按钮
- 优先 FormPro、TablePro、ModalPro、CustomList、HandsontablePro
### 表单
- label span 6,wrapper span 16
- FormPro:rowGutter 20,defaultSpan 6
### 表格
- TablePro:api 返回 totalCount + items
- HandsontablePro 列定义用 `key` + `label`,勿用 `data` + `title`
- HandsontablePro 固定列序:操作(可选,内容自适应宽)→ 序号(50px)→ 复选框(可选,60px)→ 数据;`stretch-columns` 只拉宽数据列,勿再传 `action-column-position` / `action-column-width`
- 列表页高度:`flex: 1; min-height: 0`,`.list-wrap` 勿写死 min-height
- 分页 10/30/50/100,默认 50
- 生产前后端分域名 + Traefik TLS;前端容器仅静态 SPA(见规范 §十五)
### 权限
- `hasPermission('Module.Resource.Action')` 控制按钮/路由
- 路由 meta 配置 permission
### 命名
- 文件:views 用 index.vue,组件 PascalCase
- 路由 path:camelCase
- 变量:camelCase
### 新增页面(开发刷新)
- 路由必须写入 `src/router/routes/newModules/*.ts` 或 `src/router/index.ts`
- **禁止**再往 `vite.config.ts` 手工加 SPA 白名单;开发态回退由 `config/devSpaRoutes.ts` 从 Router 自动收集(见 `spa-dev-route-fallback` 规则)
- H5(`/h5/**`)与 PC 同一套刷新回退;新 H5 子页挂在 `/h5` 或 `/h5/admin` 下即可
完整规范见 `docs/前端页面设计规范.md`。