Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
a39c5a94
Commit
a39c5a94
authored
Jun 01, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加tob进入页面入口
parent
896d3873
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
4 deletions
+59
-4
BasicLayout.jsx
src/layouts/BasicLayout.jsx
+29
-3
BasicLayout.less
src/layouts/BasicLayout.less
+8
-0
request.js
src/utils/request.js
+1
-1
utils.js
src/utils/utils.js
+21
-0
No files found.
src/layouts/BasicLayout.jsx
View file @
a39c5a94
...
...
@@ -11,9 +11,10 @@ import { connect } from 'dva';
import
{
Icon
as
LegacyIcon
}
from
'
@ant-design/compatible
'
;
import
{
Result
,
Button
,
Layout
,
Menu
}
from
'
antd
'
;
import
Authorized
from
'
@/utils/Authorized
'
;
import
localStorage
from
'
@/utils/localStorage
'
;
import
RightContent
from
'
@/components/GlobalHeader/RightContent
'
;
import
MessageReminder
from
'
@/components/MessageReminder
'
;
import
{
getAuthorityFromRouter
}
from
'
@/utils/utils
'
;
import
{
getAuthorityFromRouter
,
getUrlSearchParams
}
from
'
@/utils/utils
'
;
import
{
getSocketUrl
}
from
'
@/services/messageReminder
'
;
import
logo
from
'
../assets/logo.png
'
;
import
style
from
'
./BasicLayout.less
'
;
...
...
@@ -54,6 +55,7 @@ const BasicLayout = props => {
const
[
siderCollapsed
,
setSiderCollapsed
]
=
useState
(
false
);
const
messageReminderComplexRef
=
useRef
();
// const audioRef = useRef()
useEffect
(()
=>
{
...
...
@@ -131,7 +133,8 @@ const BasicLayout = props => {
),
);
return
window
.
__POWERED_BY_QIANKUN__
?
(
// 嵌套乾坤
const
qianKunLayout
=
()
=>
(
<
div
id=
"micro"
>
<
Layout
className=
{
style
.
layout
}
>
<
Sider
...
...
@@ -148,7 +151,10 @@ const BasicLayout = props => {
</
Layout
>
</
Layout
>
</
div
>
)
:
(
);
// 商家端直接登录
const
merchantLayout
=
()
=>
(
<
ProLayout
logo=
{
logo
}
onCollapse=
{
handleMenuCollapse
}
...
...
@@ -206,6 +212,26 @@ const BasicLayout = props => {
{
/* <Button ref={audioRef} onClick={() => { socket.play() }}>声音</Button> */
}
</
ProLayout
>
);
// tob登录
const
tobLayout
=
()
=>
(
<
Layout
className=
{
style
.
tobLayout
}
>
<
Authorized
noMatch=
{
noMatch
}
>
{
children
}
</
Authorized
>
</
Layout
>
);
// 是否从消费地图后管跳转过来
const
searchPrams
=
getUrlSearchParams
();
const
isTob
=
searchPrams
.
source
===
'
tob
'
;
if
(
window
.
__POWERED_BY_QIANKUN__
)
{
return
qianKunLayout
();
}
if
(
isTob
&&
searchPrams
.
token
)
{
localStorage
.
set
(
'
tobToken
'
,
searchPrams
.
token
||
''
);
return
tobLayout
();
}
return
merchantLayout
();
};
export
default
connect
(({
global
,
settings
,
menu
})
=>
({
collapsed
:
global
.
collapsed
,
...
...
src/layouts/BasicLayout.less
View file @
a39c5a94
...
...
@@ -44,3 +44,11 @@
}
}
}
.tobLayout {
:global {
.ant-pro-page-header-wrap-page-header-warp {
display: none !important;
}
}
}
src/utils/request.js
View file @
a39c5a94
...
...
@@ -76,7 +76,7 @@ const refreshRequest = async (url, options) => {
// request拦截器, 改变url 或 options.
request
.
interceptors
.
request
.
use
(
async
(
url
,
options
)
=>
{
const
token
=
localStorage
.
get
(
'
token
'
);
const
token
=
localStorage
.
get
(
'
to
bToken
'
)
||
localStorage
.
get
(
'
to
ken
'
);
if
(
!
token
&&
!
url
.
includes
(
'
/v2/oauth/login
'
))
{
window
.
location
.
href
=
`
${
window
.
origin
}
/user/login`
;
}
...
...
src/utils/utils.js
View file @
a39c5a94
...
...
@@ -171,3 +171,24 @@ export const getErrorMessage = err => {
})(
err
);
return
message
;
};
// 获取地址栏参数,name:参数名称
export
const
getUrlParams
=
name
=>
{
const
regArg
=
new
RegExp
(
`(^|&)
${
name
}
=([^&]*)(&|$)`
);
const
r
=
window
.
location
.
search
.
substr
(
1
).
match
(
regArg
);
if
(
r
!=
null
)
return
decodeURIComponent
(
r
[
2
]);
return
null
;
};
// 获取地址栏所以参数
export
const
getUrlSearchParams
=
()
=>
{
const
newObj
=
{};
const
url
=
window
.
location
.
search
;
// 获取url中"?"符后的字符串
if
(
url
.
indexOf
(
'
?
'
)
!==
-
1
)
{
const
strs
=
url
.
replace
(
'
?
'
,
''
).
split
(
'
&
'
);
for
(
let
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
newObj
[
strs
[
i
].
split
(
'
=
'
)[
0
]]
=
strs
[
i
].
split
(
'
=
'
)[
1
]
||
''
;
}
}
return
newObj
;
};
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