Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
reservation-service
Commits
670561f7
Commit
670561f7
authored
Nov 03, 2020
by
Choi Ga Young
Browse files
Merge remote-tracking branch 'origin/cherry' into rkyoung7
parents
27cc5b26
ae1406c4
Changes
3
Show whitespace changes
Inline
Side-by-side
server/client/src/Components/Menu.js
View file @
670561f7
import
axios
from
'
axios
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
styled
from
'
styled-components
'
;
import
styled
from
'
styled-components
'
;
...
...
server/client/src/Components/Schedule.js
View file @
670561f7
...
@@ -3,10 +3,13 @@ import Calendar from '@toast-ui/react-calendar';
...
@@ -3,10 +3,13 @@ import Calendar from '@toast-ui/react-calendar';
import
"
tui-calendar/dist/tui-calendar.css
"
;
import
"
tui-calendar/dist/tui-calendar.css
"
;
import
"
tui-date-picker/dist/tui-date-picker.css
"
;
import
"
tui-date-picker/dist/tui-date-picker.css
"
;
import
"
tui-time-picker/dist/tui-time-picker.css
"
;
import
"
tui-time-picker/dist/tui-time-picker.css
"
;
import
axios
from
'
axios
'
;
function
Cal
(
calledday
)
{
function
Cal
(
props
)
{
const
calendarRef
=
useRef
();
const
calendarRef
=
useRef
();
const
[
day
,
setDay
]
=
useState
(
calledday
);
const
[
reserve
,
setReserve
]
=
useState
([]);
// const [day, setDay] = useState(props.calledday);
const
[
day
,
setDay
]
=
useState
(
props
.
day
);
const
[
myTheme
,
setMyTheme
]
=
useState
({
const
[
myTheme
,
setMyTheme
]
=
useState
({
'
common.dayname.color
'
:
'
#333
'
,
'
common.dayname.color
'
:
'
#333
'
,
'
common.today.color
'
:
'
#333
'
,
'
common.today.color
'
:
'
#333
'
,
...
@@ -15,6 +18,59 @@ function Cal(calledday) {
...
@@ -15,6 +18,59 @@ function Cal(calledday) {
// Theme object to extends default dark theme.
// Theme object to extends default dark theme.
});
});
const
yj
=
[
{
id
:
'
a
'
,
calendarId
:
'
Subject
'
,
category
:
'
time
'
,
start
:
'
2020-10-27T11:00:00
'
,
end
:
'
2020-10-27T12:00:00
'
,
},
{
id
:
'
b
'
,
calendarId
:
'
Subject
'
,
category
:
'
time
'
,
start
:
'
2020-10-28T10:00:00
'
,
end
:
'
2020-10-28T11:00:00
'
,
},
{
id
:
'
3
'
,
calendarId
:
'
Subject
'
,
category
:
'
time
'
,
start
:
'
2020-10-29T11:00:00
'
,
end
:
'
2020-10-29T15:00:00
'
,
}
]
function
getReserve
(
room
)
{
console
.
log
(
"
room
"
,
room
)
// setReserve({
// id: room,
// calendarId: 'Subject',
// category: 'time',
// })
axios
.
get
(
`/reserves/room/
${
room
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
const
reserves
=
res
.
data
.
map
(
item
=>
({
id
:
item
.
_id
,
start
:
item
.
start
,
end
:
item
.
end
,
calendarId
:
'
Subject
'
,
category
:
'
time
'
,
}))
console
.
log
(
"
room list
"
,
res
.
data
);
setReserve
(
reserves
);
// console.log("room list",res.data);
})
.
catch
(
err
=>
{
alert
(
err
.
error
)
});
}
useEffect
(()
=>
{
useEffect
(()
=>
{
// const cal = calendarRef.current.getInstance();
// const cal = calendarRef.current.getInstance();
// cal.setDate(new Date(day));
// cal.setDate(new Date(day));
...
@@ -39,9 +95,21 @@ function Cal(calledday) {
...
@@ -39,9 +95,21 @@ function Cal(calledday) {
// return (console.log(isFocused))
// return (console.log(isFocused))
// });
// });
// setReserve([
// {
// id: '3',
// calendarId: 'Subject',
// category: 'time',
// start: '2020-10-29T11:00:00',
// end: '2020-10-29T15:00:00',
// }
// ])
getReserve
(
props
.
room
);
},
[
day
])
},
[
day
])
return
(
return
(
<
div
>
{
console
.
log
(
"
reserve
"
,
reserve
)}
<
Calendar
<
Calendar
height
=
"
100%
"
height
=
"
100%
"
calendars
=
{[
calendars
=
{[
...
@@ -62,29 +130,36 @@ function Cal(calledday) {
...
@@ -62,29 +130,36 @@ function Cal(calledday) {
// return display: "none"
// return display: "none"
// }
// }
// }
// }
schedules
=
{[
schedules
=
{
reserve
{
// reserve.map(item=>({id: item._id,
id
:
'
1
'
,
// start: item.start,
calendarId
:
'
Subject
'
,
// end: item.end,
category
:
'
time
'
,
// calendarId: 'Subject',
start
:
'
2020-10-05T11:00:00
'
,
// category: 'time',}))
end
:
'
2020-10-05T12:00:00
'
,
// [
},
// {
{
// id: 'a',
id
:
'
2
'
,
// calendarId: 'Subject',
calendarId
:
'
Subject
'
,
// category: 'time',
category
:
'
time
'
,
// start: '2020-10-27T11:00:00',
start
:
'
2020-10-09T10:00:00
'
,
// end: '2020-10-27T12:00:00',
end
:
'
2020-10-09T11:00:00
'
,
// },
},
// {
{
// id: 'b',
id
:
'
3
'
,
// calendarId: 'Subject',
calendarId
:
'
Subject
'
,
// category: 'time',
category
:
'
time
'
,
// start: '2020-10-28T10:00:00',
start
:
'
2020-10-08T11:00:00
'
,
// end: '2020-10-28T11:00:00',
end
:
'
2020-10-08T15:00:00
'
,
// },
// {
// id: '3',
// calendarId: 'Subject',
// category: 'time',
// start: '2020-10-29T11:00:00',
// end: '2020-10-29T15:00:00',
// }
// ]
}
}
]}
scheduleView
=
{[
'
time
'
]}
scheduleView
=
{[
'
time
'
]}
taskView
=
{
false
}
taskView
=
{
false
}
theme
=
{
myTheme
}
theme
=
{
myTheme
}
...
@@ -104,6 +179,7 @@ function Cal(calledday) {
...
@@ -104,6 +179,7 @@ function Cal(calledday) {
hourEnd
:
23
hourEnd
:
23
}}
}}
/
>
/
>
<
/div
>
)
)
}
}
...
...
server/routes/notices.js
View file @
670561f7
...
@@ -6,13 +6,15 @@ const router = express.Router();
...
@@ -6,13 +6,15 @@ const router = express.Router();
router
.
get
(
'
/
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'
/
'
,
function
(
req
,
res
,
next
)
{
Notice
.
find
({}).
sort
({
post_date
:
-
1
})
Notice
.
find
({}).
sort
({
post_date
:
-
1
})
.
then
((
notices
)
=>
{
.
then
((
notices
)
=>
{
res
.
json
(
notices
);
res
.
status
(
201
).
json
(
notices
);
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
console
.
error
(
err
);
console
.
error
(
err
);
next
(
err
);
next
(
err
);
});
});
// res.status(404).json({error:"없음."})
res
.
status
(
201
).
json
(
notices
);
});
});
module
.
exports
=
router
;
module
.
exports
=
router
;
\ No newline at end of file
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