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
c6d01df3
Commit
c6d01df3
authored
Aug 12, 2020
by
Jiwon Yoon
Browse files
a
parent
e67f66d7
Changes
1
Show whitespace changes
Inline
Side-by-side
src/AdminQuiz.js
View file @
c6d01df3
...
@@ -2,46 +2,71 @@ import React, { useState } from 'react';
...
@@ -2,46 +2,71 @@ import React, { useState } from 'react';
let
list
=
[]
let
list
=
[]
let
QnAadmins
=
[]
let
QnAadmin
=
{}
function
AdminQuiz
()
{
function
AdminQuiz
()
{
const
[
question
,
setQuestion
]
=
useState
(
''
)
const
[
question
,
setQuestion
]
=
useState
(
''
)
const
[
choose
,
setChoose
]
=
useState
(
''
)
const
[
choose
,
setChoose
]
=
useState
(
''
)
const
[
answer
,
setAnswer
]
=
useState
(
''
)
const
[
answer
,
setAnswer
]
=
useState
(
''
)
const
[
selectOption
,
setselectOption
]
=
useState
(
1
)
const
[
selectOption
,
setselectOption
]
=
useState
(
1
)
const
handleChangeQuestion
=
(
event
)
=>
{
const
handleChangeQuestion
=
(
event
)
=>
{
QnAadmin
[
'
Q
'
]
=
event
.
target
.
value
setQuestion
(
event
.
target
.
value
)
setQuestion
(
event
.
target
.
value
)
}
}
const
handleChangeChoose
=
(
event
)
=>
{
const
handleChangeChoose
=
(
event
)
=>
{
QnAadmin
[
'
Choose
'
]
=
event
.
target
.
value
setChoose
(
event
.
target
.
value
)
setChoose
(
event
.
target
.
value
)
}
}
const
handleChangeanswer
=
(
event
)
=>
{
const
handleChangeanswer
=
(
event
)
=>
{
QnAadmin
[
'
A
'
]
=
event
.
target
.
value
setAnswer
(
event
.
target
.
value
)
setAnswer
(
event
.
target
.
value
)
}
}
function
addSelectOption
()
{
function
addSelectOption
()
{
list
.
push
(
list
.
push
(
<
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
"
name
=
"
answer
"
/>
<
input
type
=
"
radio
"
id
=
{
selectOption
+
1
}
name
=
"
answer
"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
input
type
=
"
text
"
class
Name
=
"
form-control
"
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
<
input
type
=
"
text
"
class
=
"
form-control
"
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
<
/div
>
<
/div
>
)
)
setselectOption
(
selectOption
+
1
)
setselectOption
(
selectOption
+
1
)
}
}
function
handleClick
()
{
alert
(
'
입력이 완료되었습니다
'
)
function
handleClick
()
{
// localStorage.setItem('Q', question)
if
(
!
question
)
{
// localStorage.setItem('Choose', choose)
alert
(
'
문제가 입력되지 않았습니다.
'
)
// localStorage.setItem('Answer', answer)
}
// localStorage.setItem('P', password)
else
if
(
!
choose
)
{
// localStorage.setItem('AP', adminpassword)
alert
(
'
보기가 입력되지 않았습니다.
'
)
// localStorage.setItem('T', time * 1000)
}
else
if
(
!
answer
)
{
alert
(
'
정답이 입력되지 않았습니다.
'
)
}
else
{
console
.
log
(
QnAadmin
)
QnAadmins
.
push
(
QnAadmin
)
localStorage
.
setItem
(
'
QnA
'
,
JSON
.
stringify
(
QnAadmins
))
console
.
log
(
QnAadmins
)
alert
(
'
입력이 완료되었습니다.
'
)
}
}
}
...
...
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