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
b5f735f8
Commit
b5f735f8
authored
Aug 19, 2020
by
baesangjune
Browse files
.
parent
a683b650
Changes
2
Show whitespace changes
Inline
Side-by-side
src/Admin.js
View file @
b5f735f8
...
@@ -5,7 +5,6 @@ import AdminSetting from './AdminSetting'
...
@@ -5,7 +5,6 @@ import AdminSetting from './AdminSetting'
let
QuizBtn
=
[]
let
QuizBtn
=
[]
function
Admin
()
{
function
Admin
()
{
// QnA.length === 0 ? console.log(QnA.length) : QnA = JSON.parse(localStorage.getItem('QnA'))
const
[
result
,
setresult
]
=
useState
(
''
)
const
[
result
,
setresult
]
=
useState
(
''
)
const
[
QuizBtnCount
,
setQuizBtnCount
]
=
useState
(
4
)
const
[
QuizBtnCount
,
setQuizBtnCount
]
=
useState
(
4
)
const
indexRef
=
useRef
(
0
)
const
indexRef
=
useRef
(
0
)
...
@@ -41,7 +40,6 @@ function Admin() {
...
@@ -41,7 +40,6 @@ function Admin() {
}
//퀴즈 추가버튼
}
//퀴즈 추가버튼
function
handleClickSave
(
QnAadmin
)
{
function
handleClickSave
(
QnAadmin
)
{
console
.
log
(
QnAadmin
,
indexRef
.
current
)
dbRef
.
current
[
indexRef
.
current
]
=
QnAadmin
dbRef
.
current
[
indexRef
.
current
]
=
QnAadmin
localStorage
.
setItem
(
'
QnA
'
,
JSON
.
stringify
(
dbRef
.
current
))
localStorage
.
setItem
(
'
QnA
'
,
JSON
.
stringify
(
dbRef
.
current
))
...
...
src/AdminQuiz.js
View file @
b5f735f8
...
@@ -16,7 +16,8 @@ function AdminQuiz(props) {
...
@@ -16,7 +16,8 @@ function AdminQuiz(props) {
setQuestion
(
props
.
data
.
Q
)
setQuestion
(
props
.
data
.
Q
)
setChoose
(
props
.
data
.
Choose
)
setChoose
(
props
.
data
.
Choose
)
setAnswer
(
props
.
data
.
A
)
setAnswer
(
props
.
data
.
A
)
},[
props
.
quizNum
])
// eslint-disable-next-line
},
[
props
.
quizNum
])
const
handleChangeQuestion
=
(
event
)
=>
{
const
handleChangeQuestion
=
(
event
)
=>
{
...
@@ -27,6 +28,7 @@ function AdminQuiz(props) {
...
@@ -27,6 +28,7 @@ function AdminQuiz(props) {
const
handleChangeChoose
=
(
event
)
=>
{
const
handleChangeChoose
=
(
event
)
=>
{
savechoose
[
event
.
target
.
id
]
=
event
.
target
.
value
savechoose
[
event
.
target
.
id
]
=
event
.
target
.
value
setChoose
(
event
.
target
.
value
)
setChoose
(
event
.
target
.
value
)
console
.
log
(
event
.
target
.
value
)
}
}
const
handleChangeanswer
=
(
event
)
=>
{
const
handleChangeanswer
=
(
event
)
=>
{
...
@@ -61,6 +63,8 @@ function AdminQuiz(props) {
...
@@ -61,6 +63,8 @@ function AdminQuiz(props) {
}
}
else
{
else
{
QnAadmin
[
'
Choose
'
]
=
Object
.
values
(
savechoose
)
QnAadmin
[
'
Choose
'
]
=
Object
.
values
(
savechoose
)
console
.
log
(
savechoose
)
console
.
log
(
QnAadmin
.
Choose
)
QnAadmin
[
'
N
'
]
=
String
(
props
.
quizNum
)
QnAadmin
[
'
N
'
]
=
String
(
props
.
quizNum
)
props
.
fn
(
QnAadmin
)
props
.
fn
(
QnAadmin
)
QnAadmin
=
{}
QnAadmin
=
{}
...
@@ -86,7 +90,7 @@ function AdminQuiz(props) {
...
@@ -86,7 +90,7 @@ function AdminQuiz(props) {
<
input
type
=
"
radio
"
checked
=
{
false
}
name
=
"
answer
"
/>
<
input
type
=
"
radio
"
checked
=
{
false
}
name
=
"
answer
"
/>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
input
type
=
"
text
"
className
=
"
form-control
"
id
=
'
1
'
value
=
{
choose
}
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
<
input
type
=
"
text
"
className
=
"
form-control
"
id
=
'
1
'
value
=
{
choose
[
0
]
}
placeholder
=
"
보기를 입력하세요
"
onChange
=
{
handleChangeChoose
}
/
>
<
/div
>
<
/div
>
{
list
.
map
((
element
)
=>
element
)}
{
list
.
map
((
element
)
=>
element
)}
<
button
className
=
"
btn btn-outline-secondary btn-sm
"
onClick
=
{
addSelectOption
}
>+<
/button
>
<
button
className
=
"
btn btn-outline-secondary btn-sm
"
onClick
=
{
addSelectOption
}
>+<
/button
>
...
...
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