From 567b9d0519cfd5c709294b32fed4be69a6dd54b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8?= Date: Wed, 20 May 2026 13:42:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AF=BC=E8=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 18 + src/components/layout/Breadcrumb.vue | 15 +- src/components/layout/Header.vue | 119 ++-- src/components/layout/Layout.vue | 37 +- src/components/layout/Sidebar.vue | 26 +- src/components/layout/Tabs.vue | 798 ++++++++++++++++++--------- src/stores/modules/tabs.ts | 65 ++- 8 files changed, 734 insertions(+), 345 deletions(-) diff --git a/package.json b/package.json index f29f8fd..6cfc1e6 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "vue": "^3.5.29", "vue-i18n": "^11.4.2", "vue-router": "^5.0.3", + "vuedraggable": "^4.1.0", "xlsx": "^0.18.5" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 72d8224..71ab7f0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -65,6 +65,9 @@ importers: vue-router: specifier: ^5.0.3 version: 5.0.3(@vue/compiler-sfc@3.5.29)(pinia@3.0.4(typescript@5.9.3)(vue@3.5.29(typescript@5.9.3)))(vue@3.5.29(typescript@5.9.3)) + vuedraggable: + specifier: ^4.1.0 + version: 4.1.0(vue@3.5.29(typescript@5.9.3)) xlsx: specifier: ^0.18.5 version: 0.18.5 @@ -2398,6 +2401,9 @@ packages: resolution: {integrity: sha512-LJhUYUvItdQ0LkJTmPeaEObWXAqFyfmP85x0tch/ez9cahmhlBBLbIqDFnvBnUJGagb0JbIQrkBs1wJ+yRYpEw==} engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + sortablejs@1.14.0: + resolution: {integrity: sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==} + source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -2666,6 +2672,11 @@ packages: typescript: optional: true + vuedraggable@4.1.0: + resolution: {integrity: sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==} + peerDependencies: + vue: ^3.0.1 + webpack-virtual-modules@0.6.2: resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==} @@ -4957,6 +4968,8 @@ snapshots: ip-address: 10.2.0 smart-buffer: 4.2.0 + sortablejs@1.14.0: {} + source-map-js@1.2.1: {} speakingurl@14.0.1: {} @@ -5243,6 +5256,11 @@ snapshots: optionalDependencies: typescript: 5.9.3 + vuedraggable@4.1.0(vue@3.5.29(typescript@5.9.3)): + dependencies: + sortablejs: 1.14.0 + vue: 3.5.29(typescript@5.9.3) + webpack-virtual-modules@0.6.2: {} which-module@2.0.1: {} diff --git a/src/components/layout/Breadcrumb.vue b/src/components/layout/Breadcrumb.vue index 2b37086..fd466a8 100644 --- a/src/components/layout/Breadcrumb.vue +++ b/src/components/layout/Breadcrumb.vue @@ -28,16 +28,17 @@ const breadcrumbList = computed(() => tabsStore.currentBreadcr diff --git a/src/stores/modules/tabs.ts b/src/stores/modules/tabs.ts index d00b28c..e1395cf 100644 --- a/src/stores/modules/tabs.ts +++ b/src/stores/modules/tabs.ts @@ -41,35 +41,35 @@ export const useTabsStore = defineStore('tabs', () => { /** * 从菜单中查找当前路由的面包屑路径 + * 逻辑: + * - 第一个永远是一级菜单的名字 + * - 点击一级菜单会跳转到第一个二级菜单 */ const findBreadcrumbPath = (path: string): BreadcrumbItem[] => { const list: BreadcrumbItem[] = [] - // 添加首页 - list.push({ - title: '首页', - path: '/dashboard' - }) - - // 如果是首页,直接返回 + // 如果是首页,直接返回首页 if (path === '/dashboard') { + list.push({ + title: '首页', + path: '/dashboard' + }) return list } // 从菜单中查找当前路由的层级信息 - const findMenuPath = (menus: any[], targetPath: string, currentPath: any[] = []): any[] | null => { + const findMenuPath = (menus: any[], targetPath: string, parentMenu: any = null): any => { for (const menu of menus) { const menuPath = menu.path || menu.api || `/menu-${menu.id}` - const newPath = [...currentPath, menu] if (menuPath === targetPath) { - return newPath + return { current: menu, parent: parentMenu } } // 兼容 children 和 son 两种子菜单字段名 const subMenus = menu.children || menu.son if (subMenus && subMenus.length > 0) { - const result = findMenuPath(subMenus, targetPath, newPath) + const result = findMenuPath(subMenus, targetPath, menu) if (result) { return result } @@ -78,23 +78,41 @@ export const useTabsStore = defineStore('tabs', () => { return null } - const menuPath = findMenuPath(userStore.sideMenu, path) - console.log('menuPath:', menuPath); + const menuResult = findMenuPath(userStore.sideMenu, path) - if (menuPath) { - console.log('list:', menuPath) - menuPath.forEach((menu: any, index: number) => { - // 跳过第一个(首页已添加) - if (index === 0 && menu.label === '首页') { - return - } + if (menuResult) { + const { current, parent } = menuResult + + // 如果存在父级菜单(一级菜单) + if (parent) { + // 获取第一个二级菜单的路径 + const firstChildMenus = parent.children || parent.son + const firstChildPath = firstChildMenus && firstChildMenus.length > 0 + ? (firstChildMenus[0].path || firstChildMenus[0].api || `/menu-${firstChildMenus[0].id}`) + : parent.path || parent.api || `/menu-${parent.id}` + + // 第一个面包屑是一级菜单的名字,但点击跳转第一个二级菜单 list.push({ - title: menu.label, - path: menu.path || menu.api || `/menu-${menu.id}` + title: parent.label, + path: firstChildPath }) + } + + // 添加当前菜单(二级菜单) + list.push({ + title: current.label, + path: current.path || current.api || `/menu-${current.id}` }) } -; + + // 如果没有找到菜单信息,默认添加首页 + if (list.length === 0) { + list.push({ + title: '首页', + path: '/dashboard' + }) + } + return list } @@ -104,7 +122,6 @@ export const useTabsStore = defineStore('tabs', () => { const existIndex = tabs.value.findIndex(item => item.path === tab.path) // 计算面包屑路径 const breadcrumbs = findBreadcrumbPath(tab.path) - console.log('aaaaaaaaaaaaa:', breadcrumbs); if (existIndex === -1) { // 新标签页,添加到列表 From 5f739fae13ff7debf54b2d8b9c17e77de6bc6b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8?= Date: Wed, 20 May 2026 14:05:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BC=A0=E5=80=BC=E9=97=AE=E9=A2=98=E5=8F=8A?= =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91=E5=AF=BC=E8=88=AA=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Pagination.vue | 26 ++--------- src/components/layout/Breadcrumb.vue | 67 ++++++++++++++++++++++++---- src/components/layout/Tabs.vue | 6 +-- src/views/agent/user/index.vue | 3 +- src/views/capital/fundFlow/index.vue | 4 +- src/views/capital/withdraw/index.vue | 10 ++--- src/views/order/history/index.vue | 3 +- src/views/order/transfer/index.vue | 4 +- src/views/profile/agent/index.vue | 3 +- 9 files changed, 82 insertions(+), 44 deletions(-) diff --git a/src/components/common/Pagination.vue b/src/components/common/Pagination.vue index f03bf38..147df07 100644 --- a/src/components/common/Pagination.vue +++ b/src/components/common/Pagination.vue @@ -80,34 +80,16 @@ const pageSize = computed({ set: (val: number) => emit('update:pageSizeValue', val), }) -// 监听当前页变化,派发事件 -watch( - () => currentPage, - (newVal) => { - emit('update:modelValue', newVal) - emit('pagination-change', { currentPage: newVal, pageSize }) - }, -) - -// 监听每页条数变化,派发事件 -watch( - () => pageSize, - (newVal) => { - emit('update:pageSizeValue', newVal) - emit('pagination-change', { currentPage, pageSize: newVal }) - }, -) - -// 每页条数变更处理(兼容Element Plus原生事件) +// 每页条数变更处理 const handleSizeChange = (val: number) => { emit('update:pageSizeValue', val) - emit('pagination-change', { currentPage, pageSize: val }) + emit('pagination-change', { currentPage: currentPage.value, pageSize: val }) } -// 当前页变更处理(兼容Element Plus原生事件) +// 当前页变更处理 const handleCurrentChange = (val: number) => { emit('update:modelValue', val) - emit('pagination-change', { currentPage: val, pageSize }) + emit('pagination-change', { currentPage: val, pageSize: pageSize.value }) } diff --git a/src/components/layout/Breadcrumb.vue b/src/components/layout/Breadcrumb.vue index fd466a8..60f1cd7 100644 --- a/src/components/layout/Breadcrumb.vue +++ b/src/components/layout/Breadcrumb.vue @@ -13,17 +13,68 @@