Commit c2ead115 authored by 前端-许佳敏's avatar 前端-许佳敏

chore: 菜单配置修改

parent 4e0c660f
import BASE_CONFIG from '../base.config.json'
import { checkUrl } from '../utils'
const shopInfo = BASE_CONFIG.web.shopInfo
const webChannelInfo = shopInfo.filter(item => item.environment === 1 && item.type === 3)[0] // 渠道商城
const webChannelPointInfo = shopInfo.filter(item => item.environment === 1 && item.type === 5)[0] // 渠道积分商城
const defaultChannelRoute = '/channelmall' // 默认渠道商城根路径
const defaultIChannelPointRoute = '/pointsMall' // 默认渠道积分商城路径
const rootRoute = process.env.USE_ROUTE_CONFIG === 'true' ? checkUrl(webChannelInfo.url, defaultChannelRoute) : defaultChannelRoute
const pointMallRoute = process.env.USE_ROUTE_CONFIG === 'true' ? checkUrl(webChannelPointInfo.url, defaultIChannelPointRoute) : defaultIChannelPointRoute
const ChannelRoute = {
path: rootRoute,
component: '@/pages/lxMall/layouts/LXChannelLayout',
routes: [
{
// 店铺(渠道商城)
path: rootRoute,
name: 'shopHome',
key: 'shopHome',
component: '@/pages/lxMall/channel',
},
{
// 商品商城
path: `${rootRoute}/commodity`,
name: 'shopCommodity',
key: 'shopCommodity',
component: '@/pages/lxMall/commodity',
},
{
// 商品详情
path: `${rootRoute}/commodity/detail`,
name: 'channelCommodityDetail',
key: 'channelCommodityDetail',
hide: true,
component: '@/pages/lxMall/commodityDetail',
},
{
// 商品搜索
path: `${rootRoute}/commodity/search`,
name: 'channelmallCommoditySearch',
key: 'channelmallCommoditySearch',
hide: true,
component: '@/pages/lxMall/commodity/search',
},
{
// 积分商城
path: `${rootRoute}${pointMallRoute}`,
name: 'shopPointsMall',
key: 'channelmallPointsMall',
component: '@/pages/lxMall/pointsMall',
},
{
// 资讯
path: `${rootRoute}/infomation`,
name: 'shopInfomation',
key: 'channelmallInfomation',
component: '@/pages/lxMall/information',
},
{
// 资讯详情
path: `${rootRoute}/infomation/detail`,
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
component: '@/pages/lxMall/information/detail',
},
{
// 资讯详情搜索
path: `${rootRoute}/infomation/search`,
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
component: '@/pages/lxMall/information/search',
},
{
// 关于我们
path: `${rootRoute}/about`,
name: 'shopAbout',
key: 'channelmallAbout',
component: '@/pages/lxMall/shopAbout',
},
{
// 进货单
path: `${rootRoute}/purchaseOrder`,
name: 'purchaseOrder',
key: 'purchaseOrder',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/purchaseOrder',
},
{
// 渠道订单
path: `${rootRoute}/order`,
name: 'order',
key: 'order',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/order',
},
{
// 渠道订单支付页面
path: `${rootRoute}/pay`,
name: 'pay',
key: 'pay',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/pay',
},
{
// 支付结果页面
path: `${rootRoute}/pay/result`,
name: 'payResult',
key: 'payResult',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/payResult',
},
{
path: '/noAuth',
component: '@/pages/403',
},
// 商城页的404
{
component: '@/pages/404',
},
],
}
export default ChannelRoute
import shopRoute from '../shopRoutes'
import channelRoute from '../channelRoutes'
import ichannelRoute from '../selfchannelRoutes'
import BASE_CONFIG from '../base.config.json'
import { checkUrl } from '../utils'
const shopInfo = BASE_CONFIG.web.shopInfo
// let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0] // 企业商城
const webPointMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 2)[0] // 积分商城
const defaultPointMallRoute = '/pointsMall' // 积分商城默认路径
const pointMallRoute = process.env.USE_ROUTE_CONFIG === 'true' ? checkUrl(webPointMallInfo.url, defaultPointMallRoute) : defaultPointMallRoute
const mallRoute = {
path: '/',
component: '@/pages/lxMall/layouts/LXMallLayout',
routes: [
{
// 首页
path: `/`,
name: 'mallHome',
key: 'mallHome',
component: '@/pages/lxMall/index',
},
{
// 商品商城
path: `/commodity`,
name: 'mallCommodity',
key: 'mallCommodity',
component: '@/pages/lxMall/commodity',
},
{
// 商品详情
path: `/commodity/detail`,
name: 'commodityDetail',
key: 'commodityDetail',
hide: true,
component: '@/pages/lxMall/commodityDetail',
},
{
// 商品搜索
path: `/commodity/search`,
name: 'mallCommoditySearch',
key: 'mallCommoditySearch',
hide: true,
component: '@/pages/lxMall/commodity/search',
},
{
// 订单
path: `/order`,
name: 'order',
key: 'order',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/order',
},
{
// 进货单
path: '/purchaseOrder',
name: 'purchaseOrder',
key: 'purchaseOrder',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/purchaseOrder',
},
{
// 支付页面
path: '/pay',
name: 'pay',
key: 'pay',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/pay',
},
{
// 支付结果页面
path: '/pay/result',
name: 'payResult',
key: 'payResult',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/payResult',
},
// {
// // 在线求购
// path: `/purchaseOnline`,
// name: 'purchaseOnline',
// key: 'purchaseOnline',
// component: '@/pages/lxMall/purchaseOnline',
// },
{
// 积分商城
path: pointMallRoute,
name: 'pointsMall',
key: 'pointsMall',
component: '@/pages/lxMall/pointsMall',
},
{
// 店铺
path: `/shops`,
name: 'shops',
key: 'shops',
component: '@/pages/lxMall/shopList',
},
{
// 资讯
path: `/infomation`,
name: 'infomation',
key: 'infomation',
component: '@/pages/lxMall/information',
},
{
// 资讯详情
path: '/infomation/detail',
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
component: '@/pages/lxMall/information/detail',
},
{
// 资讯详情搜索
path: '/infomation/search',
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
component: '@/pages/lxMall/information/search',
}
],
}
export default [
shopRoute,
channelRoute,
ichannelRoute,
mallRoute
]
export default {
path: `/memberCenter/formView`,
icon: 'home',
name: '表单能力',
routes: [
{
path: `/memberCenter/formView/formdesign`,
name: '表单预览',
component: '@/pages/formView/form',
},
]
}
......@@ -5,31 +5,46 @@
* @LastEditTime: 2021-08-26 16:31:22
*/
import CommodityRoute from './commodityRoute'; // 商品能力路由
// import MemberRoute from './memberRoute' // 会员能力路由
// import ShopRoute from './shopRoute' // 店铺能力路由
// import ChannelRoute from './channelRoute' // 渠道能力路由
import MemberRoute from './memberRoute' // 会员能力路由
import ShopRoute from './shopRoute' // 店铺能力路由
import ChannelRoute from './channelRoute' // 渠道能力路由
import TranactionRoute from './tranactionRoute'; // 交易能力路由
// import LogisticsRoute from './logisticsRoutes' // 物流能力路由
// import PayandSettleRoute from './payandSettle' //支付与结算
import LogisticsRoute from './logisticsRoutes' // 物流能力路由
import PayandSettleRoute from './payandSettle' //支付与结算
import AuthConfigRoute from './authConfigRoute'
// import AfterService from './afterServiceRoute' // 售后
// import HandlingRoute from './handlingRoute'; // 加工能力
// import DealAbilityRoute from './dealAbilityRoute'; //
// import marketingRoute from './marketingRoute';
// import BalancedRoute from './balanceRoute'; // 结算能力
import AfterService from './afterServiceRoute' // 售后
import HandlingRoute from './handlingRoute'; // 加工能力
import DealAbilityRoute from './dealAbilityRoute'; //
import marketingRoute from './marketingRoute';
import BalancedRoute from './balanceRoute'; // 结算能力
import OrderRoute from './orderRoute'; // 订单能力
import asyncRoutes from '../router.config.json';
import FormDesignRoute from './formDesignRoute'; // 订单能力
// import asyncRoutes from '../router.config.json';
import ProcurementRoute from './procurementRoute';
// import { callForBidsRoute } from './procurementRoute/callForBids';
// import { purchaseInquiryRoute } from './procurementRoute/purchaseInquiry';
import { callForBidsRoute } from './procurementRoute/callForBids';
import { purchaseInquiryRoute } from './procurementRoute/purchaseInquiry';
import contracRoute from './contracRoute';
import MaterialRoute from './materialRoute';
export const memberCenterRoutes = [
CommodityRoute,
MemberRoute,
ShopRoute,
ChannelRoute,
TranactionRoute,
PayandSettleRoute,
AuthConfigRoute,
AfterService,
HandlingRoute,
OrderRoute,
FormDesignRoute,
]
// export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute]
// const isDev = process.env.NODE_ENV === 'development'
const isDev = false
const isDev = false && process.env.NODE_ENV === 'development'
const homeRoute = {
path: `/memberCenter/home`,
name: 'home',
......@@ -38,24 +53,6 @@ const homeRoute = {
component: '@/pages/home',
};
const indexComRoute = {
path: `/memberCenter/formView`,
icon: 'home',
name: '表单能力',
routes: [
{
path: `/memberCenter/formView/form`,
name: '表单预览',
component: '@/pages/formView/form',
},
{
path: `/memberCenter/formView/formDesign`,
name: '表单设计',
component: '@/pages/formView/formDesign',
}
]
}
const srmPurchaserHomeRoute = {
path: `/memberCenter/srmPurchaserHome`,
name: 'srmPurchaserHome',
......@@ -66,7 +63,7 @@ const srmPurchaserHomeRoute = {
// isDev ? [ homeRoute, OrderRoute ] :
// const routes = asyncRoutes;
const routes = isDev ? [homeRoute, indexComRoute, contracRoute, CommodityRoute, AuthConfigRoute] : asyncRoutes;
// const routes = isDev ? [homeRoute, indexComRoute] : asyncRoutes;
const memberCenterRoute = {
path: '/memberCenter',
......@@ -76,26 +73,6 @@ const memberCenterRoute = {
path: '/memberCenter',
redirect: '/memberCenter/home',
},
// {
// path: '/memberCenter/shopAbility',
// redirect: '/memberCenter/shopAbility/infoManage',
// },
// {
// path: '/memberCenter/logisticsAbility',
// redirect: '/memberCenter/logisticsAbility/infoManage',
// },
// {
// path: '/memberCenter/handling',
// redirect: '/memberCenter/handling/infoManage',
// },
// {
// path: '/memberCenter/procurementAbility',
// redirect: '/memberCenter/procurementAbility/purchasDoor/purchasInfo',
// },
// {
// path: '/memberCenter/channelAbility',
// redirect: '/memberCenter/channelAbility/infoManage',
// },
// 当注册的会员审核不通过时, 可以修改个人信息, 这里任何人都有权限
{
path: `/memberCenter/editMySelf`,
......@@ -105,23 +82,7 @@ const memberCenterRoute = {
noMargin: true,
name: '修改个人信息',
},
// ShopRoute,
// CommodityRoute,
// TranactionRoute,
// ChannelRoute,
// ShopRoute,
// ProcurementRoute,
// // 合同能力
// contracRoute,
// AuthConfigRoute,
// MemberRoute,
// HandlingRoute,
// PayandSettleRoute,
// marketingRoute,
// DealAbilityRoute,
// ...asyncRoutes,
// indexComRoute,
...routes,
...memberCenterRoutes,
{
path: '/memberCenter/noAuth',
auth: false,
......
import BASE_CONFIG from '../base.config.json'
import { checkUrl } from '../utils'
const shopInfo = BASE_CONFIG.web.shopInfo
let webIChannelInfo = shopInfo.filter(item => item.environment === 1 && item.type === 4)[0] // 渠道自有商城
let webChannelPointInfo = shopInfo.filter(item => item.environment === 1 && item.type === 5)[0] // 渠道积分商城
const defaultIChannelRoute = '/ichannelmall' // 默认渠道商城根路径
const defaultIChannelPointRoute = '/pointsMall' // 默认渠道积分商城路径
const rootRoute = process.env.USE_ROUTE_CONFIG === 'true' ? checkUrl(webIChannelInfo.url, defaultIChannelRoute) : defaultIChannelRoute
const pointMallRoute = process.env.USE_ROUTE_CONFIG === 'true' ? checkUrl(webChannelPointInfo.url, defaultIChannelPointRoute) : defaultIChannelPointRoute
const selfChannelRoute = {
path: rootRoute,
component: '@/pages/lxMall/layouts/LXIChannelLayout',
routes: [
{
// 店铺(渠道商城)
path: rootRoute,
name: 'shopHome',
key: 'shopHome',
component: '@/pages/lxMall/channel',
},
{
// 商品商城
path: `${rootRoute}/commodity`,
name: 'shopCommodity',
key: 'shopCommodity',
component: '@/pages/lxMall/commodity',
},
{
// 商品详情
path: `${rootRoute}/commodity/detail`,
name: 'channelCommodityDetail',
key: 'channelCommodityDetail',
hide: true,
component: '@/pages/lxMall/commodityDetail',
},
{
// 商品搜索
path: `${rootRoute}/commodity/search`,
name: 'channelmallCommoditySearch',
key: 'channelmallCommoditySearch',
hide: true,
component: '@/pages/lxMall/commodity/search',
},
{
// 积分商城
path: `${rootRoute}${pointMallRoute}`,
name: 'shopPointsMall',
key: 'channelmallPointsMall',
component: '@/pages/lxMall/pointsMall',
},
{
// 资讯
path: `${rootRoute}/infomation`,
name: 'shopInfomation',
key: 'channelmallInfomation',
component: '@/pages/lxMall/information',
},
{
// 资讯详情
path: `${rootRoute}/infomation/detail`,
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
component: '@/pages/lxMall/information/detail',
},
{
// 资讯详情搜索
path: `${rootRoute}/infomation/search`,
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
component: '@/pages/lxMall/information/search',
},
{
// 关于我们
path: `${rootRoute}/about`,
name: 'shopAbout',
key: 'channelmallAbout',
component: '@/pages/lxMall/shopAbout',
},
{
// 进货单
path: `${rootRoute}/purchaseOrder`,
name: 'purchaseOrder',
key: 'purchaseOrder',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/purchaseOrder',
},
{
// 渠道订单
path: `${rootRoute}/order`,
name: 'order',
key: 'order',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/order',
},
{
// 渠道订单支付页面
path: `${rootRoute}/pay`,
name: 'pay',
key: 'pay',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/pay',
},
{
// 支付结果页面
path: `${rootRoute}/pay/result`,
name: 'payResult',
key: 'payResult',
hide: true,
hideHeader: true,
component: '@/pages/lxMall/payResult',
},
{
path: '/noAuth',
component: '@/pages/403',
},
// 商城页的404
{
component: '@/pages/404',
},
],
}
export default selfChannelRoute
\ No newline at end of file
const shopRoute = {
path: '/shop',
component: '@/pages/lxMall/layouts/LXShopLayout',
routes: [
{
// 店铺(渠道商城)
path: `/shop`,
name: 'shopHome',
key: 'shopHome',
component: '@/pages/lxMall/shop',
},
{
// 商品商城
path: `/shop/commodity`,
name: 'shopCommodity',
key: 'shopCommodity',
component: '@/pages/lxMall/commodity',
},
{
// 商品详情
path: `/shop/commodity/detail`,
name: 'shopCommodityDetail',
key: 'shopCommodityDetail',
hide: true,
component: '@/pages/lxMall/commodityDetail',
},
{
// 商品搜索
path: `/shop/commodity/search`,
name: 'shopCommoditySearch',
key: 'shopCommoditySearch',
hide: true,
component: '@/pages/lxMall/commodity/search',
},
{
// 积分商城
path: `/shop/pointsMall`,
name: 'shopPointsMall',
key: 'shopPointsMall',
component: '@/pages/lxMall/pointsMall',
},
// {
// // 资讯
// path: `/shop/infomation`,
// name: 'shopInfomation',
// key: 'shopInfomation',
// component: '@/pages/lxMall/information',
// },
// {
// // 资讯详情
// path: '/shop/infomation/detail',
// name: 'infomationDetail',
// key: 'infomationDetail',
// hide: true,
// component: '@/pages/lxMall/information/detail',
// },
// {
// // 资讯详情搜索
// path: '/shop/infomation/search',
// name: 'infomationSearch',
// key: 'infomationSearch',
// hide: true,
// component: '@/pages/lxMall/information/search',
// },
{
// 关于我们
path: `/shop/about`,
name: 'shopAbout',
key: 'shopAbout',
component: '@/pages/lxMall/shopAbout',
},
{
path: '/noAuth',
component: '@/pages/403',
},
// 商城页的404
{
component: '@/pages/404',
},
],
}
export default shopRoute
\ No newline at end of file
......@@ -57,6 +57,13 @@ const loginWhiteList = [
]
const devRoute = [
{
path: '/',
relationParentCode: 'home',
redirect: '/memberCenter/home',
},
]
/**
* @description 配置函数,对已配置的路由做修改, 一般与render函数一起结合可根据接口动态配置路由, 直接修改routes即可
* @author xjm
......@@ -73,21 +80,9 @@ const loginWhiteList = [
*/
let realTimeRoutes: GetMemberAuthListResponse;
export function patchRoutes({ routes }: IRoutes) {
console.log(routes, 'patch')
console.log(routes, '合并权限菜单前')
merge(realTimeRoutes, routes)
console.log(routes, 'merge')
// if (isDev) {
// return;
// }
// const authInfo = getAuth()
// if (authInfo) {
// getMemberLoginReget({}, { useCache: true, ttl: 1000 }).then(res => {
// const { data, code } = res
// if (code === 1000) {
// asyncRouter(data.auth, routes)
// }
// })
// }
console.log(routes, '合并权限菜单后')
}
/**
......
......@@ -101,7 +101,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
const menuData = basicInfo.menuData ? basicInfo.menuData.filter(item => !item.redirect) : []
const menuRouter = getMenuRouter(menuData, location.pathname)
// 当前路由信息, 可获取到config下的route配置
const currentRouter = basicInfo.breadcrumb[location.pathname];
......@@ -156,7 +155,6 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
minWidth: '1280px',
}
: {}
// console.log(currentRouter)
return currentRouter?.noLayout ? props.children : (
<ProLayout
pageTitleRender={() => currentRouter ? currentRouter.name : window.location.href}
......
......@@ -73,7 +73,8 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
if (menuRouter && menuRouter.children) {
menuItemsCache = getMenus(menuRouter.children)
}
console.log(menuRouter)
console.log(menuItemsCache)
const handleOpenchange = (keys: string[]) => {
changeOpenKeys(keys)
}
......
......@@ -36,7 +36,7 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
const subHeadMenus: Array<any> = []
menuData.forEach(item => {
// 为适配pass菜单自由组合变更, 使用code进行高亮显示
const code = currentRouter.relationParentCode
const code = currentRouter?.relationParentCode
// console.log(code, item.relationParentCode)
if (code && code === item.relationParentCode) {
defaultSelectedKeys = item.relationParentCode
......
......@@ -205,7 +205,7 @@ const recursionRemove = (urls, userRoutes) => {
const result = urls.find(s => s.url === item.path)
if(result) {
// @todo 这里可以实时更新配置菜单信息
item.name = `${result.title}123`
item.name = `${result.title}`
}
if(item.routes?.length) {
recursionRemove(urls, item.routes)
......@@ -222,6 +222,7 @@ const recursionFindUserMenus = (urlLists, routes) => {
if(item?.path === '/memberCenter') {
const configRoutes = item.routes.slice(2, item.routes.length - 1)
// console.log(urlLists, configRoutes, 'recursionFindUserMenus')
console.log(configRoutes)
recursionRemove(urlLists, configRoutes)
item.routes.splice(2, item.routes.slice(2, item.routes.length - 1).length, ...configRoutes)
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment