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
3b2d28b7
Commit
3b2d28b7
authored
Jun 27, 2023
by
武广
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改跳转登录问题
parent
c0d16b8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
iframeBridge.js
src/utils/iframeBridge.js
+42
-0
request.js
src/utils/request.js
+3
-2
No files found.
src/utils/iframeBridge.js
0 → 100644
View file @
3b2d28b7
class
IframeBridge
{
constructor
()
{
console
.
info
(
'
use iframeBridge
'
);
this
.
mountEventBus
();
}
static
run
(
data
,
callbackName
)
{
return
new
Promise
(
resolve
=>
{
if
(
!
data
.
event
)
{
resolve
(
false
);
return
;
}
console
.
log
(
'
childIframe
'
,
data
);
window
.
parent
.
postMessage
(
data
,
'
*
'
);
!
callbackName
&&
resolve
(
true
);
});
}
static
mountEventBus
()
{
window
.
addEventListener
(
'
message
'
,
info
=>
{
// 来源页面地址
console
.
log
(
'
addEventListenerCallBack
'
,
info
);
});
}
// async closeBrowser() {
// return await this.run({ event: 'closeBrowser' });
// }
// async getToken() {
// return await this.run({ event: 'getToken' }, 'getTokenSuccess');
// }
// async openNewUrl(data: RunData = {}) {
// if (!data.event) {
// data.event = 'openNewUrl';
// }
// return await this.run(data);
// }
}
export
default
IframeBridge
;
src/utils/request.js
View file @
3b2d28b7
...
...
@@ -9,6 +9,7 @@ import { notification } from 'antd';
import
{
getUrlSearchParams
,
getToken
}
from
'
./utils
'
;
import
localStorage
from
'
./localStorage
'
;
import
config
from
'
../../config/env.config
'
;
import
IframeBridge
from
'
./iframeBridge
'
;
let
isRefreshing
=
true
;
let
subscriber
=
[];
...
...
@@ -128,8 +129,8 @@ request.interceptors.response.use(async (response, options) => {
if
(
!
isTob
)
{
window
.
location
.
href
=
loginPath
;
}
else
{
window
.
parent
.
location
.
hash
=
'
#login
'
;
window
.
parent
.
reload
(
);
const
iframeBridgeModel
=
IframeBridge
()
;
iframeBridgeModel
.
run
({
event
:
'
toLogin
'
}
);
}
}
if
(
data
.
businessCode
&&
data
.
businessCode
!==
'
0000
'
&&
!
options
.
notTip
)
{
...
...
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