From 7184f4c2ae8d0eac6c55a0764890d583b8398967 Mon Sep 17 00:00:00 2001 From: xiangcongshuai Date: Thu, 31 Jul 2025 13:47:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=BD=99=E4=BB=A3=E7=A0=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/modules/remaining.ts | 16 ---------- src/router/utils.ts | 55 ++------------------------------- src/views/AiLive/index.vue | 17 ++++++++++ src/views/login/index.vue | 3 -- 4 files changed, 19 insertions(+), 72 deletions(-) diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index b756684..432ab8d 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -74,21 +74,5 @@ export default [ children: [] } ] - }, - { - path: "/redirect", - component: Layout, - meta: { - title: "加载中...", - showLink: false, - rank: 102 - }, - children: [ - { - path: "/redirect/:path(.*)", - name: "Redirect", - component: () => import("@/layout/redirect.vue") - } - ] } ] as Array; diff --git a/src/router/utils.ts b/src/router/utils.ts index 8aa92fa..4c9cb78 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -22,7 +22,6 @@ import { buildHierarchyTree } from "@/utils/tree"; import { sessionKey, type DataInfo } from "@/utils/auth"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; import { usePermissionStoreHook } from "@/store/modules/permission"; -const IFrame = () => import("@/layout/frameView.vue"); // https://cn.vitejs.dev/guide/features.html#glob-import const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}"); @@ -150,36 +149,7 @@ function addPathMatch() { } /** 处理动态路由(后端返回的路由) */ -function handleAsyncRoutes(routeList) { - if (routeList.length === 0) { - usePermissionStoreHook().handleWholeMenus(routeList); - } else { - formatFlatteningRoutes(addAsyncRoutes(routeList)).map( - (v: RouteRecordRaw) => { - // 防止重复添加路由 - if ( - router.options.routes[0].children?.findIndex( - value => value.path === v.path - ) !== -1 - ) { - return; - } else { - // 切记将路由push到routes后还需要使用addRoute,这样路由才能正常跳转 - router.options.routes[0].children.push(v); - // 最终路由进行升序 - ascending(router.options.routes[0].children); - if (!router.hasRoute(v?.name)) router.addRoute(v); - const flattenRouters: any = router - .getRoutes() - .find(n => n.path === "/"); - router.addRoute(flattenRouters); - } - } - ); - usePermissionStoreHook().handleWholeMenus(routeList); - } - addPathMatch(); -} +function handleAsyncRoutes(routeList) {} /** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/ function initRouter() { @@ -294,28 +264,7 @@ function handleAliveRoute({ name }: ToRouteType, mode?: string) { function addAsyncRoutes(arrRoutes: Array) { if (!arrRoutes || !arrRoutes.length) return; const modulesRoutesKeys = Object.keys(modulesRoutes); - arrRoutes.forEach((v: RouteRecordRaw) => { - // 将backstage属性加入meta,标识此路由为后端返回路由 - v.meta.backstage = true; - // 父级的redirect属性取值:如果子级存在且父级的redirect属性不存在,默认取第一个子级的path;如果子级存在且父级的redirect属性存在,取存在的redirect属性,会覆盖默认值 - if (v?.children && v.children.length && !v.redirect) - v.redirect = v.children[0].path; - // 父级的name属性取值:如果子级存在且父级的name属性不存在,默认取第一个子级的name;如果子级存在且父级的name属性存在,取存在的name属性,会覆盖默认值(注意:测试中发现父级的name不能和子级name重复,如果重复会造成重定向无效(跳转404),所以这里给父级的name起名的时候后面会自动加上`Parent`,避免重复) - if (v?.children && v.children.length && !v.name) - v.name = (v.children[0].name as string) + "Parent"; - if (v.meta?.frameSrc) { - v.component = IFrame; - } else { - // 对后端传component组件路径和不传做兼容(如果后端传component组件路径,那么path可以随便写,如果不传,component组件路径会跟path保持一致) - const index = v?.component - ? modulesRoutesKeys.findIndex(ev => ev.includes(v.component as any)) - : modulesRoutesKeys.findIndex(ev => ev.includes(v.path)); - v.component = modulesRoutes[modulesRoutesKeys[index]]; - } - if (v?.children && v.children.length) { - addAsyncRoutes(v.children); - } - }); + arrRoutes.forEach((v: RouteRecordRaw) => {}); return arrRoutes; } diff --git a/src/views/AiLive/index.vue b/src/views/AiLive/index.vue index 0f0a36a..5d2a378 100644 --- a/src/views/AiLive/index.vue +++ b/src/views/AiLive/index.vue @@ -5,6 +5,12 @@ import editImg from "@/assets/live/edit.png"; const router = useRouter(); const liveName = ref("慧文的直播间"); + +const sidebarList = ref([ + { name: "直播商品" }, + { name: "互动脚本" }, + { name: "基础设置" } +]); diff --git a/src/views/login/index.vue b/src/views/login/index.vue index ae5a8ae..ef78fcd 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,8 +1,5 @@