diff --git a/.axhub/make/sidebar-tree.json b/.axhub/make/sidebar-tree.json index 4e622f8..dc683eb 100644 --- a/.axhub/make/sidebar-tree.json +++ b/.axhub/make/sidebar-tree.json @@ -1,6 +1,6 @@ { "version": 1, - "updatedAt": "2026-06-30T08:18:11.135Z", + "updatedAt": "2026-06-30T08:53:12.196Z", "prototypes": [ { "id": "item:prototypes:insurance-procurement", @@ -56,6 +56,19 @@ "title": "自营业务台账", "itemKey": "prototypes/self-operated-business-ledger" }, + { + "id": "folder-prototypes-xll-miniapp", + "kind": "folder", + "title": "小羚羚小程序", + "children": [ + { + "id": "item:prototypes:oneos-web-safety-training", + "kind": "item", + "title": "安全培训扫码", + "itemKey": "prototypes/oneos-web-safety-training" + } + ] + }, { "id": "folder-prototypes-oneos-web", "kind": "folder", @@ -73,12 +86,6 @@ "title": "登录", "itemKey": "prototypes/oneos-web-login" }, - { - "id": "item:prototypes:oneos-web-safety-training", - "kind": "item", - "title": "安全培训扫码", - "itemKey": "prototypes/oneos-web-safety-training" - }, { "id": "item:prototypes:oneos-web-vehicle-asset", "kind": "item", diff --git a/scripts/sync-oneos-web-prototypes.mjs b/scripts/sync-oneos-web-prototypes.mjs index 846320b..7594c08 100644 --- a/scripts/sync-oneos-web-prototypes.mjs +++ b/scripts/sync-oneos-web-prototypes.mjs @@ -16,10 +16,13 @@ const sidebarPath = path.join(projectRoot, '.axhub/make/sidebar-tree.json'); const PAGE_ID_RE = /^[a-z0-9-]+$/u; +const XLL_MODULES = [ + { slug: 'oneos-web-safety-training', title: '安全培训扫码', files: ['安全培训扫码.jsx'] }, +]; + const MODULES = [ { slug: 'oneos-web-workbench', title: '工作台', files: ['工作台.jsx'] }, { slug: 'oneos-web-login', title: '登录', files: ['登录.jsx'] }, - { slug: 'oneos-web-safety-training', title: '安全培训扫码', files: ['安全培训扫码.jsx'] }, { slug: 'oneos-web-vehicle-asset', title: '车辆管理', files: ['车辆管理.jsx', '车辆管理-查看.jsx'] }, { slug: 'oneos-web-contract-template', title: '合同模板管理', files: ['合同模板管理.jsx'] }, { slug: 'oneos-web-help-center', title: '帮助中心', dir: '帮助中心' }, @@ -191,6 +194,7 @@ function writePrototype(module, pages) { * @name ${module.title} * 自 ONE-OS web端 原稿复刻(${pages.length} 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; ${importLines.join('\n')} import { OneosWebLegacyShell } from '../../common/oneosWebLegacy/OneosWebLegacyShell'; @@ -219,25 +223,42 @@ function toComponentName(slug) { .join(''); } -function updateSidebar(modules) { +function toSidebarItem(module) { + return { + id: `item:prototypes:${module.slug}`, + kind: 'item', + title: module.title, + itemKey: `prototypes/${module.slug}`, + }; +} + +function updateSidebar(webModules, xllModules) { const sidebar = JSON.parse(fs.readFileSync(sidebarPath, 'utf8')); const prefix = 'item:prototypes:oneos-web-'; - const existing = (sidebar.prototypes ?? []).filter((item) => !String(item.id).startsWith(prefix) && !String(item.itemKey).startsWith('prototypes/oneos-web-')); + const existing = (sidebar.prototypes ?? []).filter( + (item) => + item.id !== 'folder-prototypes-oneos-web' + && item.id !== 'folder-prototypes-xll-miniapp' + && !String(item.id).startsWith(prefix) + && !String(item.itemKey).startsWith('prototypes/oneos-web-'), + ); + + const xllFolder = { + id: 'folder-prototypes-xll-miniapp', + kind: 'folder', + title: '小羚羚小程序', + children: xllModules.map(toSidebarItem), + }; const oneosFolder = { id: 'folder-prototypes-oneos-web', kind: 'folder', title: 'ONE-OS Web 端', defaultExpanded: true, - children: modules.map((module) => ({ - id: `item:prototypes:${module.slug}`, - kind: 'item', - title: module.title, - itemKey: `prototypes/${module.slug}`, - })), + children: webModules.map(toSidebarItem), }; - sidebar.prototypes = [...existing, oneosFolder]; + sidebar.prototypes = [...existing, xllFolder, oneosFolder]; sidebar.updatedAt = new Date().toISOString(); fs.writeFileSync(sidebarPath, `${JSON.stringify(sidebar, null, 2)}\n`, 'utf8'); } @@ -248,7 +269,9 @@ function main() { process.exit(1); } - for (const module of MODULES) { + const allModules = [...XLL_MODULES, ...MODULES]; + + for (const module of allModules) { if (module.docsOnly) { writeRequirementsPrototype(module); console.log(`[ok] ${module.slug} (需求说明文档浏览)`); @@ -263,7 +286,7 @@ function main() { console.log(`[ok] ${module.slug} (${pages.length} pages)`); } - updateSidebar(MODULES); + updateSidebar(MODULES, XLL_MODULES); console.log('已更新 .axhub/make/sidebar-tree.json'); } diff --git a/src/common/oneosWebLegacy/legacyGlobals.ts b/src/common/oneosWebLegacy/legacyGlobals.ts index 1898f97..8f39cb5 100644 --- a/src/common/oneosWebLegacy/legacyGlobals.ts +++ b/src/common/oneosWebLegacy/legacyGlobals.ts @@ -16,3 +16,6 @@ export function ensureOneosWebLegacyGlobals(): void { window.ReactDOM = ReactDOM; window.antd = antd; } + +// Legacy jsx 可能在模块顶层使用 React.createElement,须在页面 import 之前完成注入。 +ensureOneosWebLegacyGlobals(); diff --git a/src/prototypes/oneos-web-business/index.tsx b/src/prototypes/oneos-web-business/index.tsx index 2203a98..2ce7696 100644 --- a/src/prototypes/oneos-web-business/index.tsx +++ b/src/prototypes/oneos-web-business/index.tsx @@ -2,6 +2,7 @@ * @name 业务管理 * 自 ONE-OS web端 原稿复刻(18 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-保险采购.jsx'; import Page2 from './pages/02-编辑交车任务.jsx'; diff --git a/src/prototypes/oneos-web-contract-template/index.tsx b/src/prototypes/oneos-web-contract-template/index.tsx index e027400..17b356c 100644 --- a/src/prototypes/oneos-web-contract-template/index.tsx +++ b/src/prototypes/oneos-web-contract-template/index.tsx @@ -2,6 +2,7 @@ * @name 合同模板管理 * 自 ONE-OS web端 原稿复刻(1 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-合同模板管理.jsx'; import { OneosWebLegacyShell } from '../../common/oneosWebLegacy/OneosWebLegacyShell'; diff --git a/src/prototypes/oneos-web-data-analysis/index.tsx b/src/prototypes/oneos-web-data-analysis/index.tsx index df5c3ab..6be5b54 100644 --- a/src/prototypes/oneos-web-data-analysis/index.tsx +++ b/src/prototypes/oneos-web-data-analysis/index.tsx @@ -2,6 +2,7 @@ * @name 数据分析 * 自 ONE-OS web端 原稿复刻(9 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-客户服务部业务统计报表.jsx'; import Page2 from './pages/02-物流业务台账.jsx'; diff --git a/src/prototypes/oneos-web-finance/index.tsx b/src/prototypes/oneos-web-finance/index.tsx index 42aef57..b45732c 100644 --- a/src/prototypes/oneos-web-finance/index.tsx +++ b/src/prototypes/oneos-web-finance/index.tsx @@ -2,6 +2,7 @@ * @name 财务管理 * 自 ONE-OS web端 原稿复刻(10 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-还车应结款-查看.jsx'; import Page2 from './pages/02-还车应结款-费用明细.jsx'; diff --git a/src/prototypes/oneos-web-h2-station/index.tsx b/src/prototypes/oneos-web-h2-station/index.tsx index a0c37f4..2a7adb5 100644 --- a/src/prototypes/oneos-web-h2-station/index.tsx +++ b/src/prototypes/oneos-web-h2-station/index.tsx @@ -2,6 +2,7 @@ * @name 加氢站管理 * 自 ONE-OS web端 原稿复刻(3 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-加氢订单.jsx'; import Page2 from './pages/02-加氢记录.jsx'; diff --git a/src/prototypes/oneos-web-help-center/index.tsx b/src/prototypes/oneos-web-help-center/index.tsx index 075f8d3..593bdde 100644 --- a/src/prototypes/oneos-web-help-center/index.tsx +++ b/src/prototypes/oneos-web-help-center/index.tsx @@ -2,6 +2,7 @@ * @name 帮助中心 * 自 ONE-OS web端 原稿复刻(1 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-功能说明书.jsx'; import { OneosWebLegacyShell } from '../../common/oneosWebLegacy/OneosWebLegacyShell'; diff --git a/src/prototypes/oneos-web-lease-contract/index.tsx b/src/prototypes/oneos-web-lease-contract/index.tsx index 4d240f1..5bcfb21 100644 --- a/src/prototypes/oneos-web-lease-contract/index.tsx +++ b/src/prototypes/oneos-web-lease-contract/index.tsx @@ -2,6 +2,7 @@ * @name 车辆租赁合同 * 自 ONE-OS web端 原稿复刻(8 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-车辆租赁合同-变更为三方合同.jsx'; import Page2 from './pages/02-车辆租赁合同-查看.jsx'; diff --git a/src/prototypes/oneos-web-ledger-data/index.tsx b/src/prototypes/oneos-web-ledger-data/index.tsx index ff6969c..a308bbc 100644 --- a/src/prototypes/oneos-web-ledger-data/index.tsx +++ b/src/prototypes/oneos-web-ledger-data/index.tsx @@ -2,6 +2,7 @@ * @name 台账数据 * 自 ONE-OS web端 原稿复刻(5 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-保险分摊明细.jsx'; import Page2 from './pages/02-车辆氢费明细.jsx'; diff --git a/src/prototypes/oneos-web-login/index.tsx b/src/prototypes/oneos-web-login/index.tsx index 90afa5e..f6e4b17 100644 --- a/src/prototypes/oneos-web-login/index.tsx +++ b/src/prototypes/oneos-web-login/index.tsx @@ -2,6 +2,7 @@ * @name 登录 * 自 ONE-OS web端 原稿复刻(1 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-登录.jsx'; import { OneosWebLegacyShell } from '../../common/oneosWebLegacy/OneosWebLegacyShell'; diff --git a/src/prototypes/oneos-web-ops/index.tsx b/src/prototypes/oneos-web-ops/index.tsx index c45dfcb..476a4f3 100644 --- a/src/prototypes/oneos-web-ops/index.tsx +++ b/src/prototypes/oneos-web-ops/index.tsx @@ -2,6 +2,7 @@ * @name 运维管理 * 自 ONE-OS web端 原稿复刻(49 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-备件库存.jsx'; import Page2 from './pages/02-仓库管理.jsx'; diff --git a/src/prototypes/oneos-web-procurement/index.tsx b/src/prototypes/oneos-web-procurement/index.tsx index df4b73b..756f59c 100644 --- a/src/prototypes/oneos-web-procurement/index.tsx +++ b/src/prototypes/oneos-web-procurement/index.tsx @@ -2,6 +2,7 @@ * @name 采购管理 * 自 ONE-OS web端 原稿复刻(2 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-三方退租车管理.jsx'; import Page2 from './pages/02-三方退租申请-新增.jsx'; diff --git a/src/prototypes/oneos-web-safety-training/index.tsx b/src/prototypes/oneos-web-safety-training/index.tsx index 1a2ef56..e063bc0 100644 --- a/src/prototypes/oneos-web-safety-training/index.tsx +++ b/src/prototypes/oneos-web-safety-training/index.tsx @@ -2,6 +2,7 @@ * @name 安全培训扫码 * 自 ONE-OS web端 原稿复刻(1 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-安全培训扫码.jsx'; import { OneosWebLegacyShell } from '../../common/oneosWebLegacy/OneosWebLegacyShell'; diff --git a/src/prototypes/oneos-web-vehicle-asset/index.tsx b/src/prototypes/oneos-web-vehicle-asset/index.tsx index 6e52a41..422df34 100644 --- a/src/prototypes/oneos-web-vehicle-asset/index.tsx +++ b/src/prototypes/oneos-web-vehicle-asset/index.tsx @@ -2,6 +2,7 @@ * @name 车辆管理 * 自 ONE-OS web端 原稿复刻(2 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-车辆管理.jsx'; import Page2 from './pages/02-车辆管理-查看.jsx'; diff --git a/src/prototypes/oneos-web-workbench/index.tsx b/src/prototypes/oneos-web-workbench/index.tsx index 3de3cfe..c2feea7 100644 --- a/src/prototypes/oneos-web-workbench/index.tsx +++ b/src/prototypes/oneos-web-workbench/index.tsx @@ -2,6 +2,7 @@ * @name 工作台 * 自 ONE-OS web端 原稿复刻(1 个页面) */ +import '../../common/oneosWebLegacy/legacyGlobals'; import React from 'react'; import Page1 from './pages/01-工作台.jsx'; import { OneosWebLegacyShell } from '../../common/oneosWebLegacy/OneosWebLegacyShell';