Commit 773150f6 authored by 周宏民's avatar 周宏民

fix: 演示功能 在一些报错情况下,停止loading,跳转成功前进度条100%

parent aebc19d3
Pipeline #89095 waiting for manual action with stages
/* eslint-disable no-underscore-dangle */
import 'kit_logger';
import { log, params, encipher } from '@wisdom-utils/utils/lib/helpers';
import { message } from 'antd';
import { decode, encode } from 'js-base64';
import Cookies from 'js-cookie';
import { appService, noticeService } from '@/api';
import { getUserInfo, getWebSiteConfig } from '@/api/service/base';
import { SERVICE_APP_LOGIN_MODE, SERVICE_INTERFACE_SUCCESS_CODE, WX_REDIRECT_URI } from '@/constants';
import store from '@/stores';
import {
DEFAULT_MQTT_PATH,
DEFAULT_TCP_IP,
DEFAULT_TCP_PORT,
DEFAULT_PARSE_LEVEL,
} from '@wisdom-utils/components/lib/AppLayout/notifier/constants';
// eslint-disable-next-line no-undef
const Logger = logger('login');
const getGlobalConfig = () => store.getState().toJS().global?.globalConfig ?? {};
class Login {
constructor(props, callback, isInit) {
this.props = props;
this.events = window.share.event;
this.globalConfig = props.global;
// this.updateConfig = props.updateConfig;
this.updateConfig = config => {
props.updateConfig(config);
this.globalConfig = getGlobalConfig();
};
this.createContext = props.createContext;
this.history = props.history;
this.callback = callback;
this.integratedNum = 0;
this.hasTry = false;
this.logout = props.logout;
}
writeLogs() {
if (this.globalConfig.userInfo.UserImge === '') {
// _config.userInfo.UserImge = __webpack_public_path__ + "assets/images/icon/熊猫新2.png";
this.globalConfig.userInfo.UserImge = 'https://panda-water.cn/web4/assets/images/icon/熊猫新2.png';
}
if (this.globalConfig.userInfo.site) {
// eslint-disable-next-line no-undef
appService
.writeLogs({
origin: window.location.origin,
client: this.globalConfig.client,
site: this.globalConfig.userInfo && this.globalConfig.userInfo.site ? this.globalConfig.userInfo.site : '',
loginName:
this.globalConfig.userInfo && this.globalConfig.userInfo.fullName
? this.globalConfig.userInfo.fullName
: '',
})
.catch(error => {});
}
if (window.location.host === 'panda-water.com') {
appService
.loginLogs({
origin: window.location.origin,
client: this.globalConfig.client,
site: this.globalConfig.userInfo && this.globalConfig.userInfo.site ? this.globalConfig.userInfo.site : '',
loginName:
this.globalConfig.userInfo && this.globalConfig.userInfo.fullName
? this.globalConfig.userInfo.fullName
: '',
})
.catch(error => {});
}
}
getIndustry(flag, token, getIndustry) {
this.globalConfig.userInfo.Industries = [];
if (this.globalConfig.userInfo.Groups && this.globalConfig.userInfo.Groups.length) {
this.globalConfig.userInfo.Groups.forEach(group => {
if (group.industry && this.globalConfig.userInfo.Industries.indexOf(group.industry) < 0) {
this.globalConfig.userInfo.Industries.push(group.industry);
}
});
}
// eslint-disable-next-line prettier/prettier
if (
!flag &&
this.isSignIn &&
this.globalConfig.userInfo.Industries.length &&
this.globalConfig.userInfo.Industries.length > 1
) {
this.createContext(this);
this.updateConfig && this.updateConfig(this.globalConfig);
this.history.push('/industry');
return false;
}
// 跳转到集成登录引导页_xule_2023-08-28
if (!flag && this.isSignIn && this.globalConfig.isIntegration >= 1 && this.integratedNum >= 2) {
this.history.push('/industry');
return false;
}
this.initGateWay(token, getIndustry);
}
refreshToken(self, token, time) {
if (window.refreshCurrentToken) clearInterval(window.refreshCurrentToken);
window.refreshCurrentToken = setInterval(() => {
appService
.authorizationToken({
loginName: token,
type: 'token',
})
.then(tokenRes => {
if (tokenRes.code === 0) {
self.globalConfig.access_token = tokenRes.data?.access_token ?? '';
localStorage.setItem('access_token', self.globalConfig.access_token);
}
self.updateConfig(self.globalConfig);
});
}, time);
}
initGateWay(token, getIndustry, failCallback) {
const self = this;
const gateWayParam = {
_site: this?.globalConfig?.userInfo?.site ?? '',
};
appService
.getWateWayConfig(gateWayParam)
.then(res => {
// eslint-disable-next-line prettier/prettier, no-undef
const hasGateWay =
!res || !res.data
? false
: _.isString(res.data)
? JSON.parse(res.data)
: typeof res.data === 'boolean'
? res.data
: false;
self.globalConfig.hasGateWay = hasGateWay;
self.globalConfig.apiGatewayDomain = `${window.location.origin}${hasGateWay ? '/PandaCore/GateWay' : ''}`;
if (hasGateWay) {
appService
.authorizationToken({
loginName: token,
type: 'token',
})
.then(tokenRes => {
if (tokenRes.code === 0) {
self.globalConfig.access_token = tokenRes.data?.access_token ?? '';
localStorage.setItem('access_token', self.globalConfig.access_token);
if (self.globalConfig.security === '1') {
const time =
typeof tokenRes.data?.expires_in === 'number' && tokenRes.data?.expires_in / 2 > 0
? tokenRes.data?.expires_in / 2
: 43200000;
self.refreshToken(self, token, time);
}
if (tokenRes.msg === '密码过期') {
localStorage.setItem('password_needChange', true);
} else {
localStorage.removeItem('password_needChange');
}
}
self.updateConfig(self.globalConfig);
})
.then(() => {
// eslint-disable-next-line no-use-before-define
this.getWebConfig(token, getIndustry, failCallback);
})
.catch(err => {
self.updateConfig(self.globalConfig);
});
} else {
self.globalConfig.access_token = null;
localStorage.setItem('access_token', self.globalConfig.access_token);
self.updateConfig(self.globalConfig);
this.getWebConfig(token, getIndustry);
}
})
.catch(err => {
this.events.emit('loginError', '该站点无法连接,请联系管理人员');
});
}
getWebConfig(token, getIndustry, failCallback) {
const self = this;
// eslint-disable-next-line no-undef
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
// 兼容云平台子站不更新的情况
const param = {
client: self.globalConfig.client,
'request.preventCache': Date.now(),
};
if (window.location?.host === 'panda-water.cn') {
param.token = token;
} else {
param.identity = token;
}
Promise.allSettled([noticeService.getMqttSiteCode({ 'request.preventCache': Date.now() }), getWebSiteConfig(param)])
.then(results => {
const promise = results[0];
const site = results[1];
if (site.status === 'fulfilled') {
const respon = site.value;
if (respon.code === 0 && respon.data.length) {
window._changeStation = respon.data[0].changeStation;
}
}
const mqttConfig = {
mqtt_mess: {},
mqtt_path: DEFAULT_MQTT_PATH,
nginxStart: false,
mqtt_IsSSL: true,
ipConfig: {},
};
if (promise.status === 'rejected') {
self.globalConfig = Object.assign(self.globalConfig, {
...mqttConfig,
});
return results;
}
const res = promise.value || {};
if (res && res.code === 0) {
if (Array.isArray(res.data) && res.data.length > 0) {
if (res.data[0]) {
const data = res.data[0];
mqttConfig.ipConfig = data;
mqttConfig.mqtt_IsSSL = data.IsSSL ? data.IsSSL : false;
// eslint-disable-next-line no-multi-assign
mqttConfig.mqtt_mess.site_code = mqttConfig.mqtt_site_code =
data.SiteCode || self.globalConfig.userInfo.site;
mqttConfig.mqtt_mess.TcpIP = data.TcpIP;
// eslint-disable-next-line radix
mqttConfig.mqtt_mess.TcpPort = data.TcpPort ? parseInt(data.TcpPort) : 8083;
mqttConfig.mqtt_mess.MessageLevel = data.MessageLevel ? data.MessageLevel : DEFAULT_PARSE_LEVEL;
if (data.NginxStart) {
mqttConfig.nginxStart = data.NginxStart;
mqttConfig.mqtt_mess.TcpIP = window.location.hostname;
// eslint-disable-next-line radix
mqttConfig.mqtt_mess.TcpPort = parseInt(window.location.port);
mqttConfig.mqtt_path = '/ws/';
} else {
mqttConfig.nginxStart = data.NginxStart;
}
} else {
mqttConfig.mqtt_mess.TcpIP = DEFAULT_TCP_IP;
mqttConfig.mqtt_mess.TcpPort = DEFAULT_TCP_PORT;
mqttConfig.mqtt_IsSSL = `${mqttConfig.mqtt_mess.TcpIP}:${mqttConfig.mqtt_mess.TcpPort}`;
}
mqttConfig.mqtt_iotIP = `${mqttConfig.mqtt_mess.TcpIP}:${
mqttConfig.mqtt_mess.TcpPort ? mqttConfig.mqtt_mess.TcpPort : '443'
}`;
self.globalConfig = Object.assign(self.globalConfig, {
...mqttConfig,
});
}
} else {
Logger.info('获取mqtt服务器参数失败');
}
return results;
})
.then(results => {
const response = results[1]?.value ?? {};
const result =
response && response.code === SERVICE_INTERFACE_SUCCESS_CODE
? Array.isArray(response.data)
? response.data
: []
: response;
if (result && result.length > 0) {
const config = result.shift();
const homeType = config.productType || 'civweb4';
// 产品类型和首页路径同时有才行
// eslint-disable-next-line prettier/prettier
const homepage = params.getParams('homepage')
? params.getParams('homepage')
: homeType && config.homepage
? `${homeType}/${params.getParams('homepage') || config.homepage}`
: '';
window.qiankunIsCache =
window.location.origin.replace(/^(http|https):\/\//, '') === 'panda-water.cn'
? false
: config.isCache || false;
const redirect = params.getParams('redirect') ? params.getParams('redirect') : '';
if (
config.productType === 'civweb4' ||
(redirect.indexOf && (redirect.indexOf('skipHome=true') > -1 || redirect.indexOf('hideTitle=true') > -1))
)
window.qiankunIsCache = false;
const hideFeedback =
config.afterSales && typeof config.afterSales === 'string'
? config.afterSales.split(',').includes(`${self.globalConfig?.userInfo?.OID}`)
: false;
const openAnnouncement = config.OpenAnnouncement;
const announcementContent = config.AnnouncementContent;
const isOpenTransitionPage =
['panda-water.cn', 'panda-water.com'].indexOf(window.location.origin.replace(/^(http|https):\/\//, '')) ===
-1 && config.IsOpenTransitionPage
? config.IsOpenTransitionPage
: false;
self.globalConfig = Object.assign(self.globalConfig, config, {
theme: self.globalConfig.theme,
menu: self.globalConfig.menu,
style: self.globalConfig.style,
homepage: homepage || '',
products: self.globalConfig.products,
isOpenTransitionPage,
hideFeedback,
openAnnouncement,
announcementContent,
// mapsettings: config.mapsettings
});
if (this.globalConfig?.isIntegration >= 1) {
self.globalConfig = Object.assign(self.globalConfig, config, {
widgets: config.widgets || [],
allWidgets: config.widgets || [],
uiwidgets: config.uiwidgets || [],
theme: self.globalConfig.theme,
menu: self.globalConfig.menu,
style: self.globalConfig.style,
homepage: homepage || '',
products: self.globalConfig.products,
hideFeedback,
openAnnouncement,
announcementContent,
});
self.updateConfig && self.updateConfig(self.globalConfig);
}
self.getProjectItems().then(res => {
window.subSysCfg = {};
self.globalConfig = Object.assign(self.globalConfig, {
mapsettings: res,
});
result.forEach(item => {
window.subSysCfg[item.client] = item;
});
if (self.globalConfig.isShared) {
self.globalConfig.mode = 'single';
self.globalConfig.style = 'sandbox';
self.globalConfig.uiwidgets = [self.globalConfig.shareWidget];
self.globalConfig.widgets = [];
}
if (
self.globalConfig.userInfo &&
self.globalConfig.userInfo.site &&
self.globalConfig.userInfo.site.length > 0
) {
// 云模式关闭缓存
window.qiankunIsCache = false;
// eslint-disable-next-line no-undef,no-underscore-dangle
getWebSiteConfig(
{
client: self.globalConfig.client,
identity: token,
ignoreSite: true,
'request.preventCache': Date.now(),
},
// eslint-disable-next-line no-shadow
)
// eslint-disable-next-line no-shadow
.then(response => {
const resultData =
response && response.code === SERVICE_INTERFACE_SUCCESS_CODE
? Array.isArray(response.data)
? response.data
: []
: response;
if (resultData && resultData.length > 0) {
const mainConf = resultData.shift();
const mainType = mainConf.productType || 'civweb4';
if (mainConf.homepage) self.globalConfig.homepage = `${mainType}/${mainConf.homepage}`;
if (mainConf.bannerLogo) self.globalConfig.bannerLogo = mainConf.bannerLogo;
if (mainConf.logo) self.globalConfig.logo = mainConf.logo;
if (mainConf.mdi) self.globalConfig.mdi = mainConf.mdi;
if (mainConf.menu) self.globalConfig.menu = mainConf.menu;
if (mainConf.shortcutIcon) self.globalConfig.shortcutIcon = mainConf.shortcutIcon;
// eslint-disable-next-line no-prototype-builtins
if (mainConf && mainConf.hasOwnProperty('topMenu')) self.globalConfig.topMenu = mainConf.topMenu;
if (mainConf && mainConf.navTheme && self.globalConfig.CloudStyle !== '否')
self.globalConfig.navTheme = mainConf.navTheme; // 云平台统一navTheme
// 云平台切换站点 应用站点自己主题配置
if (config.CloudStyle === '否') {
if (config.navTheme === 'chinaWater') {
self.globalConfig.variableTheme = {
primaryColor: '#009C73',
navTheme: config.navTheme,
headerPrimaryColor: 'linear-gradient(0deg, #048373 0%, #24AE9D 100%)',
};
} else {
self.globalConfig.variableTheme = {
primaryColor: config.primaryColor,
navTheme: config.navTheme,
headerPrimaryColor: config.headerPrimaryColor,
};
}
} else {
self.globalConfig.variableTheme = {
primaryColor: mainConf.primaryColor,
navTheme: mainConf.navTheme,
headerPrimaryColor: mainConf.headerPrimaryColor,
};
}
}
this.isOpenYanshi(self, getIndustry);
});
} else {
this.isOpenYanshi(self, getIndustry);
}
});
} else {
if (this.goLogin()) {
return false;
}
this.handleLoginError();
this.events.emit('loginError', '获取网络配置失败');
}
})
.catch(error => {
// Logger.log(error);
this.handleLoginError();
this.events.emit('loginError', '获取网络配置失败');
});
}
isOpenYanshi(self, getIndustry) {
appService
.isOpenYanshi()
.then(res => {
if (res.data) {
appService
.getYanshiAuthority({ userId: self?.globalConfig?.userInfo?.OID })
.then(response => {
if (response.data && response.data.length > 0) {
const menu = response.data.map(item => `widget=${item}`);
self.globalConfig.mockMenu = menu;
}
self.getYanshiAuthority(self, getIndustry);
})
.catch(error => {
this.events.emit('loginError', '服务请求报错');
this.handleLoginError();
});
} else {
self.getYanshiAuthority(self, getIndustry);
}
})
.catch(error => {
self.getYanshiAuthority(self, getIndustry);
});
}
finish(self, getIndustry) {
self.events.emit('onendLoading');
setTimeout(() => {
getIndustry ? self.events.emit('toggleIndustry') : self.events.emit('loginSuccess');
window.share.event = self.events;
self.callback && self.callback();
}, 200);
}
getYanshiAuthority(self, getIndustry) {
self.updateConfig && self.updateConfig(self.globalConfig);
if (self.globalConfig.widgets.length === 0) {
self.events.emit('loginError', '当前账号未配置菜单');
self.handleLoginError();
return;
}
if (self.globalConfig.isOpenTransitionPage) {
appService
.getTransitionPage()
.then(res => {
const { allWidgets } = self.globalConfig || [];
if (res && res.data && res.data.content && allWidgets.length < 9) {
const transitionPage = {
...res.data,
content: [],
};
allWidgets.forEach(item => {
res.data.content.forEach &&
res.data.content.forEach(content => {
if (content.name === item.label) {
transitionPage.content.push({
name: item.label,
subTitle: content.alias,
image: content.icon,
icon:
item.icon?.indexOf('CityTemp') > -1
? `${window.location.origin}/${item.icon}`
: `${window.location.origin}/civweb4/${item.icon}`,
});
}
});
});
if (transitionPage.content.length > 0) {
self.globalConfig.transitionPage = transitionPage;
self.updateConfig && self.updateConfig(self.globalConfig);
self.events.emit('loginHomePage');
window.share.event = self.events;
return self.callback && self.callback();
}
self.globalConfig.isOpenTransitionPage = false;
self.updateConfig && self.updateConfig(self.globalConfig);
}
self.finish(self, getIndustry);
})
.catch(error => {
self.finish(self, getIndustry);
});
} else {
self.finish(self, getIndustry);
}
}
getProjectItems() {
let MAX_BOTTOM = 0;
let isScale = false;
let widgetIndex = -1;
this.globalConfig.uiwidgets &&
this.globalConfig.uiwidgets.map((item, index) => {
// eslint-disable-next-line radix
if (parseInt(item.bottom) > MAX_BOTTOM) {
// eslint-disable-next-line radix
MAX_BOTTOM = parseInt(item.bottom);
}
if (!isScale && item.url.toLowerCase().indexOf('widgets/zoom') > -1) isScale = true;
if (widgetIndex === -1 && item.url.indexOf('ToggleProject/ToggleProject') > -1) widgetIndex = index;
});
const { layers = [] } = this.globalConfig.mapsettings || {};
if (layers && layers.length === 0) {
widgetIndex !== -1 && this.globalConfig.uiwidgets.splice(widgetIndex, 1);
return Promise.resolve(this.globalConfig.mapsettings);
}
const layer = layers && layers[0] ? layers[0] : {};
if (!layer.id) {
layer.layerType = 'dynamic';
} else {
layer.layerType = 'PipenetLayer';
}
let flag = false;
this.globalConfig.uiwidgets.forEach(item => {
if (item.label === '图层管理') {
flag = true;
}
});
if (!flag) {
if (layers && layers.length > 1 && widgetIndex === -1) {
this.globalConfig.uiwidgets.push({
bottom: isScale ? MAX_BOTTOM + 70 : MAX_BOTTOM + 35,
config: '',
label: '方案切换',
right: 15,
url: 'product/webgisPanda/ToggleProject/ToggleProject',
});
}
}
this.globalConfig.mapsettings.initareasettings = { ...this.globalConfig.mapsettings.areasettings };
if (layer.areaName) {
this.globalConfig.mapsettings.areasettings.areaName = layer.areaName;
}
if (layer.backgroundColor) {
this.globalConfig.mapsettings.areasettings.backgroundColor = layer.backgroundColor;
}
if (layer.boundColor) {
this.globalConfig.mapsettings.areasettings.boundColor = layer.boundColor;
}
if (layer.boundWidth) {
this.globalConfig.mapsettings.areasettings.boundWidth = layer.boundWidth;
}
// eslint-disable-next-line radix
if (Number.isInteger(parseInt(layer.backgroundOpacity))) {
this.globalConfig.mapsettings.areasettings.backgroundOpacity = layer.backgroundOpacity;
}
if (layer.extent) this.globalConfig.mapsettings.areasettings.extent = layer.extent;
if (layer.basemaps && layer.basemaps.length > 0) {
this.globalConfig.mapsettings.basemaps = layer.basemaps;
}
return Promise.resolve(this.globalConfig.mapsettings);
}
handleLoginError(callback) {
Cookies.set(this.globalConfig.client, '', {
path: '/',
});
Cookies.set('token', '', {
path: '/',
});
Cookies.set('site', '', {
path: '/',
});
Cookies.set('loginMode', '', {
path: '/',
});
Cookies.set('redirect_state', '', {
path: '/',
});
this.loginFailed = true;
callback && callback();
}
goLogin() {
if (this.globalConfig.style === 'ios' && this.globalConfig.loginTemplate === 'IOSCloud.html') {
window.location.href = `${window.location.origin}/#login`;
return true;
}
return false;
}
isRememberPWD(status) {
this.isRememberPWD = status;
}
getLocalSiteBytoken(tk) {
const sStr = localStorage.getItem('loginSite');
let s = null;
if (sStr) {
const sObj = JSON.parse(sStr);
if (sObj && sObj[tk]) {
s = sObj[tk];
}
}
return s;
}
getUserInfoAndConfig(failCallback, flag, industry, toSite) {
const { token: tk } = this.globalConfig;
const token = tk || Cookies.get('token');
const site = Cookies.get('site');
const self = this;
/* eslint-disable */
let _industrySite = null;
if (industry) {
let userInfo =
self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array
? self.globalConfig.userInfo.Groups.find(enter => {
if (toSite) {
return enter.site === toSite;
} else {
return enter.industry === industry;
}
})
: null;
if (industry === '熊猫新产品' && site) {
self.globalConfig.userInfo = {
site: decodeURIComponent(decode(site)),
Groups: self.globalConfig.userInfo.Groups,
};
self.updateConfig && self.updateConfig(self.globalConfig);
} else if (userInfo) {
self.globalConfig.userInfo = {
site: userInfo.site ? userInfo.site : null,
Groups: self.globalConfig.userInfo.Groups,
};
_industrySite = userInfo.site ? userInfo.site : null;
// self.globalConfig.Industry = industry
self.updateConfig && self.updateConfig(self.globalConfig);
}
} else if (!!site && self.isSignIn) {
self.globalConfig.userInfo = {
site: decodeURIComponent(decode(site)),
Groups:
self.globalConfig.userInfo &&
self.globalConfig.userInfo.Groups &&
self.globalConfig.userInfo.Groups instanceof Array
? self.globalConfig.userInfo.Groups
: null,
};
self.updateConfig && self.updateConfig(self.globalConfig);
}
if (self.isSignIn || !!industry) {
// eslint-disable-next-line no-undef
let param = {
subOID: 'subOID',
industry,
site: _industrySite || this.getLocalSiteBytoken(token),
ignoreSite: true,
'request.preventCache': Date.now(),
// self.globalConfig.userInfo.site ? self.globalConfig.userInfo.site: this.getLocalSiteBytoken(token),
// industrySite ? _industrySite : this.getLocalSiteBytoken(token),
};
if (window.location?.host === 'panda-water.cn') {
param.token = token;
} else {
param.identity = token;
}
getUserInfo(param)
.then(response => {
try {
if (response && response.code === 0) {
self.globalConfig.userInfo = window?.globalConfig?.transformUserInfo?.(response.data) ?? {};
self.integratedNum = response.data?.integrated;
const date = new Date();
date.setTime(date.getTime() + 24 * 60 * 60 * 1000);
// date = date.toGMTString();
const encodeSite = encode(encodeURIComponent(response.site));
Cookies.set('site', encodeSite, {
expires: date,
path: '/',
});
self.globalConfig.Industry = industry;
self.updateConfig && self.updateConfig(self.globalConfig);
const loginSite = {};
loginSite[token] = response.site;
// Cookie.set()
localStorage.setItem('loginSite', JSON.stringify(loginSite));
self.writeLogs();
self.getIndustry(flag, token, industry);
} else {
message.error(response.errMsg);
if (self.goLogin()) {
return false;
}
self.handleLoginError(failCallback);
this.events.emit('loginError', '获取账号信息错误');
}
self.updateConfig && self.updateConfig(self.globalConfig);
} catch (error) {
if (self.goLogin()) {
return false;
}
self.events.emit('loginError', '获取账号信息错误');
self.handleLoginError(failCallback);
}
})
.catch(error => {
if (self.goLogin()) {
return false;
}
self.events.emit('loginError', '获取账号信息错误');
self.handleLoginError(failCallback);
});
} else {
try {
self.writeLogs();
self.getIndustry(flag, token);
} catch (error) {
if (self.goLogin()) {
return false;
}
self.handleLoginError(failCallback);
}
}
}
}
export default Login;
......@@ -17,12 +17,12 @@ import { encode } from 'js-base64';
import { appService } from '@/api';
import { actionCreators } from '@/containers/App/store';
import { connect } from 'react-redux';
import LoginAction from '@/pages/user/login/login';
import classNames from 'classnames';
import { defaultApp } from '@/micro';
import Iframe from '@/components/Container/Iframe';
import moment from 'moment';
import LoadPage from '@/components/LoadPage';
import LoginAction from './components/login';
import useFullScreen from './components/useFullScreen';
import styles from './index.less';
import LeftItem from './components/Left';
......@@ -378,8 +378,13 @@ const Demonstration = props => {
setLoading(false);
});
};
const onendLoading = () => {
jumpProgressEnd();
};
const handError = err => {
if (err) {
message.error(err);
}
setJumpLoading(false);
jumpProgressEnd();
};
......@@ -418,8 +423,11 @@ const Demonstration = props => {
}, [props]);
useEffect(() => {
window.share.event.on('loginError', handError);
// 结束跳转loading
window.share.event.on('onendLoading', onendLoading);
return () => {
window.share.event.removeListener('loginError', handError);
window.share.event.removeListener('onendLoading', onendLoading);
};
}, [jumpLoading]);
useEffect(() => {
......
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