Reorganize miniapp menu and fix legacy prototype React globals.
Move 安全培训扫码 under 小羚羚小程序 in the sidebar, eager-inject window.React before legacy page imports, and keep the sync script aligned with both behaviors. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
@@ -16,3 +16,6 @@ export function ensureOneosWebLegacyGlobals(): void {
|
||||
window.ReactDOM = ReactDOM;
|
||||
window.antd = antd;
|
||||
}
|
||||
|
||||
// Legacy jsx 可能在模块顶层使用 React.createElement,须在页面 import 之前完成注入。
|
||||
ensureOneosWebLegacyGlobals();
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user