Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-convertor-view
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
station
amos-convertor-view
Commits
cd5f6e04
Commit
cd5f6e04
authored
Jun 16, 2020
by
单奇雲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
天气查询
parent
0267a1ae
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
14 deletions
+29
-14
weatherCity.json
src/_mock/weatherCity.json
+0
-0
urlConsts.js
src/consts/urlConsts.js
+2
-1
commonServices.js
src/services/commonServices.js
+12
-6
Weather.js
src/view/common/header/Weather.js
+12
-6
index.js
src/view/region/index.js
+3
-1
No files found.
src/_mock/weatherCity.json
0 → 100644
View file @
cd5f6e04
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/consts/urlConsts.js
View file @
cd5f6e04
...
...
@@ -7,7 +7,7 @@ const AmosConfig = endConf.AmosConfig;
const
securityBaseWsURI
=
AmosConfig
.
wsURI
.
securityBaseURI
;
// 三维视图
//const view3dURI = AmosConfig.httpURI.view3dURI;
const
view3dURI
=
AmosConfig
.
httpURI
.
base
URI
;
const
view3dURI
=
AmosConfig
.
httpURI
.
view3d
URI
;
export
const
baseURI
=
AmosConfig
.
httpURI
.
baseURI
;
//const patrolURI = AmosConfig.httpURI.patrolURI;
const
patrolURI
=
AmosConfig
.
httpURI
.
baseURI
;
...
...
@@ -85,6 +85,7 @@ export const FscSerUrl = {
statisticsCheckUrl
:
completePrefix
(
patrolURI
,
'api/view3d/statistics/check'
),
//今日巡检统计接口
statisticsDutyUrl
:
completePrefix
(
patrolURI
,
'api/view3d/statistics/duty'
),
//今日值班统计
onlineDayUrl
:
completePrefix
(
patrolURI
,
'api/view3d/online/date'
),
//消防安全执行天数
cityWeatherUrl
:
completePrefix
(
patrolURI
,
'/api/weather/{cityCode}'
),
//天气查询
//*******************************************************************************
...
...
src/services/commonServices.js
View file @
cd5f6e04
import
{
singleFetch
}
from
'./../utils/request'
;
import
formatUrl
from
'amos-processor/lib/utils/urlFormat'
;
import
{
singleFetch
,
commonGet
}
from
'./../utils/request'
;
import
{
FscSerUrl
}
from
'./../consts/urlConsts'
;
/**
* 获取在线天气
* @param {string} cityKey
*/
export
const
getOnlineWeather
=
(
cityKey
)
=>
{
const
url
=
`http://wthrcdn.etouch.cn/weather_mini?city=
${
cityKey
}
`
;
return
singleFetch
(
url
);
export
const
getOnlineWeather
=
(
cityCode
)
=>
{
// const url = `http://wthrcdn.etouch.cn/weather_mini?city=${cityKey}`;
return
commonGet
(
formatUrl
(
FscSerUrl
.
cityWeatherUrl
,
{
cityCode
}));
};
export
const
getWeatherCityCode
=
()
=>
{
return
singleFetch
(
'/src/_mock/weatherCity.json'
);
};
export
const
conmmonGetService
=
(
url
)
=>
{
export
const
conmmonGetService
=
(
url
)
=>
{
return
singleFetch
(
url
);
}
}
;
src/view/common/header/Weather.js
View file @
cd5f6e04
import
React
,
{
Component
}
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
{
getOnlineWeather
}
from
'./../../../services/commonServices'
;
import
{
message
}
from
'amos-framework'
;
import
{
getOnlineWeather
,
getWeatherCityCode
}
from
'./../../../services/commonServices'
;
class
Weather
extends
Component
{
...
...
@@ -22,9 +23,14 @@ class Weather extends Component {
}
getWeatherInfo
=
()
=>
{
const
{
address
}
=
this
.
props
;
getOnlineWeather
(
address
).
then
((
res
)
=>
{
this
.
parseData
(
res
.
data
);
let
{
address
}
=
this
.
props
;
getWeatherCityCode
().
then
(
citys
=>
{
const
curCity
=
citys
.
find
(
e
=>
e
.
city_name
.
indexOf
(
address
)
>
-
1
);
getOnlineWeather
(
curCity
.
city_code
).
then
((
res
)
=>
{
this
.
parseData
(
res
.
data
);
},
error
=>
{
message
.
danger
(
`天气(
${
address
}
)查询失败!`
);
});
});
}
...
...
@@ -32,10 +38,10 @@ class Weather extends Component {
const
{
forecast
=
[]
}
=
data
;
const
current
=
forecast
[
0
];
if
(
current
){
const
fengli
=
current
.
fengli
.
replace
(
'<![CDATA
\
['
,
''
).
replace
(
']]>'
,
''
);
//
const fengli = current.fengli.replace('<![CDATA\[', '').replace(']]>', '');
const
high
=
current
.
high
.
replace
(
'高温'
,
''
).
trim
();
const
low
=
current
.
low
.
replace
(
'低温'
,
''
).
trim
();
const
weatherInfo
=
`
${
current
.
type
}
${
low
}
~
${
high
}
${
current
.
f
engxiang
}
${
fengli
}
`
;
const
weatherInfo
=
`
${
current
.
type
}
${
low
}
~
${
high
}
${
current
.
f
x
}
${
current
.
fl
}
`
;
this
.
setState
({
weatherInfo
});
...
...
src/view/region/index.js
View file @
cd5f6e04
...
...
@@ -162,7 +162,9 @@ class RegionSelect extends Component {
let
{
departments
=
[],
roles
=
[]
}
=
this
.
state
;
if
(
key
===
'company'
)
{
reginParams
.
company
=
companys
.
find
(
item
=>
item
.
sequenceNbr
===
value
);
let
company
=
companys
.
find
(
item
=>
item
.
sequenceNbr
===
value
);
reginParams
.
company
=
company
;
reginParams
.
address
=
company
.
address
;
departments
=
companyDepartments
[
value
];
roles
=
orgRoles
[
value
];
}
...
...
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