Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김건희
/
OSSW_Weather_Briefing
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김건희
2022-06-08 22:56:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3b2142382c89e0c04260136475261fcb168495a2
3b214238
1 parent
55c1f4f6
[Update] Weather File
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
22 deletions
weather_briefing/src/component/views/MainPage/MainPage.js
weather_briefing/src/component/views/RecommandPage/RecommandPage.js
weather_briefing/src/component/views/WeatherPage/WeatherPage.js
weather_briefing/src/component/views/MainPage/MainPage.js
View file @
3b21423
...
...
@@ -50,7 +50,6 @@ function MainPage(props) {
useEffect
(()
=>
{
user
.
then
((
result
)
=>
{
console
.
log
(
result
);
setName
(
result
.
logData
.
name
);
setSex
(
result
.
logData
.
gender
);
})
...
...
@@ -156,12 +155,14 @@ function MainPage(props) {
setCheckSubmitError
(
false
);
}
if
(
!
checkSubmitError
)
{
addressResult
.
then
((
result
)
=>
{
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
)
{
if
(
result
[
i
].
address1
===
CityAdd
&&
result
[
i
].
address2
===
GuAdd
&&
result
[
i
].
address3
===
DongAdd
)
{
const
dotData
=
{
address1
:
CityAdd
,
address2
:
GuAdd
,
...
...
@@ -170,8 +171,6 @@ function MainPage(props) {
dotY
:
result
[
i
].
dotY
,
}
console
.
log
(
dotData
)
dispatch
(
todayInformation
(
dotData
));
dispatch
(
tommorrowInformation
(
dotData
));
...
...
weather_briefing/src/component/views/RecommandPage/RecommandPage.js
View file @
3b21423
...
...
@@ -16,9 +16,6 @@ function RecommandPage(props) {
useEffect
(()
=>
{
clothesResult
.
then
((
result
)
=>
{
console
.
log
(
result
);
console
.
log
(
result
.
top
);
console
.
log
(
result
.
bottom
);
if
(
result
.
umbrella
==
1
)
{
setIsRain
(
"비 예보가 있습니다. 우산을 꼭 챙겨주세요!"
);
...
...
weather_briefing/src/component/views/WeatherPage/WeatherPage.js
View file @
3b21423
...
...
@@ -25,12 +25,15 @@ function WeatherPage(props) {
const
[
tommorrowHighTemperature
,
setTommorrowHighTemperature
]
=
useState
(
-
100
);
const
[
tommorrowLowTemperature
,
setTommorrowLowTemperature
]
=
useState
(
100
);
const
[
tommorrowWeatherSymbol
,
setTommorrowWeatherSymbol
]
=
useState
(
''
);
const
[
todayWeatherLevel
,
setTodayWeatherLevel
]
=
useState
(
''
);
const
[
userGender
,
setUserGender
]
=
useState
(
''
);
const
[
cityAdd
,
setCityAdd
]
=
useState
(
''
);
const
[
guAdd
,
setGuAdd
]
=
useState
(
''
);
const
[
dongAdd
,
setDongAdd
]
=
useState
(
''
);
const
[
Time
,
setTime
]
=
useState
(
"00:00:00"
);
let
todayWeatherLevel
=
0
;
let
userGender
;
const
currentTime
=
()
=>
{
const
date
=
new
Date
();
const
hours
=
String
(
date
.
getHours
()).
padStart
(
2
,
"0"
);
...
...
@@ -60,7 +63,22 @@ function WeatherPage(props) {
for
(
let
i
=
0
;
i
<
24
;
i
++
)
{
if
(
i
===
13
)
{
setTodayWeatherLevel
(
result
[
i
].
weather
);
if
(
result
[
i
].
weather
===
0
)
{
todayWeatherLevel
=
0
;
}
else
if
(
result
[
i
].
weather
===
1
)
{
todayWeatherLevel
=
1
;
}
else
if
(
result
[
i
].
weather
===
2
)
{
todayWeatherLevel
=
2
;
}
else
if
(
result
[
i
].
weather
===
3
)
{
todayWeatherLevel
=
3
;
}
else
if
(
result
[
i
].
weather
===
4
)
{
todayWeatherLevel
=
4
;
}
}
// 세부 시간 정보
if
(
i
>
Number
(
currentHour
))
{
...
...
@@ -103,6 +121,7 @@ function WeatherPage(props) {
highTemperature
=
result
[
i
].
temperature
;
}
}
setTodayHighTemperature
(
highTemperature
);
setTodayLowTemperature
(
lowTemperature
);
})
...
...
@@ -111,7 +130,6 @@ function WeatherPage(props) {
// 내일의 날씨
useEffect
(()
=>
{
tommorrowWeatherResult
.
then
((
result
)
=>
{
console
.
log
(
result
);
let
highTemperature
=
-
100
;
let
lowTemperature
=
100
;
...
...
@@ -136,9 +154,19 @@ function WeatherPage(props) {
})
},
[
tommorrowWeatherResult
])
// 유저 성별 정보
useEffect
(()
=>
{
user
.
then
((
result
)
=>
{
setUserGender
(
result
.
logData
.
gender
);
console
.
log
(
result
);
if
(
result
.
logData
.
gender
===
'0'
)
{
userGender
=
0
;
}
else
{
userGender
=
1
;
}
});
},
[
user
])
...
...
@@ -157,28 +185,22 @@ function WeatherPage(props) {
const
onSubmitHandler
=
useCallback
((
event
)
=>
{
event
.
preventDefault
();
//체크박스 미리 클릭 방지
let
todayWeather
=
''
;
let
isRain
=
0
;
let
tempData
=
[];
if
(
todayWeatherSymbol
===
'🌧️'
)
{
isRain
=
1
;
}
tempData
.
push
(
isRain
);
console
.
log
(
todayWeatherLevel
);
console
.
log
(
userGender
);
console
.
log
(
isRain
);
const
sendData
=
{
gender
:
0
,
weather
:
"1"
,
gender
:
userGender
,
weather
:
todayWeatherLevel
,
rain
:
isRain
}
console
.
log
(
sendData
);
dispatch
(
recommend
(
sendData
))
navigate
(
'/recommand'
)
dispatch
(
recommend
(
sendData
))
;
navigate
(
'/recommand'
)
;
},
[
todayWeatherResult
,
user
]);
...
...
Please
register
or
login
to post a comment