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

修复权限路径访问,将site站点加入到请求头

parent 38c6d146
......@@ -38,12 +38,13 @@ const memberCenterRoute = {
},
...routes,
{
path: '/noAuth',
path: '/memberCenter/noAuth',
auth: false,
component: '@/pages/403',
},
// 能力中心的404页
{
path: '/*',
auth: false,
component: '@/pages/404',
},
......
......@@ -22,13 +22,16 @@ const whiteLists = [
'/user/login',
'/user/register',
'/memberCenter',
'/memberCenter/noAuth',
'/commodity',
'/shops',
'/shop/commodity/detail',
'/shop/commodity',
'/shop',
'/infomation',
'/403',
'/404',
'/500',
'/noAuth'
]
......@@ -98,7 +101,8 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
if (routeAuthUrls.includes(location.pathname)) {
} else {
// history.replace('/')
// 无权限访问时
history.replace('/memberCenter/noAuth')
}
} else {
history.replace('/user/login')
......
......@@ -9,7 +9,8 @@ export const MALL_TYPE = {
}
// 本地环境跳过权限校验
export const isDev = process.env.NODE_ENV === "development"
// export const isDev = process.env.NODE_ENV === "development"
export const isDev = false
export const Environment_Status = {
0: "所有",
......
......@@ -14,7 +14,6 @@ const NoFoundPage: React.FC<{}> = () => {
return (
<div className={styles.wrapper}>
<UserHeader logo={GlobalConfig.global.logo}/>
<div className={styles.errorBox}>
<Row>
<Col span={12}>
......
......@@ -23,6 +23,7 @@ const LoginWrap: React.FC = () => {
token: data.token
})
setRouters(data.urls)
// 此处需使用href跳转, 否则无法触发app.ts中的路由初始化校验
window.location.href = '/memberCenter/home'
})
}
......
......@@ -4,6 +4,7 @@ import { IRequestError, IRequestSuccess } from '..';
import { history } from 'umi'
import { message } from 'antd'
import { getAuth, removeAuth } from './auth';
import { GlobalConfig } from '@/global/config';
export type CtlType = 'none' | 'message'
// 根前缀请求路径
......@@ -52,7 +53,8 @@ const errorHandler = (error: ResponseError): IRequestError => {
const defaultHeaders = {
'Content-Type': 'Application/json',
'source': '1'
'source': '1',
'site': GlobalConfig.global.siteId.toString()
}
/**
......
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