diry преди 2 седмици
родител
ревизия
206e142994
променени са 8 файла, в които са добавени 966 реда и са изтрити 695 реда
  1. 114 15
      docs/sapit-ui-base-guide.en.md
  2. 122 23
      docs/sapit-ui-基座说明与业务使用.md
  3. 1 1
      lib/config.json
  4. 0 0
      lib/css/style.css
  5. 322 322
      lib/js/SModal.js
  6. 29 23
      lib/js/components-doc.js
  7. 20 21
      lib/js/docs.js
  8. 358 290
      lib/js/index2.js

+ 114 - 15
docs/sapit-ui-base-guide.en.md

@@ -134,6 +134,8 @@ The height chain of `BasicLayout` (**business layout components must match it**,
 | `/docs`, `/components`                     | Built-in docs / component pages (`public` = no login, `hidden` = not in the menu)    |
 | `/404`, `/403`, `/500`, `/:pathMatch(.*)*` | Error pages; the catch-all renders 404 (**no redirect**, so refreshing dynamic routes never lands on a 404). All four sit under `BasicLayout` and swap **only the content-area `router-view`**, keeping the sidebar and header untouched |
 
+> Redirect rules, query parameters, wording and color overrides for the error pages are documented in [2.17 Error pages](#docs-217Errorpages301403404500).
+
 **Static routes** (`staticRoutes`, independent of backend menus): see 5.4. The base ships `/docs` and `/components`.
 
 **Dynamic routes** (`packages/router/generator-routers.js`): after login a tree is generated from the backend `menus`, rooted at `BasicLayout`; leaf nodes use `item.hrefs` to match business `pages` (keys of `import.meta.glob('@/views/**/*.vue')`) and fall back to 404 when nothing matches. Registration happens inside the guard (memory flag, re-registered on refresh).
@@ -219,21 +221,7 @@ How it takes effect:
 3. **body class**: `theme-<VITE_APP_THEME_VALUE>` (e.g. `theme-blue`).
 4. **Menu palette**: on startup the whole menu palette (top-level background / submenu background / hover / selected / text) is derived from the primary color and **emitted as solid `#rrggbb` only — no alpha**. It is written to `:root` as `--s-menu-bg`, `--s-menu-sub-bg`, `--s-menu-text`, `--s-menu-text-hover`, `--s-menu-text-active`, `--s-menu-hover-bg`, `--s-menu-active-bg`, `--s-menu-active-text`, plus `window.$menuTheme` (carrying the antd `Menu` tokens and an `isLightBg` flag).
 
-The menu is **light by default**: the primary hue is kept, saturation capped at 30% and lightness set to 93% — the `blue` theme yields `#e8ecf3`. All four backgrounds come from one source, so tuning a single parameter changes the entire menu instead of leaving submenu/selected items dark.
-
-| Config | Default | Description |
-|---|---|---|
-| `VITE_APP_MENU_THEME` | `dark` | Menu appearance; text color still follows the actual background luminance |
-| `VITE_APP_MENU_BG` | `theme` | `theme` follows the primary color / `dark` = `#001529` / `#RRGGBB` custom |
-| `VITE_APP_MENU_BG_LIGHTNESS` | `93` | Background lightness 0-100: higher is lighter |
-| `VITE_APP_MENU_BG_SATURATION` | `30` | Max saturation 0-100: lower is closer to grey |
-| `VITE_APP_MENU_BG_ACTIVE_MIX` | `16` | Share of the primary color in the selected item background, 0-100 |
-
-```js
-// business web-config.js / deployed config.json
-VITE_APP_MENU_BG_LIGHTNESS: 88, // raise for a lighter menu, 100 is near white
-VITE_APP_MENU_BG_SATURATION: 20, // lower for a greyer menu
-```
+The menu is **light by default** (the `blue` theme yields `#e8ecf3` for the top level), and all four backgrounds come from one set of parameters, so tuning one changes the whole menu. **The full palette, config reference and measured values per theme live in [2.18 Menu palette](#docs-218Menupalettesidetop)**.
 
 > Below 50% lightness the palette flips to "dark background + light text" automatically, with a WCAG contrast ratio solved to stay >= 4.6 — no manual text tuning needed. The side menu, the top menu (`VITE_APP_MENU_BAR: 'top'`), the logo variant and the header text color all share this single decision.
 
@@ -529,6 +517,117 @@ Built-in iconMap keys: `add` / `edit` / `delete` / `remove` / `import` / `export
 
 ---
 
+### 2.17 Error pages (301 / 403 / 404 / 500)
+
+The base ships three error pages. **One page serves both "the page itself failed" and "an API failed"**, and the wording is selected by the `?api=` query parameter.
+
+| Path | Component | Status sources | Accent |
+| --- | --- | --- | --- |
+| `/403` | `pages-components/403.vue` | API 403 (no permission), API 301 (address changed), page without permission | Orange `#fa8c16` |
+| `/404` | `pages-components/404.vue` | No route matched (catch-all `/:pathMatch(.*)*`), API 404 | Primary color `var(--s-color)` |
+| `/500` | `pages-components/500.vue` | Reachable directly only; **API 5xx does not redirect**, it still shows a notification | Red `#f5222d` |
+
+**Where they render**: `buildErrorRoute()` wraps all three under `BasicLayout` as nested children (`children: [{ path: '' }]`) — navigation **replaces only the content-area `router-view`**, leaving the sidebar, header and footer untouched. The route-miss 404 (catch-all) and the API 404 share the same structure and behave identically.
+
+**Login-free**: `/403`, `/404` and `/500` carry `meta.public` (an API failure may mean the token is already gone, and the page must not get stuck in the login guard); the catch-all `/:pathMatch(.*)*` **does not** — an unauthenticated visit to an unknown URL still goes to login.
+
+**API status mapping** (`packages/utils/request.js`):
+
+| HTTP status | Behaviour | Target URL |
+| --- | --- | --- |
+| 301 | Go to the 403 page with the "API address changed" wording | `/403?api=<api>&status=301&from=<page>` |
+| 403 | Go to the 403 page with the "no API permission" wording | `/403?api=<api>&status=403&from=<page>` |
+| 404 | Go to the 404 page with the "API does not exist" wording | `/404?api=<api>&status=404&from=<page>` |
+| Anything else (incl. 5xx) | **No redirect**, a notification is shown as before | — |
+
+**Query parameters**:
+
+| Parameter | Meaning |
+| --- | --- |
+| `api` | Failing API address. **Its presence switches to the API wording**; page-level failures omit it |
+| `status` | Original status code; `301` gets its own "API address changed" wording |
+| `from` | Source page address (with `VITE_APP_BASE_URL` stripped), rendered as the "source address" line |
+
+Wording matrix:
+
+| Source | 403 page | 404 page |
+| --- | --- | --- |
+| Page (no `api`) | Insufficient page permission | Page not found |
+| API (with `api`) | No API permission | API does not exist |
+| API 301 | API address changed | — |
+
+The two buttons: "Back to home" uses `VITE_APP_DEFAULT_PATH` (default `/workplace/index`); "Back" calls `router.back()` and falls back to home when there is no history, so the button is never dead.
+
+**Skipping the redirect** (polling, auxiliary requests — keeps one failing side request from taking over the whole page):
+
+```js
+// the third argument accepts { skipErrorPage: true } (also readable from the request meta)
+window.$utils.http.post(url, data, { skipErrorPage: true })
+```
+
+**Concurrency and fallback**: error-page navigation is **serialised, last one wins**, so a 403 and a 404 arriving together no longer cancel each other. After navigating it re-reads `currentRoute` to verify the arrival (tolerating a redirect that rewrites the path), retries twice, and only then falls back to a full-page `location.replace`, so the user always ends up on the error page. When already on the error page with an `api` parameter the reason is not overwritten — otherwise an auxiliary request fired by the error page itself would replace the real cause.
+
+**Changing colors / wording**:
+
+- All wording lives in i18n entries (`packages/pages-components/i18n.js`, namespace `pages-components`).
+- The 403 and 500 pages each declare `--e-color` (accent), `--e-light-color` (light accent) and `--e-border-color` (dashed border) on their root node, so the business can override them with the same variables; the 404 page uses the primary `--s-color` and follows `VITE_APP_THEME_VALUE`.
+- Every root node is `height:100%; overflow:hidden`, and the decorative glows are clipped by `__deco`, so overflow only scrolls inside the card and never creates a page scrollbar.
+
+> The error pages sit under `BasicLayout`, so the layout still fires the `getSystemIcon` and message-count requests. If those are auxiliary endpoints that can fail on their own, give them `skipErrorPage: true`; otherwise a 403 can bounce to the 404 page.
+
+### 2.18 Menu palette (side / top)
+
+Menu colors are **not hard-coded in stylesheets**: on startup `packages/utils/menu-theme.js` derives the whole palette from the primary color, emits solid `#rrggbb` only (**no rgba / alpha**), writes it to `:root` CSS variables and exposes it as `window.$menuTheme`. Change the primary color or a parameter and all four backgrounds move together.
+
+| Part | CSS variable | Derivation |
+| --- | --- | --- |
+| Top-level background | `--s-menu-bg` | Primary hue + capped saturation + configured lightness |
+| Submenu panel | `--s-menu-sub-bg` | Same hue, one step lighter than the top level |
+| Hovered item | `--s-menu-hover-bg` | Same hue, 6 lightness points darker than the top level |
+| Selected item | `--s-menu-active-bg` | Primary blended with white, ratio driven by `VITE_APP_MENU_BG_ACTIVE_MIX` |
+| Normal text | `--s-menu-text` | Solved against the background for a contrast ratio >= 4.6 |
+| Hover / selected text | `--s-menu-text-hover`, `--s-menu-text-active` | Same rule |
+
+Config (defaults in `packages/config/web-config.js`; overridable from the business `.env` or the deployed `config.json`):
+
+| Config | Default | Description |
+| --- | --- | --- |
+| `VITE_APP_MENU_BG` | `theme` | `theme` follows the primary color / `dark` = antd `#001529` / `#RRGGBB` uses that color |
+| `VITE_APP_MENU_BG_LIGHTNESS` | `93` | Top-level lightness 0-100: higher is lighter; **below 50 it flips to a dark background with light text** |
+| `VITE_APP_MENU_BG_SATURATION` | `30` | Max saturation 0-100: lower is closer to grey, `0` gives pure grey |
+| `VITE_APP_MENU_BG_ACTIVE_MIX` | `16` | Share of the primary color in the selected background, 0-100 |
+| `VITE_APP_MENU_THEME` | `dark` | Menu appearance; the text color actually follows the **background luminance**, not this value alone |
+| `VITE_APP_MENU_BAR` | `left` | `left` sidebar / `top` top bar; both share the same palette |
+
+Default palettes per theme (lightness 93 / saturation 30 / active mix 16, measured):
+
+| Theme | Top-level | Submenu | Hover | Selected | Text |
+| --- | --- | --- | --- | --- | --- |
+| blue | `#e8ecf3` | `#f5f7fa` | `#d4dce8` | `#dae9ff` | `#344051` |
+| green | `#ebf3e8` | `#f7faf5` | `#dbe8d4` | `#e3f6da` | `#3d5134` |
+| orange | `#f3ede8` | `#faf7f5` | `#e8ded4` | `#feedda` | `#514334` |
+| red | `#f3e8e8` | `#faf5f5` | `#e8d4d5` | `#fddcdd` | `#513435` |
+| purple | `#ece8f3` | `#f7f5fa` | `#dcd4e8` | `#e8def8` | `#403451` |
+| cyan | `#e8f3f3` | `#f5fafa` | `#d4e8e8` | `#d9f5f5` | `#345151` |
+
+Common tweaks:
+
+```js
+// business web-config.js / deployed config.json
+VITE_APP_MENU_BG_LIGHTNESS: 97,  // 1) lighter (100 is near white)
+VITE_APP_MENU_BG_SATURATION: 0,  // 2) drop the tint entirely, pure grey
+VITE_APP_MENU_BG_ACTIVE_MIX: 30, // 3) a more prominent selected item
+VITE_APP_MENU_BG: 'dark',        // 4) back to the classic antd #001529
+VITE_APP_MENU_BG: '#213045'      // 5) pin a custom color, no longer theme-driven
+```
+
+> Notes
+>
+> 1. With `VITE_APP_MENU_BG: '#RRGGBB'` the submenu, hover, selected and text colors are still derived from that color, so a new background never leaves unreadable text.
+> 2. Below 50 lightness the palette flips to dark: text turns light, the logo switches to its light variant and the header text turns white. The decision comes from `window.$menuTheme.isLightBg`, not `VITE_APP_MENU_THEME`.
+> 3. Do not hard-code menu colors such as `#001529` or `rgba(255,255,255,.1)` in business styles — use `var(--s-menu-*)`, otherwise a theme switch breaks the look.
+> 4. `.menu-wrap .ant-menu.ant-menu-dark` already backs the top-level, submenu, hover and selected nodes with these variables (the parts antd 4.2.6 Menu tokens miss).
+
 ## 3. Layout and height rules
 
 > This chapter is a **mandatory contract for the base's internal layout components**. Business pages only use the layouts and never compute heights themselves; any new layout component must satisfy these rules first.

+ 122 - 23
docs/sapit-ui-基座说明与业务使用.md

@@ -8,14 +8,14 @@
 
 ## 目录
 
-- [一、总览](#一总览)
-- [二、基座提供的内容](#二基座提供的内容)
-- [三、布局与高度规范](#三布局与高度规范)
-- [四、构建与配置](#四构建与配置)
-- [五、业务项目接入](#五业务项目接入)
-- [六、注意事项](#六注意事项)
-- [七、常见全局方法速查](#七常见全局方法速查)
-- [八、在线文档入口](#八在线文档入口)
+- [一、总览](#docs-一总览)
+- [二、基座提供的内容](#docs-二基座提供的内容)
+- [三、布局与高度规范](#docs-三布局与高度规范)
+- [四、构建与配置](#docs-四构建与配置)
+- [五、业务项目接入](#docs-五业务项目接入)
+- [六、注意事项](#docs-六注意事项)
+- [七、常见全局方法速查](#docs-七常见全局方法速查)
+- [八、在线文档入口](#docs-八在线文档入口)
 
 ---
 
@@ -132,6 +132,8 @@ sapit-ui-framework/
 | `/docs`、`/components`                     | 内置文档 / 组件页(`public` 免登录、`hidden` 不进菜单)             |
 | `/404`、`/403`、`/500`、`/:pathMatch(.*)*` | 错误页;通配渲染 404(**不用 redirect**,保证刷新动态路由不掉 404)。四者都挂在 `BasicLayout` 下,**只在内容区 `router-view` 内切换**,侧边菜单与顶栏保持不变 |
 
+> 错误页的触发规则、URL 参数、文案口径与改色方法见 [2.17 错误页](#docs-217错误页301403404500)。
+
 **静态路由**(`staticRoutes`,不依赖后端菜单):见 5.4。基座内置 `/docs`、`/components`。
 
 **动态路由**(`packages/router/generator-routers.js`):登录后按后端 `menus` 生成树,根节点 `BasicLayout`;叶子节点用 `item.hrefs` 匹配业务 `pages`(`import.meta.glob('@/views/**/*.vue')` 的 key),匹配不到回退 404。注册在守卫中完成(内存标记,刷新重注册)。
@@ -221,21 +223,7 @@ const { $l } = useI18n('user')  // 显式
 3. **body 类**:`theme-<VITE_APP_THEME_VALUE>`(如 `theme-blue`)。
 4. **菜单配色**:启动时按当前主题色推导整套菜单色(一级底 / 子菜单底 / hover / 选中 / 文字),**全部输出实色 `#rrggbb`,不含透明度**,写入 `:root` 的 `--s-menu-bg`、`--s-menu-sub-bg`、`--s-menu-text`、`--s-menu-text-hover`、`--s-menu-text-active`、`--s-menu-hover-bg`、`--s-menu-active-bg`、`--s-menu-active-text`,同时写入 `window.$menuTheme`(含 antd `Menu` token,`isLightBg` 标记实际明暗)。
 
-菜单默认是**浅色系**:取主题色的色相、饱和度压到 30% 以内、亮度取 93%,blue 主题一级底为 `#e8ecf3`。四处底色由同一个来源算出,改一个参数整套一起变,不会出现「主底浅了、子菜单和选中还是黑」。
-
-| 配置 | 默认 | 说明 |
-|---|---|---|
-| `VITE_APP_MENU_THEME` | `dark` | 菜单外观模式;`dark` 下也按实际底色明暗自动切文字色 |
-| `VITE_APP_MENU_BG` | `theme` | `theme` 跟随主题色 / `dark` 用 antd `#001529` / `#RRGGBB` 自定义 |
-| `VITE_APP_MENU_BG_LIGHTNESS` | `93` | 菜单底亮度 0-100:越大越白,越小越深 |
-| `VITE_APP_MENU_BG_SATURATION` | `30` | 饱和度上限 0-100:越小越接近灰白 |
-| `VITE_APP_MENU_BG_ACTIVE_MIX` | `16` | 选中块里主题色的占比 0-100:越大越蓝 |
-
-```js
-// 业务 web-config.js / 部署目录 config.json
-VITE_APP_MENU_BG_LIGHTNESS: 88, // 想要更浅就往上调,100 接近纯白
-VITE_APP_MENU_BG_SATURATION: 20, // 想要更灰就往下调
-```
+菜单默认是**浅色系**(blue 主题一级底 `#e8ecf3`),四个部位的底色由同一份参数算出,改一个参数整套一起变。**完整色板、配置项说明与各主题实测值见 [2.18 菜单配色](#docs-218菜单配色侧边顶部)**。
 
 > 底色亮度降到 50 以下会自动切换成「深色底 + 浅色文字」体系,文字与底色的对比度按 WCAG 反解保证 ≥ 4.6,不用手工调文字色。侧边菜单、顶部菜单(`VITE_APP_MENU_BAR: 'top'`)、logo 明暗、顶栏文字色共用这一套判断。
 
@@ -533,6 +521,117 @@ props 与 `SChooseUser` 相同(`title` 默认 `'选择岗位'`、`searchPlaceh
 >
 > 旧版本的 `initLayoutHeight()` 方法**已移除**,`layoutHeight` 也不再暴露(原实现是 `parentNode.offsetHeight - 76` 且只在 `mounted` 算一次)。
 
+### 2.17 错误页(301 / 403 / 404 / 500)
+
+基座内置三张错误页,**同一张页面承接「页面本身出错」和「接口报错」两种来源**,靠 URL 上的 `?api=` 区分文案。
+
+| 路径 | 组件 | 状态码来源 | 主色 |
+| --- | --- | --- | --- |
+| `/403` | `pages-components/403.vue` | 接口 403 无权限、接口 301 地址变更、页面无权限 | 橙色 `#fa8c16` |
+| `/404` | `pages-components/404.vue` | 路由没命中(通配 `/:pathMatch(.*)*`)、接口 404 | 主题色 `var(--s-color)` |
+| `/500` | `pages-components/500.vue` | 仅可直接访问;**接口 5xx 不跳转**,仍走通知 | 红色 `#f5222d` |
+
+**渲染位置**:`buildErrorRoute()` 把三页统一包在 `BasicLayout` 下,作为 `children: [{ path: '' }]` 的嵌套子路由——跳转时**只替换内容区 `router-view`**,侧边菜单、顶栏、页脚保持原样。页面 404(通配)与接口 404 共用同一套结构,表现完全一致。
+
+**免登录**:`/403`、`/404`、`/500` 带 `meta.public`(接口报错时 token 可能已失效,不能让它再卡在登录守卫里);通配 `/:pathMatch(.*)*` **不带** `public`,未登录访问不存在的地址仍回登录页。
+
+**接口报错的映射**(`packages/utils/request.js`):
+
+| HTTP 状态 | 行为 | 目标 URL |
+| --- | --- | --- |
+| 301 | 跳 403 页,文案「接口地址已变更」 | `/403?api=<接口>&status=301&from=<出错页>` |
+| 403 | 跳 403 页,文案「接口无权限」 | `/403?api=<接口>&status=403&from=<出错页>` |
+| 404 | 跳 404 页,文案「接口不存在」 | `/404?api=<接口>&status=404&from=<出错页>` |
+| 其它(含 5xx) | **不跳**,照旧弹通知 | — |
+
+**URL 参数**:
+
+| 参数 | 含义 |
+| --- | --- |
+| `api` | 报错接口地址。**有它即切「接口口径」文案**;页面自身出错时不带 |
+| `status` | 原始状态码;`301` 单独走「接口地址已变更」这一档文案 |
+| `from` | 出错来源页面地址(已剥掉 `VITE_APP_BASE_URL`),页面显示为「出错地址」 |
+
+文案口径:
+
+| 来源 | 403 页 | 404 页 |
+| --- | --- | --- |
+| 页面(无 `api`) | 页面权限不足 | 页面走丢了 |
+| 接口(有 `api`) | 接口无权限 | 接口不存在 |
+| 接口 301 | 接口地址已变更 | — |
+
+两个按钮:「返回首页」走 `VITE_APP_DEFAULT_PATH`(默认 `/workplace/index`);「返回上一页」用 `router.back()`,没有历史记录时自动退回首页,避免点了没反应。
+
+**跳过跳转**(后台轮询、辅助接口等非主流程请求,避免一条辅助接口失败把整页顶掉):
+
+```js
+// 第三个参数支持 { skipErrorPage: true }(也可写在请求 meta 里)
+window.$utils.http.post(url, data, { skipErrorPage: true })
+```
+
+**并发与兜底**:错误页跳转是**串行排队、后到优先**,同时来 403 和 404 不会互相取消;导航结束后回读 `currentRoute` 校验是否真的到达(兼容目标被 redirect 改写路径),没到达重试 2 次,仍失败才 `location.replace` 整页兜底,保证用户一定看到错误页。已经在错误页且已带 `api` 时不再覆盖,防止错误页自身挂的辅助接口把真实原因顶掉。
+
+**改颜色 / 改文案**:
+
+- 文案全部走 i18n 词条(`packages/pages-components/i18n.js`,命名空间 `pages-components`),改词条即改三页文字。
+- 403 / 500 各自在根节点定义了 `--e-color`(主色)、`--e-light-color`(浅色)、`--e-border-color`(虚线边框),业务侧用同名变量覆盖即可换色;404 用主题色 `--s-color`,跟随 `VITE_APP_THEME_VALUE`。
+- 三页根节点都是 `height:100%; overflow:hidden`,装饰光斑包在 `__deco` 里自裁,超出部分只在卡片内部滚动,不会撑出页面滚动条。
+
+> 错误页挂在 `BasicLayout` 下,布局层会带发 `getSystemIcon` 与消息计数两个请求。这两个接口若是本身会失败的辅助接口,建议加 `skipErrorPage: true`,否则可能从 403 再跳到 404。
+
+### 2.18 菜单配色(侧边 / 顶部)
+
+菜单颜色**不在样式里写死**:启动时由 `packages/utils/menu-theme.js` 按当前主题色算出整套色板,全部输出实色 `#rrggbb`(**不含 rgba / 透明度**),写入 `:root` 的 CSS 变量,同时挂到 `window.$menuTheme`。改主题色或改参数,四处底色一起变。
+
+| 部位 | CSS 变量 | 计算方式 |
+| --- | --- | --- |
+| 一级菜单底 | `--s-menu-bg` | 主题色相 + 饱和度上限 + 指定亮度 |
+| 子菜单展开区 | `--s-menu-sub-bg` | 同色相,比一级底亮一档 |
+| 悬停项 | `--s-menu-hover-bg` | 同色相,比一级底暗 6 个亮度 |
+| 选中项 | `--s-menu-active-bg` | 主题色兑白,占比由 `VITE_APP_MENU_BG_ACTIVE_MIX` 控制 |
+| 普通文字 | `--s-menu-text` | 按底色反解,保证对比度 ≥ 4.6 |
+| 悬停 / 选中文字 | `--s-menu-text-hover`、`--s-menu-text-active` | 同上 |
+
+配置项(默认值见 `packages/config/web-config.js`,业务 `.env` 或部署目录 `config.json` 可覆盖):
+
+| 配置 | 默认 | 说明 |
+| --- | --- | --- |
+| `VITE_APP_MENU_BG` | `theme` | `theme` 跟随主题色 / `dark` 用 antd `#001529` / `#RRGGBB` 直接用该色 |
+| `VITE_APP_MENU_BG_LIGHTNESS` | `93` | 一级底亮度 0-100:越大越白,越小越深;**低于 50 自动切深色底 + 浅色文字** |
+| `VITE_APP_MENU_BG_SATURATION` | `30` | 饱和度上限 0-100:越小越接近灰白,`0` 得纯灰 |
+| `VITE_APP_MENU_BG_ACTIVE_MIX` | `16` | 选中块里主题色的占比 0-100:越大越显眼 |
+| `VITE_APP_MENU_THEME` | `dark` | 菜单外观模式;文字色实际按**底色明暗**自动切换,不只依赖这个值 |
+| `VITE_APP_MENU_BAR` | `left` | `left` 侧边 / `top` 顶部,两者共用同一套色板 |
+
+各主题默认色(亮度 93 / 饱和 30 / 选中 16,均为实测值):
+
+| 主题 | 一级底 | 子菜单底 | 悬停 | 选中块 | 普通文字 |
+| --- | --- | --- | --- | --- | --- |
+| blue | `#e8ecf3` | `#f5f7fa` | `#d4dce8` | `#dae9ff` | `#344051` |
+| green | `#ebf3e8` | `#f7faf5` | `#dbe8d4` | `#e3f6da` | `#3d5134` |
+| orange | `#f3ede8` | `#faf7f5` | `#e8ded4` | `#feedda` | `#514334` |
+| red | `#f3e8e8` | `#faf5f5` | `#e8d4d5` | `#fddcdd` | `#513435` |
+| purple | `#ece8f3` | `#f7f5fa` | `#dcd4e8` | `#e8def8` | `#403451` |
+| cyan | `#e8f3f3` | `#f5fafa` | `#d4e8e8` | `#d9f5f5` | `#345151` |
+
+常用调法:
+
+```js
+// 业务 web-config.js / 部署目录 config.json
+VITE_APP_MENU_BG_LIGHTNESS: 97,  // 1) 想更白(100 接近纯白)
+VITE_APP_MENU_BG_SATURATION: 0,  // 2) 去掉色调,走纯灰白
+VITE_APP_MENU_BG_ACTIVE_MIX: 30, // 3) 选中块更明显
+VITE_APP_MENU_BG: 'dark',        // 4) 回到 antd 经典深蓝黑 #001529
+VITE_APP_MENU_BG: '#213045'      // 5) 固定一个自定义色,不再跟随主题
+```
+
+> 注意事项
+>
+> 1. `VITE_APP_MENU_BG` 传 `#RRGGBB` 时,子菜单底 / 悬停 / 选中 / 文字仍在该色基础上推导,不会出现「主底换了、文字看不清」。
+> 2. 底色亮度 < 50 进入深色体系:文字转浅、logo 自动换浅色版、顶栏文字转白。判据是 `window.$menuTheme.isLightBg`,不是 `VITE_APP_MENU_THEME`。
+> 3. 业务样式不要写死 `#001529`、`rgba(255,255,255,.1)` 这类菜单色,直接用 `var(--s-menu-*)`,否则换主题会割裂。
+> 4. `.menu-wrap .ant-menu.ant-menu-dark` 已用上述变量兜住一级项、子菜单、hover、选中四类节点(antd 4.2.6 的 Menu token 覆盖不到的部分)。
+
 ## 三、布局与高度规范
 
 > 本章是**基座内部布局组件的强制约定**。业务页面只管用 layout,不要自己写高度;如果要新增布局组件,必须先满足本章规则。

+ 1 - 1
lib/config.json

@@ -1 +1 @@
-{"_hash":1793357421874,"VITE_APP_PROJECT_NAME":"前端项目架构","VITE_APP_VERSION":"v1.0","VITE_APP_JSS_LICENSE":"","VITE_APP_TITLE":"平台","VITE_APP_BASE_URL":"/","VITE_APP_FOOTER_VISIBLE":false,"VITE_APP_LOGIN_PHONE":false,"VITE_APP_LOGIN_QRCODE":false,"VITE_APP_MESSAGE_VISIBLE":true,"VITE_APP_IS_BASE":false,"VITE_APP_LANG_ENABLE":false,"VITE_APP_LANG":"zh","VITE_APP_API_PATH":"/apig","VITE_APP_SYS_SERVER_NAME":"portal","VITE_APP_MESSAGE_SERVER_NAME":"message","VITE_APP_PORTAL_SERVER_NAME":"portal","VITE_APP_FLOW_SERVER_NAME":"flow","VITE_APP_CLIENT_ID":"mm0001","VITE_APP_PREVIEW_ONLINE":"/filePreview/onlinePreview?url=","VITE_APP_WEB_SITE":"https://sapit.com.cn/#/home","VITE_APP_LOGIN_CASE_NAME":"辽ICP备14008719号-2","VITE_APP_BASE_CASE_NAME":"辽ICP备14008719号-2","VITE_APP_SOCKET_URL":"/","VITE_APP_SOCKET_PATH":"/apig/ws/websocket","VITE_CONFIG_MODE":false,"VITE_APP_API_BASE_URL":"http://192.168.200.7:6801","VITE_APP_API_FILE_URL":"/","VITE_APP_MENU_THEME":"dark","VITE_APP_MENU_BG":"theme","VITE_APP_MENU_BG_LIGHTNESS":93,"VITE_APP_MENU_BG_SATURATION":30,"VITE_APP_MENU_BG_ACTIVE_MIX":16,"VITE_APP_MENU_BAR":"left","VITE_APP_LOGIN_PATH_THEME":"3","VITE_APP_THEME_VALUE":"blue","VITE_APP_THEME":{"blue":{"name":"blue","color":"#1677FF","lightColor":"\t#6495ED","darkColor":"#00008B","borderColor":"#B0C4DE","bgColor":"#f0f2f5"},"green":{"name":"green","color":"#00b96b","lightColor":"#90EE90","darkColor":"#3CB371","borderColor":"#98FB98","bgColor":"#F0FFF0"},"orange":{"name":"orange","color":"#FFA500","lightColor":"\t#FFE4B5","darkColor":"#FF8C00","borderColor":"#FFDEAD","bgColor":"#FFEFD5"}},"VITE_APP_LOGIN_PATH":"/login","VITE_APP_DEFAULT_PATH":"/workplace/index","VITE_USER_NODE_ENV":"production"}
+{"_hash":1793358241709,"VITE_APP_PROJECT_NAME":"前端项目架构","VITE_APP_VERSION":"v1.0","VITE_APP_JSS_LICENSE":"","VITE_APP_TITLE":"平台","VITE_APP_BASE_URL":"/","VITE_APP_FOOTER_VISIBLE":false,"VITE_APP_LOGIN_PHONE":false,"VITE_APP_LOGIN_QRCODE":false,"VITE_APP_MESSAGE_VISIBLE":true,"VITE_APP_IS_BASE":false,"VITE_APP_LANG_ENABLE":false,"VITE_APP_LANG":"zh","VITE_APP_API_PATH":"/apig","VITE_APP_SYS_SERVER_NAME":"portal","VITE_APP_MESSAGE_SERVER_NAME":"message","VITE_APP_PORTAL_SERVER_NAME":"portal","VITE_APP_FLOW_SERVER_NAME":"flow","VITE_APP_CLIENT_ID":"mm0001","VITE_APP_PREVIEW_ONLINE":"/filePreview/onlinePreview?url=","VITE_APP_WEB_SITE":"https://sapit.com.cn/#/home","VITE_APP_LOGIN_CASE_NAME":"辽ICP备14008719号-2","VITE_APP_BASE_CASE_NAME":"辽ICP备14008719号-2","VITE_APP_SOCKET_URL":"/","VITE_APP_SOCKET_PATH":"/apig/ws/websocket","VITE_CONFIG_MODE":false,"VITE_APP_API_BASE_URL":"http://192.168.200.7:6801","VITE_APP_API_FILE_URL":"/","VITE_APP_MENU_THEME":"dark","VITE_APP_MENU_BG":"theme","VITE_APP_MENU_BG_LIGHTNESS":93,"VITE_APP_MENU_BG_SATURATION":30,"VITE_APP_MENU_BG_ACTIVE_MIX":16,"VITE_APP_MENU_BAR":"left","VITE_APP_LOGIN_PATH_THEME":"3","VITE_APP_THEME_VALUE":"blue","VITE_APP_THEME":{"blue":{"name":"blue","color":"#1677FF","lightColor":"\t#6495ED","darkColor":"#00008B","borderColor":"#B0C4DE","bgColor":"#f0f2f5"},"green":{"name":"green","color":"#00b96b","lightColor":"#90EE90","darkColor":"#3CB371","borderColor":"#98FB98","bgColor":"#F0FFF0"},"orange":{"name":"orange","color":"#FFA500","lightColor":"\t#FFE4B5","darkColor":"#FF8C00","borderColor":"#FFDEAD","bgColor":"#FFEFD5"}},"VITE_APP_LOGIN_PATH":"/login","VITE_APP_DEFAULT_PATH":"/workplace/index","VITE_USER_NODE_ENV":"production"}

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
lib/css/style.css


Файловите разлики са ограничени, защото са твърде много
+ 322 - 322
lib/js/SModal.js


Файловите разлики са ограничени, защото са твърде много
+ 29 - 23
lib/js/components-doc.js


Файловите разлики са ограничени, защото са твърде много
+ 20 - 21
lib/js/docs.js


Файловите разлики са ограничени, защото са твърде много
+ 358 - 290
lib/js/index2.js


Някои файлове не бяха показани, защото твърде много файлове са промени