Commit 69c25960 authored by GuanHua's avatar GuanHua

feat:修改商城相关路由

parent 55637338
import BASE_CONFIG from '../base.config.json'
import { MALL_ROUTE_USE_CONFIG } from '../config'
const shopInfo = BASE_CONFIG.web.shopInfo
let webChannelInfo = shopInfo.filter(item => item.environment === 1 && item.type === 3)[0] // 渠道商城
let webChannelPointInfo = shopInfo.filter(item => item.environment === 1 && item.type === 5)[0] // 渠道积分商城
const defaultChannelRoute = '/channelmall' // 默认渠道商城根路径
const defaultIChannelPointRoute = '/pointsMall' // 默认渠道积分商城路径
const rootRoute = MALL_ROUTE_USE_CONFIG ? webChannelInfo.url || defaultChannelRoute : defaultChannelRoute
const pointMallRoute = MALL_ROUTE_USE_CONFIG ? webChannelPointInfo.url || defaultIChannelPointRoute : defaultIChannelPointRoute
const ChannelRoute = {
path: '/channelmall',
path: rootRoute,
component: '@/pages/lxMall/layouts/LXChannelLayout',
routes: [
{
// 店铺(渠道商城)
path: `/channelmall`,
path: rootRoute,
name: 'shopHome',
key: 'shopHome',
component: '@/pages/lxMall/channel',
},
{
// 商品商城
path: `/channelmall/commodity`,
path: `${rootRoute}/commodity`,
name: 'shopCommodity',
key: 'shopCommodity',
component: '@/pages/lxMall/commodity',
},
{
// 商品详情
path: `/channelmall/commodity/detail`,
path: `${rootRoute}/commodity/detail`,
name: 'channelCommodityDetail',
key: 'channelCommodityDetail',
hide: true,
......@@ -28,7 +39,7 @@ const ChannelRoute = {
},
{
// 商品搜索
path: `/channelmall/commodity/search`,
path: `${rootRoute}/commodity/search`,
name: 'channelmallCommoditySearch',
key: 'channelmallCommoditySearch',
hide: true,
......@@ -36,21 +47,21 @@ const ChannelRoute = {
},
{
// 积分商城
path: `/channelmall/pointsMall`,
path: `${rootRoute}${pointMallRoute}`,
name: 'shopPointsMall',
key: 'channelmallPointsMall',
component: '@/pages/lxMall/pointsMall',
},
{
// 资讯
path: `/channelmall/infomation`,
path: `${rootRoute}/infomation`,
name: 'shopInfomation',
key: 'channelmallInfomation',
component: '@/pages/lxMall/information',
},
{
// 资讯详情
path: '/channelmall/infomation/detail',
path: `${rootRoute}/infomation/detail`,
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
......@@ -58,7 +69,7 @@ const ChannelRoute = {
},
{
// 资讯详情搜索
path: '/channelmall/infomation/search',
path: `${rootRoute}/infomation/search`,
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
......@@ -66,14 +77,14 @@ const ChannelRoute = {
},
{
// 关于我们
path: `/channelmall/about`,
path: `${rootRoute}/about`,
name: 'shopAbout',
key: 'channelmallAbout',
component: '@/pages/lxMall/shopAbout',
},
{
// 进货单
path: '/channelmall/purchaseOrder',
path: `${rootRoute}/purchaseOrder`,
name: 'purchaseOrder',
key: 'purchaseOrder',
hide: true,
......@@ -82,7 +93,7 @@ const ChannelRoute = {
},
{
// 渠道订单
path: `/channelmall/order`,
path: `${rootRoute}/order`,
name: 'order',
key: 'order',
hide: true,
......
......@@ -3,7 +3,9 @@ import routes from './router'
import proxy from './proxy'
import theme from './lingxi.theme.config'
export const MALL_ROUTE_USE_CONFIG = process.env.USE_ROUTE_CONFIG || true // 是否使用pass平台配置的商城子域名
const OPEN_THEME_BUILD = process.env.NODE_ENV === 'production' ? true : false // 是否开启动态主题
const config: any = {
// 如需写入环境变量 需在config中先写入
define: {
......@@ -23,7 +25,7 @@ const config: any = {
},
routes,
extraBabelPlugins: [
['import', {
['import', {
libraryName: 'bizcharts',
camel2DashComponentName: false,
customName: require('path').resolve(__dirname, './utils/customBitchartsName.js')
......
import shopRoute from '../shopRoutes'
import channelRoute from '../channelRoutes'
import ichannelRoute from '../selfchannelRoutes'
import { MALL_ROUTE_USE_CONFIG } from '../config'
import BASE_CONFIG from '../base.config.json'
const shopInfo = BASE_CONFIG.web.shopInfo
const webShopInfo = shopInfo.filter(item => item.environment === 1)
let webMallInfo = webShopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
// console.log(webShopInfo, "webShopInfo")
let USE_CONFIG = true // 是否使用pass平台配置的商城子域名
// let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0] // 企业商城
let webPointMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 2)[0] // 积分商城
const defaultPointMallRoute = '/pointsMall' // 积分商城默认路径
const pointMallRoute = MALL_ROUTE_USE_CONFIG ? webPointMallInfo.url || defaultPointMallRoute : defaultPointMallRoute
const mallRoute = {
path: '/',
......@@ -79,7 +81,7 @@ const mallRoute = {
},
{
// 积分商城
path: `/pointsMall`,
path: pointMallRoute,
name: 'pointsMall',
key: 'pointsMall',
component: '@/pages/lxMall/pointsMall',
......@@ -117,4 +119,9 @@ const mallRoute = {
],
}
export default mallRoute
\ No newline at end of file
export default [
shopRoute,
channelRoute,
ichannelRoute,
mallRoute
]
import memberCenterRoute from './routes'
import mallRoute from './mallRoutes'
import shopRoute from './shopRoutes'
import channelRoute from './channelRoutes'
import ichannelRoute from './selfchannelRoutes'
/**
* @description 路由配置页, 更多配置可查看 https://umijs.org/zh-CN/docs/routing#routes
......@@ -57,10 +54,7 @@ const router = [
component: '@/pages/preview/shopPreview',
},
memberCenterRoute,
shopRoute,
channelRoute,
ichannelRoute,
mallRoute,
...mallRoute,
{
component: '@/pages/404',
},
......@@ -68,9 +62,4 @@ const router = [
}
]
export const asyncRouterLists = {
memberCenterRoute,
shopRoute
}
export default router
\ No newline at end of file
import BASE_CONFIG from '../base.config.json'
import { MALL_ROUTE_USE_CONFIG } from '../config'
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 = MALL_ROUTE_USE_CONFIG ? webIChannelInfo.url || defaultIChannelRoute : defaultIChannelRoute
const pointMallRoute = MALL_ROUTE_USE_CONFIG ? webChannelPointInfo.url || defaultIChannelPointRoute : defaultIChannelPointRoute
const selfChannelRoute = {
path: '/ichannelmall',
path: rootRoute,
component: '@/pages/lxMall/layouts/LXIChannelLayout',
routes: [
{
// 店铺(渠道商城)
path: `/ichannelmall`,
path: rootRoute,
name: 'shopHome',
key: 'shopHome',
component: '@/pages/lxMall/channel',
},
{
// 商品商城
path: `/ichannelmall/commodity`,
path: `${rootRoute}/commodity`,
name: 'shopCommodity',
key: 'shopCommodity',
component: '@/pages/lxMall/commodity',
},
{
// 商品详情
path: `/ichannelmall/commodity/detail`,
path: `${rootRoute}/commodity/detail`,
name: 'channelCommodityDetail',
key: 'channelCommodityDetail',
hide: true,
......@@ -28,7 +38,7 @@ const selfChannelRoute = {
},
{
// 商品搜索
path: `/ichannelmall/commodity/search`,
path: `${rootRoute}/commodity/search`,
name: 'channelmallCommoditySearch',
key: 'channelmallCommoditySearch',
hide: true,
......@@ -36,21 +46,21 @@ const selfChannelRoute = {
},
{
// 积分商城
path: `/ichannelmall/pointsMall`,
path: `${rootRoute}${pointMallRoute}`,
name: 'shopPointsMall',
key: 'channelmallPointsMall',
component: '@/pages/lxMall/pointsMall',
},
{
// 资讯
path: `/ichannelmall/infomation`,
path: `${rootRoute}/infomation`,
name: 'shopInfomation',
key: 'channelmallInfomation',
component: '@/pages/lxMall/information',
},
{
// 资讯详情
path: '/ichannelmall/infomation/detail',
path: `${rootRoute}/infomation/detail`,
name: 'infomationDetail',
key: 'infomationDetail',
hide: true,
......@@ -58,7 +68,7 @@ const selfChannelRoute = {
},
{
// 资讯详情搜索
path: '/ichannelmall/infomation/search',
path: `${rootRoute}/infomation/search`,
name: 'infomationSearch',
key: 'infomationSearch',
hide: true,
......@@ -66,14 +76,14 @@ const selfChannelRoute = {
},
{
// 关于我们
path: `/ichannelmall/about`,
path: `${rootRoute}/about`,
name: 'shopAbout',
key: 'channelmallAbout',
component: '@/pages/lxMall/shopAbout',
},
{
// 进货单
path: '/ichannelmall/purchaseOrder',
path: `${rootRoute}/purchaseOrder`,
name: 'purchaseOrder',
key: 'purchaseOrder',
hide: true,
......@@ -82,7 +92,7 @@ const selfChannelRoute = {
},
{
// 渠道订单
path: `/ichannelmall/order`,
path: `${rootRoute}/order`,
name: 'order',
key: 'order',
hide: true,
......
......@@ -18,9 +18,9 @@
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
"test": "umi-test",
"test:coverage": "umi-test --coverage",
"start:cross": "cross-env SITE_ID=352 yarn start",
"start:url": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-all.wg.shushangyun.com yarn start",
"start:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 yarn start"
"start:cross": "cross-env SITE_ID=352 USE_ROUTE_CONFIG=true yarn start",
"start:url": "cross-env SITE_ID=1 BACK_GATEWAY=http://lingxi-all.wg.shushangyun.com USE_ROUTE_CONFIG=true yarn start",
"start:10": "cross-env SITE_ID=1 BACK_GATEWAY=http://10.0.0.10:8100 USE_ROUTE_CONFIG=true yarn start"
},
"lint-staged": {
"*.{js,jsx,less,md,json}": [
......
......@@ -14,6 +14,7 @@ import { getRouters, getAuth, asyncRouter, setAuth, setRouters, removeAuth, remo
import { PublicApi } from './services/api';
// 全局注册虚拟组件
import '@/components/NiceForm/public'
import { GlobalConfig } from '@/global/config'
setup()
......@@ -49,28 +50,28 @@ const mallLists = [
'/shop/infomation/search',
'/shop/infomation/detail',
'/shop/about',
'/channelmall',
'/channelmall/commodity',
'/channelmall/commodity/search',
'/channelmall/commodity/detail',
'/channelmall/pointsMall',
'/channelmall/infomation',
'/channelmall/infomation/detail',
'/channelmall/infomation/search',
'/channelmall/about',
'/channelmall/purchaseOrder',
'/channelmall/order',
'/ichannelmall',
'/ichannelmall/commodity',
'/ichannelmall/commodity/search',
'/ichannelmall/commodity/detail',
'/ichannelmall/pointsMall',
'/ichannelmall/infomation',
'/ichannelmall/infomation/detail',
'/ichannelmall/infomation/search',
'/ichannelmall/about',
'/ichannelmall/purchaseOrder',
'/ichannelmall/order',
`${GlobalConfig.channelRootRoute}`,
`${GlobalConfig.channelRootRoute}/commodity`,
`${GlobalConfig.channelRootRoute}/commodity/search`,
`${GlobalConfig.channelRootRoute}/commodity/detail`,
`${GlobalConfig.channelRootRoute}/pointsMall`,
`${GlobalConfig.channelRootRoute}/infomation`,
`${GlobalConfig.channelRootRoute}/infomation/detail`,
`${GlobalConfig.channelRootRoute}/infomation/search`,
`${GlobalConfig.channelRootRoute}/about`,
`${GlobalConfig.channelRootRoute}/purchaseOrder`,
`${GlobalConfig.channelRootRoute}/order`,
`${GlobalConfig.ichannelRootRoute}`,
`${GlobalConfig.ichannelRootRoute}/commodity`,
`${GlobalConfig.ichannelRootRoute}/commodity/search`,
`${GlobalConfig.ichannelRootRoute}/commodity/detail`,
`${GlobalConfig.ichannelRootRoute}/pointsMall`,
`${GlobalConfig.ichannelRootRoute}/infomation`,
`${GlobalConfig.ichannelRootRoute}/infomation/detail`,
`${GlobalConfig.ichannelRootRoute}/infomation/search`,
`${GlobalConfig.ichannelRootRoute}/about`,
`${GlobalConfig.ichannelRootRoute}/purchaseOrder`,
`${GlobalConfig.ichannelRootRoute}/order`,
]
// let routeAuthUrls: any[] = []
......
......@@ -8,5 +8,18 @@
import SELF_CONFIG from '../../../config/base.config.json'
import { RootObject } from './global'
const MALL_ROUTE_USE_CONFIG = process.env.USE_ROUTE_CONFIG || true
let webChannelInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 1 && item.type === 3)[0] // 渠道商城
let webIChannelInfo = SELF_CONFIG.web.shopInfo.filter(item => item.environment === 1 && item.type === 4)[0] // 渠道自有商城
const defaultChannelRoute = '/channelmall' // 默认渠道商城根路径
const defaultIChannelRoute = '/ichannelmall' // 默认渠道自有商城根路径
const channelRootRoute = MALL_ROUTE_USE_CONFIG ? webChannelInfo.url || defaultChannelRoute : defaultChannelRoute
const ichannelRootRoute = MALL_ROUTE_USE_CONFIG ? webIChannelInfo.url || defaultIChannelRoute : defaultIChannelRoute
SELF_CONFIG.channelRootRoute = channelRootRoute // 渠道商城路由根路径
SELF_CONFIG.ichannelRootRoute = ichannelRootRoute // 渠道自有商城路由根路径
export const GlobalConfig: RootObject = SELF_CONFIG
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