Commit 9b4b3e37 authored by 崔佳豪's avatar 崔佳豪

Merge branch 'master' into dev

parents ba9862aa 8de744f6
Pipeline #58797 passed with stages
...@@ -214,7 +214,7 @@ export const initMicroApps = () => { ...@@ -214,7 +214,7 @@ export const initMicroApps = () => {
}); });
}; };
export const defaultApp = () => { export const defaultApp = (setUrl) => {
const globalStore = store.getState().toJS(); const globalStore = store.getState().toJS();
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const config = window.globalConfig; const config = window.globalConfig;
...@@ -224,9 +224,9 @@ export const defaultApp = () => { ...@@ -224,9 +224,9 @@ export const defaultApp = () => {
if (config && config.token) { if (config && config.token) {
let url = !config.home ? let url = !config.home ?
((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: (`/civbase/${config.homepage.replace(/^\//, '')}`)) : `/civbase/${config.homepage.replace(/^\//, '')}`; ((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: (`/civbase/${config.homepage.replace(/^\//, '')}`)) : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url); setDefaultMountApp(setUrl || url);
window.share.event.emit('visible', url); window.share.event.emit('visible', setUrl || url);
} }
}; };
......
...@@ -57,10 +57,10 @@ class Login { ...@@ -57,10 +57,10 @@ class Login {
loginName = params.getParams('loginName') loginName = params.getParams('loginName')
? params.getParams('loginName') ? params.getParams('loginName')
: loginName; : loginName;
const redirect = params.getParams('redirect'); const homepage = params.getParams('homepage');
const generateType = params.getParams('generateType'); const generateType = params.getParams('generateType');
if (redirect) { if (homepage) {
this.globalConfig.homepage = redirect; this.globalConfig.homepage = homepage;
// this.globalConfig.layout = 'blank'; // this.globalConfig.layout = 'blank';
} }
if (generateType) { if (generateType) {
...@@ -311,10 +311,10 @@ class Login { ...@@ -311,10 +311,10 @@ class Login {
const config = result.shift(); const config = result.shift();
const homeType = config.productType || 'civweb4'; const homeType = config.productType || 'civweb4';
// 产品类型和首页路径同时有才行 // 产品类型和首页路径同时有才行
let homepage = params.getParams('redirect') let homepage = params.getParams('homepage')
? params.getParams('redirect') ? params.getParams('homepage')
: homeType && config.homepage : homeType && config.homepage
? `${homeType}/${params.getParams('redirect') || config.homepage}` ? `${homeType}/${params.getParams('homepage') || config.homepage}`
: ''; : '';
self.globalConfig = Object.assign(self.globalConfig, config, { self.globalConfig = Object.assign(self.globalConfig, config, {
......
import '@wisdom-utils/utils/lib/helpers/format'; import '@wisdom-utils/utils/lib/helpers/format';
import { params } from '@wisdom-utils/utils/lib/helpers';
import React, { forwardRef, useEffect, useRef, useState } from 'react'; import React, { forwardRef, useEffect, useRef, useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
...@@ -12,6 +12,10 @@ const Login = forwardRef((props, _ref) => { ...@@ -12,6 +12,10 @@ const Login = forwardRef((props, _ref) => {
() => () =>
new LoginAction(Object.assign({}, props, { history }), () => {}, false), new LoginAction(Object.assign({}, props, { history }), () => {}, false),
); );
const [redirect] = useState(() => {
const param = params.getParams('redirect')?.replaceAll(';', '&');
return param ? decodeURIComponent(escape(param)) : null;
});
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱 // 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱
const hasLogin = useRef(); const hasLogin = useRef();
...@@ -36,7 +40,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -36,7 +40,7 @@ const Login = forwardRef((props, _ref) => {
); );
// window.share.event.emit('triggerMicro', props.global); // window.share.event.emit('triggerMicro', props.global);
// initMicroApps(); // initMicroApps();
defaultApp(); defaultApp(redirect);
}); });
return () => { return () => {
action && action.events && action.events.removeAllListeners('loginSuccess'); action && action.events && action.events.removeAllListeners('loginSuccess');
......
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