diff --git a/src/router/index.js b/src/router/index.js index de595a814..9ba8abf56 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -6,6 +6,7 @@ import store from "@/js/store"; Vue.use(Router); +const CUSTOMER = process.env.VUE_APP_CUSTOMER; // 页面路由(独立页面) export const pageRoutes = [ { @@ -26,7 +27,11 @@ export const pageRoutes = [ }, { path: "/login", - component: () => import("@/views/pages/login"), + component: () => { + return CUSTOMER == "yantai" + ? import("@/views/pages/yantai-login") + : import("@/views/pages/login"); + }, name: "login", meta: { title: "登录", @@ -35,7 +40,11 @@ export const pageRoutes = [ { path: "/", name: "index", - component: () => import("@/views/pages/index"), + component: () => { + return CUSTOMER == "yantai" + ? import("@/views/pages/yantai-index") + : import("@/views/pages/index"); + }, }, { path: "/indexWork", @@ -138,6 +147,18 @@ function cookApiDataItem(item) { // }); return item; } +// 把按钮都化为页面内部的权限 +function cookApiDataItem2(item) { + let { children } = item; + if (children && Array.isArray(children) && children.length > 0) { + let btns = item.children.filter((item) => item.type == 1); + item.btns = btns; + item.children = item.children + .filter((val) => val.type == 0) + .map((val) => cookApiDataItem2(val)); + } + return item; +} // 模块路由(基于主入口布局页面) 可视化数据 export const moduleShujuRoutes = { @@ -145,7 +166,10 @@ export const moduleShujuRoutes = { component: () => import("@/views/main-shuju/main"), name: "main-shuju", redirect: { - path: "/main-shuju/visual-basicinfo-basicInfoMain", + path: + CUSTOMER == "yantai" && process.env.VUE_APP_NODE_ENV == "prod" + ? "/main-shuju/i-1536625421829599234" + : "/main-shuju/visual-basicinfo-basicInfoMain", }, meta: { title: "主入口布局", @@ -282,9 +306,9 @@ router.beforeEach((to, from, next) => { name: "login", }); } - window.SITE_CONFIG["menuList"] = res.data.map((item) => - cookApiDataItem(item) - ); + window.SITE_CONFIG["menuList"] = res.data + .map((item) => cookApiDataItem2(item)) + .map((item) => cookApiDataItem(item)); fnAddDynamicMenuRoutes(window.SITE_CONFIG["menuList"]); // next({ ...to, replace: true }) next({ @@ -338,6 +362,7 @@ function fnAddDynamicMenuRoutes(menuList = [], routes = []) { ...window.SITE_CONFIG["contentTabDefault"], menuId: menuList[i].id, title: menuList[i].name, + btns: menuList[i].btns || [], }, }; // eslint-disable-next-line