Commit 8d7d2cd9 by Lin

feat: 项目打包路径配置修改

1 parent 3430d919
{ {
"name": "@venus/venus-agentic-assisant", "name": "@venus/venus-agentic-assisant",
"version": "1.0.0", "version": "1.0.0",
"description": "汽车智能体",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --port 8081 --host", "dev": "vite --port 8081 --host",
"build": "vue-tsc && vite build", "build": "vue-tsc && vite build",
"postbuild": "node ../../../../scripts/copy-dist-to-root.mjs",
"preview": "vite preview --port 8081", "preview": "vite preview --port 8081",
"type-check": "vue-tsc --noEmit" "type-check": "vue-tsc --noEmit"
}, },
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
"@vitejs/plugin-vue-jsx": "catalog:", "@vitejs/plugin-vue-jsx": "catalog:",
"typescript": "catalog:", "typescript": "catalog:",
"unplugin-auto-import": "catalog:", "unplugin-auto-import": "catalog:",
"unplugin-element-plus": "catalog:",
"unplugin-vue-components": "catalog:", "unplugin-vue-components": "catalog:",
"vite": "catalog:", "vite": "catalog:",
"vite-plugin-qiankun": "catalog:", "vite-plugin-qiankun": "catalog:",
......
import type { QiankunProps } from 'vite-plugin-qiankun/dist/helper'; import type { QiankunProps } from 'vite-plugin-qiankun/dist/helper';
import zhCn from "element-plus/es/locale/lang/zh-cn"; import zhCn from "element-plus/es/locale/lang/zh-cn";
import type { App as VueApp } from 'vue'; import type { App as VueApp } from 'vue';
import './styles/element/index.scss';
import { createApp } from 'vue'; import { createApp } from 'vue';
import ElementPlus from 'element-plus'; import ElementPlus from 'element-plus';
import './styles/element/index.scss';
import { createPinia } from 'pinia'; import { createPinia } from 'pinia';
import { import {
qiankunWindow, qiankunWindow,
......
...@@ -201,7 +201,7 @@ const updateInspectionTemplate = async () => { ...@@ -201,7 +201,7 @@ const updateInspectionTemplate = async () => {
} }
const getCategoryWithMaterialList = async () => { const getCategoryWithMaterialList = async () => {
const res = await findCategoryWithMaterialList({}) const res = await findCategoryWithMaterialList({})
const data = res|| [] const data = res || []
// 将 data 格式化为 treeData 结构 // 将 data 格式化为 treeData 结构
treeData.value = data.map((item: any) => ({ treeData.value = data.map((item: any) => ({
id: item.id, id: item.id,
......
...@@ -14,10 +14,12 @@ const handleBreadcrumbClick = ( ...@@ -14,10 +14,12 @@ const handleBreadcrumbClick = (
index: number, index: number,
breadcrumbs: BreadcrumbItem[], breadcrumbs: BreadcrumbItem[],
) => { ) => {
console.log("handleBreadcrumbClick", crumb, index, breadcrumbs);
console.log("router", router);
// 只有非最后一项且有路径的面包屑项可以点击 // 只有非最后一项且有路径的面包屑项可以点击
if (crumb.path && index < breadcrumbs.length - 1) { // if (crumb.path && index < breadcrumbs.length - 1) {
router.push(crumb.path); // router.push(crumb.path);
} // }
}; };
</script> </script>
...@@ -56,13 +58,13 @@ const handleBreadcrumbClick = ( ...@@ -56,13 +58,13 @@ const handleBreadcrumbClick = (
.breadcrumb-item.clickable { .breadcrumb-item.clickable {
color: #969aa3; color: #969aa3;
cursor: pointer; cursor: default;
transition: color 0.3s; transition: color 0.3s;
} }
.breadcrumb-item.clickable:hover { /* .breadcrumb-item.clickable:hover {
color: #2f3133; color: #2f3133;
} } */
.breadcrumb-separator { .breadcrumb-separator {
margin: 0 8px; margin: 0 8px;
......
...@@ -111,6 +111,24 @@ const checkChildActive = (child: MenuItem): boolean => { ...@@ -111,6 +111,24 @@ const checkChildActive = (child: MenuItem): boolean => {
return false; return false;
}; };
// 递归检查菜单是否有可见的子菜单(考虑 hidden 属性)
const hasVisibleChildren = (menu: MenuItem): boolean => {
if (!menu.children || menu.children.length === 0) {
return false;
}
// 检查是否有任何非隐藏的子菜单
const visibleChildren = menu.children.filter((child) => !child.hidden);
if (visibleChildren.length === 0) {
return false;
}
// 递归检查:至少有一个可见的子菜单有可见的子菜单
// 如果所有可见子菜单都没有可见的子菜单(递归),则返回 false
return visibleChildren.some((child) => {
// 如果子菜单有可见的子菜单(递归检查),则返回 true
return hasVisibleChildren(child);
});
};
// 点击子菜单项 // 点击子菜单项
const handleChildClick = (child: MenuItem) => { const handleChildClick = (child: MenuItem) => {
emit('click', child); emit('click', child);
...@@ -222,7 +240,7 @@ const handleChildClick = (child: MenuItem) => { ...@@ -222,7 +240,7 @@ const handleChildClick = (child: MenuItem) => {
@click="handleChildClick(child)" @click="handleChildClick(child)"
> >
<span class="popover-menu-title">{{ child.title }}</span> <span class="popover-menu-title">{{ child.title }}</span>
<el-icon v-if="child.children && child.children.length > 0"> <el-icon v-if="hasVisibleChildren(child)">
<ArrowRight /> <ArrowRight />
</el-icon> </el-icon>
</div> </div>
......
...@@ -25,23 +25,14 @@ ...@@ -25,23 +25,14 @@
"build:filter": "node scripts/build/buildToRoot.mjs", "build:filter": "node scripts/build/buildToRoot.mjs",
"build:docs": "pnpm run build --filter=@venus/docs", "build:docs": "pnpm run build --filter=@venus/docs",
"changeset": "pnpm exec changeset", "changeset": "pnpm exec changeset",
"check": "pnpm run check:circular && pnpm run check:dep && pnpm run check:type && pnpm check:cspell",
"check:circular": "vsh check-circular",
"check:cspell": "cspell lint **/*.ts **/README.md .changeset/*.md --no-progress",
"check:dep": "vsh check-dep",
"check:type": "turbo run typecheck",
"clean": "node ./scripts/clean.mjs", "clean": "node ./scripts/clean.mjs",
"commit": "powershell -ExecutionPolicy Bypass -File ./scripts/commit.ps1", "commit": "powershell -ExecutionPolicy Bypass -File ./scripts/commit.ps1",
"format": "vsh lint --format",
"lint": "vsh lint",
"postinstall": "pnpm -r run stub --if-present", "postinstall": "pnpm -r run stub --if-present",
"prepare": "husky", "prepare": "husky",
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"preview": "turbo-run preview", "preview": "turbo-run preview",
"publint": "vsh publint", "publint": "vsh publint",
"reinstall": "pnpm clean --del-lock && pnpm install", "reinstall": "pnpm clean --del-lock && pnpm install",
"test:unit": "vitest run --dom",
"test:e2e": "turbo run test:e2e",
"update:deps": "npx taze -r -w", "update:deps": "npx taze -r -w",
"version": "pnpm exec changeset version && pnpm install --no-frozen-lockfile", "version": "pnpm exec changeset version && pnpm install --no-frozen-lockfile",
"catalog": "pnpx codemod pnpm/catalog", "catalog": "pnpx codemod pnpm/catalog",
......
/**
* 将当前项目的 dist 文件夹复制到 venus-pro 根目录的 dist 文件夹
* 用于 postbuild 钩子
*/
import { existsSync, rmSync, cpSync } from 'node:fs';
import { join, dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// 获取 venus-pro 项目根目录(scripts 的父目录)
const venusProRoot = resolve(__dirname, '..');
const rootDistDir = join(venusProRoot, 'dist');
// 获取当前包的工作目录
// pnpm 在执行 postbuild 时,工作目录就是包的目录
const packageDir = process.cwd();
const sourceDistDir = join(packageDir, 'dist');
if (!existsSync(sourceDistDir)) {
console.error(`❌ 构建产物不存在: ${sourceDistDir}`);
process.exit(1);
}
// 清理 venus-pro 根目录的 dist(如果存在)
if (existsSync(rootDistDir)) {
rmSync(rootDistDir, { recursive: true, force: true });
}
// 复制 dist 到 venus-pro 根目录的 dist 文件夹
cpSync(sourceDistDir, rootDistDir, { recursive: true });
console.log(`✅ 已将构建产物复制到 venus-pro 根目录: ${rootDistDir}`);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!