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
7814c14c
Commit
7814c14c
authored
Mar 31, 2022
by
邓晓峰
Browse files
Options
Browse Files
Download
Plain Diff
feat: 添加高德地图
parents
fe39bc21
e4d9a0e8
Pipeline
#47060
skipped with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
20 deletions
+68
-20
index.js
src/components/Notifier/index.js
+6
-7
initConfig.js
src/initConfig.js
+3
-1
login.js
src/pages/user/login/login.js
+56
-9
baseLogin.js
src/pages/user/login/template/baseLogin.js
+3
-3
No files found.
src/components/Notifier/index.js
View file @
7814c14c
...
...
@@ -558,7 +558,6 @@ class Notifier {
mqtt_IsSSL
:
true
};
if
(
Array
.
isArray
(
res
.
getMe
)
&&
res
.
getMe
.
length
>
0
)
{
debugger
if
(
res
.
getMe
[
0
])
{
const
data
=
res
.
getMe
[
0
];
mqttConfig
.
mqtt_IsSSL
=
self
.
_siteConfig
.
IsSSL
=
data
.
IsSSL
?
data
.
IsSSL
:
false
;
...
...
@@ -583,14 +582,14 @@ class Notifier {
mqttConfig
.
mqtt_iotIP
=
self
.
_siteConfig
.
mqtt_iotIP
=
mqttConfig
.
mqtt_mess
.
TcpIP
+
":"
+
mqttConfig
.
mqtt_mess
.
TcpPort
;
self
.
props
.
updateConfig
&&
self
.
props
.
updateConfig
(
Object
.
assign
({},
self
.
props
.
global
,
{
...
mqttConfig
}))
//
self.props.updateConfig && self.props.updateConfig(Object.assign({}, self.props.global, {
//
...mqttConfig
//
}))
// 应用共享状态只在initMicro中更新了一次,异步修改了的globalConfig,子应用读取到的是旧的,需要更新一下应用共享状态
setGlobalState
({
globalConfig
:
window
.
globalConfig
});
//
setGlobalState({
//
globalConfig: window.globalConfig
//
});
}
}
else
{
Logger
.
info
(
'获取mqtt服务器参数失败'
);
...
...
src/initConfig.js
View file @
7814c14c
...
...
@@ -48,7 +48,9 @@ export const initGlobalConfig = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
let
client
=
params
.
getParams
(
'client'
)
||
Cookies
.
get
(
'city'
)
client
=
client
&&
client
!==
'undefined'
?
client
:
'city'
;
appService
.
getWateWayConfig
().
then
(
res
=>
{
appService
.
getWateWayConfig
({
ignoreSite
:
true
,
}).
then
(
res
=>
{
const
hasGateWay
=
!
res
||
!
res
.
data
?
false
:
isString
(
res
.
data
)
?
JSON
.
parse
(
res
.
data
)
:
typeof
res
.
data
===
'boolean'
?
res
.
data
:
false
;
// if (res.code === 0 && res.data === 'true') {
...
...
src/pages/user/login/login.js
View file @
7814c14c
...
...
@@ -6,21 +6,25 @@ import Cookies from 'js-cookie';
import
sha1
from
'sha1'
;
import
{
SlideVerify
}
from
'@wisdom-utils/components'
;
import
{
appService
}
from
'@/api'
;
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
'@/components/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
.
events
=
window
.
share
.
event
;
this
.
globalConfig
=
props
.
global
;
this
.
updateConfig
=
props
.
updateConfig
;
// this.updateConfig = props.updateConfig;
this
.
updateConfig
=
(
config
)
=>
{
props
.
updateConfig
(
config
);
this
.
globalConfig
=
getGlobalConfig
();
}
this
.
createContext
=
props
.
createContext
;
this
.
history
=
props
.
history
;
this
.
callback
=
callback
;
...
...
@@ -207,12 +211,55 @@ class Login {
const
self
=
this
;
// eslint-disable-next-line no-undef
getWebSiteConfig
({
client
:
self
.
globalConfig
.
client
,
token
,
'request.preventCache'
:
Date
.
now
(),
})
.
then
(
response
=>
{
// 获取网站配置的同时,预先获取到mqtt配置,注册进子应用
Promise
.
all
([
noticeService
.
getMqttSiteCode
({
'request.preventCache'
:
Date
.
now
()
}),
getWebSiteConfig
({
client
:
self
.
globalConfig
.
client
,
token
,
'request.preventCache'
:
Date
.
now
(),
})
]).
then
(
results
=>
{
const
res
=
results
[
0
]
??
{};
if
(
res
&&
res
.
say
.
statusCode
===
'0000'
)
{
let
mqttConfig
=
{
mqtt_mess
:
{},
mqtt_path
:
DEFAULT_MQTT_PATH
,
nginxStart
:
false
,
mqtt_IsSSL
:
true
};
if
(
Array
.
isArray
(
res
.
getMe
)
&&
res
.
getMe
.
length
>
0
)
{
if
(
res
.
getMe
[
0
])
{
const
data
=
res
.
getMe
[
0
];
mqttConfig
.
mqtt_IsSSL
=
data
.
IsSSL
?
data
.
IsSSL
:
false
;
mqttConfig
.
mqtt_mess
.
site_code
=
data
.
SiteCode
||
self
.
globalConfig
.
userInfo
.
site
;
mqttConfig
.
mqtt_mess
.
TcpIP
=
data
.
TcpIP
;
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
;
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
;
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
{
...
mqttConfig
});
}
}
else
{
Logger
.
info
(
'获取mqtt服务器参数失败'
);
}
return
results
;
}).
then
(
results
=>
{
const
response
=
results
[
1
]
??
{};
const
result
=
response
&&
response
.
code
===
SERVICE_INTERFACE_SUCCESS_CODE
?
Array
.
isArray
(
response
.
data
)
...
...
@@ -364,7 +411,7 @@ class Login {
const
{
layers
=
[]
}
=
this
.
globalConfig
.
mapsettings
||
{};
if
(
layers
.
length
===
0
)
{
widgetIndex
!==
-
1
&&
this
.
globalConfig
.
uiwidgets
.
splice
(
widgetIndex
,
1
);
return
Promise
.
resolve
(
{}
);
return
Promise
.
resolve
(
this
.
globalConfig
.
mapsettings
);
}
const
layer
=
layers
[
0
];
...
...
src/pages/user/login/template/baseLogin.js
View file @
7814c14c
...
...
@@ -38,9 +38,9 @@ const Login = forwardRef((props, _ref) => {
()
=>
new
LoginAction
(
Object
.
assign
({},
props
,
{
history
}),
setVisible
,
true
),
);
useEffect
(()
=>
{
action
.
globalConfig
=
props
.
global
;
},
[
props
.
global
]);
//
useEffect(() => {
//
action.globalConfig = props.global;
//
}, [props.global]);
const
handleSubmit
=
values
=>
{
/* eslint-disable */
...
...
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