Toggle navigation
Toggle navigation
This project
Loading...
Sign in
권주희
/
howsTheAir
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
권주희
2020-06-23 15:31:59 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c16fc3149a336ce830eab3955493ad540cf16925
c16fc314
1 parent
f5bd852b
Update home.js
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
1 deletions
frontend/src/home.js
frontend/src/home.js
View file @
c16fc31
...
...
@@ -31,6 +31,12 @@ export default class Home extends Component {
region
:
"은평구청"
,
curAirCondition
:
null
,
routeInformation
:
null
,
temperature
:
null
,
humidity
:
null
,
weather
:
null
,
icon
:
null
,
wind
:
null
,
cloud
:
null
,
};
}
...
...
@@ -303,6 +309,35 @@ export default class Home extends Component {
.
finally
(
function
()
{
// always executed
});
API
.
get
(
"airCondition/weather"
,
{
params
:
{
latitude
:
position
[
"Ha"
],
longitude
:
position
[
"Ga"
],
},
})
.
then
((
response
)
=>
{
let
resp
=
response
[
"data"
];
console
.
log
(
resp
);
console
.
log
(
"현재온도 : "
+
(
resp
.
main
.
temp
-
273.15
));
console
.
log
(
"현재습도 : "
+
resp
.
main
.
humidity
);
console
.
log
(
"날씨 : "
+
resp
.
weather
[
0
].
main
);
console
.
log
(
"상세날씨설명 : "
+
resp
.
weather
[
0
].
description
);
console
.
log
(
"날씨 이미지 : "
+
resp
.
weather
[
0
].
icon
);
console
.
log
(
"바람 : "
+
resp
.
wind
.
speed
);
console
.
log
(
"구름 : "
+
resp
.
clouds
.
all
+
"%"
);
this
.
setState
({
temperature
:
(
resp
.
main
.
temp
-
273.15
).
toFixed
(
3
),
humidity
:
resp
.
main
.
humidity
,
weather
:
resp
.
weather
[
0
].
main
,
icon
:
resp
.
weather
[
0
].
icon
,
wind
:
resp
.
wind
.
speed
,
cloud
:
resp
.
clouds
.
all
+
"%"
,
});
})
.
catch
(
function
(
error
)
{
console
.
log
(
error
);
});
};
let
setDepart
=
document
.
createElement
(
"Button"
);
setDepart
.
innerHTML
=
"출발지로 설정하기"
;
...
...
@@ -400,7 +435,12 @@ export default class Home extends Component {
<
br
/>
미세먼지
등급
<
br
/>
{
pm10Image
}
<
br
/>
미세먼지
지수
:
{
this
.
state
.
curAirCondition
.
pm10Value
}
<
br
/>
초미세먼지
등급
<
br
/>
{
pm25Image
}
<
br
/>
초미세먼지
지수
:
{
this
.
state
.
curAirCondition
.
pm25Value
}
<
br
/>
{
" "
}
초미세먼지
지수
:
{
this
.
state
.
curAirCondition
.
pm25Value
}
<
br
/>
현재
온도
:
{
this
.
state
.
temperature
}
℃
<
br
/>
현재
습도
:
{
this
.
state
.
humidity
}
<
br
/>
날씨
:
{
this
.
state
.
weather
}
<
br
/>
바람
:
{
this
.
state
.
wind
}
<
br
/>
구름
:
{
this
.
state
.
cloud
}
<
br
/>
{
" "
}
<
/h5
>
);
}
...
...
Please
register
or
login
to post a comment