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
64f5ae98
Commit
64f5ae98
authored
Aug 05, 2020
by
김민수
Browse files
No commit message
No commit message
parent
aca78a40
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Quiz.js
View file @
64f5ae98
...
@@ -11,15 +11,15 @@ const QnA = [
...
@@ -11,15 +11,15 @@ const QnA = [
]
]
function
Quiz
()
{
function
Quiz
()
{
let
[
question
,
setQuestion
ss
]
=
useState
({
let
[
question
,
setQuestion
]
=
useState
({
...
QnA
[
0
],
...
QnA
[
0
],
i
:
0
,
i
:
0
,
page
:
0
,
page
:
0
,
})
})
let
[
selected
,
setSelected
]
=
useState
(
""
)
//선택한 답을 보여줄 것들
let
[
selected
,
setSelected
]
=
useState
(
""
)
//선택한 답을 보여줄 것들
function
set
Question
()
{
function
handle
Question
()
{
setQuestion
ss
({
...
QnA
[
question
.
i
+
1
],
i
:
question
.
i
+
1
,
page
:
question
.
page
+
1
})
setQuestion
({
...
QnA
[
question
.
i
+
1
],
i
:
question
.
i
+
1
,
page
:
question
.
page
+
1
})
}
}
let
handleChange
=
(
ev
)
=>
{
let
handleChange
=
(
ev
)
=>
{
ev
.
preventDefault
()
//새로고침 안되도록
ev
.
preventDefault
()
//새로고침 안되도록
...
@@ -60,7 +60,7 @@ function Quiz() {
...
@@ -60,7 +60,7 @@ function Quiz() {
<
/form
>
<
/form
>
<
p
style
=
{{
fontSize
:
"
20px
"
,
marginLeft
:
"
600px
"
}}
>
선택한
답
:
<
span
style
=
{{
color
:
"
green
"
,
fontWeight
:
"
bold
"
,
fontSize
:
"
90px
"
,
marginLeft
:
"
30px
"
}}
>
{
selected
}
<
/span> {/
*
선택한
값
보여줌
*
/}<span style={{ marginLeft: "50px" }}> {
(
question.page === QnA.length - 1
)
<
p
style
=
{{
fontSize
:
"
20px
"
,
marginLeft
:
"
600px
"
}}
>
선택한
답
:
<
span
style
=
{{
color
:
"
green
"
,
fontWeight
:
"
bold
"
,
fontSize
:
"
90px
"
,
marginLeft
:
"
30px
"
}}
>
{
selected
}
<
/span> {/
*
선택한
값
보여줌
*
/}<span style={{ marginLeft: "50px" }}> {
(
question.page === QnA.length - 1
)
?
<
Link
to
=
"
/end
"
>
제출
<
/Link
>
?
<
Link
to
=
"
/end
"
>
제출
<
/Link
>
:
<
button
type
=
"
button
"
onClick
=
{
set
Question
}
style
=
{{
width
:
"
85px
"
,
height
:
"
40px
"
}}
>
다음
<
/button
>
:
<
button
type
=
"
button
"
onClick
=
{
handle
Question
}
style
=
{{
width
:
"
85px
"
,
height
:
"
40px
"
}}
>
다음
<
/button
>
}
<
/span
>
}
<
/span
>
<
/p
>
<
/p
>
...
@@ -70,7 +70,7 @@ function Quiz() {
...
@@ -70,7 +70,7 @@ function Quiz() {
{
/* 마지막 질문일 경우 /end페이지로 이동, 그렇지 않을경우는 this.setQuestion발생 */
}
{
/* 마지막 질문일 경우 /end페이지로 이동, 그렇지 않을경우는 this.setQuestion발생 */
}
{
/* {(question.page === QnA.length - 1)
{
/* {(question.page === QnA.length - 1)
? <Link to="/end">제출</Link>
? <Link to="/end">제출</Link>
: <button type="button" onClick={
set
Question} >다음</button>
: <button type="button" onClick={
handle
Question} >다음</button>
} */
}
} */
}
...
@@ -84,7 +84,7 @@ function Quiz() {
...
@@ -84,7 +84,7 @@ function Quiz() {
checkpoints
=
{[
checkpoints
=
{[
{
{
time
:
0
,
time
:
0
,
callback
:
set
Question
callback
:
handle
Question
// history.go(1)
// history.go(1)
}
}
]}
]}
...
...
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