Commit 3720288d authored by 崔佳豪's avatar 崔佳豪

fix: 异步更新的globalConfig更新到应用共享状态

parent b4e9e9d7
Pipeline #46928 passed with stages
in 2 minutes 39 seconds
...@@ -8,5 +8,6 @@ export const initialState = { ...@@ -8,5 +8,6 @@ export const initialState = {
const actions = initGlobalState(initialState); const actions = initGlobalState(initialState);
// action.setGlobalState({key: value}) 更新状态 // action.setGlobalState({key: value}) 更新状态
// actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态 // actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态
export const setGlobalState = actions.setGlobalState;
export const onGlobalStateChange = actions.onGlobalStateChange;
export default actions; export default actions;
...@@ -25,6 +25,7 @@ import { ...@@ -25,6 +25,7 @@ import {
VIDEO_LEVEL, VIDEO_LEVEL,
} from './constants'; } from './constants';
import createMessage from './message'; import createMessage from './message';
import { setGlobalState } from '@/actions';
/* eslint-disable */ /* eslint-disable */
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
...@@ -557,7 +558,7 @@ class Notifier { ...@@ -557,7 +558,7 @@ class Notifier {
mqtt_IsSSL: true mqtt_IsSSL: true
}; };
if (Array.isArray(res.getMe) && res.getMe.length > 0) { if (Array.isArray(res.getMe) && res.getMe.length > 0) {
debugger
if (res.getMe[0]) { if (res.getMe[0]) {
const data = res.getMe[0]; const data = res.getMe[0];
mqttConfig.mqtt_IsSSL = self._siteConfig.IsSSL = data.IsSSL ? data.IsSSL : false; mqttConfig.mqtt_IsSSL = self._siteConfig.IsSSL = data.IsSSL ? data.IsSSL : false;
...@@ -586,6 +587,10 @@ class Notifier { ...@@ -586,6 +587,10 @@ class Notifier {
...mqttConfig ...mqttConfig
})) }))
// 应用共享状态只在initMicro中更新了一次,异步修改了的globalConfig,子应用读取到的是旧的,需要更新一下应用共享状态
setGlobalState({
globalConfig: window.globalConfig
});
} }
} else { } else {
Logger.info('获取mqtt服务器参数失败'); Logger.info('获取mqtt服务器参数失败');
......
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