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 16:28:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5b12fb226a20b5cef3bb3b3f267237df301d6ab1
5b12fb22
1 parent
bf06ec08
[Update] Connect Files
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
46 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/style/WeatherPage.scss
weather_briefing/src/component/views/MainPage/MainPage.js
View file @
5b12fb2
...
...
@@ -171,9 +171,6 @@ function MainPage(props) {
return
(
<>
<
dir
id
=
"header"
>
<
dir
className
=
"header_clock"
>
<
h1
id
=
"clock"
>
{
Time
}
<
/h1
>
<
/dir
>
<
dir
className
=
"header_title"
>
<
h1
>
Weather_Briefing
<
/h1
>
<
/dir
>
...
...
weather_briefing/src/component/views/RecommandPage/RecommandPage.js
View file @
5b12fb2
...
...
@@ -93,16 +93,6 @@ function RecommandPage(props) {
<
/dir
>
<
/dir
>
<
/div
>
<
dir
id
=
"footer"
>
<
dir
className
=
"footer_logo"
>
<
h1
>
logo
<
/h1
>
<
/dir
>
<
dir
className
=
"footer_info"
>
<
p
>
경희대학교
<
/p
>
<
p
>
컴퓨터공학과
김건희ㅣ오석진ㅣ손수민
<
/p
>
<
/dir
>
<
/dir
>
<
/
>
);
};
...
...
weather_briefing/src/component/views/WeatherPage/WeatherPage.js
View file @
5b12fb2
...
...
@@ -3,16 +3,12 @@ import { useDispatch, useSelector } from "react-redux";
import
{
useNavigate
}
from
"react-router-dom"
;
import
{
recommend
}
from
"../../../modules/clothes"
;
import
"../style/WeatherPage.scss"
function
WeatherPage
(
props
)
{
const
dispatch
=
useDispatch
();
const
navigate
=
useNavigate
();
const
user
=
useSelector
((
state
)
=>
state
.
user
.
loginData
);
const
todayWeatherResult
=
useSelector
((
state
)
=>
state
.
weather
.
todayInformation
);
const
tommorrowWeatherResult
=
useSelector
((
state
)
=>
state
.
weather
.
tommorrowInformation
);
const
today
=
new
Date
();
const
detailWeather
=
[];
let
currentHour
;
...
...
@@ -20,7 +16,6 @@ function WeatherPage(props) {
const
today_year
=
today
.
getFullYear
();
const
today_month
=
today
.
getMonth
();
const
today_date
=
today
.
getDate
();
const
[
todayHighTemperature
,
setTodayHighTemperature
]
=
useState
(
-
100
);
const
[
todayLowTemperature
,
setTodayLowTemperature
]
=
useState
(
100
);
const
[
todayWeatherSymbol
,
setTodayWeatherSymbol
]
=
useState
(
'☀️'
);
...
...
@@ -31,13 +26,10 @@ function WeatherPage(props) {
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"
);
const
currentTime
=
()
=>
{
const
date
=
new
Date
();
const
hours
=
String
(
date
.
getHours
()).
padStart
(
2
,
"0"
);
...
...
@@ -53,9 +45,7 @@ function WeatherPage(props) {
startTimer
()
useEffect
(()
=>
{
todayWeatherResult
.
then
((
result
)
=>
{
let
highTemperature
=
-
100
;
let
lowTemperature
=
100
;
let
symbol
=
''
;
...
...
@@ -68,11 +58,9 @@ function WeatherPage(props) {
setDongAdd
(
result
[
24
].
address3
);
for
(
let
i
=
0
;
i
<
24
;
i
++
)
{
if
(
i
===
13
)
{
setTodayWeatherLevel
(
result
[
i
].
weather
);
}
// 세부 시간 정보
if
(
i
>
Number
(
currentHour
))
{
if
(
result
[
i
].
rainPer
>=
50
)
{
...
...
@@ -85,16 +73,13 @@ function WeatherPage(props) {
else
{
symbol
=
'☀️'
;
}
const
tempData
=
{
time
:
result
[
i
].
time
,
temperature
:
result
[
i
].
temperature
,
symbol
:
symbol
,
}
detailWeather
.
push
(
tempData
);
}
// 현재 시간 정보 다루는 부분
if
(
i
===
Number
(
currentHour
))
{
if
(
result
[
i
].
rainPer
>=
50
)
{
...
...
@@ -109,17 +94,14 @@ function WeatherPage(props) {
setNowTemperature
(
result
[
i
].
temperature
);
}
// 하루 온도 정보 다루는 부분
if
(
result
[
i
].
temperature
<
lowTemperature
)
{
lowTemperature
=
result
[
i
].
temperature
;
}
if
(
result
[
i
].
temperature
>
highTemperature
)
{
highTemperature
=
result
[
i
].
temperature
;
}
}
setTodayHighTemperature
(
highTemperature
);
setTodayLowTemperature
(
lowTemperature
);
})
...
...
@@ -139,20 +121,16 @@ function WeatherPage(props) {
if
(
result
[
i
].
rainPer
>=
50
)
{
symbol
=
'🌧️'
;
}
// 내일 온도 정보 다루는 부분
if
(
result
[
i
].
temperature
<
lowTemperature
)
{
lowTemperature
=
result
[
i
].
temperature
;
}
if
(
result
[
i
].
temperature
>
highTemperature
)
{
highTemperature
=
result
[
i
].
temperature
;
}
setTommorrowHighTemperature
(
highTemperature
);
setTommorrowLowTemperature
(
lowTemperature
);
setTommorrowWeatherSymbol
(
symbol
);
}
})
},
[
tommorrowWeatherResult
])
...
...
@@ -165,22 +143,19 @@ function WeatherPage(props) {
const
onSubmitHandler
=
useCallback
((
event
)
=>
{
event
.
preventDefault
();
//체크박스 미리 클릭 방지
let
todayWeather
=
''
;
let
isRain
=
0
;
let
tempData
=
[];
if
(
todayWeatherSymbol
===
'🌧️'
)
{
isRain
=
1
;
}
tempData
.
push
(
isRain
);
tempData
.
push
(
isRain
);
console
.
log
(
todayWeatherLevel
);
console
.
log
(
userGender
);
console
.
log
(
isRain
);
// 추천 페이지로 보낼 데이터
const
sendData
=
{
gender
:
0
,
weather
:
"1"
,
...
...
@@ -188,18 +163,15 @@ function WeatherPage(props) {
}
console
.
log
(
sendData
);
dispatch
(
recommend
(
sendData
))
navigate
(
'/recommand'
)
},
[
todayWeatherResult
,
user
]);
return
(
<>
<
dir
id
=
"header"
>
<
dir
className
=
"clock"
>
<
h1
id
=
"clock"
>
{
Time
}
<
/h1
>
<
/dir
>
<
dir
className
=
"title"
>
<
dir
className
=
"header_title"
>
<
h1
>
Weather_Briefing
<
/h1
>
<
/dir
>
<
dir
className
=
"Login-Register"
>
...
...
@@ -207,7 +179,6 @@ function WeatherPage(props) {
<
button
type
=
"button"
>
Register
<
/button
>
<
/dir
>
<
/dir
>
<
div
id
=
"body"
>
<
div
className
=
"address"
>
<
p
>
{
cityAdd
}
{
guAdd
}
{
dongAdd
}
<
/p
>
...
...
@@ -258,5 +229,4 @@ function WeatherPage(props) {
<
/
>
);
}
export
default
WeatherPage
;
\ No newline at end of file
...
...
weather_briefing/src/component/views/style/WeatherPage.scss
View file @
5b12fb2
#header
{
display
:
flex
;
position
:
fixed
;
justify-content
:
center
;
align-items
:
center
;
height
:
15%
;
width
:
100%
;
border-top
:
2px
solid
;
border-bottom
:
2px
solid
;
.header_title
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
margin-left
:
300px
;
margin-right
:
300px
;
h1
{
font-size
:
50px
;
font-family
:
'Times New Roman'
,
Times
,
serif
;
color
:
rgb
(
0
,
0
,
0
);
}
}
.header_choice_box
{
display
:
flex
;
justify-content
:
right
;
align-items
:
right
;
margin-right
:
10x
;
}
button
{
width
:
70px
;
height
:
25px
;
font-size
:
15px
;
font-weight
:
bold
;
cursor
:
pointer
;
}
}
#body
{
display
:
flex
;
justify-content
:
center
;
...
...
Please
register
or
login
to post a comment