Commit 3b2d28b7 authored by 武广's avatar 武广

fix: 修改跳转登录问题

parent c0d16b8f
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;
......@@ -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) {
......
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