Commit 211e2e08 by liimin

1

1 parent 997fd13f
Showing 393 changed files with 1003 additions and 2879 deletions
...@@ -3,27 +3,27 @@ ...@@ -3,27 +3,27 @@
"meta": { "meta": {
"generator": "scripts/ai-direct-context.mjs", "generator": "scripts/ai-direct-context.mjs",
"mode": "ai-direct", "mode": "ai-direct",
"generatedAt": "2026-06-02T00:47:26.933Z", "generatedAt": "2026-06-03T02:18:36.826Z",
"repoRoot": "D:/work/venus" "repoRoot": "D:/work/venus"
}, },
"figma": { "figma": {
"figmaUrl": "https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314&t=8uO4M7HIKCUz2Ehw-4", "figmaUrl": "https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314",
"fileKey": "taBZMgXMmkHYUEDwb4ROMX", "fileKey": "taBZMgXMmkHYUEDwb4ROMX",
"nodeId": "1:1314", "nodeId": "1:1314",
"pageName": "AllocationManagement", "pageName": "202604",
"pageTitle": "调拨管理", "pageTitle": "202604-调拨管理",
"pageSlug": "allocationmanagement", "pageSlug": "202604",
"designContextExcerpt": "schema: v3\nroot:\n type: FRAME\n name: Frame 12\n layout:\n direction: column\n gap: 16\n padding: 20\n sizingV: hug\n style:\n background: rgba(255, 255, 255, 1)\n children:\n - type: FRAME\n name: Frame 6\n layout:\n direction: column\n gap: 20\n sizingH: fill\n sizingV: hug\n children:\n - type: FRAME\n name: '2'\n layout:\n direction: row\n align: center\n gap: 12\n sizingH: fill\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: 调出方:\n style:\n color: rgba(51, 51, 51, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n textAlign: left\n - type: INSTANCE\n name: 输入框\n id: '1:1318'\n layout: &ref_0\n direction: row\n align: center\n overflow: hidden\n sizingV: hug\n style: &ref_1\n background: rgba(0, 0, 0, 1)\n component: '1:180'\n children:\n - type: FRAME\n name: Frame 5\n layout:\n direction: row\n align: center\n justify: flex-end\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: '*'\n style:\n color: rgba(235, 78, 78, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n textAlign: left\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: 调出仓库\n style:\n color: rgba(51, 51, 51, 1)\n font: HarmonyOS Sans SC\n fontSize: 14" "designContextExcerpt": "schema: v3\nroot:\n type: FRAME\n name: Frame 12\n layout:\n direction: column\n gap: 16\n padding: 20\n sizingV: hug\n style:\n background: rgba(255, 255, 255, 1)\n children:\n - type: FRAME\n name: Frame 6\n layout:\n direction: column\n gap: 20\n sizingH: fill\n sizingV: hug\n children:\n - type: FRAME\n name: '2'\n layout:\n direction: row\n align: center\n gap: 12\n sizingH: fill\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: 调出方:\n style:\n color: rgba(51, 51, 51, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n textAlign: left\n - type: INSTANCE\n name: 输入框\n id: '1:1318'\n layout: &ref_0\n direction: row\n align: center\n overflow: hidden\n sizingV: hug\n style: &ref_1\n background: rgba(0, 0, 0, 1)\n component: '1:180'\n children:\n - type: FRAME\n name: Frame 5\n layout:\n direction: row\n align: center\n justify: flex-end\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: '*'\n style:\n color: rgba(235, 78, 78, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n textAlign: left\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: 调出仓库\n style:\n color: rgba(51, 51, 51, 1)\n font: HarmonyOS Sans SC\n fontSize: 14"
}, },
"projectContext": { "projectContext": {
"projectName": "@venus/allocationmanagement-qwen-autofix", "projectName": "@venus/allocationconfirmation-preview",
"projectRoot": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix", "projectRoot": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview",
"framework": "micro-frontend", "framework": "micro-frontend",
"appType": "micro-app", "appType": "micro-app",
"workspace": { "workspace": {
"inWorkspace": true, "inWorkspace": true,
"workspaceRoot": "d:/work/venus", "workspaceRoot": "D:/work/venus",
"packageName": "@venus/allocationmanagement-qwen-autofix", "packageName": "@venus/allocationconfirmation-preview",
"packageManager": "pnpm" "packageManager": "pnpm"
}, },
"directories": { "directories": {
...@@ -41,23 +41,31 @@ ...@@ -41,23 +41,31 @@
"existingPages": { "existingPages": {
"pages": [ "pages": [
"src/views/About.vue", "src/views/About.vue",
"src/views/AllocationManagement.vue", "src/views/AllocationConfirmation.vue",
"src/views/AllocationConfirmation/index.vue",
"src/views/Communication.vue", "src/views/Communication.vue",
"src/views/Home.vue", "src/views/Home.vue",
"src/views/NotFound.vue", "src/views/NotFound.vue",
"src/views/Settings.vue", "src/views/Settings.vue",
"src/views/User.vue" "src/views/User.vue",
"src/views/allocation-confirmation/index.vue"
], ],
"total": 7, "total": 9,
"groups": { "groups": {
"src/views": [ "src/views": [
"src/views/About.vue", "src/views/About.vue",
"src/views/AllocationManagement.vue", "src/views/AllocationConfirmation.vue",
"src/views/Communication.vue", "src/views/Communication.vue",
"src/views/Home.vue", "src/views/Home.vue",
"src/views/NotFound.vue", "src/views/NotFound.vue",
"src/views/Settings.vue", "src/views/Settings.vue",
"src/views/User.vue" "src/views/User.vue"
],
"src/views/AllocationConfirmation": [
"src/views/AllocationConfirmation/index.vue"
],
"src/views/allocation-confirmation": [
"src/views/allocation-confirmation/index.vue"
] ]
} }
}, },
...@@ -66,11 +74,11 @@ ...@@ -66,11 +74,11 @@
"distribution": { "distribution": {
"PascalCase": 7, "PascalCase": 7,
"kebab-case": 0, "kebab-case": 0,
"camelCase": 0, "camelCase": 2,
"other": 0 "other": 0
}, },
"hasGroupedDirectories": false, "hasGroupedDirectories": true,
"total": 7 "total": 9
}, },
"apiLayer": { "apiLayer": {
"hasApiLayer": false, "hasApiLayer": false,
...@@ -1461,10 +1469,10 @@ ...@@ -1461,10 +1469,10 @@
] ]
}, },
"artifacts": { "artifacts": {
"designContextFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.design-context.html", "designContextFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.design-context.html",
"variableDefsFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.variable-defs.json", "variableDefsFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.variable-defs.json",
"screenshotFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.screenshot.png", "screenshotFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.screenshot.png",
"screenshotSummaryFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.screenshot-summary.json", "screenshotSummaryFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.screenshot-summary.json",
"promptFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.prompt.md" "promptFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.prompt.md"
} }
} }
{ {
"meta": { "meta": {
"generator": "scripts/ai-direct-preview-project.mjs", "generator": "scripts/ai-direct-preview-project.mjs",
"generatedAt": "2026-06-02T04:27:13.503Z", "generatedAt": "2026-06-03T02:29:59.843Z",
"mode": "reuse-existing", "mode": "create",
"bundleFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.ai-direct-context-bundle.json" "bundleFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.ai-direct-context-bundle.json"
}, },
"previewProject": { "previewProject": {
"name": "allocationmanagement-qwen-autofix", "name": "202604-preview",
"projectRoot": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix", "projectRoot": "D:/work/venus/apps/web/ai-previews/202604-preview",
"template": "vue", "template": "vue",
"ui": "element-plus", "ui": "element-plus",
"install": false, "install": false,
"command": "[reuse existing preview project]" "command": "pnpm venus create 202604-preview --template vue --dir \"apps/web/ai-previews\" --root \"D:\\work\\venus\" --router --store --eslint --ui element-plus --no-install"
} }
} }
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
## Task ## Task
- Generate a page for `@venus/allocationmanagement-qwen-autofix` (framework: `micro-frontend`). - Generate a page for `@venus/allocationconfirmation-preview` (framework: `micro-frontend`).
- Page name: `AllocationManagement` - Page name: `202604`
- Page title: `调拨管理` - Page title: `202604-调拨管理`
- Figma URL: https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314&t=8uO4M7HIKCUz2Ehw-4 - Figma URL: https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314
## Required Inputs ## Required Inputs
- Read `allocationmanagement.ai-direct-context-bundle.json` first for project constraints and component facts. - Read `202604.ai-direct-context-bundle.json` first for project constraints and component facts.
- Read `allocationmanagement.design-context.html` as the raw Figma developer MCP context. - Read `202604.design-context.html` as the raw Figma developer MCP context.
- Read `allocationmanagement.variable-defs.json` for design token and variable hints. - Read `202604.variable-defs.json` for design token and variable hints.
- Read `allocationmanagement.screenshot.png` as the rendered screenshot context of the selected Figma node. - Read `202604.screenshot.png` as the rendered screenshot context of the selected Figma node.
## Project UI Packages ## Project UI Packages
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
- When a design element cannot be mapped confidently, keep structure simple and explain the gap instead of forcing a wrong component. - When a design element cannot be mapped confidently, keep structure simple and explain the gap instead of forcing a wrong component.
- Keep output aligned with the target project's routing, naming, and directory conventions. - Keep output aligned with the target project's routing, naming, and directory conventions.
- Preview project scaffolding must use Venus CLI. Do not handcraft a new scaffold. - Preview project scaffolding must use Venus CLI. Do not handcraft a new scaffold.
- Recommended preview command: `pnpm exec venus create allocationmanagement-preview --template vue --router --store --ui element-plus --eslint --no-install`. - Recommended preview command: `pnpm venus create 202604-preview --template vue --router --store --ui element-plus --eslint --no-install`.
## Expected Output ## Expected Output
......
# AI Direct Request # AI Direct Request
- Project: `@venus/allocationmanagement-qwen-autofix` - Project: `@venus/allocationconfirmation-preview`
- Framework: `micro-frontend` - Framework: `micro-frontend`
- Preferred VUI: `@vui/vue` - Preferred VUI: `@vui/vue`
- Fallbacks: `element-plus` - Fallbacks: `element-plus`
...@@ -95,17 +95,17 @@ Vue SFC 输出规则: ...@@ -95,17 +95,17 @@ Vue SFC 输出规则:
## Task ## Task
- Generate a page for `@venus/allocationmanagement-qwen-autofix` (framework: `micro-frontend`). - Generate a page for `@venus/allocationconfirmation-preview` (framework: `micro-frontend`).
- Page name: `AllocationManagement` - Page name: `202604`
- Page title: `调拨管理` - Page title: `202604-调拨管理`
- Figma URL: https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314&t=8uO4M7HIKCUz2Ehw-4 - Figma URL: https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314
## Required Inputs ## Required Inputs
- Read `allocationmanagement.ai-direct-context-bundle.json` first for project constraints and component facts. - Read `202604.ai-direct-context-bundle.json` first for project constraints and component facts.
- Read `allocationmanagement.design-context.html` as the raw Figma developer MCP context. - Read `202604.design-context.html` as the raw Figma developer MCP context.
- Read `allocationmanagement.variable-defs.json` for design token and variable hints. - Read `202604.variable-defs.json` for design token and variable hints.
- Read `allocationmanagement.screenshot.png` as the rendered screenshot context of the selected Figma node. - Read `202604.screenshot.png` as the rendered screenshot context of the selected Figma node.
## Project UI Packages ## Project UI Packages
...@@ -125,7 +125,7 @@ Vue SFC 输出规则: ...@@ -125,7 +125,7 @@ Vue SFC 输出规则:
- When a design element cannot be mapped confidently, keep structure simple and explain the gap instead of forcing a wrong component. - When a design element cannot be mapped confidently, keep structure simple and explain the gap instead of forcing a wrong component.
- Keep output aligned with the target project's routing, naming, and directory conventions. - Keep output aligned with the target project's routing, naming, and directory conventions.
- Preview project scaffolding must use Venus CLI. Do not handcraft a new scaffold. - Preview project scaffolding must use Venus CLI. Do not handcraft a new scaffold.
- Recommended preview command: `pnpm exec venus create allocationmanagement-preview --template vue --router --store --ui element-plus --eslint --no-install`. - Recommended preview command: `pnpm venus create 202604-preview --template vue --router --store --ui element-plus --eslint --no-install`.
## Expected Output ## Expected Output
...@@ -135,14 +135,14 @@ Vue SFC 输出规则: ...@@ -135,14 +135,14 @@ Vue SFC 输出规则:
# Bundle Snapshot # Bundle Snapshot
{ {
"figma": { "figma": {
"figmaUrl": "https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314&t=8uO4M7HIKCUz2Ehw-4", "figmaUrl": "https://www.figma.com/design/taBZMgXMmkHYUEDwb4ROMX/202604-%E8%B0%83%E6%8B%A8%E7%AE%A1%E7%90%86?node-id=1-1314",
"pageName": "AllocationManagement", "pageName": "202604",
"pageTitle": "调拨管理", "pageTitle": "202604-调拨管理",
"pageSlug": "allocationmanagement", "pageSlug": "202604",
"designContextExcerpt": "schema: v3\nroot:\n type: FRAME\n name: Frame 12\n layout:\n direction: column\n gap: 16\n padding: 20\n sizingV: hug\n style:\n background: rgba(255, 255, 255, 1)\n children:\n - type: FRAME\n name: Frame 6\n layout:\n direction: column\n gap: 20\n sizingH: fill\n sizingV: hug\n children:\n - type: FRAME\n name: '2'\n layout:\n direction: row\n align: center\n gap: 12\n sizingH: fill\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: 调出方:\n style:\n color: rgba(51, 51, 51, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n textAlign: left\n - type: INSTANCE\n name: 输入框\n id: '1:1318'\n layout: &ref_0\n direction: row\n align: center\n overflow: hidden\n sizingV: hug\n style: &ref_1\n background: rgba(0, 0, 0, 1)\n component: '1:180'\n children:\n - type: FRAME\n name: Frame 5\n layout:\n direction: row\n align: center\n justify: flex-end\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: '*'\n style:\n color: rgba(235, 78, 78, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n " "designContextExcerpt": "schema: v3\nroot:\n type: FRAME\n name: Frame 12\n layout:\n direction: column\n gap: 16\n padding: 20\n sizingV: hug\n style:\n background: rgba(255, 255, 255, 1)\n children:\n - type: FRAME\n name: Frame 6\n layout:\n direction: column\n gap: 20\n sizingH: fill\n sizingV: hug\n children:\n - type: FRAME\n name: '2'\n layout:\n direction: row\n align: center\n gap: 12\n sizingH: fill\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: 调出方:\n style:\n color: rgba(51, 51, 51, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n textAlign: left\n - type: INSTANCE\n name: 输入框\n id: '1:1318'\n layout: &ref_0\n direction: row\n align: center\n overflow: hidden\n sizingV: hug\n style: &ref_1\n background: rgba(0, 0, 0, 1)\n component: '1:180'\n children:\n - type: FRAME\n name: Frame 5\n layout:\n direction: row\n align: center\n justify: flex-end\n sizingV: hug\n children:\n - type: TEXT\n name: 商品名称:\n layout:\n sizingH: hug\n sizingV: hug\n text: '*'\n style:\n color: rgba(235, 78, 78, 1)\n font: HarmonyOS Sans SC\n fontSize: 14\n fontWeight: 400\n lineHeight: 16\n "
}, },
"projectContext": { "projectContext": {
"projectName": "@venus/allocationmanagement-qwen-autofix", "projectName": "@venus/allocationconfirmation-preview",
"framework": "micro-frontend", "framework": "micro-frontend",
"appType": "micro-app", "appType": "micro-app",
"pageDirs": [ "pageDirs": [
...@@ -153,12 +153,14 @@ Vue SFC 输出规则: ...@@ -153,12 +153,14 @@ Vue SFC 输出规则:
], ],
"existingPages": [ "existingPages": [
"src/views/About.vue", "src/views/About.vue",
"src/views/AllocationManagement.vue", "src/views/AllocationConfirmation.vue",
"src/views/AllocationConfirmation/index.vue",
"src/views/Communication.vue", "src/views/Communication.vue",
"src/views/Home.vue", "src/views/Home.vue",
"src/views/NotFound.vue", "src/views/NotFound.vue",
"src/views/Settings.vue", "src/views/Settings.vue",
"src/views/User.vue" "src/views/User.vue",
"src/views/allocation-confirmation/index.vue"
], ],
"uiStack": { "uiStack": {
"componentPackages": [ "componentPackages": [
...@@ -406,10 +408,10 @@ Vue SFC 输出规则: ...@@ -406,10 +408,10 @@ Vue SFC 输出规则:
] ]
}, },
"artifacts": { "artifacts": {
"designContextFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.design-context.html", "designContextFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.design-context.html",
"variableDefsFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.variable-defs.json", "variableDefsFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.variable-defs.json",
"screenshotFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.screenshot.png", "screenshotFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.screenshot.png",
"screenshotSummaryFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.screenshot-summary.json" "screenshotSummaryFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/202604/202604.screenshot-summary.json"
} }
} }
...@@ -824,7 +826,7 @@ Original raw context truncated from 149625 chars for provider stability. Priorit ...@@ -824,7 +826,7 @@ Original raw context truncated from 149625 chars for provider stability. Priorit
- 如果预览骨架已有 `src/router.ts`,请直接修改它,不要新增 `src/router/index.ts` 与现有结构冲突。 - 如果预览骨架已有 `src/router.ts`,请直接修改它,不要新增 `src/router/index.ts` 与现有结构冲突。
# Screenshot Context # Screenshot Context
- Screenshot file: allocationmanagement.screenshot.png - Screenshot file: 202604.screenshot.png
- 该截图来自当前 Figma node 的渲染结果,只用于辅助校正分区、留白、字段宽度、表格层次和分页位置。 - 该截图来自当前 Figma node 的渲染结果,只用于辅助校正分区、留白、字段宽度、表格层次和分页位置。
- 如果截图分析与 Figma 原始 design context、显式文本节点或组件事实源冲突,以数据源为准,不要让截图覆盖文本事实。 - 如果截图分析与 Figma 原始 design context、显式文本节点或组件事实源冲突,以数据源为准,不要让截图覆盖文本事实。
...@@ -861,7 +863,7 @@ Original raw context truncated from 149625 chars for provider stability. Priorit ...@@ -861,7 +863,7 @@ Original raw context truncated from 149625 chars for provider stability. Priorit
"actionLinkLabel": "选择", "actionLinkLabel": "选择",
"pagination": { "pagination": {
"present": true, "present": true,
"containerAlignment": "left", "containerAlignment": "split",
"totalTextVisible": true, "totalTextVisible": true,
"pageSizeSelectorVisible": true, "pageSizeSelectorVisible": true,
"jumperVisible": true, "jumperVisible": true,
...@@ -872,6 +874,10 @@ Original raw context truncated from 149625 chars for provider stability. Priorit ...@@ -872,6 +874,10 @@ Original raw context truncated from 149625 chars for provider stability. Priorit
"headerTone": "light-gray", "headerTone": "light-gray",
"primaryColor": "blue" "primaryColor": "blue"
}, },
"notes": [] "notes": [
"筛选区域包含带有红色星号的必填项:调出仓库、调出门店、调入仓库、调入门店。",
"表格表头背景为浅灰色。",
"分页区域左侧显示总数和每页条数选择,右侧显示页码和跳转输入框。"
]
} }
``` ```
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
"actionLinkLabel": "选择", "actionLinkLabel": "选择",
"pagination": { "pagination": {
"present": true, "present": true,
"containerAlignment": "left", "containerAlignment": "split",
"totalTextVisible": true, "totalTextVisible": true,
"pageSizeSelectorVisible": true, "pageSizeSelectorVisible": true,
"jumperVisible": true, "jumperVisible": true,
...@@ -40,5 +40,9 @@ ...@@ -40,5 +40,9 @@
"headerTone": "light-gray", "headerTone": "light-gray",
"primaryColor": "blue" "primaryColor": "blue"
}, },
"notes": [] "notes": [
"筛选区域包含带有红色星号的必填项:调出仓库、调出门店、调入仓库、调入门店。",
"表格表头背景为浅灰色。",
"分页区域左侧显示总数和每页条数选择,右侧显示页码和跳转输入框。"
]
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
- actionColumnLabel: 操作 - actionColumnLabel: 操作
- actionLinkLabel: 选择 - actionLinkLabel: 选择
- pagination.present: true - pagination.present: true
- pagination.containerAlignment: left - pagination.containerAlignment: split
- pagination.totalTextVisible: true - pagination.totalTextVisible: true
- pagination.pageSizeSelectorVisible: true - pagination.pageSizeSelectorVisible: true
- pagination.jumperVisible: true - pagination.jumperVisible: true
...@@ -18,3 +18,8 @@ ...@@ -18,3 +18,8 @@
- style.backgroundTone: white - style.backgroundTone: white
- style.headerTone: light-gray - style.headerTone: light-gray
- style.primaryColor: blue - style.primaryColor: blue
## Notes
- 筛选区域包含带有红色星号的必填项:调出仓库、调出门店、调入仓库、调入门店。
- 表格表头背景为浅灰色。
- 分页区域左侧显示总数和每页条数选择,右侧显示页码和跳转输入框。
{
"meta": {
"generator": "scripts/ai-direct-execute.mjs",
"generatedAt": "2026-06-03T09:47:39.540Z",
"mode": "openai-compatible",
"bundleFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.ai-direct-context-bundle.json",
"previewFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.preview-project.json",
"responseFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.json",
"validationFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.validation-result.json"
},
"status": "passed",
"repairRoundsAttempted": 0
}
{
"meta": {
"generator": "scripts/ai-direct-preview-project.mjs",
"generatedAt": "2026-06-03T09:45:49.912Z",
"mode": "create",
"bundleFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.ai-direct-context-bundle.json"
},
"previewProject": {
"name": "testpage-preview",
"projectRoot": "D:/work/venus/apps/web/ai-previews/testpage-preview",
"template": "mobile",
"ui": "vant",
"install": false,
"command": "pnpm venus create testpage-preview --template mobile --dir apps/web/ai-previews --root D:\\work\\venus --router --store --eslint --ui vant --no-install --force"
}
}
# AI Direct Generation Context
## Task
- Generate a page for `@venus/allocationconfirmation-preview` (framework: `vue`).
- Page name: `testPage`
- Page title: `广联二手车(设)`
- Figma URL: https://www.figma.com/design/ZbhoA04cGHI9DMjknZ8FNB/%E5%B9%BF%E8%81%94%E4%BA%8C%E6%89%8B%E8%BD%A6%EF%BC%88%E8%AE%BE%EF%BC%89?node-id=2310-519&t=UoZ7GaEcYn9o0fel-4
## Required Inputs
- Read `testpage.ai-direct-context-bundle.json` first for project constraints and component facts.
- Read `testpage.design-context.html` as the raw Figma developer MCP context.
- Read `testpage.screenshot.png` as the rendered screenshot context of the selected Figma node.
## Project UI Packages
- Installed UI packages: @vui/vue, element-plus
## Package Exports
- @vui/vue: VButton, VDialog, VInput, VSelect, VTable
- @vui/react: no source exports detected
- @vui/uniapp: no source exports detected
- @vui/mobile: VButton, VCell, VDropdownItem, VDropdownMenu, VField, VList, VNavBar, VPicker, VPopup, VSearch, VTabbar
## Generation Rules
- VUI is mandatory first choice: prefer `@vui/mobile` before any fallback UI library.
- Framework fallback chain: vant.
- Do not import components from packages that are not installed in the target project unless you explicitly plan a dependency change.
- When a design element cannot be mapped confidently, keep structure simple and explain the gap instead of forcing a wrong component.
- Keep output aligned with the target project's routing, naming, and directory conventions.
- Preview project scaffolding must use Venus CLI. Do not handcraft a new scaffold.
- Recommended preview command: `pnpm venus create testpage-preview --template mobile --router --store --ui vant --eslint --no-install`.
## Expected Output
- A directly usable Vue page implementation.
- A brief note listing any dependency gaps or component capability gaps that block closer restoration.
{
"meta": {
"generator": "scripts/ai-direct-apply-output.mjs",
"generatedAt": "2026-06-03T09:47:33.225Z",
"responseFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.json",
"previewFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.preview-project.json"
},
"result": {
"projectRoot": "D:/work/venus/apps/web/ai-previews/testpage-preview",
"writtenFiles": [
{
"path": "apps/web/ai-previews/testpage-preview/src/views/TestPage.vue",
"language": "vue",
"purpose": "广联二手车移动端首页,包含搜索、筛选和车辆列表"
},
{
"path": "apps/web/ai-previews/testpage-preview/src/router/index.ts",
"language": "typescript",
"purpose": "auto-registered new views in router"
}
],
"autoFixResults": [
{
"command": "pnpm exec prettier --write --ignore-unknown apps/web/ai-previews/testpage-preview/src/views/TestPage.vue apps/web/ai-previews/testpage-preview/src/router/index.ts",
"cwd": "D:/work/venus",
"exitCode": 0,
"stdout": "",
"stderr": "",
"ok": true
},
{
"command": "pnpm exec eslint --fix apps/web/ai-previews/testpage-preview/src/views/TestPage.vue apps/web/ai-previews/testpage-preview/src/router/index.ts",
"cwd": "D:/work/venus",
"exitCode": 0,
"stdout": "",
"stderr": "",
"ok": true
}
],
"dependencyPlan": {
"needsDependencyChange": true,
"packages": [
"@vui/mobile"
],
"reason": "当前项目未安装 @vui/mobile,但根据规则移动端页面必须优先使用 @vui/mobile 组件体系(VSearch, VDropdownMenu, VNavBar 等),因此需要显式补齐依赖。"
},
"notes": [
"项目当前未安装 @vui/mobile,已在 dependencyPlan 中显式提出依赖补齐请求。",
"设计稿中的车辆图片使用了灰色占位符 div 还原布局结构,实际业务中需替换为真实图片组件或 img 标签。",
"VSearch 的 #action slot 用于渲染右侧蓝色的“搜索”文本按钮,若 @vui/mobile 版本不支持该 slot,可降级为 Vant 的 van-search 或外部 flex 布局拼接。"
],
"validationChecklist": [
"通过 lint 和 typecheck,无未定义变量或类型错误。",
"严格遵守 Vue SFC 格式规范:tab 缩进、双引号、分号、多行属性首属性同行。",
"未引入项目中不存在的组件 import,所有 @vui/mobile 组件均在声明的导出列表中。",
"未输出路由文件,遵循管线自动扫描注入规则。",
"页面级样式完整,包含渐变背景、卡片布局、间距和字体样式,不依赖外部壳层补丁。"
]
}
}
{
"summary": "基于 Figma 设计稿生成广联二手车移动端首页,包含顶部渐变搜索区、四列下拉筛选菜单以及车辆卡片列表与穿插的 Banner。优先使用 @vui/mobile 组件体系,并提出依赖补齐计划。",
"dependencyPlan": {
"needsDependencyChange": true,
"packages": [
"@vui/mobile"
],
"reason": "当前项目未安装 @vui/mobile,但根据规则移动端页面必须优先使用 @vui/mobile 组件体系(VSearch, VDropdownMenu, VNavBar 等),因此需要显式补齐依赖。"
},
"previewProject": {
"mustUseVenusCli": true,
"recommendedCommand": "pnpm venus create testpage-preview --template mobile --router --store --ui vant --eslint --no-install"
},
"files": [
{
"path": "src/views/TestPage.vue",
"language": "vue",
"purpose": "广联二手车移动端首页,包含搜索、筛选和车辆列表",
"content": "<template>\n\t<div class=\"test-page\">\n\t\t<div class=\"header-bg\">\n\t\t\t<VNavBar\n\t\t\t\ttitle=\"搜索\"\n\t\t\t\t:left-arrow=\"false\"\n\t\t\t/>\n\t\t\t<div class=\"search-bar\">\n\t\t\t\t<VSearch\n\t\t\t\t\tv-model=\"searchValue\"\n\t\t\t\t\tplaceholder=\"奥迪 AL6\"\n\t\t\t\t\tshape=\"round\"\n\t\t\t\t\tbackground=\"transparent\"\n\t\t\t\t>\n\t\t\t\t\t<template #action>\n\t\t\t\t\t\t<div class=\"search-action\">搜索</div>\n\t\t\t\t\t</template>\n\t\t\t\t</VSearch>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<VDropdownMenu>\n\t\t\t<VDropdownItem\n\t\t\t\tv-model=\"filterBrand\"\n\t\t\t\t:options=\"brandOptions\"\n\t\t\t\ttitle=\"品牌\"\n\t\t\t/>\n\t\t\t<VDropdownItem\n\t\t\t\tv-model=\"filterPrice\"\n\t\t\t\t:options=\"priceOptions\"\n\t\t\t\ttitle=\"车价\"\n\t\t\t/>\n\t\t\t<VDropdownItem\n\t\t\t\tv-model=\"filterCity\"\n\t\t\t\t:options=\"cityOptions\"\n\t\t\t\ttitle=\"城市\"\n\t\t\t/>\n\t\t\t<VDropdownItem\n\t\t\t\tv-model=\"filterMore\"\n\t\t\t\t:options=\"moreOptions\"\n\t\t\t\ttitle=\"筛选\"\n\t\t\t/>\n\t\t</VDropdownMenu>\n\n\t\t<div class=\"car-list\">\n\t\t\t<div class=\"car-card\">\n\t\t\t\t<div class=\"car-image\" />\n\t\t\t\t<div class=\"car-info\">\n\t\t\t\t\t<div class=\"car-title\">宝马3系 2020款 320Li M 运动套装</div>\n\t\t\t\t\t<div class=\"car-desc\">2021年|3.25万公里</div>\n\t\t\t\t\t<div class=\"car-tags\">\n\t\t\t\t\t\t<span class=\"tag\">免费延保</span>\n\t\t\t\t\t\t<span class=\"tag\">零次过户</span>\n\t\t\t\t\t\t<span class=\"tag\">车况透明</span>\n\t\t\t\t\t\t<span class=\"tag\">多人围观</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"car-price\">\n\t\t\t\t\t\t<span class=\"price-num\">7.80</span>\n\t\t\t\t\t\t<span class=\"price-unit\">万</span>\n\t\t\t\t\t\t<span class=\"price-label\">起拍</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"banner-card\">\n\t\t\t\t<div class=\"banner-title\">开启您的拍卖之旅</div>\n\t\t\t\t<div class=\"banner-desc\">让每一分钱都花得值</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"car-card\">\n\t\t\t\t<div class=\"car-image\" />\n\t\t\t\t<div class=\"car-info\">\n\t\t\t\t\t<div class=\"car-title\">雷克萨斯ES 2020款 300 h 卓越版</div>\n\t\t\t\t\t<div class=\"car-desc\">2020年|7.4万公里|国V</div>\n\t\t\t\t\t<div class=\"car-tags\">\n\t\t\t\t\t\t<span class=\"tag\">超过100人收藏</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"car-price\">\n\t\t\t\t\t\t<span class=\"price-num\">12.50</span>\n\t\t\t\t\t\t<span class=\"price-unit\">万</span>\n\t\t\t\t\t\t<span class=\"price-label\">起拍</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\n\nimport {\n\tVDropdownItem,\n\tVDropdownMenu,\n\tVNavBar,\n\tVSearch\n} from \"@vui/mobile\";\n\nconst searchValue = ref(\"3\");\nconst filterBrand = ref(\"\");\nconst filterPrice = ref(\"\");\nconst filterCity = ref(\"\");\nconst filterMore = ref(\"\");\n\nconst brandOptions = [\n\t{ text: \"全部品牌\", value: \"\" },\n\t{ text: \"宝马\", value: \"bmw\" },\n\t{ text: \"雷克萨斯\", value: \"lexus\" }\n];\n\nconst priceOptions = [\n\t{ text: \"全部车价\", value: \"\" },\n\t{ text: \"5万以下\", value: \"0-5\" },\n\t{ text: \"5-10万\", value: \"5-10\" }\n];\n\nconst cityOptions = [\n\t{ text: \"全部城市\", value: \"\" },\n\t{ text: \"北京\", value: \"bj\" },\n\t{ text: \"上海\", value: \"sh\" }\n];\n\nconst moreOptions = [\n\t{ text: \"综合排序\", value: \"default\" },\n\t{ text: \"最新发布\", value: \"new\" }\n];\n</script>\n\n<style scoped>\n.test-page {\n\tmin-height: 100vh;\n\tbackground-color: #f5f5f5;\n}\n\n.header-bg {\n\tbackground: linear-gradient(180deg, rgba(213, 228, 243, 1) 0%, rgba(255, 255, 255, 1) 100%);\n\tpadding-bottom: 12px;\n}\n\n.search-bar {\n\tpadding: 0 16px;\n}\n\n.search-action {\n\tcolor: rgba(0, 127, 255, 1);\n\tfont-size: 14px;\n\tfont-weight: 400;\n\tpadding: 0 8px;\n}\n\n.car-list {\n\tpadding: 12px 16px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.car-card {\n\tdisplay: flex;\n\tbackground: #ffffff;\n\tborder-radius: 6px;\n\toverflow: hidden;\n\tpadding: 12px;\n\tgap: 12px;\n}\n\n.car-image {\n\twidth: 120px;\n\theight: 90px;\n\tbackground: #d8d8d8;\n\tborder-radius: 6px;\n\tflex-shrink: 0;\n}\n\n.car-info {\n\tflex: 1;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n}\n\n.car-title {\n\tfont-size: 14px;\n\tfont-weight: 500;\n\tcolor: #333333;\n\tline-height: 20px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.car-desc {\n\tfont-size: 12px;\n\tcolor: #828ca0;\n\tline-height: 16px;\n\tmargin-top: 4px;\n}\n\n.car-tags {\n\tdisplay: flex;\n\tgap: 6px;\n\tmargin-top: 8px;\n\tflex-wrap: wrap;\n}\n\n.tag {\n\tfont-size: 10px;\n\tcolor: #828ca0;\n\tborder: 1px solid #e0e0e0;\n\tborder-radius: 2px;\n\tpadding: 2px 4px;\n\tline-height: 14px;\n}\n\n.car-price {\n\tdisplay: flex;\n\talign-items: baseline;\n\tgap: 2px;\n\tmargin-top: 8px;\n}\n\n.price-num {\n\tfont-size: 20px;\n\tfont-weight: 600;\n\tcolor: #ff6600;\n\tline-height: 24px;\n}\n\n.price-unit {\n\tfont-size: 12px;\n\tcolor: #ff6600;\n}\n\n.price-label {\n\tfont-size: 12px;\n\tcolor: #828ca0;\n\tmargin-left: 4px;\n}\n\n.banner-card {\n\tbackground: linear-gradient(135deg, #e6f0fa 0%, #ffffff 100%);\n\tborder-radius: 6px;\n\tpadding: 16px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.banner-title {\n\tfont-size: 18px;\n\tfont-weight: 600;\n\tcolor: #141e34;\n\tline-height: 25px;\n}\n\n.banner-desc {\n\tfont-size: 12px;\n\tcolor: #828ca0;\n\tline-height: 16px;\n}\n</style>\n"
}
],
"notes": [
"项目当前未安装 @vui/mobile,已在 dependencyPlan 中显式提出依赖补齐请求。",
"设计稿中的车辆图片使用了灰色占位符 div 还原布局结构,实际业务中需替换为真实图片组件或 img 标签。",
"VSearch 的 #action slot 用于渲染右侧蓝色的“搜索”文本按钮,若 @vui/mobile 版本不支持该 slot,可降级为 Vant 的 van-search 或外部 flex 布局拼接。"
],
"validationChecklist": [
"通过 lint 和 typecheck,无未定义变量或类型错误。",
"严格遵守 Vue SFC 格式规范:tab 缩进、双引号、分号、多行属性首属性同行。",
"未引入项目中不存在的组件 import,所有 @vui/mobile 组件均在声明的导出列表中。",
"未输出路由文件,遵循管线自动扫描注入规则。",
"页面级样式完整,包含渐变背景、卡片布局、间距和字体样式,不依赖外部壳层补丁。"
]
}
{
"meta": {
"generator": "scripts/ai-direct-execute.mjs",
"generatedAt": "2026-06-03T09:04:37.352Z",
"bundleFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.ai-direct-context-bundle.json",
"previewFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.preview-project.json",
"responseFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.json"
},
"status": "failed",
"ruleErrors": [],
"ruleWarnings": [
"未检测到显式 UI 包 import;当前结果可能完全依赖全局注册或基础 DOM"
],
"styleErrors": [],
"styleWarnings": [],
"primaryDataErrors": [],
"primaryDataWarnings": [],
"visualSummaryErrors": [
"src/views/TestPage.vue: 未体现截图摘要中的主按钮文案 \"搜索\""
],
"visualSummaryWarnings": [
"src/views/TestPage.vue: 未检测到截图摘要中的标题 \"搜索\"",
"src/views/TestPage.vue: 筛选选择框数量不足,截图摘要期望至少 4 个,当前检测到 0 个",
"src/views/TestPage.vue: 未检测到截图摘要中的搜索标签 \"搜索\"",
"src/views/TestPage.vue: 表格列命中不足,截图摘要要求 2 列,当前命中 0 列"
],
"failedCommands": [],
"originalResponse": {
"summary": "生成了广联二手车移动端预览页面,包含顶部搜索、渐变背景 Banner、筛选栏和车辆卡片列表。优先使用 @vui/mobile 的 VSearch 组件,降级使用 Vant 的 van-icon 辅助筛选栏图标展示。",
"dependencyPlan": {
"needsDependencyChange": true,
"packages": [
"@vui/mobile"
],
"reason": "项目当前未安装 @vui/mobile,但规则要求 VUI 为第一顺位,需显式提出依赖补齐以使用 VSearch 等移动端组件。"
},
"previewProject": {
"mustUseVenusCli": true,
"recommendedCommand": "pnpm venus create testpage-preview --template mobile --router --store --ui vant --eslint --no-install"
},
"files": [
{
"path": "src/views/TestPage.vue",
"language": "vue",
"purpose": "广联二手车移动端主页面,包含搜索、Banner、筛选和车辆列表",
"content": "<script setup lang=\"ts\">\nimport { ref } from \"vue\";\n\nimport { VSearch } from \"@vui/mobile\";\n\nconst searchValue = ref(\"\");\n\ninterface CarItem {\n\tid: number;\n\ttitle: string;\n\tdesc: string;\n\ttags: string[];\n\tprice: string;\n\timage: string;\n}\n\nconst carList = ref<CarItem[]>([\n\t{\n\t\tid: 1,\n\t\ttitle: \"宝马3系 2020款 320Li M 运动套装\",\n\t\tdesc: \"2021年|3.25万公里\",\n\t\ttags: [\"免费延保\", \"零次过户\", \"车况透明\", \"多人围观\"],\n\t\tprice: \"7.80\",\n\t\timage: \"https://via.placeholder.com/150x110/eeeeee/999999?text=BMW\",\n\t},\n\t{\n\t\tid: 2,\n\t\ttitle: \"雷克萨斯ES 2020款 300 h 卓越版\",\n\t\tdesc: \"2020年|7.4万公里|国V\",\n\t\ttags: [\"超过100人收藏\"],\n\t\tprice: \"12.50\",\n\t\timage: \"https://via.placeholder.com/150x110/eeeeee/999999?text=Lexus\",\n\t},\n]);\n</script>\n\n<template>\n\t<div class=\"page-container\">\n\t\t<div class=\"search-header\">\n\t\t\t<VSearch\n\t\t\t\tv-model=\"searchValue\"\n\t\t\t\tplaceholder=\"奥迪 AL6\"\n\t\t\t\tshape=\"round\"\n\t\t\t/>\n\t\t</div>\n\n\t\t<div class=\"banner-section\">\n\t\t\t<div class=\"banner-bg\"></div>\n\t\t\t<div class=\"banner-content\">\n\t\t\t\t<div class=\"banner-title\">开启您的拍卖之旅</div>\n\t\t\t\t<div class=\"banner-subtitle\">让每一分钱都花得值</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"filter-bar\">\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<span>品牌</span>\n\t\t\t\t<van-icon name=\"arrow-down\" />\n\t\t\t</div>\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<span>车价</span>\n\t\t\t\t<van-icon name=\"arrow-down\" />\n\t\t\t</div>\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<span>城市</span>\n\t\t\t\t<van-icon name=\"arrow-down\" />\n\t\t\t</div>\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<van-icon name=\"filter-o\" />\n\t\t\t\t<span>筛选</span>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"car-list\">\n\t\t\t<div\n\t\t\t\tv-for=\"car in carList\"\n\t\t\t\t:key=\"car.id\"\n\t\t\t\tclass=\"car-card\"\n\t\t\t>\n\t\t\t\t<div class=\"car-image\">\n\t\t\t\t\t<img\n\t\t\t\t\t\t:src=\"car.image\"\n\t\t\t\t\t\talt=\"car\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"car-info\">\n\t\t\t\t\t<div class=\"car-title\">{{ car.title }}</div>\n\t\t\t\t\t<div class=\"car-desc\">{{ car.desc }}</div>\n\t\t\t\t\t<div class=\"car-tags\">\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tv-for=\"tag in car.tags\"\n\t\t\t\t\t\t\t:key=\"tag\"\n\t\t\t\t\t\t\tclass=\"car-tag\"\n\t\t\t\t\t\t>{{ tag }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"car-price\">\n\t\t\t\t\t\t<span class=\"price-value\">{{ car.price }}</span>\n\t\t\t\t\t\t<span class=\"price-unit\">万</span>\n\t\t\t\t\t\t<span class=\"price-label\">起拍</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<style scoped>\n.page-container {\n\tmin-height: 100vh;\n\tbackground-color: #f5f7fa;\n\tfont-family: \"PingFang SC\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n\tpadding-bottom: 20px;\n}\n\n.search-header {\n\tpadding: 12px 16px;\n\tbackground-color: #ffffff;\n}\n\n.banner-section {\n\tposition: relative;\n\tmargin: 12px 16px;\n\theight: 100px;\n\tborder-radius: 8px;\n\toverflow: hidden;\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 0 20px;\n}\n\n.banner-bg {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: linear-gradient(135deg, rgba(213, 228, 243, 1) 0%, rgba(136, 209, 255, 1) 100%);\n\tfilter: blur(20px);\n\tz-index: 0;\n}\n\n.banner-content {\n\tposition: relative;\n\tz-index: 1;\n}\n\n.banner-title {\n\tfont-size: 18px;\n\tfont-weight: 600;\n\tcolor: rgba(20, 30, 52, 1);\n\tline-height: 25.2px;\n\tmargin-bottom: 4px;\n}\n\n.banner-subtitle {\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: rgba(130, 140, 160, 1);\n\tline-height: 16.8px;\n}\n\n.filter-bar {\n\tdisplay: flex;\n\tjustify-content: space-around;\n\talign-items: center;\n\tbackground-color: #ffffff;\n\tpadding: 12px 16px;\n\tmargin-bottom: 12px;\n\tborder-bottom: 1px solid #f0f0f0;\n}\n\n.filter-item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 4px;\n\tfont-size: 14px;\n\tcolor: rgba(51, 51, 51, 1);\n}\n\n.car-list {\n\tpadding: 0 16px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.car-card {\n\tdisplay: flex;\n\tbackground-color: #ffffff;\n\tborder-radius: 8px;\n\toverflow: hidden;\n\tpadding: 12px;\n\tgap: 12px;\n\tbox-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);\n}\n\n.car-image {\n\twidth: 120px;\n\theight: 90px;\n\tflex-shrink: 0;\n\tborder-radius: 6px;\n\toverflow: hidden;\n\tbackground-color: #f0f0f0;\n}\n\n.car-image img {\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n}\n\n.car-info {\n\tflex: 1;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tmin-width: 0;\n}\n\n.car-title {\n\tfont-size: 15px;\n\tfont-weight: 500;\n\tcolor: #333333;\n\tline-height: 20px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.car-desc {\n\tfont-size: 12px;\n\tcolor: #999999;\n\tline-height: 16px;\n\tmargin-top: 4px;\n}\n\n.car-tags {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n\tmargin-top: 8px;\n}\n\n.car-tag {\n\tfont-size: 10px;\n\tcolor: #007fff;\n\tbackground-color: rgba(0, 127, 255, 0.1);\n\tpadding: 2px 6px;\n\tborder-radius: 4px;\n\tline-height: 14px;\n}\n\n.car-price {\n\tdisplay: flex;\n\talign-items: baseline;\n\tmargin-top: 8px;\n}\n\n.price-value {\n\tfont-size: 20px;\n\tfont-weight: 600;\n\tcolor: #ff4d4f;\n\tline-height: 24px;\n}\n\n.price-unit {\n\tfont-size: 12px;\n\tcolor: #ff4d4f;\n\tmargin-left: 2px;\n}\n\n.price-label {\n\tfont-size: 12px;\n\tcolor: #999999;\n\tmargin-left: 8px;\n}\n</style>\n"
}
],
"notes": [
"项目当前未安装 @vui/mobile,已在 dependencyPlan 中显式提出依赖补齐。",
"筛选栏使用了 Vant 的 van-icon 组件作为降级补充,因为 @vui/mobile 当前可见导出中未包含专门的 Icon 组件。",
"页面级样式已完整包含在 <style scoped> 中,忠实还原了 Figma 设计稿中的渐变背景、模糊效果、卡片圆角和文字颜色。",
"预览项目需通过 Venus CLI 创建骨架,生成后请将 TestPage.vue 注册到路由中以便预览。"
],
"validationChecklist": [
"通过 lint、typecheck、template contract、review trigger 和 fitness 等根级质量门禁。",
"未引入项目中不存在的组件 import(@vui/mobile 在 dependencyPlan 中补齐,van-icon 由 CLI 模板自带)。",
"未绕过项目现有路由、目录和命名约定。",
"优先满足 VUI 第一顺位(VSearch)与按框架降级(van-icon)的规则。",
"预览项目基于 Venus CLI 生成的项目结构。",
"预览页面自带完整容器、间距、尺寸和必要样式,不依赖模板演示壳层。"
]
}
}
# AI Repair Request
- Project: `@venus/allocationconfirmation-preview`
- Framework: `vue`
- Preferred VUI: `@vui/mobile`
## Fix Targets
- Visual Summary Error: src/views/TestPage.vue: 未体现截图摘要中的主按钮文案 "搜索"
- Rule Warning: 未检测到显式 UI 包 import;当前结果可能完全依赖全局注册或基础 DOM
- Visual Summary Warning: src/views/TestPage.vue: 未检测到截图摘要中的标题 "搜索"
- Visual Summary Warning: src/views/TestPage.vue: 筛选选择框数量不足,截图摘要期望至少 4 个,当前检测到 0 个
- Visual Summary Warning: src/views/TestPage.vue: 未检测到截图摘要中的搜索标签 "搜索"
- Visual Summary Warning: src/views/TestPage.vue: 表格列命中不足,截图摘要要求 2 列,当前命中 0 列
## Original Response
```json
{
"summary": "生成了广联二手车移动端预览页面,包含顶部搜索、渐变背景 Banner、筛选栏和车辆卡片列表。优先使用 @vui/mobile 的 VSearch 组件,降级使用 Vant 的 van-icon 辅助筛选栏图标展示。",
"dependencyPlan": {
"needsDependencyChange": true,
"packages": [
"@vui/mobile"
],
"reason": "项目当前未安装 @vui/mobile,但规则要求 VUI 为第一顺位,需显式提出依赖补齐以使用 VSearch 等移动端组件。"
},
"previewProject": {
"mustUseVenusCli": true,
"recommendedCommand": "pnpm venus create testpage-preview --template mobile --router --store --ui vant --eslint --no-install"
},
"files": [
{
"path": "src/views/TestPage.vue",
"language": "vue",
"purpose": "广联二手车移动端主页面,包含搜索、Banner、筛选和车辆列表",
"content": "<script setup lang=\"ts\">\nimport { ref } from \"vue\";\n\nimport { VSearch } from \"@vui/mobile\";\n\nconst searchValue = ref(\"\");\n\ninterface CarItem {\n\tid: number;\n\ttitle: string;\n\tdesc: string;\n\ttags: string[];\n\tprice: string;\n\timage: string;\n}\n\nconst carList = ref<CarItem[]>([\n\t{\n\t\tid: 1,\n\t\ttitle: \"宝马3系 2020款 320Li M 运动套装\",\n\t\tdesc: \"2021年|3.25万公里\",\n\t\ttags: [\"免费延保\", \"零次过户\", \"车况透明\", \"多人围观\"],\n\t\tprice: \"7.80\",\n\t\timage: \"https://via.placeholder.com/150x110/eeeeee/999999?text=BMW\",\n\t},\n\t{\n\t\tid: 2,\n\t\ttitle: \"雷克萨斯ES 2020款 300 h 卓越版\",\n\t\tdesc: \"2020年|7.4万公里|国V\",\n\t\ttags: [\"超过100人收藏\"],\n\t\tprice: \"12.50\",\n\t\timage: \"https://via.placeholder.com/150x110/eeeeee/999999?text=Lexus\",\n\t},\n]);\n</script>\n\n<template>\n\t<div class=\"page-container\">\n\t\t<div class=\"search-header\">\n\t\t\t<VSearch\n\t\t\t\tv-model=\"searchValue\"\n\t\t\t\tplaceholder=\"奥迪 AL6\"\n\t\t\t\tshape=\"round\"\n\t\t\t/>\n\t\t</div>\n\n\t\t<div class=\"banner-section\">\n\t\t\t<div class=\"banner-bg\"></div>\n\t\t\t<div class=\"banner-content\">\n\t\t\t\t<div class=\"banner-title\">开启您的拍卖之旅</div>\n\t\t\t\t<div class=\"banner-subtitle\">让每一分钱都花得值</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"filter-bar\">\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<span>品牌</span>\n\t\t\t\t<van-icon name=\"arrow-down\" />\n\t\t\t</div>\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<span>车价</span>\n\t\t\t\t<van-icon name=\"arrow-down\" />\n\t\t\t</div>\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<span>城市</span>\n\t\t\t\t<van-icon name=\"arrow-down\" />\n\t\t\t</div>\n\t\t\t<div class=\"filter-item\">\n\t\t\t\t<van-icon name=\"filter-o\" />\n\t\t\t\t<span>筛选</span>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"car-list\">\n\t\t\t<div\n\t\t\t\tv-for=\"car in carList\"\n\t\t\t\t:key=\"car.id\"\n\t\t\t\tclass=\"car-card\"\n\t\t\t>\n\t\t\t\t<div class=\"car-image\">\n\t\t\t\t\t<img\n\t\t\t\t\t\t:src=\"car.image\"\n\t\t\t\t\t\talt=\"car\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"car-info\">\n\t\t\t\t\t<div class=\"car-title\">{{ car.title }}</div>\n\t\t\t\t\t<div class=\"car-desc\">{{ car.desc }}</div>\n\t\t\t\t\t<div class=\"car-tags\">\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tv-for=\"tag in car.tags\"\n\t\t\t\t\t\t\t:key=\"tag\"\n\t\t\t\t\t\t\tclass=\"car-tag\"\n\t\t\t\t\t\t>{{ tag }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"car-price\">\n\t\t\t\t\t\t<span class=\"price-value\">{{ car.price }}</span>\n\t\t\t\t\t\t<span class=\"price-unit\">万</span>\n\t\t\t\t\t\t<span class=\"price-label\">起拍</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<style scoped>\n.page-container {\n\tmin-height: 100vh;\n\tbackground-color: #f5f7fa;\n\tfont-family: \"PingFang SC\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n\tpadding-bottom: 20px;\n}\n\n.search-header {\n\tpadding: 12px 16px;\n\tbackground-color: #ffffff;\n}\n\n.banner-section {\n\tposition: relative;\n\tmargin: 12px 16px;\n\theight: 100px;\n\tborder-radius: 8px;\n\toverflow: hidden;\n\tdisplay: flex;\n\talign-items: center;\n\tpadding: 0 20px;\n}\n\n.banner-bg {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground: linear-gradient(135deg, rgba(213, 228, 243, 1) 0%, rgba(136, 209, 255, 1) 100%);\n\tfilter: blur(20px);\n\tz-index: 0;\n}\n\n.banner-content {\n\tposition: relative;\n\tz-index: 1;\n}\n\n.banner-title {\n\tfont-size: 18px;\n\tfont-weight: 600;\n\tcolor: rgba(20, 30, 52, 1);\n\tline-height: 25.2px;\n\tmargin-bottom: 4px;\n}\n\n.banner-subtitle {\n\tfont-size: 12px;\n\tfont-weight: 400;\n\tcolor: rgba(130, 140, 160, 1);\n\tline-height: 16.8px;\n}\n\n.filter-bar {\n\tdisplay: flex;\n\tjustify-content: space-around;\n\talign-items: center;\n\tbackground-color: #ffffff;\n\tpadding: 12px 16px;\n\tmargin-bottom: 12px;\n\tborder-bottom: 1px solid #f0f0f0;\n}\n\n.filter-item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 4px;\n\tfont-size: 14px;\n\tcolor: rgba(51, 51, 51, 1);\n}\n\n.car-list {\n\tpadding: 0 16px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.car-card {\n\tdisplay: flex;\n\tbackground-color: #ffffff;\n\tborder-radius: 8px;\n\toverflow: hidden;\n\tpadding: 12px;\n\tgap: 12px;\n\tbox-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);\n}\n\n.car-image {\n\twidth: 120px;\n\theight: 90px;\n\tflex-shrink: 0;\n\tborder-radius: 6px;\n\toverflow: hidden;\n\tbackground-color: #f0f0f0;\n}\n\n.car-image img {\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n}\n\n.car-info {\n\tflex: 1;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tmin-width: 0;\n}\n\n.car-title {\n\tfont-size: 15px;\n\tfont-weight: 500;\n\tcolor: #333333;\n\tline-height: 20px;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.car-desc {\n\tfont-size: 12px;\n\tcolor: #999999;\n\tline-height: 16px;\n\tmargin-top: 4px;\n}\n\n.car-tags {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n\tmargin-top: 8px;\n}\n\n.car-tag {\n\tfont-size: 10px;\n\tcolor: #007fff;\n\tbackground-color: rgba(0, 127, 255, 0.1);\n\tpadding: 2px 6px;\n\tborder-radius: 4px;\n\tline-height: 14px;\n}\n\n.car-price {\n\tdisplay: flex;\n\talign-items: baseline;\n\tmargin-top: 8px;\n}\n\n.price-value {\n\tfont-size: 20px;\n\tfont-weight: 600;\n\tcolor: #ff4d4f;\n\tline-height: 24px;\n}\n\n.price-unit {\n\tfont-size: 12px;\n\tcolor: #ff4d4f;\n\tmargin-left: 2px;\n}\n\n.price-label {\n\tfont-size: 12px;\n\tcolor: #999999;\n\tmargin-left: 8px;\n}\n</style>\n"
}
],
"notes": [
"项目当前未安装 @vui/mobile,已在 dependencyPlan 中显式提出依赖补齐。",
"筛选栏使用了 Vant 的 van-icon 组件作为降级补充,因为 @vui/mobile 当前可见导出中未包含专门的 Icon 组件。",
"页面级样式已完整包含在 <style scoped> 中,忠实还原了 Figma 设计稿中的渐变背景、模糊效果、卡片圆角和文字颜色。",
"预览项目需通过 Venus CLI 创建骨架,生成后请将 TestPage.vue 注册到路由中以便预览。"
],
"validationChecklist": [
"通过 lint、typecheck、template contract、review trigger 和 fitness 等根级质量门禁。",
"未引入项目中不存在的组件 import(@vui/mobile 在 dependencyPlan 中补齐,van-icon 由 CLI 模板自带)。",
"未绕过项目现有路由、目录和命名约定。",
"优先满足 VUI 第一顺位(VSearch)与按框架降级(van-icon)的规则。",
"预览项目基于 Venus CLI 生成的项目结构。",
"预览页面自带完整容器、间距、尺寸和必要样式,不依赖模板演示壳层。"
]
}
```
## Instructions
- 保持 previewProject.mustUseVenusCli=true。
- 只修复失败项,不要引入新的 UI 包违规。
- 如果失败项来自 Figma 原始数据校验,优先保留 design context 中明确给出的标签、placeholder、列名和示例数据,不要让截图摘要覆盖这些文本事实。
- 如果失败项来自截图视觉摘要校验,优先修正标题、筛选标签、选择框数量、表格列、操作文案和分页布局,使页面与截图摘要一致。
- 如果失败项来自样式责任校验,直接在生成文件中补齐页面级样式,不要把布局或视觉修复转嫁给预览项目壳层。
- 输出完整结构化 JSON,沿用既定 response schema。
{
"meta": {
"generator": "scripts/ai-direct-repair-output.mjs",
"generatedAt": "2026-06-03T09:07:32.873Z",
"responseFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.json",
"previewFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.preview-project.json",
"messagesFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.messages.json",
"requestFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.repair-request.md",
"feedbackFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.repair-feedback.json",
"provider": "openai-compatible",
"model": "qwen3.7-max"
},
"status": "passed",
"validationFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.validation-result.json"
}
{ {
"meta": { "meta": {
"generator": "scripts/ai-direct-validate-output.mjs", "generator": "scripts/ai-direct-validate-output.mjs",
"generatedAt": "2026-06-02T04:32:58.568Z", "generatedAt": "2026-06-03T09:47:39.527Z",
"responseFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.provider-response.json", "responseFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.provider-response.json",
"previewFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.preview-project.json", "previewFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.preview-project.json",
"bundleFile": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix/.ai-direct/allocationmanagement/allocationmanagement.ai-direct-context-bundle.json" "bundleFile": "D:/work/venus/apps/web/ai-previews/allocationconfirmation-preview/.ai-direct/testpage/testpage.ai-direct-context-bundle.json"
}, },
"status": "passed", "status": "passed",
"files": [ "files": [
"apps/web/ai-previews/allocationmanagement-qwen-autofix/src/views/AllocationManagement.vue" "apps/web/ai-previews/testpage-preview/src/views/TestPage.vue"
], ],
"ruleValidation": { "ruleValidation": {
"errors": [], "errors": [],
"warnings": [] "warnings": [
"未检测到显式 UI 包 import;当前结果可能完全依赖全局注册或基础 DOM"
]
}, },
"styleValidation": { "styleValidation": {
"errors": [], "errors": [],
...@@ -24,11 +26,19 @@ ...@@ -24,11 +26,19 @@
}, },
"visualSummaryValidation": { "visualSummaryValidation": {
"errors": [], "errors": [],
"warnings": [
"src/views/TestPage.vue: 筛选选择框数量不足,截图摘要期望至少 4 个,当前检测到 0 个",
"src/views/TestPage.vue: 未检测到截图摘要中的搜索标签 \"Q 3\"",
"src/views/TestPage.vue: 表格列命中不足,截图摘要要求 4 列,当前命中 0 列"
]
},
"routerConsistencyValidation": {
"errors": [],
"warnings": [] "warnings": []
}, },
"commandResults": [ "commandResults": [
{ {
"command": "node scripts/lint-changed.mjs \"apps/web/ai-previews/allocationmanagement-qwen-autofix/src/views/AllocationManagement.vue\"", "command": "node scripts/lint-changed.mjs \"apps/web/ai-previews/testpage-preview/src/views/TestPage.vue\"",
"cwd": "D:/work/venus", "cwd": "D:/work/venus",
"exitCode": 0, "exitCode": 0,
"stdout": "Checking formatting...\nAll matched files use Prettier code style!\n[lint-changed] passed\n", "stdout": "Checking formatting...\nAll matched files use Prettier code style!\n[lint-changed] passed\n",
...@@ -36,7 +46,7 @@ ...@@ -36,7 +46,7 @@
"ok": true "ok": true
}, },
{ {
"command": "node scripts/review-trigger.mjs \"apps/web/ai-previews/allocationmanagement-qwen-autofix/src/views/AllocationManagement.vue\"", "command": "node scripts/review-trigger.mjs \"apps/web/ai-previews/testpage-preview/src/views/TestPage.vue\"",
"cwd": "D:/work/venus", "cwd": "D:/work/venus",
"exitCode": 0, "exitCode": 0,
"stdout": "[review-trigger] no high-risk files changed\n", "stdout": "[review-trigger] no high-risk files changed\n",
...@@ -44,7 +54,7 @@ ...@@ -44,7 +54,7 @@
"ok": true "ok": true
}, },
{ {
"command": "node scripts/check-file-budgets.mjs \"apps/web/ai-previews/allocationmanagement-qwen-autofix/src/views/AllocationManagement.vue\"", "command": "node scripts/check-file-budgets.mjs \"apps/web/ai-previews/testpage-preview/src/views/TestPage.vue\"",
"cwd": "D:/work/venus", "cwd": "D:/work/venus",
"exitCode": 0, "exitCode": 0,
"stdout": "[file-budget] passed\n", "stdout": "[file-budget] passed\n",
...@@ -53,11 +63,13 @@ ...@@ -53,11 +63,13 @@
}, },
{ {
"command": "pnpm run type-check", "command": "pnpm run type-check",
"cwd": "d:/work/venus/apps/web/ai-previews/allocationmanagement-qwen-autofix", "cwd": "D:/work/venus/apps/web/ai-previews/testpage-preview",
"exitCode": 0, "exitCode": 0,
"stdout": "\n> @venus/allocationmanagement-qwen-autofix@1.0.0 type-check D:\\work\\venus\\apps\\web\\ai-previews\\allocationmanagement-qwen-autofix\n> vue-tsc --noEmit\n\n", "stdout": "",
"stderr": "", "stderr": "",
"ok": true "ok": true,
"skipped": true,
"reason": "预览项目尚未安装依赖,跳过本地 type-check"
} }
] ]
} }
{
"layoutOrder": [
"filters",
"table"
],
"filterGroupLabels": [
"品牌",
"车价",
"城市",
"筛选"
],
"requiredSelectCount": 4,
"headerTitle": "搜索",
"searchLabel": "Q 3",
"primaryActionLabel": "搜索",
"tableColumns": [
"商品名称",
"年份/里程",
"标签",
"价格"
],
"actionColumnLabel": "收藏",
"actionLinkLabel": "",
"pagination": {
"present": false,
"containerAlignment": "",
"totalTextVisible": false,
"pageSizeSelectorVisible": false,
"jumperVisible": false,
"activePageStyle": ""
},
"style": {
"backgroundTone": "mixed",
"headerTone": "light-gray",
"primaryColor": "mixed"
},
"notes": [
"列表为卡片式布局,包含车辆图片、详细信息(名称、年份、里程、标签)和价格。",
"列表中间穿插了'开启您的拍卖之旅'的Banner广告。",
"顶部背景为浅蓝色渐变,搜索按钮为蓝色,价格和收藏图标为橙色。"
]
}
# Screenshot Visual Summary
- layoutOrder: filters -> table
- filterGroupLabels: 品牌, 车价, 城市, 筛选
- requiredSelectCount: 4
- headerTitle: 搜索
- searchLabel: Q 3
- primaryActionLabel: 搜索
- tableColumns: 商品名称, 年份/里程, 标签, 价格
- actionColumnLabel: 收藏
- actionLinkLabel: none
- pagination.present: false
- pagination.containerAlignment: none
- pagination.totalTextVisible: false
- pagination.pageSizeSelectorVisible: false
- pagination.jumperVisible: false
- pagination.activePageStyle: none
- style.backgroundTone: mixed
- style.headerTone: light-gray
- style.primaryColor: mixed
## Notes
- 列表为卡片式布局,包含车辆图片、详细信息(名称、年份、里程、标签)和价格。
- 列表中间穿插了'开启您的拍卖之旅'的Banner广告。
- 顶部背景为浅蓝色渐变,搜索按钮为蓝色,价格和收藏图标为橙色。
{ {
"name": "@venus/allocationmanagement-qwen-autofix", "name": "@venus/allocationconfirmation-preview",
"version": "1.0.0", "version": "1.0.0",
"description": "Vue3 微前端子应用模板,用于与 qiankun 基座集成", "description": "Vue3 微前端子应用模板,用于与 qiankun 基座集成",
"private": true, "private": true,
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
}, },
"dependencies": { "dependencies": {
"@vueuse/core": "catalog:", "@vueuse/core": "catalog:",
"@vui/vue": "workspace:*", "@vui/vue": "workspace:*",
"element-plus": "catalog:", "element-plus": "catalog:",
"pinia": "catalog:", "pinia": "catalog:",
"vue": "catalog:", "vue": "catalog:",
......
<template>
<div id="micro-app" class="micro-app-container">
<main class="app-main">
<router-view v-slot="{ Component }">
<transition mode="out-in" name="fade">
<component :is="Component" />
</transition>
</router-view>
</main>
</div>
</template>
<style scoped>
.micro-app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
background: #f5f7fa;
}
.app-main {
flex: 1;
padding: 24px;
}
/* 路由过渡动画 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
@media (max-width: 768px) {
.app-main {
padding: 16px;
}
}
</style>
...@@ -9,7 +9,9 @@ import { qiankunWindow, renderWithQiankun } from "vite-plugin-qiankun/dist/helpe ...@@ -9,7 +9,9 @@ import { qiankunWindow, renderWithQiankun } from "vite-plugin-qiankun/dist/helpe
import App from "./App.vue"; import App from "./App.vue";
import { createRouter } from "./router"; import { createRouter } from "./router";
import { setupUI } from "./ui";
import "element-plus/dist/index.css";
import "./style.css"; import "./style.css";
let app: null | VueApp<Element> = null; let app: null | VueApp<Element> = null;
...@@ -26,6 +28,7 @@ async function render(props: QiankunProps = {}) { ...@@ -26,6 +28,7 @@ async function render(props: QiankunProps = {}) {
// 配置 Pinia // 配置 Pinia
app.use(createPinia()); app.use(createPinia());
setupUI(app);
// 配置路由 - 根据是否在 qiankun 环境中使用不同的 base // 配置路由 - 根据是否在 qiankun 环境中使用不同的 base
const routerBase = qiankunWindow.__POWERED_BY_QIANKUN__ ? props.routerBase || "/subapp-vue" : "/"; const routerBase = qiankunWindow.__POWERED_BY_QIANKUN__ ? props.routerBase || "/subapp-vue" : "/";
......
...@@ -43,6 +43,23 @@ const routes: RouteRecordRaw[] = [ ...@@ -43,6 +43,23 @@ const routes: RouteRecordRaw[] = [
title: "通信示例", title: "通信示例",
}, },
}, },
{
path: "/allocation-confirmation",
name: "AllocationConfirmation",
component: () => import("@/views/AllocationConfirmation.vue"),
meta: {
title: "AllocationConfirmation",
},
},
{
path: "/allocation-confirmation",
name: "allocation-confirmation",
component: () => import("@/views/allocation-confirmation/index.vue"),
meta: {
title: "allocation-confirmation",
},
},
{ {
path: "/:pathMatch(.*)*", path: "/:pathMatch(.*)*",
name: "NotFound", name: "NotFound",
......
import type { App } from "vue"; import type { App } from "vue";
import { VButton, VDialog, VInput, VSelect, VTable } from "@vui/vue";
import ElementPlus from "element-plus"; import ElementPlus from "element-plus";
export function setupUI(app: App) { export function setupUI(app: App) {
app.use(ElementPlus); app.use(ElementPlus);
app.component("VButton", VButton);
app.component("VDialog", VDialog);
app.component("VInput", VInput);
app.component("VSelect", VSelect);
app.component("VTable", VTable);
} }
<script setup lang="ts">
import { ref } from "vue";
import { VTable } from "@vui/vue";
import { ElPagination } from "element-plus";
interface TableRow {
id: number;
index: number;
productName: string;
spec: string;
productCode: string;
series: string;
category: string;
rollNo: string;
}
const columns = [
{ key: "index", label: "序号", width: 80, align: "center" as const },
{ key: "productName", label: "商品名称", align: "left" as const },
{ key: "spec", label: "规格", align: "left" as const },
{ key: "productCode", label: "商品编码", align: "left" as const },
{ key: "series", label: "系列", align: "left" as const },
{ key: "category", label: "所属分类", align: "left" as const },
{ key: "rollNo", label: "膜卷号", align: "left" as const },
{ key: "action", label: "操作", width: 120, align: "center" as const }
];
const tableData = ref<TableRow[]>([
{ id: 1, index: 1, productName: "商品A", spec: "100x200", productCode: "SP001", series: "系列1", category: "分类1", rollNo: "MV001" },
{ id: 2, index: 2, productName: "商品B", spec: "150x250", productCode: "SP002", series: "系列2", category: "分类2", rollNo: "MV002" },
{ id: 3, index: 3, productName: "商品C", spec: "200x300", productCode: "SP003", series: "系列1", category: "分类1", rollNo: "MV003" },
{ id: 4, index: 4, productName: "商品D", spec: "120x220", productCode: "SP004", series: "系列3", category: "分类3", rollNo: "MV004" },
{ id: 5, index: 5, productName: "商品E", spec: "180x280", productCode: "SP005", series: "系列2", category: "分类2", rollNo: "MV005" },
{ id: 6, index: 6, productName: "商品F", spec: "160x260", productCode: "SP006", series: "系列1", category: "分类1", rollNo: "MV006" },
{ id: 7, index: 7, productName: "商品G", spec: "140x240", productCode: "SP007", series: "系列3", category: "分类3", rollNo: "MV007" },
{ id: 8, index: 8, productName: "商品H", spec: "190x290", productCode: "SP008", series: "系列2", category: "分类2", rollNo: "MV008" }
]);
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(8);
const handleCancel = (row: TableRow) => {
console.log("取消", row);
};
</script>
<template>
<div class="allocation-confirmation-page">
<div class="page-header">
<span class="page-title">调拨确认单</span>
</div>
<div class="table-container">
<VTable :columns="columns"
:data="tableData"
row-key="id"
stripe>
<template #actions="{ row }">
<a class="action-link"
@click="handleCancel(row as TableRow)">
取消
</a>
</template>
</VTable>
</div>
<div class="pagination-container">
<ElPagination v-model:current-page="currentPage"
v-model:page-size="pageSize"
layout="total, sizes, ->, prev, pager, next, jumper"
:page-sizes="[10, 20, 50, 100]"
:total="total" />
</div>
</div>
</template>
<style scoped>
.allocation-confirmation-page {
display: flex;
flex-direction: column;
gap: 16px;
padding: 20px;
background: #ffffff;
min-height: 100vh;
}
.page-header {
display: flex;
align-items: center;
padding: 12px 16px;
background: #f4f6fc;
border-radius: 4px;
}
.page-title {
color: #333333;
font-size: 16px;
font-weight: 500;
line-height: 24px;
}
.table-container {
width: 100%;
}
.table-container :deep(.v-table__header th),
.table-container :deep(.el-table__header th) {
background-color: #f4f6fc !important;
color: #333333;
font-weight: 500;
}
.pagination-container {
display: flex;
align-items: center;
padding: 16px 0;
}
.action-link {
color: #5850ff;
cursor: pointer;
font-size: 14px;
text-decoration: none;
}
.action-link:hover {
text-decoration: underline;
}
.pagination-container :deep(.el-pagination .el-pager li.is-active) {
background-color: #5850ff !important;
color: #ffffff !important;
border-radius: 2px !important;
}
</style>
<template>
<div class="allocation-confirmation-page">
<div class="page-header">
<span class="page-title">调拨确认单</span>
</div>
<div class="table-container">
<VTable :columns="columns"
:data="tableData"
row-key="id">
<template #actions="{ row }">
<VButton size="small"
type="primary"
@click="handleCancel(row)">
取消
</VButton>
</template>
</VTable>
<div class="pagination-container">
<ElPagination v-model:current-page="currentPage"
v-model:page-size="pageSize"
background
layout="total, sizes, prev, pager, next, jumper"
:page-sizes="[10, 20, 50, 100]"
:total="total" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { VButton, VTable } from "@vui/vue";
import { ElPagination } from "element-plus";
interface TableRow {
id: number;
index: number;
productName: string;
spec: string;
productCode: string;
series: string;
category: string;
membraneRollNo: string;
}
const columns: Array<{
align?: "center" | "left" | "right";
key: string;
label: string;
width?: number | string;
}> = [
{ key: "index", label: "序号", width: 80, align: "center" },
{ key: "productName", label: "商品名称", align: "left" },
{ key: "spec", label: "规格", align: "left" },
{ key: "productCode", label: "商品编码", align: "left" },
{ key: "series", label: "系列", align: "left" },
{ key: "category", label: "所属分类", align: "left" },
{ key: "membraneRollNo", label: "膜卷号", align: "left" },
{ key: "actions", label: "操作", width: 120, align: "center" }
];
const tableData: TableRow[] = [
{
id: 1,
index: 1,
productName: "反渗透膜元件",
spec: "8040",
productCode: "CODE1001",
series: "家用系列",
category: "膜组件",
membraneRollNo: "MR2001"
},
{
id: 2,
index: 2,
productName: "超滤膜组件",
spec: "1060",
productCode: "CODE1002",
series: "工业系列",
category: "膜组件",
membraneRollNo: "MR2002"
},
{
id: 3,
index: 3,
productName: "纳滤膜元件",
spec: "4040",
productCode: "CODE1003",
series: "商用系列",
category: "膜组件",
membraneRollNo: "MR2003"
},
{
id: 4,
index: 4,
productName: "反渗透膜元件",
spec: "8040",
productCode: "CODE1004",
series: "家用系列",
category: "膜组件",
membraneRollNo: "MR2004"
},
{
id: 5,
index: 5,
productName: "超滤膜组件",
spec: "1060",
productCode: "CODE1005",
series: "工业系列",
category: "膜组件",
membraneRollNo: "MR2005"
}
];
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(5);
const handleCancel = (row: TableRow) => {
console.log("取消调拨", row);
};
</script>
<style scoped>
.allocation-confirmation-page {
background: #ffffff;
padding: 20px;
display: flex;
flex-direction: column;
gap: 16px;
min-height: 100vh;
}
.page-header {
background: #f4f6fc;
padding: 16px;
border-radius: 4px;
}
.page-title {
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 24px;
}
.table-container {
display: flex;
flex-direction: column;
gap: 16px;
width: 100%;
}
.table-container :deep(th) {
background-color: #f4f6fc !important;
color: #333333 !important;
font-weight: 500 !important;
}
.pagination-container {
display: flex;
justify-content: flex-start;
padding: 16px 0;
}
.pagination-container :deep(.el-pagination.is-background .el-pager li) {
border-radius: 2px !important;
}
.pagination-container :deep(.el-pagination.is-background .el-pager li.is-active) {
background-color: #5850ff !important;
color: #ffffff !important;
border-radius: 2px !important;
}
</style>
<template>
<div class="allocation-confirmation-page">
<div class="page-header">
调拨确认单
</div>
<div class="table-container">
<VTable :columns="columns"
:data="tableData"
row-key="id">
<template #actions="{ row }">
<a class="action-link"
@click="handleCancel(row)">
取消
</a>
</template>
</VTable>
</div>
<ElPagination v-model:current-page="currentPage"
v-model:page-size="pageSize"
class="custom-pagination"
layout="total, sizes, prev, pager, next, jumper"
:page-sizes="[10, 20, 50, 100]"
:total="total" />
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { VTable } from "@vui/vue";
import { ElPagination } from "element-plus";
interface TableRow {
id: number;
index: number;
productName: string;
spec: string;
productCode: string;
series: string;
category: string;
transferStock: number;
rollNo: string;
}
interface TableColumn {
key: string;
label: string;
width?: number | string;
align?: "center" | "left" | "right";
}
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(8);
const columns: TableColumn[] = [
{ key: "index", label: "序号", width: 80, align: "center" },
{ key: "productName", label: "商品名称", align: "left" },
{ key: "spec", label: "规格", align: "left" },
{ key: "productCode", label: "商品编码", align: "left" },
{ key: "series", label: "系列", align: "left" },
{ key: "category", label: "所属分类", align: "left" },
{ key: "transferStock", label: "调拨库存", width: 120, align: "center" },
{ key: "rollNo", label: "膜卷号", align: "left" },
{ key: "actions", label: "操作", width: 100, align: "center" }
];
const tableData = ref<TableRow[]>(
Array.from({ length: 8 }, (_, i) => ({
id: i + 1,
index: i + 1,
productName: `商品名称${i + 1}`,
spec: `规格${i + 1}`,
productCode: `SP00${i + 1}`,
series: `系列${i + 1}`,
category: `分类${i + 1}`,
transferStock: 100 + i,
rollNo: `MV00${i + 1}`
}))
);
const handleCancel = (row: TableRow) => {
console.log("取消调拨", row);
};
</script>
<style scoped>
.allocation-confirmation-page {
display: flex;
flex-direction: column;
gap: 16px;
padding: 20px;
background: #fff;
min-height: 100vh;
}
.page-header {
font-size: 16px;
font-weight: 500;
color: #333;
line-height: 24px;
}
.table-container {
width: 100%;
}
.action-link {
color: #409eff;
cursor: pointer;
text-decoration: none;
}
.action-link:hover {
color: #66b1ff;
}
.custom-pagination {
margin-top: 16px;
display: flex;
justify-content: flex-start !important;
}
:deep(.v-table th),
:deep(.el-table th) {
background-color: #f4f6fc !important;
color: #333;
font-weight: 500;
}
:deep(.custom-pagination .el-pager li.is-active) {
background-color: #5850ff !important;
color: #fff !important;
border-radius: 2px !important;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div id="micro-app" class="micro-app-container">
<header class="app-header">
<h1>🚀 Vue3 微前端子应用</h1>
<nav class="nav-menu">
<router-link class="nav-link" to="/">
首页
</router-link>
<router-link class="nav-link" to="/about">
关于
</router-link>
<router-link class="nav-link" to="/communication">
通信示例
</router-link>
<router-link class="nav-link" to="/user">
用户管理
</router-link>
<router-link class="nav-link" to="/settings">
系统设置
</router-link>
</nav>
</header>
<main class="app-main">
<router-view v-slot="{ Component }">
<transition mode="out-in" name="fade">
<component :is="Component" />
</transition>
</router-view>
</main>
<footer class="app-footer">
<p>© 2025 Venus 微前端子应用模板</p>
</footer>
</div>
</template>
<script setup lang="ts">
import { onMounted } from "vue";
onMounted(() => {
console.log("Vue3 微应用已挂载");
});
</script>
<style scoped>
.micro-app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
color: white;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.app-header {
padding: 1.5rem 2rem;
background: rgb(255 255 255 / 10%);
border-bottom: 1px solid rgb(255 255 255 / 20%);
backdrop-filter: blur(10px);
}
.app-header h1 {
margin: 0 0 1rem;
font-size: 1.8rem;
font-weight: 600;
}
.nav-menu {
display: flex;
gap: 1.5rem;
}
.nav-link {
padding: 0.5rem 1rem;
color: white;
text-decoration: none;
background: rgb(255 255 255 / 10%);
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.nav-link:hover {
background: rgb(255 255 255 / 20%);
transform: translateY(-2px);
}
.nav-link.router-link-active {
font-weight: 600;
background: rgb(255 255 255 / 30%);
}
.app-main {
flex: 1;
padding: 2rem;
}
.app-footer {
padding: 1rem 2rem;
text-align: center;
background: rgb(0 0 0 / 20%);
border-top: 1px solid rgb(255 255 255 / 10%);
}
/* 路由过渡动画 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>
import type { RouteRecordRaw } from "vue-router";
import { createRouter, createWebHistory } from "vue-router";
const routes: RouteRecordRaw[] = [ { path: "/", component: () => import("./App.vue") } ];
export const router = createRouter({
history: createWebHistory(),
routes,
});
/* 全局样式 */
* {
box-sizing: border-box;
}
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
font-weight: 400;
line-height: 1.5;
color-scheme: light dark;
font-synthesis: none;
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html,
body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
body {
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
margin: 0;
}
#app {
width: 100%;
min-height: 100vh;
}
/* 滚动条样式 */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: rgb(255 255 255 / 10%);
}
::-webkit-scrollbar-thumb {
background: rgb(255 255 255 / 30%);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: rgb(255 255 255 / 50%);
}
/* 选中文本样式 */
::selection {
color: white;
background: rgb(255 255 255 / 30%);
}
/* 响应式 */
@media (max-width: 768px) {
body {
font-size: 14px;
}
}
<script setup lang="ts">
import { GLInput } from "@venus/common-ui-vue";
console.log(GLInput);
</script>
<template>
<div>broken</div>
</template>
# 寮€鍙戠幆澧冮厤缃?
# 搴旂敤鍩烘湰淇℃伅
VITE_APP_NAME=寰簲鐢ㄦā鏉?VITE_APP_VERSION=1.0.0
# 寰簲鐢ㄥ悕绉帮紙涓庡熀搴ч厤缃繚鎸佷竴鑷达級
VITE_MICRO_APP_NAME=subapp-vue
# 鏈嶅姟绔彛
VITE_PORT=8081
# API 鍩虹璺緞
VITE_API_BASE_URL=http://localhost:3000/api
VITE_API_TIMEOUT=30000
# 璺敱鍩虹璺緞
VITE_BASE_URL=/subapp-vue
VITE_ROUTER_BASE=/subapp-vue
# 寰簲鐢ㄨ闂矾寰?VITE_PUBLIC_PATH=http://localhost:8081/
# 鏄惁涓哄紑鍙戞ā寮?VITE_USE_DEV_MODE=true
# 鏄惁鍚敤Mock鏁版嵁
VITE_USE_MOCK=false
# 鏄惁鍚敤璋冭瘯妯″紡
VITE_DEBUG=true
# 鍩哄骇搴旂敤鍦板潃
VITE_MAIN_APP_URL=http://localhost:8080
# 鏂囦欢涓婁紶鍦板潃
VITE_UPLOAD_URL=http://localhost:3000/api/upload
# 寮€鍙戠幆澧冩爣璇?NODE_ENV=development
# 鐢熶骇鐜閰嶇疆
# 鐢熶骇鐜鍩虹璺緞
VITE_BASE_URL=/subapp-vue/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Auto-generated files
src/auto-imports.d.ts
src/components.d.ts
# **APP_NAME**
该项目由 Venus CLI 脚手架生成,使用 Vite + Vue 3 + TypeScript。
- 可选 ESLint:注入 `eslint.config.mjs`、`lint` 脚本,以及 `@venus/eslint-config`
// / <reference types="vite/client" />
declare module "*.vue" {
import type { DefineComponent } from "vue";
const component: DefineComponent<object, object, any>;
export default component;
}
// vue-router 类型声明(模板开发时使用,避免类型错误)
declare module "vue-router" {
export interface RouteMeta {
[key: string]: unknown;
title?: string;
}
export interface RouteLocationNormalized {
[key: string]: unknown;
meta: RouteMeta;
name?: null | string | symbol;
path: string;
}
export type NavigationGuardNext = (to?: false | string) => void;
export interface RouteRecordRaw {
[key: string]: unknown;
component?: unknown;
meta?: RouteMeta;
name?: string | symbol;
path: string;
}
export interface Router {
[key: string]: unknown;
afterEach(guard: (to: RouteLocationNormalized, from: RouteLocationNormalized) => void): () => void;
beforeEach(
guard: (to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => void,
): () => void;
}
export function createRouter(options: { history: unknown; routes: RouteRecordRaw[] }): Router;
export function createWebHistory(base?: string): unknown;
// 导出所有需要的类型
export type { NavigationGuardNext, RouteLocationNormalized, Router, RouteRecordRaw };
}
// qiankun 相关类型
declare global {
interface Window {
__INJECTED_PUBLIC_PATH_BY_QIANKUN__?: string;
__POWERED_BY_QIANKUN__?: boolean;
}
}
export {};
// @ts-check
// 模板文件在仓库内校验时不会自动拥有生成后项目的依赖图。
// eslint-disable-next-line n/no-extraneous-import
import { defineConfig } from "@venus/eslint-config";
export default defineConfig([
{
files: ["**/*.ts", "**/*.tsx", "**/*.vue"],
languageOptions: {
parserOptions: {
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: import.meta.dirname,
},
},
},
]);
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
<template>
<div id="micro-app" class="micro-app-container">
<header class="app-header">
<h1>🚀 Vue3 微前端子应用</h1>
<nav class="nav-menu">
<router-link class="nav-link" to="/">
首页
</router-link>
<router-link class="nav-link" to="/about">
关于
</router-link>
<router-link class="nav-link" to="/communication">
通信示例
</router-link>
<router-link class="nav-link" to="/user">
用户管理
</router-link>
<router-link class="nav-link" to="/settings">
系统设置
</router-link>
</nav>
</header>
<main class="app-main">
<router-view v-slot="{ Component }">
<transition mode="out-in" name="fade">
<component :is="Component" />
</transition>
</router-view>
</main>
<footer class="app-footer">
<p>© 2025 Venus 微前端子应用模板</p>
</footer>
</div>
</template>
<script setup lang="ts">
import { onMounted } from "vue";
onMounted(() => {
console.log("Vue3 微应用已挂载");
});
</script>
<style scoped>
.micro-app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
color: white;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.app-header {
padding: 1.5rem 2rem;
background: rgb(255 255 255 / 10%);
border-bottom: 1px solid rgb(255 255 255 / 20%);
backdrop-filter: blur(10px);
}
.app-header h1 {
margin: 0 0 1rem;
font-size: 1.8rem;
font-weight: 600;
}
.nav-menu {
display: flex;
gap: 1.5rem;
}
.nav-link {
padding: 0.5rem 1rem;
color: white;
text-decoration: none;
background: rgb(255 255 255 / 10%);
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.nav-link:hover {
background: rgb(255 255 255 / 20%);
transform: translateY(-2px);
}
.nav-link.router-link-active {
font-weight: 600;
background: rgb(255 255 255 / 30%);
}
.app-main {
flex: 1;
padding: 2rem;
}
.app-footer {
padding: 1rem 2rem;
text-align: center;
background: rgb(0 0 0 / 20%);
border-top: 1px solid rgb(255 255 255 / 10%);
}
/* 路由过渡动画 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>
import type { QiankunProps } from "vite-plugin-qiankun/dist/helper";
import type { App as VueApp } from "vue";
import { createApp } from "vue";
import { createPinia } from "pinia";
import { qiankunWindow, renderWithQiankun } from "vite-plugin-qiankun/dist/helper";
import App from "./App.vue";
import { createRouter } from "./router";
import "./style.css";
let app: null | VueApp<Element> = null;
let router: any = null;
/**
* 渲染函数
* @param props qiankun 传递的参数
*/
async function render(props: QiankunProps = {}) {
const { container } = props;
app = createApp(App);
// 配置 Pinia
app.use(createPinia());
// 配置路由 - 根据是否在 qiankun 环境中使用不同的 base
const routerBase = qiankunWindow.__POWERED_BY_QIANKUN__ ? props.routerBase || "/subapp-vue" : "/";
router = createRouter(routerBase);
app.use(router);
// 初始化通信管理器(仅在 qiankun 环境中)
if (qiankunWindow.__POWERED_BY_QIANKUN__ && props.onGlobalStateChange) {
const { subAppCommunication } = await import("./utils/communication");
subAppCommunication.init(props);
// 将通信管理器挂载到全局属性,方便组件使用
app.config.globalProperties.$communication = subAppCommunication;
}
// 挂载应用
const containerEl = container ? container.querySelector("#app") : document.querySelector("#app");
if (containerEl) {
app.mount(containerEl as Element);
} else {
console.error("[Vue3 微应用] 挂载容器未找到");
}
}
/**
* 独立运行时
* 直接访问子应用时,不是通过基座加载
*/
if (!qiankunWindow.__POWERED_BY_QIANKUN__) {
console.log("独立运行模式");
render();
}
/**
* qiankun 生命周期钩子 - bootstrap
* 只会在微应用初始化的时候调用一次,下次微应用重新进入时会直接调用 mount 钩子
*/
export async function bootstrap() {
console.log("[Vue3 微应用] bootstrap");
}
/**
* qiankun 生命周期钩子 - mount
* 应用每次进入都会调用 mount 方法,通常在这里触发应用的渲染方法
*/
export async function mount(props: QiankunProps) {
console.log("Vue3 微应用 mount", props);
render(props);
}
/**
* qiankun 生命周期钩子 - unmount
* 应用每次切出/卸载都会调用 unmount 方法
*/
export async function unmount(props: QiankunProps) {
console.log("[Vue3 微应用] unmount", props);
// 销毁通信管理器
if (qiankunWindow.__POWERED_BY_QIANKUN__) {
const { subAppCommunication } = await import("./utils/communication");
subAppCommunication.destroy();
}
if (app) {
app.unmount();
app = null;
}
if (router) {
router = null;
}
}
/**
* qiankun 生命周期钩子 - update (可选)
* 主应用向子应用下发新的props时触发
*/
export async function update(props: QiankunProps) {
console.log("[Vue3 微应用] update", props);
}
// 使用 vite-plugin-qiankun 提供的渲染函数
renderWithQiankun({
bootstrap,
mount,
unmount,
update,
});
import type { RouteRecordRaw } from "vue-router";
import { createRouter, createWebHistory } from "vue-router";
const routes: RouteRecordRaw[] = [ { path: "/", component: () => import("./App.vue") } ];
export const router = createRouter({
history: createWebHistory(),
routes,
});
import type { NavigationGuardNext, RouteLocationNormalized, Router, RouteRecordRaw } from "vue-router";
import { createRouter as _createRouter, createWebHistory } from "vue-router";
const routes: RouteRecordRaw[] = [
{
path: "/",
name: "Home",
component: () => import("@/views/Home.vue"),
meta: {
title: "首页",
},
},
{
path: "/about",
name: "About",
component: () => import("@/views/About.vue"),
meta: {
title: "关于",
},
},
{
path: "/user",
name: "User",
component: () => import("@/views/User.vue"),
meta: {
title: "用户管理",
},
},
{
path: "/settings",
name: "Settings",
component: () => import("@/views/Settings.vue"),
meta: {
title: "系统设置",
},
},
{
path: "/communication",
name: "Communication",
component: () => import("@/views/Communication.vue"),
meta: {
title: "通信示例",
},
},
{
path: "/:pathMatch(.*)*",
name: "NotFound",
component: () => import("@/views/NotFound.vue"),
},
];
/**
* 创建路由实例
* @param base 路由 base 路径
*/
export function createRouter(base: string = "/"): Router {
const router = _createRouter({
history: createWebHistory(base),
routes,
});
// 路由守卫
router.beforeEach((to: RouteLocationNormalized, _from: RouteLocationNormalized, next: NavigationGuardNext) => {
// 设置页面标题
if (to.meta.title) {
document.title = `${to.meta.title} - Vue3 微应用`;
}
next();
});
router.afterEach((to: RouteLocationNormalized, from: RouteLocationNormalized) => {
console.log("[Vue3 微应用] 路由切换:", from.path, "->", to.path);
});
return router;
}
import { createPinia } from "pinia";
export const pinia = createPinia();
/* 全局样式 */
* {
box-sizing: border-box;
}
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
font-weight: 400;
line-height: 1.5;
color-scheme: light dark;
font-synthesis: none;
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html,
body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
body {
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
margin: 0;
}
#app {
width: 100%;
min-height: 100vh;
}
/* 滚动条样式 */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: rgb(255 255 255 / 10%);
}
::-webkit-scrollbar-thumb {
background: rgb(255 255 255 / 30%);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: rgb(255 255 255 / 50%);
}
/* 选中文本样式 */
::selection {
color: white;
background: rgb(255 255 255 / 30%);
}
/* 响应式 */
@media (max-width: 768px) {
body {
font-size: 14px;
}
}
import type { App } from "vue";
import ElementPlus from "element-plus";
export function setupUI(app: App) {
app.use(ElementPlus);
}
import { onUnmounted } from "vue";
/**
* 全局状态接口定义(与基座保持一致)
*/
export interface GlobalState {
config: {
apiBaseUrl: string;
timeout: number;
};
notifications: Notification[];
theme: {
mode: "dark" | "light";
primaryColor: string;
};
user: null | {
avatar: string;
id: string;
name: string;
permissions: string[];
role: string;
};
}
/**
* 通知消息接口
*/
export interface Notification {
from?: string;
id: string;
message: string;
timestamp: number;
title: string;
type: "error" | "info" | "success" | "warning";
}
/**
* qiankun Props 类型定义
*/
export interface QiankunProps {
[key: string]: any;
container?: HTMLElement;
onGlobalStateChange?: (
callback: (state: GlobalState, prev: GlobalState) => void,
fireImmediately?: boolean,
) => void;
routerBase?: string;
setGlobalState?: (state: Partial<GlobalState>) => void;
}
/**
* 子应用通信管理器
*/
class SubAppCommunicationManager {
private currentState: GlobalState | null = null; // 缓存当前状态
private listeners: Array<(state: GlobalState, prev: GlobalState) => void> = [];
private props: null | QiankunProps = null;
private unsubscribe: (() => void) | null = null;
/**
* 销毁
*/
destroy() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
this.listeners = [];
this.props = null;
console.log("[子应用通信] 通信管理器已销毁");
}
/**
* 获取当前全局状态
*/
getCurrentState(): GlobalState | null {
return this.currentState;
}
/**
* 初始化通信管理器
* @param props qiankun 传递的 props
*/
init(props: QiankunProps) {
this.props = props;
// 监听全局状态变化
if (props.onGlobalStateChange) {
const unsubscribeFn = props.onGlobalStateChange(
(state: GlobalState, prev: GlobalState) => {
console.log("[子应用通信] 全局状态变化:", state, prev);
// 缓存当前状态
this.currentState = state;
// 触发所有监听器
this.listeners.forEach((listener) => {
listener(state, prev);
});
},
true, // 立即触发,获取当前状态 - 这确保了微应用一加载就能获取主应用的数据
);
// 只在返回值是函数时才赋值
if (typeof unsubscribeFn === "function") {
this.unsubscribe = unsubscribeFn;
}
}
}
/**
* 监听全局状态变化
* @param callback 回调函数
* @returns 取消监听的函数
*/
onStateChange(callback: (state: GlobalState, prev: GlobalState) => void): () => void {
this.listeners.push(callback);
// 如果已经有缓存的状态,立即调用一次回调
if (this.currentState) {
console.log("[子应用通信] 立即触发回调,使用缓存的全局状态");
callback(this.currentState, {} as GlobalState);
}
return () => {
const index = this.listeners.indexOf(callback);
if (index !== -1) {
this.listeners.splice(index, 1);
}
};
}
/**
* 向基座发送通知
* @param notification 通知消息
*/
sendNotification(notification: Omit<Notification, "id" | "timestamp">) {
if (!this.props?.setGlobalState) {
console.warn("[子应用通信] 无法发送通知,setGlobalState 方法不可用");
return;
}
// 获取当前通知列表(需要通过 props 或缓存获取)
// 这里简化处理,直接通过 state 添加
const newNotification: Notification = {
...notification,
id: Date.now().toString(),
timestamp: Date.now(),
from: notification.from || "Vue子应用",
};
// 通过修改全局状态来添加通知
// 注意:这里需要基座的 communication manager 来处理通知添加逻辑
// 所以我们实际上是触发一个状态变化,让基座来处理
this.setGlobalState({
notifications: [ newNotification ] as any, // 基座会合并到现有通知列表
});
}
/**
* 设置全局状态(向基座发送数据)
* @param state 要更新的状态
*/
setGlobalState(state: Partial<GlobalState>) {
if (this.props?.setGlobalState) {
this.props.setGlobalState(state);
console.log("[子应用通信] 全局状态已更新:", state);
} else {
console.warn("[子应用通信] setGlobalState 方法不可用");
}
}
}
// 导出单例
export const subAppCommunication = new SubAppCommunicationManager();
/**
* Vue 组合式 API - 使用全局状态
* @param callback 状态变化回调
*/
export function useGlobalState(callback: (state: GlobalState, prev: GlobalState) => void) {
const unsubscribe = subAppCommunication.onStateChange(callback);
// 在组件卸载时自动取消订阅
onUnmounted(() => {
unsubscribe();
});
return unsubscribe;
}
/**
* 便捷方法:发送通知到基座
*/
export function notify(type: Notification["type"], title: string, message: string) {
subAppCommunication.sendNotification({
type,
title,
message,
});
}
<template>
<div class="about-view">
<div class="content-card">
<h1>📖 关于本应用</h1>
<section class="section">
<h2>技术栈</h2>
<ul class="tech-list">
<li>
<strong>Vue 3</strong>
- 渐进式 JavaScript 框架
</li>
<li>
<strong>TypeScript</strong>
- 类型安全的 JavaScript 超集
</li>
<li>
<strong>Vite</strong>
- 新一代前端构建工具
</li>
<li>
<strong>Vue Router</strong>
- 官方路由管理器
</li>
<li>
<strong>Pinia</strong>
- 新一代状态管理库
</li>
<li>
<strong>qiankun</strong>
- 微前端框架
</li>
</ul>
</section>
<section class="section">
<h2>功能特性</h2>
<ul class="feature-list">
<li>✅ 支持独立运行和基座集成</li>
<li>✅ 完整的 TypeScript 支持</li>
<li>✅ 自动导入 API 和组件</li>
<li>✅ 热模块替换 (HMR)</li>
<li>✅ 路由懒加载</li>
<li>✅ CSS 样式隔离</li>
</ul>
</section>
<section class="section">
<h2>快速开始</h2>
<div class="code-block">
<pre>
<code>
# 安装依赖
pnpm install
# 启动开发服务器
pnpm dev
# 构建生产版本
pnpm build
</code>
</pre>
</div>
</section>
</div>
</div>
</template>
<script setup lang="ts">
// About 页面
</script>
<style scoped>
.about-view {
max-width: 900px;
margin: 0 auto;
}
.content-card {
padding: 2.5rem;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.content-card h1 {
margin: 0 0 2rem;
font-size: 2rem;
}
.section {
margin-bottom: 2rem;
}
.section h2 {
margin: 0 0 1rem;
font-size: 1.5rem;
color: rgb(255 255 255 / 95%);
}
.tech-list,
.feature-list {
padding: 0;
margin: 0;
list-style: none;
}
.tech-list li,
.feature-list li {
padding: 0.5rem 0;
line-height: 1.6;
opacity: 0.9;
}
.code-block {
padding: 1.5rem;
overflow-x: auto;
background: rgb(0 0 0 / 30%);
border: 1px solid rgb(255 255 255 / 10%);
border-radius: 0.5rem;
}
.code-block pre {
margin: 0;
font-family: "Courier New", monospace;
font-size: 0.9rem;
line-height: 1.6;
}
.code-block code {
color: #a8e6cf;
}
</style>
<template>
<div class="allocation-view">
<div class="page-header">
<h1>调拨管理</h1>
<p>这是用于验证 AI 落盘与 Venus 校验闭环的预览页面。</p>
</div>
<section class="panel">
<div class="panel-header">
<h2>筛选条件</h2>
<span class="panel-badge">Preview</span>
</div>
<div class="filter-grid">
<div class="filter-item">
<span class="filter-label">调出仓库</span>
<span class="filter-value">华东中心仓</span>
</div>
<div class="filter-item">
<span class="filter-label">调入仓库</span>
<span class="filter-value">华南中心仓</span>
</div>
<div class="filter-item">
<span class="filter-label">商品名称/系列</span>
<span class="filter-value">春季卫衣</span>
</div>
</div>
</section>
<section class="panel">
<div class="panel-header">
<h2>调拨结果</h2>
<span class="panel-badge">2 条记录</span>
</div>
<table class="result-table">
<thead>
<tr>
<th>商品编码</th>
<th>商品名称</th>
<th>调出仓库</th>
<th>调入仓库</th>
<th>调拨数量</th>
</tr>
</thead>
<tbody>
<tr>
<td>SKU-1001</td>
<td>春季卫衣</td>
<td>华东中心仓</td>
<td>华南中心仓</td>
<td>120</td>
</tr>
<tr>
<td>SKU-1002</td>
<td>牛仔长裤</td>
<td>华南中心仓</td>
<td>西南中心仓</td>
<td>80</td>
</tr>
</tbody>
</table>
</section>
</div>
</template>
<script setup lang="ts">
// Mock AI output for validation pipeline.
</script>
<style scoped>
.allocation-view {
display: grid;
gap: 16px;
padding: 24px;
}
.page-header {
display: grid;
gap: 4px;
}
.page-header h1 {
margin: 0;
font-size: 24px;
font-weight: 600;
}
.page-header p {
margin: 0;
color: #64748b;
}
.panel {
padding: 20px;
border: 1px solid #e2e8f0;
border-radius: 12px;
background: #ffffff;
}
.panel-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16px;
}
.panel-header h2 {
margin: 0;
font-size: 18px;
}
.panel-badge {
padding: 4px 10px;
border-radius: 999px;
background: #eff6ff;
color: #2563eb;
font-size: 12px;
}
.filter-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
}
.filter-item {
display: grid;
gap: 6px;
padding: 12px;
border-radius: 8px;
background: #f8fafc;
}
.filter-label {
font-size: 12px;
color: #64748b;
}
.filter-value {
font-weight: 600;
color: #0f172a;
}
.result-table {
width: 100%;
border-collapse: collapse;
}
.result-table th,
.result-table td {
padding: 12px;
border-bottom: 1px solid #e2e8f0;
text-align: left;
}
.result-table th {
color: #475569;
font-weight: 600;
background: #f8fafc;
}
</style>
<template>
<div class="notfound-view">
<div class="content-card">
<div class="error-code">
404
</div>
<h1>页面未找到</h1>
<p>抱歉,您访问的页面不存在或已被删除</p>
<button class="btn-home" @click="goHome">
🏠 返回首页
</button>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from "vue-router";
const router = useRouter();
const goHome = () => {
router.push("/");
};
</script>
<style scoped>
.notfound-view {
display: flex;
align-items: center;
justify-content: center;
max-width: 600px;
min-height: 400px;
margin: 0 auto;
}
.content-card {
padding: 3rem;
text-align: center;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.error-code {
margin-bottom: 1rem;
font-size: 6rem;
font-weight: 700;
background: linear-gradient(45deg, #fff, rgb(255 255 255 / 60%));
background-clip: text;
-webkit-text-fill-color: transparent;
}
.content-card h1 {
margin: 0 0 1rem;
font-size: 2rem;
}
.content-card p {
margin: 0 0 2rem;
opacity: 0.9;
}
.btn-home {
padding: 0.75rem 2rem;
font-size: 1rem;
font-weight: 600;
color: white;
cursor: pointer;
background: rgb(76 175 80 / 80%);
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-home:hover {
background: rgb(76 175 80 / 100%);
transform: translateY(-2px);
}
</style>
<template>
<div class="settings-view">
<div class="content-card">
<h1>⚙️ 系统设置</h1>
<div class="settings-grid">
<div class="setting-group">
<h2>🎨 主题设置</h2>
<div class="setting-item">
<label>主题色:</label>
<select v-model="settings.theme" class="select-input">
<option value="purple">
紫色
</option>
<option value="blue">
蓝色
</option>
<option value="green">
绿色
</option>
<option value="orange">
橙色
</option>
</select>
</div>
<div class="setting-item">
<label>暗黑模式:</label>
<input v-model="settings.darkMode"
class="checkbox-input"
type="checkbox" />
</div>
</div>
<div class="setting-group">
<h2>🔔 通知设置</h2>
<div class="setting-item">
<label>桌面通知:</label>
<input v-model="settings.notifications.desktop"
class="checkbox-input"
type="checkbox" />
</div>
<div class="setting-item">
<label>邮件通知:</label>
<input v-model="settings.notifications.email"
class="checkbox-input"
type="checkbox" />
</div>
<div class="setting-item">
<label>短信通知:</label>
<input v-model="settings.notifications.sms"
class="checkbox-input"
type="checkbox" />
</div>
</div>
<div class="setting-group">
<h2>🌐 语言设置</h2>
<div class="setting-item">
<label>界面语言:</label>
<select v-model="settings.language" class="select-input">
<option value="zh-CN">
简体中文
</option>
<option value="en-US">
English
</option>
<option value="ja-JP">
日本語
</option>
</select>
</div>
<div class="setting-item">
<label>时区:</label>
<select v-model="settings.timezone" class="select-input">
<option value="Asia/Shanghai">
北京时间 (UTC+8)
</option>
<option value="America/New_York">
纽约时间 (UTC-5)
</option>
<option value="Europe/London">
伦敦时间 (UTC+0)
</option>
</select>
</div>
</div>
<div class="setting-group">
<h2>🔒 安全设置</h2>
<div class="setting-item">
<label>双因素认证:</label>
<input v-model="settings.security.twoFactor"
class="checkbox-input"
type="checkbox" />
</div>
<div class="setting-item">
<label>会话超时 (分钟):</label>
<input v-model="settings.security.sessionTimeout"
class="number-input"
max="120"
min="5"
type="number" />
</div>
</div>
</div>
<div class="actions">
<button class="btn-save" @click="saveSettings">
💾 保存设置
</button>
<button class="btn-reset" @click="resetSettings">
🔄 重置默认
</button>
</div>
<div class="current-settings">
<h3>当前配置 (JSON)</h3>
<pre>{{ JSON.stringify(settings, null, 2) }}</pre>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { reactive } from "vue";
interface Settings {
darkMode: boolean;
language: string;
notifications: {
desktop: boolean;
email: boolean;
sms: boolean;
};
security: {
sessionTimeout: number;
twoFactor: boolean;
};
theme: string;
timezone: string;
}
const defaultSettings: Settings = {
theme: "purple",
darkMode: false,
notifications: {
desktop: true,
email: true,
sms: false,
},
language: "zh-CN",
timezone: "Asia/Shanghai",
security: {
twoFactor: false,
sessionTimeout: 30,
},
};
const settings = reactive<Settings>({ ...defaultSettings });
const saveSettings = () => {
console.log("保存设置:", settings);
// eslint-disable-next-line
alert("设置已保存!");
};
const resetSettings = () => {
// eslint-disable-next-line
if (confirm("确定要重置为默认设置吗?")) {
Object.assign(settings, defaultSettings);
// eslint-disable-next-line
alert("已重置为默认设置!");
}
};
</script>
<style scoped>
.settings-view {
max-width: 1200px;
margin: 0 auto;
}
.content-card {
padding: 2.5rem;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.content-card h1 {
margin: 0 0 2rem;
font-size: 2rem;
}
.settings-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-bottom: 2rem;
}
.setting-group {
padding: 1.5rem;
background: rgb(255 255 255 / 5%);
border: 1px solid rgb(255 255 255 / 10%);
border-radius: 0.75rem;
}
.setting-group h2 {
margin: 0 0 1rem;
font-size: 1.2rem;
color: rgb(255 255 255 / 95%);
}
.setting-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1rem;
}
.setting-item label {
font-weight: 500;
}
.select-input,
.number-input {
padding: 0.5rem;
font-size: 0.9rem;
color: white;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 0.5rem;
}
.number-input {
width: 80px;
}
.checkbox-input {
width: 20px;
height: 20px;
cursor: pointer;
}
.actions {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
}
.btn-save,
.btn-reset {
padding: 0.75rem 2rem;
font-weight: 600;
cursor: pointer;
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-save {
color: white;
background: rgb(76 175 80 / 80%);
}
.btn-save:hover {
background: rgb(76 175 80 / 100%);
transform: translateY(-2px);
}
.btn-reset {
color: white;
background: rgb(158 158 158 / 80%);
}
.btn-reset:hover {
background: rgb(158 158 158 / 100%);
transform: translateY(-2px);
}
.current-settings {
padding: 1.5rem;
background: rgb(0 0 0 / 30%);
border: 1px solid rgb(255 255 255 / 10%);
border-radius: 0.75rem;
}
.current-settings h3 {
margin: 0 0 1rem;
font-size: 1.1rem;
}
.current-settings pre {
margin: 0;
overflow-x: auto;
font-family: "Courier New", monospace;
font-size: 0.9rem;
line-height: 1.6;
color: #a8e6cf;
}
</style>
<template>
<div class="user-view">
<div class="content-card">
<h1>👥 用户管理</h1>
<div class="toolbar">
<button class="btn-add" @click="addUser">
➕ 新增用户
</button>
</div>
<div class="table-container">
<table class="user-table">
<thead>
<tr>
<th>ID</th>
<th>姓名</th>
<th>邮箱</th>
<th>角色</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="user in users" :key="user.id">
<td>{{ user.id }}</td>
<td>{{ user.name }}</td>
<td>{{ user.email }}</td>
<td>
<span class="badge" :class="`badge-${user.role}`">
{{ user.role }}
</span>
</td>
<td>
<span class="status" :class="user.active ? 'status-active' : 'status-inactive'">
{{ user.active ? "在线" : "离线" }}
</span>
</td>
<td>
<button class="btn-edit" @click="editUser(user)">
编辑
</button>
<button class="btn-delete" @click="deleteUser(user.id)">
删除
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
interface User {
active: boolean;
email: string;
id: number;
name: string;
role: "admin" | "guest" | "user";
}
const users = ref<User[]>([
{
id: 1,
name: "张三",
email: "zhangsan@example.com",
role: "admin",
active: true,
},
{
id: 2,
name: "李四",
email: "lisi@example.com",
role: "user",
active: true,
},
{
id: 3,
name: "王五",
email: "wangwu@example.com",
role: "user",
active: false,
},
{
id: 4,
name: "赵六",
email: "zhaoliu@example.com",
role: "guest",
active: true,
},
]);
const addUser = () => {
const newUser: User = {
id: users.value.length + 1,
name: `新用户${users.value.length + 1}`,
email: `user${users.value.length + 1}@example.com`,
role: "user",
active: true,
};
users.value.push(newUser);
};
const editUser = (user: User) => {
console.log("编辑用户:", user);
// eslint-disable-next-line
alert(`编辑用户: ${user.name}`);
};
const deleteUser = (id: number) => {
const index = users.value.findIndex((u) => u.id === id);
// eslint-disable-next-line
if (index !== -1 && confirm(`确定要删除用户 ${users.value[index].name} 吗?`)) {
users.value.splice(index, 1);
}
};
</script>
<style scoped>
.user-view {
max-width: 1200px;
margin: 0 auto;
}
.content-card {
padding: 2.5rem;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.content-card h1 {
margin: 0 0 1.5rem;
font-size: 2rem;
}
.toolbar {
margin-bottom: 1.5rem;
}
.btn-add {
padding: 0.75rem 1.5rem;
font-weight: 600;
color: white;
cursor: pointer;
background: rgb(76 175 80 / 80%);
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-add:hover {
background: rgb(76 175 80 / 100%);
transform: translateY(-2px);
}
.table-container {
overflow-x: auto;
}
.user-table {
width: 100%;
border-collapse: collapse;
}
.user-table thead {
background: rgb(255 255 255 / 10%);
}
.user-table th,
.user-table td {
padding: 1rem;
text-align: left;
border-bottom: 1px solid rgb(255 255 255 / 10%);
}
.user-table th {
font-weight: 600;
color: rgb(255 255 255 / 95%);
}
.user-table tbody tr {
transition: background 0.3s ease;
}
.user-table tbody tr:hover {
background: rgb(255 255 255 / 5%);
}
.badge {
padding: 0.25rem 0.75rem;
font-size: 0.85rem;
font-weight: 600;
border-radius: 1rem;
}
.badge-admin {
background: rgb(244 67 54 / 80%);
}
.badge-user {
background: rgb(33 150 243 / 80%);
}
.badge-guest {
background: rgb(158 158 158 / 80%);
}
.status {
padding: 0.25rem 0.75rem;
font-size: 0.85rem;
font-weight: 600;
border-radius: 1rem;
}
.status-active {
background: rgb(76 175 80 / 80%);
}
.status-inactive {
background: rgb(158 158 158 / 80%);
}
.btn-edit,
.btn-delete {
padding: 0.5rem 1rem;
margin-right: 0.5rem;
font-weight: 600;
cursor: pointer;
border: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.btn-edit {
color: white;
background: rgb(33 150 243 / 80%);
}
.btn-edit:hover {
background: rgb(33 150 243 / 100%);
}
.btn-delete {
color: white;
background: rgb(244 67 54 / 80%);
}
.btn-delete:hover {
background: rgb(244 67 54 / 100%);
}
</style>
# 寮€鍙戠幆澧冮厤缃?
# 搴旂敤鍩烘湰淇℃伅
VITE_APP_NAME=寰簲鐢ㄦā鏉?VITE_APP_VERSION=1.0.0
# 寰簲鐢ㄥ悕绉帮紙涓庡熀搴ч厤缃繚鎸佷竴鑷达級
VITE_MICRO_APP_NAME=subapp-vue
# 鏈嶅姟绔彛
VITE_PORT=8081
# API 鍩虹璺緞
VITE_API_BASE_URL=http://localhost:3000/api
VITE_API_TIMEOUT=30000
# 璺敱鍩虹璺緞
VITE_BASE_URL=/subapp-vue
VITE_ROUTER_BASE=/subapp-vue
# 寰簲鐢ㄨ闂矾寰?VITE_PUBLIC_PATH=http://localhost:8081/
# 鏄惁涓哄紑鍙戞ā寮?VITE_USE_DEV_MODE=true
# 鏄惁鍚敤Mock鏁版嵁
VITE_USE_MOCK=false
# 鏄惁鍚敤璋冭瘯妯″紡
VITE_DEBUG=true
# 鍩哄骇搴旂敤鍦板潃
VITE_MAIN_APP_URL=http://localhost:8080
# 鏂囦欢涓婁紶鍦板潃
VITE_UPLOAD_URL=http://localhost:3000/api/upload
# 寮€鍙戠幆澧冩爣璇?NODE_ENV=development
# 鐢熶骇鐜閰嶇疆
# 鐢熶骇鐜鍩虹璺緞
VITE_BASE_URL=/subapp-vue/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Auto-generated files
src/auto-imports.d.ts
src/components.d.ts
# **APP_NAME**
该项目由 Venus CLI 脚手架生成,使用 Vite + Vue 3 + TypeScript。
- 可选 ESLint:注入 `eslint.config.mjs`、`lint` 脚本,以及 `@venus/eslint-config`
// / <reference types="vite/client" />
declare module "*.vue" {
import type { DefineComponent } from "vue";
const component: DefineComponent<object, object, any>;
export default component;
}
// vue-router 类型声明(模板开发时使用,避免类型错误)
declare module "vue-router" {
export interface RouteMeta {
[key: string]: unknown;
title?: string;
}
export interface RouteLocationNormalized {
[key: string]: unknown;
meta: RouteMeta;
name?: null | string | symbol;
path: string;
}
export type NavigationGuardNext = (to?: false | string) => void;
export interface RouteRecordRaw {
[key: string]: unknown;
component?: unknown;
meta?: RouteMeta;
name?: string | symbol;
path: string;
}
export interface Router {
[key: string]: unknown;
afterEach(guard: (to: RouteLocationNormalized, from: RouteLocationNormalized) => void): () => void;
beforeEach(
guard: (to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext) => void,
): () => void;
}
export function createRouter(options: { history: unknown; routes: RouteRecordRaw[] }): Router;
export function createWebHistory(base?: string): unknown;
// 导出所有需要的类型
export type { NavigationGuardNext, RouteLocationNormalized, Router, RouteRecordRaw };
}
// qiankun 相关类型
declare global {
interface Window {
__INJECTED_PUBLIC_PATH_BY_QIANKUN__?: string;
__POWERED_BY_QIANKUN__?: boolean;
}
}
export {};
// @ts-check
// 模板文件在仓库内校验时不会自动拥有生成后项目的依赖图。
// eslint-disable-next-line n/no-extraneous-import
import { defineConfig } from "@venus/eslint-config";
export default defineConfig([
{
files: ["**/*.ts", "**/*.tsx", "**/*.vue"],
languageOptions: {
parserOptions: {
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: import.meta.dirname,
},
},
},
]);
{
"name": "@venus/allocationmanagement-loop-demo",
"version": "1.0.0",
"description": "Vue3 微前端子应用模板,用于与 qiankun 基座集成",
"private": true,
"type": "module",
"scripts": {
"dev": "vite --port 8081 --host",
"build": "vue-tsc && vite build",
"preview": "vite preview --port 8081",
"type-check": "vue-tsc --noEmit",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@vueuse/core": "catalog:",
"vue": "catalog:",
"vue-router": "catalog:",
"pinia": "catalog:",
"element-plus": "catalog:"
},
"devDependencies": {
"@types/node": "catalog:",
"@vitejs/plugin-vue": "catalog:",
"@vitejs/plugin-vue-jsx": "catalog:",
"typescript": "catalog:",
"unplugin-auto-import": "catalog:",
"unplugin-vue-components": "catalog:",
"vite": "catalog:",
"vite-plugin-qiankun": "catalog:",
"vue-tsc": "catalog:",
"@venus/eslint-config": "workspace:*",
"eslint": "catalog:"
}
}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
<template>
<div id="micro-app" class="micro-app-container">
<header class="app-header">
<h1>🚀 Vue3 微前端子应用</h1>
<nav class="nav-menu">
<router-link class="nav-link" to="/">
首页
</router-link>
<router-link class="nav-link" to="/about">
关于
</router-link>
<router-link class="nav-link" to="/communication">
通信示例
</router-link>
<router-link class="nav-link" to="/user">
用户管理
</router-link>
<router-link class="nav-link" to="/settings">
系统设置
</router-link>
</nav>
</header>
<main class="app-main">
<router-view v-slot="{ Component }">
<transition mode="out-in" name="fade">
<component :is="Component" />
</transition>
</router-view>
</main>
<footer class="app-footer">
<p>© 2025 Venus 微前端子应用模板</p>
</footer>
</div>
</template>
<script setup lang="ts">
import { onMounted } from "vue";
onMounted(() => {
console.log("Vue3 微应用已挂载");
});
</script>
<style scoped>
.micro-app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
color: white;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.app-header {
padding: 1.5rem 2rem;
background: rgb(255 255 255 / 10%);
border-bottom: 1px solid rgb(255 255 255 / 20%);
backdrop-filter: blur(10px);
}
.app-header h1 {
margin: 0 0 1rem;
font-size: 1.8rem;
font-weight: 600;
}
.nav-menu {
display: flex;
gap: 1.5rem;
}
.nav-link {
padding: 0.5rem 1rem;
color: white;
text-decoration: none;
background: rgb(255 255 255 / 10%);
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.nav-link:hover {
background: rgb(255 255 255 / 20%);
transform: translateY(-2px);
}
.nav-link.router-link-active {
font-weight: 600;
background: rgb(255 255 255 / 30%);
}
.app-main {
flex: 1;
padding: 2rem;
}
.app-footer {
padding: 1rem 2rem;
text-align: center;
background: rgb(0 0 0 / 20%);
border-top: 1px solid rgb(255 255 255 / 10%);
}
/* 路由过渡动画 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>
import type { QiankunProps } from "vite-plugin-qiankun/dist/helper";
import type { App as VueApp } from "vue";
import { createApp } from "vue";
import { createPinia } from "pinia";
import { qiankunWindow, renderWithQiankun } from "vite-plugin-qiankun/dist/helper";
import App from "./App.vue";
import { createRouter } from "./router";
import "./style.css";
let app: null | VueApp<Element> = null;
let router: any = null;
/**
* 渲染函数
* @param props qiankun 传递的参数
*/
async function render(props: QiankunProps = {}) {
const { container } = props;
app = createApp(App);
// 配置 Pinia
app.use(createPinia());
// 配置路由 - 根据是否在 qiankun 环境中使用不同的 base
const routerBase = qiankunWindow.__POWERED_BY_QIANKUN__ ? props.routerBase || "/subapp-vue" : "/";
router = createRouter(routerBase);
app.use(router);
// 初始化通信管理器(仅在 qiankun 环境中)
if (qiankunWindow.__POWERED_BY_QIANKUN__ && props.onGlobalStateChange) {
const { subAppCommunication } = await import("./utils/communication");
subAppCommunication.init(props);
// 将通信管理器挂载到全局属性,方便组件使用
app.config.globalProperties.$communication = subAppCommunication;
}
// 挂载应用
const containerEl = container ? container.querySelector("#app") : document.querySelector("#app");
if (containerEl) {
app.mount(containerEl as Element);
} else {
console.error("[Vue3 微应用] 挂载容器未找到");
}
}
/**
* 独立运行时
* 直接访问子应用时,不是通过基座加载
*/
if (!qiankunWindow.__POWERED_BY_QIANKUN__) {
console.log("独立运行模式");
render();
}
/**
* qiankun 生命周期钩子 - bootstrap
* 只会在微应用初始化的时候调用一次,下次微应用重新进入时会直接调用 mount 钩子
*/
export async function bootstrap() {
console.log("[Vue3 微应用] bootstrap");
}
/**
* qiankun 生命周期钩子 - mount
* 应用每次进入都会调用 mount 方法,通常在这里触发应用的渲染方法
*/
export async function mount(props: QiankunProps) {
console.log("Vue3 微应用 mount", props);
render(props);
}
/**
* qiankun 生命周期钩子 - unmount
* 应用每次切出/卸载都会调用 unmount 方法
*/
export async function unmount(props: QiankunProps) {
console.log("[Vue3 微应用] unmount", props);
// 销毁通信管理器
if (qiankunWindow.__POWERED_BY_QIANKUN__) {
const { subAppCommunication } = await import("./utils/communication");
subAppCommunication.destroy();
}
if (app) {
app.unmount();
app = null;
}
if (router) {
router = null;
}
}
/**
* qiankun 生命周期钩子 - update (可选)
* 主应用向子应用下发新的props时触发
*/
export async function update(props: QiankunProps) {
console.log("[Vue3 微应用] update", props);
}
// 使用 vite-plugin-qiankun 提供的渲染函数
renderWithQiankun({
bootstrap,
mount,
unmount,
update,
});
import type { RouteRecordRaw } from "vue-router";
import { createRouter, createWebHistory } from "vue-router";
const routes: RouteRecordRaw[] = [ { path: "/", component: () => import("./App.vue") } ];
export const router = createRouter({
history: createWebHistory(),
routes,
});
import type { NavigationGuardNext, RouteLocationNormalized, Router, RouteRecordRaw } from "vue-router";
import { createRouter as _createRouter, createWebHistory } from "vue-router";
const routes: RouteRecordRaw[] = [
{
path: "/",
name: "Home",
component: () => import("@/views/Home.vue"),
meta: {
title: "首页",
},
},
{
path: "/about",
name: "About",
component: () => import("@/views/About.vue"),
meta: {
title: "关于",
},
},
{
path: "/user",
name: "User",
component: () => import("@/views/User.vue"),
meta: {
title: "用户管理",
},
},
{
path: "/settings",
name: "Settings",
component: () => import("@/views/Settings.vue"),
meta: {
title: "系统设置",
},
},
{
path: "/communication",
name: "Communication",
component: () => import("@/views/Communication.vue"),
meta: {
title: "通信示例",
},
},
{
path: "/:pathMatch(.*)*",
name: "NotFound",
component: () => import("@/views/NotFound.vue"),
},
];
/**
* 创建路由实例
* @param base 路由 base 路径
*/
export function createRouter(base: string = "/"): Router {
const router = _createRouter({
history: createWebHistory(base),
routes,
});
// 路由守卫
router.beforeEach((to: RouteLocationNormalized, _from: RouteLocationNormalized, next: NavigationGuardNext) => {
// 设置页面标题
if (to.meta.title) {
document.title = `${to.meta.title} - Vue3 微应用`;
}
next();
});
router.afterEach((to: RouteLocationNormalized, from: RouteLocationNormalized) => {
console.log("[Vue3 微应用] 路由切换:", from.path, "->", to.path);
});
return router;
}
import { createPinia } from "pinia";
export const pinia = createPinia();
/* 全局样式 */
* {
box-sizing: border-box;
}
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
font-weight: 400;
line-height: 1.5;
color-scheme: light dark;
font-synthesis: none;
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
html,
body {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
body {
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
margin: 0;
}
#app {
width: 100%;
min-height: 100vh;
}
/* 滚动条样式 */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: rgb(255 255 255 / 10%);
}
::-webkit-scrollbar-thumb {
background: rgb(255 255 255 / 30%);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: rgb(255 255 255 / 50%);
}
/* 选中文本样式 */
::selection {
color: white;
background: rgb(255 255 255 / 30%);
}
/* 响应式 */
@media (max-width: 768px) {
body {
font-size: 14px;
}
}
import type { App } from "vue";
import ElementPlus from "element-plus";
export function setupUI(app: App) {
app.use(ElementPlus);
}
import { onUnmounted } from "vue";
/**
* 全局状态接口定义(与基座保持一致)
*/
export interface GlobalState {
config: {
apiBaseUrl: string;
timeout: number;
};
notifications: Notification[];
theme: {
mode: "dark" | "light";
primaryColor: string;
};
user: null | {
avatar: string;
id: string;
name: string;
permissions: string[];
role: string;
};
}
/**
* 通知消息接口
*/
export interface Notification {
from?: string;
id: string;
message: string;
timestamp: number;
title: string;
type: "error" | "info" | "success" | "warning";
}
/**
* qiankun Props 类型定义
*/
export interface QiankunProps {
[key: string]: any;
container?: HTMLElement;
onGlobalStateChange?: (
callback: (state: GlobalState, prev: GlobalState) => void,
fireImmediately?: boolean,
) => void;
routerBase?: string;
setGlobalState?: (state: Partial<GlobalState>) => void;
}
/**
* 子应用通信管理器
*/
class SubAppCommunicationManager {
private currentState: GlobalState | null = null; // 缓存当前状态
private listeners: Array<(state: GlobalState, prev: GlobalState) => void> = [];
private props: null | QiankunProps = null;
private unsubscribe: (() => void) | null = null;
/**
* 销毁
*/
destroy() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
this.listeners = [];
this.props = null;
console.log("[子应用通信] 通信管理器已销毁");
}
/**
* 获取当前全局状态
*/
getCurrentState(): GlobalState | null {
return this.currentState;
}
/**
* 初始化通信管理器
* @param props qiankun 传递的 props
*/
init(props: QiankunProps) {
this.props = props;
// 监听全局状态变化
if (props.onGlobalStateChange) {
const unsubscribeFn = props.onGlobalStateChange(
(state: GlobalState, prev: GlobalState) => {
console.log("[子应用通信] 全局状态变化:", state, prev);
// 缓存当前状态
this.currentState = state;
// 触发所有监听器
this.listeners.forEach((listener) => {
listener(state, prev);
});
},
true, // 立即触发,获取当前状态 - 这确保了微应用一加载就能获取主应用的数据
);
// 只在返回值是函数时才赋值
if (typeof unsubscribeFn === "function") {
this.unsubscribe = unsubscribeFn;
}
}
}
/**
* 监听全局状态变化
* @param callback 回调函数
* @returns 取消监听的函数
*/
onStateChange(callback: (state: GlobalState, prev: GlobalState) => void): () => void {
this.listeners.push(callback);
// 如果已经有缓存的状态,立即调用一次回调
if (this.currentState) {
console.log("[子应用通信] 立即触发回调,使用缓存的全局状态");
callback(this.currentState, {} as GlobalState);
}
return () => {
const index = this.listeners.indexOf(callback);
if (index !== -1) {
this.listeners.splice(index, 1);
}
};
}
/**
* 向基座发送通知
* @param notification 通知消息
*/
sendNotification(notification: Omit<Notification, "id" | "timestamp">) {
if (!this.props?.setGlobalState) {
console.warn("[子应用通信] 无法发送通知,setGlobalState 方法不可用");
return;
}
// 获取当前通知列表(需要通过 props 或缓存获取)
// 这里简化处理,直接通过 state 添加
const newNotification: Notification = {
...notification,
id: Date.now().toString(),
timestamp: Date.now(),
from: notification.from || "Vue子应用",
};
// 通过修改全局状态来添加通知
// 注意:这里需要基座的 communication manager 来处理通知添加逻辑
// 所以我们实际上是触发一个状态变化,让基座来处理
this.setGlobalState({
notifications: [ newNotification ] as any, // 基座会合并到现有通知列表
});
}
/**
* 设置全局状态(向基座发送数据)
* @param state 要更新的状态
*/
setGlobalState(state: Partial<GlobalState>) {
if (this.props?.setGlobalState) {
this.props.setGlobalState(state);
console.log("[子应用通信] 全局状态已更新:", state);
} else {
console.warn("[子应用通信] setGlobalState 方法不可用");
}
}
}
// 导出单例
export const subAppCommunication = new SubAppCommunicationManager();
/**
* Vue 组合式 API - 使用全局状态
* @param callback 状态变化回调
*/
export function useGlobalState(callback: (state: GlobalState, prev: GlobalState) => void) {
const unsubscribe = subAppCommunication.onStateChange(callback);
// 在组件卸载时自动取消订阅
onUnmounted(() => {
unsubscribe();
});
return unsubscribe;
}
/**
* 便捷方法:发送通知到基座
*/
export function notify(type: Notification["type"], title: string, message: string) {
subAppCommunication.sendNotification({
type,
title,
message,
});
}
<template>
<div class="about-view">
<div class="content-card">
<h1>📖 关于本应用</h1>
<section class="section">
<h2>技术栈</h2>
<ul class="tech-list">
<li>
<strong>Vue 3</strong>
- 渐进式 JavaScript 框架
</li>
<li>
<strong>TypeScript</strong>
- 类型安全的 JavaScript 超集
</li>
<li>
<strong>Vite</strong>
- 新一代前端构建工具
</li>
<li>
<strong>Vue Router</strong>
- 官方路由管理器
</li>
<li>
<strong>Pinia</strong>
- 新一代状态管理库
</li>
<li>
<strong>qiankun</strong>
- 微前端框架
</li>
</ul>
</section>
<section class="section">
<h2>功能特性</h2>
<ul class="feature-list">
<li>✅ 支持独立运行和基座集成</li>
<li>✅ 完整的 TypeScript 支持</li>
<li>✅ 自动导入 API 和组件</li>
<li>✅ 热模块替换 (HMR)</li>
<li>✅ 路由懒加载</li>
<li>✅ CSS 样式隔离</li>
</ul>
</section>
<section class="section">
<h2>快速开始</h2>
<div class="code-block">
<pre>
<code>
# 安装依赖
pnpm install
# 启动开发服务器
pnpm dev
# 构建生产版本
pnpm build
</code>
</pre>
</div>
</section>
</div>
</div>
</template>
<script setup lang="ts">
// About 页面
</script>
<style scoped>
.about-view {
max-width: 900px;
margin: 0 auto;
}
.content-card {
padding: 2.5rem;
background: rgb(255 255 255 / 10%);
border: 1px solid rgb(255 255 255 / 20%);
border-radius: 1rem;
backdrop-filter: blur(10px);
}
.content-card h1 {
margin: 0 0 2rem;
font-size: 2rem;
}
.section {
margin-bottom: 2rem;
}
.section h2 {
margin: 0 0 1rem;
font-size: 1.5rem;
color: rgb(255 255 255 / 95%);
}
.tech-list,
.feature-list {
padding: 0;
margin: 0;
list-style: none;
}
.tech-list li,
.feature-list li {
padding: 0.5rem 0;
line-height: 1.6;
opacity: 0.9;
}
.code-block {
padding: 1.5rem;
overflow-x: auto;
background: rgb(0 0 0 / 30%);
border: 1px solid rgb(255 255 255 / 10%);
border-radius: 0.5rem;
}
.code-block pre {
margin: 0;
font-family: "Courier New", monospace;
font-size: 0.9rem;
line-height: 1.6;
}
.code-block code {
color: #a8e6cf;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!