Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
ac0d66d0
Commit
ac0d66d0
authored
Aug 18, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复权限路径访问,将site站点加入到请求头
parent
38c6d146
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
5 deletions
+13
-5
index.ts
config/routes/index.ts
+2
-1
app.tsx
src/app.tsx
+5
-1
index.ts
src/constants/index.ts
+2
-1
403.tsx
src/pages/403.tsx
+0
-1
LoginWrap.tsx
src/pages/user/components/LoginWrap.tsx
+1
-0
request.ts
src/utils/request.ts
+3
-1
No files found.
config/routes/index.ts
View file @
ac0d66d0
...
...
@@ -38,12 +38,13 @@ const memberCenterRoute = {
},
...
routes
,
{
path
:
'/noAuth'
,
path
:
'/
memberCenter/
noAuth'
,
auth
:
false
,
component
:
'@/pages/403'
,
},
// 能力中心的404页
{
path
:
'/*'
,
auth
:
false
,
component
:
'@/pages/404'
,
},
...
...
src/app.tsx
View file @
ac0d66d0
...
...
@@ -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'
)
...
...
src/constants/index.ts
View file @
ac0d66d0
...
...
@@ -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
:
"所有"
,
...
...
src/pages/403.tsx
View file @
ac0d66d0
...
...
@@ -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
}
>
...
...
src/pages/user/components/LoginWrap.tsx
View file @
ac0d66d0
...
...
@@ -23,6 +23,7 @@ const LoginWrap: React.FC = () => {
token
:
data
.
token
})
setRouters
(
data
.
urls
)
// 此处需使用href跳转, 否则无法触发app.ts中的路由初始化校验
window
.
location
.
href
=
'/memberCenter/home'
})
}
...
...
src/utils/request.ts
View file @
ac0d66d0
...
...
@@ -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
()
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment