Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivWeb
Commits
3720288d
Commit
3720288d
authored
Mar 30, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 异步更新的globalConfig更新到应用共享状态
parent
b4e9e9d7
Pipeline
#46928
passed with stages
in 2 minutes 39 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
actions.js
src/actions.js
+2
-1
index.js
src/components/Notifier/index.js
+6
-1
No files found.
src/actions.js
View file @
3720288d
...
@@ -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
;
src/components/Notifier/index.js
View file @
3720288d
...
@@ -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服务器参数失败'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment