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
shenshaokai
jinfa-platform
Commits
7dc76ea7
Commit
7dc76ea7
authored
Apr 11, 2022
by
前端-彭佳文
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2-0418-xxx' into 'v2-220418'
菜单调整 See merge request linkseeks-design/pro-platform!192
parents
69ffb7aa
0c2e1a76
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
26 deletions
+28
-26
app.tsx
src/app.tsx
+6
-5
Roles.tsx
src/layouts/components/Roles.tsx
+2
-2
index.tsx
...nsaction/dealAbility/inquiryOffer/inquirySearch/index.tsx
+1
-1
LoginWrap.tsx
src/pages/user/components/LoginWrap.tsx
+11
-11
ScanLoginWrap.tsx
src/pages/user/components/ScanLoginWrap.tsx
+3
-3
auth.ts
src/utils/auth.ts
+5
-4
No files found.
src/app.tsx
View file @
7dc76ea7
...
...
@@ -51,6 +51,7 @@ const loginWhiteList = [
'/memberCenter/home'
,
'/memberCenter/editMySelf'
]
/**
* @description 配置函数,对已配置的路由做修改, 一般与render函数一起结合可根据接口动态配置路由, 直接修改routes即可
* @author xjm
...
...
@@ -74,7 +75,7 @@ export function patchRoutes({ routes }: IRoutes) {
getMemberLoginReget
({},
{
useCache
:
true
,
ttl
:
1000
}).
then
(
res
=>
{
const
{
data
,
code
}
=
res
if
(
code
===
1000
)
{
asyncRouter
(
data
.
urls
,
routes
)
asyncRouter
(
data
.
auth
,
routes
)
}
})
}
...
...
@@ -100,7 +101,7 @@ export function render(oldRender: Function) {
const
{
data
,
code
}
=
res
if
(
code
===
1000
)
{
setAuth
(
data
as
any
)
setRouters
(
data
.
urls
)
setRouters
(
data
.
auth
)
}
else
{
removeAuth
()
removeRouters
()
...
...
@@ -111,7 +112,7 @@ export function render(oldRender: Function) {
}).
catch
(()
=>
{
oldRender
()
})
getManagePaasSiteEnableMultiTenancy
({
siteId
:
GlobalConfig
.
global
.
siteInfo
.
id
.
toString
()
}).
then
(
res
=>
{
getManagePaasSiteEnableMultiTenancy
({
siteId
:
GlobalConfig
.
global
.
siteInfo
.
id
.
toString
()
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
}
...
...
@@ -159,9 +160,9 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
let
routeAuthUrls
=
getRouters
()
if
(
!
routeAuthUrls
||
routeAuthUrls
.
length
===
0
)
{
const
{
urls
}
=
authInfo
const
{
urls
,
auth
}
=
authInfo
routeAuthUrls
=
urls
setRouters
(
urls
)
setRouters
(
urls
,
auth
)
}
const
{
pathname
}
=
location
console
.
log
(
pathname
,
'pathname'
)
...
...
src/layouts/components/Roles.tsx
View file @
7dc76ea7
...
...
@@ -36,7 +36,7 @@ const Roles: React.FC = () => {
}
const
msg
=
message
.
loading
({
content
:
intl
.
formatMessage
({
id
:
'common.zhengzaiqiehuanjuese'
}),
content
:
intl
.
formatMessage
({
id
:
'common.zhengzaiqiehuanjuese'
}),
duration
:
0
,
});
...
...
@@ -47,7 +47,7 @@ const Roles: React.FC = () => {
return
;
}
setAuth
(
res
.
data
);
setRouters
(
res
.
data
.
urls
);
setRouters
(
res
.
data
.
auth
);
setTimeout
(()
=>
{
window
.
location
.
replace
(
'/memberCenter/home'
);
},
800
);
...
...
src/pages/transaction/dealAbility/inquiryOffer/inquirySearch/index.tsx
View file @
7dc76ea7
...
...
@@ -40,7 +40,7 @@ const InquirySearch = () => {
return
;
}
setAuth
(
res
.
data
);
setRouters
(
res
.
data
.
urls
);
setRouters
(
res
.
data
.
auth
);
setTimeout
(()
=>
{
window
.
location
.
replace
(
`/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/two?id=
${
id
}
`
);
},
800
);
...
...
src/pages/user/components/LoginWrap.tsx
View file @
7dc76ea7
...
...
@@ -25,8 +25,8 @@ const LoginWrap: React.FC = () => {
const
{
data
,
code
}
=
res
if
(
code
===
1000
)
{
message
.
destroy
()
message
.
success
(
intl
.
formatMessage
({
id
:
'user.dengluchenggong'
}))
setRouters
(
data
.
urls
)
message
.
success
(
intl
.
formatMessage
({
id
:
'user.dengluchenggong'
}))
setRouters
(
data
.
auth
)
// 设置同域名cookie缓存
setAuth
(
data
)
// 此处需使用href跳转, 否则无法触发app.ts中的路由初始化校验
...
...
@@ -45,7 +45,7 @@ const LoginWrap: React.FC = () => {
return
(
<>
<
p
>
{
validFrame
?
`${intl.formatMessage({
id: 'user.dangqianshoujihaoma'})}:xxxxxxxxx`
:
intl
.
formatMessage
({
id
:
'user.qingshiyongpingtaizhanghaodeng'
})
}
</
p
>
<
p
>
{
validFrame
?
`${intl.formatMessage({
id: 'user.dangqianshoujihaoma' })}:xxxxxxxxx`
:
intl
.
formatMessage
({
id
:
'user.qingshiyongpingtaizhanghaodeng'
})
}
</
p
>
{
validFrame
?
<>
...
...
@@ -54,12 +54,12 @@ const LoginWrap: React.FC = () => {
<
Input
size=
'large'
/>
</
Col
>
<
Col
offset=
{
1
}
span=
{
7
}
>
<
Button
type=
'default'
size=
'large'
>
{
intl
.
formatMessage
({
id
:
'user.huoquyanzhengma'
})
}
</
Button
>
<
Button
type=
'default'
size=
'large'
>
{
intl
.
formatMessage
({
id
:
'user.huoquyanzhengma'
})
}
</
Button
>
</
Col
>
</
Row
>
<
Row
>
<
Col
span=
{
24
}
>
<
Button
type=
'primary'
size=
'large'
htmlType=
'submit'
block
>
{
intl
.
formatMessage
({
id
:
'user.dianjidenglu'
})
}
</
Button
>
<
Button
type=
'primary'
size=
'large'
htmlType=
'submit'
block
>
{
intl
.
formatMessage
({
id
:
'user.dianjidenglu'
})
}
</
Button
>
</
Col
>
</
Row
>
</>
...
...
@@ -73,12 +73,12 @@ const LoginWrap: React.FC = () => {
[
{
required
:
true
,
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
{
intl
.
formatMessage
({
id
:
'user.qingshuruzhengquedeyonghu'
})
}
</
span
></>
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
{
intl
.
formatMessage
({
id
:
'user.qingshuruzhengquedeyonghu'
})
}
</
span
></>
}
]
}
>
<
Input
prefix=
{
<
UserOutlined
/>
}
placeholder=
{
intl
.
formatMessage
({
id
:
'user.yonghumingshoujihao'
})
}
size=
'large'
/>
<
Input
prefix=
{
<
UserOutlined
/>
}
placeholder=
{
intl
.
formatMessage
({
id
:
'user.yonghumingshoujihao'
})
}
size=
'large'
/>
</
Form
.
Item
>
<
Form
.
Item
name=
'password'
...
...
@@ -86,21 +86,21 @@ const LoginWrap: React.FC = () => {
[
{
required
:
true
,
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
{
intl
.
formatMessage
({
id
:
'user.qingshuruzhengquedemima'
})
}
</
span
></>
message
:
<><
ExclamationCircleFilled
style=
{
{
marginRight
:
6
}
}
/><
span
>
{
intl
.
formatMessage
({
id
:
'user.qingshuruzhengquedemima'
})
}
</
span
></>
}
]
}
>
<
Input
.
Password
prefix=
{
<
LockOutlined
/>
}
placeholder=
{
intl
.
formatMessage
({
id
:
'user.qingshurumima'
})
}
size=
'large'
/>
<
Input
.
Password
prefix=
{
<
LockOutlined
/>
}
placeholder=
{
intl
.
formatMessage
({
id
:
'user.qingshurumima'
})
}
size=
'large'
/>
</
Form
.
Item
>
{
validButton
&&
(<
Form
.
Item
className=
{
'loginVerBtn'
}
>
<
Button
ghost
type=
'primary'
block
size=
'large'
>
{
intl
.
formatMessage
({
id
:
'user.dianjijinhangyanzheng'
})
}
</
Button
>
<
Button
ghost
type=
'primary'
block
size=
'large'
>
{
intl
.
formatMessage
({
id
:
'user.dianjijinhangyanzheng'
})
}
</
Button
>
</
Form
.
Item
>)
}
<
Form
.
Item
>
<
Button
type=
'primary'
loading=
{
loginLoading
}
size=
'large'
htmlType=
'submit'
block
>
{
intl
.
formatMessage
({
id
:
'user.denglu'
})
}
</
Button
>
<
Button
type=
'primary'
loading=
{
loginLoading
}
size=
'large'
htmlType=
'submit'
block
>
{
intl
.
formatMessage
({
id
:
'user.denglu'
})
}
</
Button
>
</
Form
.
Item
>
</
Form
>
}
...
...
src/pages/user/components/ScanLoginWrap.tsx
View file @
7dc76ea7
...
...
@@ -63,9 +63,9 @@ const ScanLoginWrap: React.FC = () => {
const
{
data
,
code
}
=
res
if
(
code
===
1000
)
{
message
.
destroy
()
message
.
success
(
intl
.
formatMessage
({
id
:
'user.dengluchenggong'
}))
message
.
success
(
intl
.
formatMessage
({
id
:
'user.dengluchenggong'
}))
setAuth
(
data
)
setRouters
(
data
.
urls
)
setRouters
(
data
.
auth
)
// 此处需使用href跳转, 否则无法触发app.ts中的路由初始化校验
if
(
redirect
)
{
window
.
location
.
replace
(
decodeURIComponent
(
atob
(
redirect
)))
...
...
@@ -89,7 +89,7 @@ const ScanLoginWrap: React.FC = () => {
},
[])
return
(
<
div
className=
{
'scanLoginWrap'
}
>
<
h2
>
{
intl
.
formatMessage
({
id
:
'user.saomadenglu'
})
}
</
h2
>
<
h2
>
{
intl
.
formatMessage
({
id
:
'user.saomadenglu'
})
}
</
h2
>
<
div
className=
{
'qrCodeImage'
}
>
{
qrCode
&&
<
img
src=
{
qrCode
}
alt=
""
/>
...
...
src/utils/auth.ts
View file @
7dc76ea7
...
...
@@ -40,7 +40,7 @@ export const setAuth = (info: AuthInfo) => {
setCookie
(
AUTH_KEY
,
JSON
.
stringify
(
auth
),
{
domain
:
TOP_DOMAIN_NO_PORT
})
setCookie
(
AUTH_ROLES_KEY
,
JSON
.
stringify
(
info
.
roles
),
{
domain
:
TOP_DOMAIN_NO_PORT
})
setLocalAuth
(
info
)
setRouters
(
info
.
urls
)
setRouters
(
info
.
auth
)
}
/**
...
...
@@ -78,7 +78,7 @@ export const getAuth = (): AuthInfo => {
}
}
export
const
setRouters
=
(
routers
:
any
[]
)
=>
{
export
const
setRouters
=
(
routers
:
any
)
=>
{
window
.
sessionStorage
.
setItem
(
'rt'
,
JSON
.
stringify
(
routers
))
}
...
...
@@ -134,7 +134,8 @@ const HOME_URL = [
'/memberCenter/home'
]
export
const
asyncRouter
=
async
(
routeLists
:
string
[],
routes
:
any
[])
=>
{
export
const
asyncRouter
=
async
(
routeLists
:
{
b
:
string
[],
u
:
string
}[],
routes
:
any
[])
=>
{
const
pathList
=
routeLists
.
map
((
item
)
=>
item
.
u
)
for
(
let
i
=
0
;
i
<
routes
.
length
;
i
++
)
{
const
item
=
routes
[
i
]
if
(
item
.
routes
)
{
...
...
@@ -142,7 +143,7 @@ export const asyncRouter = async (routeLists: string[], routes: any[]) => {
}
else
{
// 参与权限校验的页面
// fix: 修复左侧菜单首页无法显示
if
(
item
.
path
&&
!
routeLists
.
includes
(
item
.
path
)
&&
!
HOME_URL
.
includes
(
item
.
path
))
{
if
(
item
.
path
&&
!
pathList
.
includes
(
item
.
path
)
&&
!
HOME_URL
.
includes
(
item
.
path
))
{
item
.
hideInMenu
=
true
item
.
noAuth
=
true
}
...
...
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