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
online-quiz-react
Commits
c5d07de9
Commit
c5d07de9
authored
Aug 12, 2020
by
Jiwon Yoon
Browse files
d
parent
f850026b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Admin.js
View file @
c5d07de9
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
Quiz
from
'
./Quiz
'
;
// import { Link } from 'react-router-dom';
// import { Link } from 'react-router-dom';
let
list
=
[]
let
list
=
[]
let
QuizBtn
=
[]
function
Admin
()
{
function
Admin
()
{
...
@@ -21,8 +23,8 @@ function Admin() {
...
@@ -21,8 +23,8 @@ function Admin() {
const
[
time
,
setTime
]
=
useState
(
''
)
const
[
time
,
setTime
]
=
useState
(
''
)
const
[
addQuiz
,
setaddQuiz
]
=
useState
(
''
)
const
[
addQuiz
,
setaddQuiz
]
=
useState
(
''
)
const
[
selectOption
,
setselectOption
]
=
useState
(
1
)
const
[
selectOption
,
setselectOption
]
=
useState
(
1
)
const
[
QuizBtnCount
,
setQuizBtnCount
]
=
useState
(
4
)
const
[
done
,
setDone
]
=
useState
(
false
)
const
handleChangeQuestion
=
(
event
)
=>
{
const
handleChangeQuestion
=
(
event
)
=>
{
...
@@ -44,6 +46,9 @@ function Admin() {
...
@@ -44,6 +46,9 @@ function Admin() {
setTime
(
event
.
target
.
value
)
setTime
(
event
.
target
.
value
)
}
}
function
handleClickSetting
(){
}
function
handleClick
()
{
function
handleClick
()
{
...
@@ -55,7 +60,6 @@ function Admin() {
...
@@ -55,7 +60,6 @@ function Admin() {
localStorage
.
setItem
(
'
AP
'
,
adminpassword
)
localStorage
.
setItem
(
'
AP
'
,
adminpassword
)
localStorage
.
setItem
(
'
T
'
,
time
*
1000
)
localStorage
.
setItem
(
'
T
'
,
time
*
1000
)
setDone
(
true
)
}
}
...
@@ -64,7 +68,7 @@ function Admin() {
...
@@ -64,7 +68,7 @@ function Admin() {
<
div
className
=
"
input-group
"
>
<
div
className
=
"
input-group
"
>
<
div
className
=
"
input-group-prepend
"
>
<
div
className
=
"
input-group-prepend
"
>
<
div
className
=
"
input-group-text
"
>
<
div
className
=
"
input-group-text
"
>
<
input
type
=
"
radio
"
id
=
{
selectOption
+
1
}
name
=
"
answer
"
/>
<
input
type
=
"
radio
"
id
=
{
selectOption
+
1
}
name
=
"
answer
"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
input
type
=
"
text
"
class
=
"
form-control
"
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
<
input
type
=
"
text
"
class
=
"
form-control
"
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
...
@@ -80,35 +84,36 @@ function Admin() {
...
@@ -80,35 +84,36 @@ function Admin() {
setaddQuiz
(
addQuiz
)
setaddQuiz
(
addQuiz
)
}
}
function
handleClickAddQuiz
()
{
QuizBtn
.
push
(
<
button
type
=
"
button
"
className
=
"
btn btn-outline-primary
"
id
=
{
QuizBtnCount
}
onClick
=
{
handleClickQuiz
}
>
Quiz
{
QuizBtnCount
}
<
/button
>
)
setQuizBtnCount
(
QuizBtnCount
+
1
)
}
return
(
return
(
<>
<>
{
done
?
alert
(
'
모두 입력되었습니다.
'
)
:
''
}
<
div
className
=
"
container-fluid
"
>
<
div
className
=
"
container-fluid
"
>
<
div
className
=
"
row justify-content-md-center mt-5
"
>
<
div
className
=
"
row justify-content-md-center mt-5
"
>
<
div
className
=
"
col-2 text-center border
"
>
<
div
className
=
"
col-2 text-center border
"
>
<
div
className
=
"
navbar-header p-3
"
>
<
div
className
=
"
my-5
"
>
<
p
className
=
"
navbar-brand border-bottom
"
>
관리자
페이지
<
/
p
>
<
h4
>
관리자페이지
<
/
h4
>
<
/div
>
<
/div
>
<
div
className
=
"
nav flex-column nav-pills
"
id
=
"
v-pills-tab
"
role
=
"
tablist
"
>
<
div
>
<
button
type
=
"
button
"
className
=
"
btn btn-outline-info mb-5
"
onClick
=
{
handleClickSetting
}
>
Setting
<
/button
>
<
p
className
=
"
navbar-text border-bottom
"
>
관리자
설정
변경하기
<
/p
>
<
a
className
=
"
nav-link
"
id
=
"
setting-tab
"
data
-
toggle
=
'
pill
'
href
=
"
#setting
"
role
=
"
tab
"
>
Setting
<
/a
>
<
p
className
=
"
navbar-text border-bottom
"
>
Quiz
입력하기
<
/p
>
<
a
className
=
"
nav-link
"
id
=
"
Quiz1-tab
"
data
-
toggle
=
"
pill
"
href
=
"
#Quiz1
"
role
=
"
tab
"
>
Quiz1
<
/a
>
<
a
className
=
"
nav-link
"
id
=
"
Quiz2-tab
"
data
-
toggle
=
"
pill
"
href
=
"
#Quiz2
"
role
=
"
tab
"
>
Quiz2
<
/a
>
<
a
className
=
"
nav-link
"
id
=
"
Quiz3-tab
"
data
-
toggle
=
"
pill
"
href
=
"
#Quiz3
"
role
=
"
tab
"
>
Quiz3
<
/a
>
{
addQuiz
}
<
button
className
=
"
btn btn-danger navbar-btn
"
onClick
=
{
handleClickQuiz
}
>
Quiz
추가
<
/button
>
<
/div
>
<
/div
>
<
div
class
=
"
btn-group-vertical
"
>
<
button
type
=
"
button
"
className
=
"
btn btn-outline-primary
"
id
=
"
1
"
onClick
=
{
handleClickQuiz
}
>
Quiz
1
<
/button
>
<
button
type
=
"
button
"
className
=
"
btn btn-outline-primary
"
id
=
"
2
"
onClick
=
{
handleClickQuiz
}
>
Quiz
2
<
/button
>
<
button
type
=
"
button
"
className
=
"
btn btn-outline-primary
"
id
=
"
3
"
onClick
=
{
handleClickQuiz
}
>
Quiz
3
<
/button
>
{
QuizBtn
.
map
((
element
)
=>
element
)}
<
button
type
=
"
button
"
className
=
"
btn btn-outline-primary
"
onClick
=
{
handleClickAddQuiz
}
>+<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
col-8
"
>
<
div
className
=
"
col-8
"
>
<
div
className
=
"
tab-content
"
id
=
"
v-pills-tabContent
"
>
<
div
className
=
"
tab-content
"
id
=
"
v-pills-tabContent
"
>
<
div
className
=
"
tab-pane fade show active
"
id
=
"
setting
"
role
=
"
tabpanel
"
>
<
div
className
=
"
tab-pane fade show active
"
id
=
"
setting
"
role
=
"
tabpanel
"
>
<
div
className
=
"
row d-flex justify-content-center
"
>
<
div
className
=
"
row d-flex justify-content-center
"
>
...
@@ -138,36 +143,33 @@ function Admin() {
...
@@ -138,36 +143,33 @@ function Admin() {
<
div
className
=
""
id
=
"
Quiz1
"
>
<
div
className
=
""
id
=
"
Quiz1
"
>
<
div
className
=
"
container
"
>
<
h2
className
=
"
p-3 border text-center
"
>
문제만들기
<
/h2
>
<
h2
className
=
"
p-3 border text-center
"
>
문제만들기
<
/h2
>
<
div
className
=
"
p-3 borber
"
>
<
div
className
=
"
p-3 borber
"
>
<
div
className
=
"
p-3
"
>
<
div
className
=
"
p-3
"
>
<
span
className
=
"
font-weight-bold mr-2 h3
"
>
1
.
<
/span
>
<
span
className
=
"
font-weight-bold mr-2 h3
"
>
1
.
<
/span
>
<
input
type
=
"
text
"
className
=
"
form-control
"
onChange
=
{
handleChangeQuestion
}
placeholder
=
"
문제를 입력하세요
"
/>
{
/* <input type="text" onChange={handleChangenumber} placeholder="Number" /> */
}
<
/div
>
<
input
type
=
"
text
"
className
=
"
form-control
"
onChange
=
{
handleChangeQuestion
}
placeholder
=
"
문제를 입력하세요
"
/>
<
div
className
=
"
p-3
"
>
<
/div
>
<
div
className
=
"
input-group
"
>
<
div
className
=
"
p-3
"
>
<
div
className
=
"
input-group-prepend
"
>
<
div
className
=
"
input-group
"
>
<
div
className
=
"
input-group-text
"
>
<
div
className
=
"
input-group-prepend
"
>
<
input
type
=
"
radio
"
id
=
{
selectOption
}
name
=
"
answer
"
/>
<
div
className
=
"
input-group-text
"
>
<
input
type
=
"
radio
"
id
=
{
selectOption
}
name
=
"
answer
"
/>
<
/div
>
<
/div
>
<
/div
>
<
input
type
=
"
text
"
className
=
"
form-control
"
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
<
/div
>
<
/div
>
{
list
.
map
((
element
)
=>
element
)}
<
input
type
=
"
text
"
className
=
"
form-control
"
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
<
button
className
=
"
btn btn-outline-secondary btn-sm
"
onClick
=
{
addSelectOption
}
>+<
/button
>
<
/div
>
<
div
className
=
"
p-3
"
>
<
span
className
=
"
font-weight-bold mr-2 h3
"
>
정답
:
<
/span
>
<
input
type
=
"
text
"
onChange
=
{
handleChangeanswer
}
placeholder
=
"
정답을 입력하세요
"
/>
<
/div
>
<
/div
>
{
list
.
map
((
element
)
=>
element
)}
<
button
className
=
"
btn btn-outline-secondary btn-sm
"
onClick
=
{
addSelectOption
}
>+<
/button
>
<
/div
>
<
label
for
=
"
inputLogin
"
className
=
"
d-flex justify-content-center
"
>
<
div
className
=
"
p-3
"
>
<
butto
n
className
=
"
mt-4 btn btn-dark
"
onClick
=
{
handleClick
}
>
작성완료
<
/butto
n
>
<
spa
n
className
=
"
font-weight-bold mr-2 h3
"
>
정답
:
<
/spa
n
>
<
/label
>
<
input
type
=
"
text
"
onChange
=
{
handleChangeanswer
}
placeholder
=
"
정답을 입력하세요
"
/
>
<
/div
>
<
/div
>
<
label
for
=
"
inputLogin
"
className
=
"
d-flex justify-content-center
"
>
<
button
className
=
"
mt-4 btn btn-dark
"
onClick
=
{
handleClick
}
>
작성완료
<
/button
>
<
/label
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/AdminQuiz.js
0 → 100644
View file @
c5d07de9
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