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
61244f26
Commit
61244f26
authored
Jun 16, 2021
by
张苗苗
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增sensorType和isMock
parent
3659dbc0
Pipeline
#29835
passed with stages
in 22 minutes 36 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
base.js
src/api/service/base.js
+14
-1
app.js
src/app.js
+39
-0
No files found.
src/api/service/base.js
View file @
61244f26
...
...
@@ -4,7 +4,7 @@ import * as constants from '../../constants';
export
const
API
=
{
AUTHORIZATION_TOKEN
:
'/Publish/Identity/AuthorizationToken'
,
GET_GATEWAY_CONFIG
:
'/P
ublish
/OMS/GateWayConfig'
,
GET_GATEWAY_CONFIG
:
'/P
andaCore
/OMS/GateWayConfig'
,
GET_CONFIG
:
'/CityInterface/rest/services.svc/GetConfig'
,
GENERATE_TOKEN
:
'/cityinterface/rest/services.svc/generatetoken'
,
GENERATE_IOT_TOKEN
:
'cityinterface/rest/services.svc/generateGCKToken'
,
...
...
@@ -33,6 +33,8 @@ export const API = {
UPLOAD_FILE_URL
:
'/cityinterface/rest/services/filedownload.svc/uploadfile/个人信息/{path}/{filename}'
,
AVATAR_FILE_URL
:
'/cityinterface/rest/services/filedownload.svc/download'
,
GET_SENSOR_TYPE
:
'/PandaCore/GCK/Sensor/GetSensorType'
,
// 获取传感器类型
GET_SYSTEM_CONFIGURATION
:
'/PandaCore/OMS/SysConfiguration'
,
// 获取系统配置
};
const
services
=
{
...
...
@@ -145,6 +147,17 @@ const services = {
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
// Sensor 指标管理
getSensorType
:
{
url
:
API
.
GET_SENSOR_TYPE
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
sysConfiguration
:
{
url
:
API
.
GET_SYSTEM_CONFIGURATION
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
};
export
const
searchAutoCity
=
keywords
=>
{
...
...
src/app.js
View file @
61244f26
...
...
@@ -80,6 +80,7 @@ const loader = (appContent, loading) => render({ appContent, loading });
const
initLocale
=
()
=>
{
localStorage
.
setItem
(
'umi_locale'
,
'zh-CN'
);
};
const
PRODUCT_NAME
=
[
'civ_water'
,
'civ_monitor'
];
const
initGlobalConfig
=
()
=>
{
// eslint-disable-next-line no-debugger
...
...
@@ -130,6 +131,7 @@ const initGlobalConfig = () => {
appService
.
queryConfig
({
client
:
params
.
getParams
(
'client'
)
||
'city'
})
.
then
(
res
=>
{
debugger
;
if
(
res
)
{
const
data
=
res
;
if
(
!
data
.
client
)
{
...
...
@@ -175,6 +177,8 @@ const initGlobalConfig = () => {
})
// eslint-disable-next-line no-shadow
.
then
(
res
=>
{
initSensorType
();
initIsMock
();
render
({
appContent
:
''
,
loading
:
true
});
})
.
catch
(
error
=>
{
...
...
@@ -183,6 +187,41 @@ const initGlobalConfig = () => {
}
};
const
initSensorType
=
()
=>
{
let
filterProduct
=
(
window
.
globalConfig
&&
window
.
globalConfig
.
products
)
||
[];
filterProduct
=
filterProduct
.
filter
(
item
=>
PRODUCT_NAME
.
includes
(
item
.
PackageName
),
);
if
(
filterProduct
.
length
>
0
)
{
appService
.
getSensorType
().
then
(
res
=>
{
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
{
sensorType
:
res
.
data
,
}),
),
);
});
}
};
const
initIsMock
=
()
=>
{
appService
.
sysConfiguration
({
moduleName
:
'是否mock数据'
,
})
.
then
(
res
=>
{
store
.
dispatch
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
{
isMock
:
res
.
data
===
'是'
,
}),
),
);
});
};
initGlobalConfig
();
initLocale
();
window
.
share
&&
...
...
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