Commit 6d1987d7 authored by 邓晓峰's avatar 邓晓峰

fix: 修复切换数据库后登陆BUG

parent 90f06049
...@@ -33,11 +33,11 @@ module.exports = { ...@@ -33,11 +33,11 @@ module.exports = {
exclude: [], exclude: [],
}, },
proxy: proxy[REACT_APP_ENV || 'dev'], proxy: proxy[REACT_APP_ENV || 'dev'],
openAPI: { // openAPI: {
requestLibPath: "import { request } from '@wisdom-utils/utils'", // requestLibPath: "import { request } from '@wisdom-utils/utils'",
schemaPath: 'http://192.168.10.150:8777/Publish/OMS/swagger/v1/swagger.json', // schemaPath: 'http://192.168.10.150:8777/Publish/OMS/swagger/v1/swagger.json',
mock: false, // mock: false,
}, // },
postcssLoader: {}, postcssLoader: {},
styleLoader: {}, styleLoader: {},
cssLoader: { cssLoader: {
......
...@@ -4,10 +4,10 @@ export function genActiveRule(routerPrefix) { ...@@ -4,10 +4,10 @@ export function genActiveRule(routerPrefix) {
export default { export default {
dev: [ dev: [
{ {
name: 'civ_monitor', name: 'civ_energy',
entry: `//${window.location.hostname}:8080/civ_monitor`, entry: `//${window.location.hostname}:8081/civ_energy`,
container: '#micro-container', container: '#micro-container',
activeRule: '/civbase/civ_monitor', activeRule: '/civbase/civ_energy',
}, },
{ {
name: 'civ_water', name: 'civ_water',
......
...@@ -83,11 +83,13 @@ const { getSchema } = require('./openapi'); ...@@ -83,11 +83,13 @@ const { getSchema } = require('./openapi');
emitter.on('onDevCompileDone', async () => { emitter.on('onDevCompileDone', async () => {
try { try {
const openAPIConfig = config.openAPI; const openAPIConfig = config.openAPI;
const openAPIJson = await getSchema(openAPIConfig.schemaPath); if(openAPIConfig && openAPIConfig.schemaPath) {
writeFileSync( const openAPIJson = await getSchema(openAPIConfig.schemaPath);
join(openAPIFilesPath, 'civ-plugins_openapi.json'), writeFileSync(
JSON.stringify(openAPIJson, null, 2), join(openAPIFilesPath, 'civ-plugins_openapi.json'),
); JSON.stringify(openAPIJson, null, 2),
);
}
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
......
...@@ -155,6 +155,8 @@ const initGlobalConfig = () => { ...@@ -155,6 +155,8 @@ const initGlobalConfig = () => {
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
updateConfig: data => updateConfig: data =>
store.dispatch(actionCreators.getConfig(data)), store.dispatch(actionCreators.getConfig(data)),
isInit: false,
logout: () => store.dispatch(actionCreators.logout())
}, },
() => { () => {
(async () => { (async () => {
......
...@@ -540,6 +540,7 @@ const BasicLayout = props => { ...@@ -540,6 +540,7 @@ const BasicLayout = props => {
); );
}, [location.pathname]); }, [location.pathname]);
const handleSelectedKey = item => { const handleSelectedKey = item => {
debugger
const config = findPathByLeafId( const config = findPathByLeafId(
item.path, item.path,
currentRoutes.routes, currentRoutes.routes,
......
...@@ -388,6 +388,7 @@ class Site { ...@@ -388,6 +388,7 @@ class Site {
beforeChangeCheck(token, site) { beforeChangeCheck(token, site) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
debugger
appService appService
.getUserInfo({ .getUserInfo({
token, token,
......
...@@ -17,6 +17,7 @@ import { SlideVerify } from '@wisdom-utils/components'; ...@@ -17,6 +17,7 @@ import { SlideVerify } from '@wisdom-utils/components';
const Logger = logger('login'); const Logger = logger('login');
class Login { class Login {
constructor(props, callback, isInit) { constructor(props, callback, isInit) {
debugger
this.events = window.share.event; this.events = window.share.event;
this.globalConfig = props.global; this.globalConfig = props.global;
this.updateConfig = props.updateConfig; this.updateConfig = props.updateConfig;
...@@ -24,6 +25,7 @@ class Login { ...@@ -24,6 +25,7 @@ class Login {
this.history = props.history; this.history = props.history;
this.callback = callback; this.callback = callback;
this.hasTry = false; this.hasTry = false;
this.logout = props.logout;
if (isInit) { if (isInit) {
this.init(); this.init();
} }
...@@ -70,6 +72,7 @@ class Login { ...@@ -70,6 +72,7 @@ class Login {
this.globalConfig.token = token; this.globalConfig.token = token;
const self = this; const self = this;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
appService appService
.getUserInfo({ .getUserInfo({
token: this.globalConfig.token, token: this.globalConfig.token,
...@@ -79,6 +82,7 @@ class Login { ...@@ -79,6 +82,7 @@ class Login {
ignoreSite: true, ignoreSite: true,
}) })
.then(response => { .then(response => {
debugger
if (response && !response.errMsg) { if (response && !response.errMsg) {
self.globalConfig.userInfo = {}; self.globalConfig.userInfo = {};
if ( if (
...@@ -95,6 +99,16 @@ class Login { ...@@ -95,6 +99,16 @@ class Login {
); );
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
self.getUserInfoAndConfig(); self.getUserInfoAndConfig();
} else {
self.logout && self.logout();
if (
self.globalConfig.style === 'ios' &&
self.globalConfig.loginTemplate === 'IOSCloud.html'
) {
window.location.href = `${window.location.origin}`;
return false;
}
window.location.reload();
} }
}); });
} }
......
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