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
1147516b
Commit
1147516b
authored
Jul 28, 2020
by
김민수
Browse files
e
parent
ca812a98
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Quiz .js
deleted
100644 → 0
View file @
ca812a98
import
React
from
'
react
'
;
// import logo from './logo.svg';
import
'
./Quiz.css
'
;
// import ReactTimeout from 'react-timeout';
// import {BrowserRouter as Router, Link, Route} from 'react-router-dom'
const
question
=
[
{
Q
:
"
6 X 4 ?
"
,
Choose
:
[
6
,
12
,
18
,
24
],
A
:
""
},
{
Q
:
"
3 + 3 ?
"
,
Choose
:
[
2
,
4
,
6
,
8
],
A
:
""
},
{
Q
:
"
3 - 1 ?
"
,
Choose
:
[
1
,
2
,
3
,
4
],
A
:
""
}
]
class
Quiz
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
)
// this.setAnswer = this.setAnswer.bind(this)
this
.
setQuestion
=
this
.
setQuestion
.
bind
(
this
)
this
.
ShowQuiz
=
this
.
ShowQuiz
.
bind
(
this
)
this
.
state
=
{
...
question
[
0
],
i
:
0
,
page
:
0
,
}
}
ShowQuiz
()
{
this
.
setState
({
page
:
1
})
}
setQuestion
()
{
this
.
setState
({
...
question
[
this
.
state
.
i
+
1
],
i
:
this
.
state
.
i
+
1
})
}
// setAnswer(e) {
// question[this.state.i]["A"] = e.target.value
// this.setState({ v: e.target.value })
// console.log(this.state)
// console.log(question)
// }
render
()
{
if
(
this
.
state
.
page
===
1
)
{
if
(
this
.
state
.
i
===
question
.
length
)
{
return
(
<
div
>
<
h2
>
수고하셨습니다
!<
/h2
>
<
/div
>
)
}
else
{
return
(
<
div
className
=
"
Quiz
"
>
<
h2
>
Q
:{
this
.
state
.
Q
}
<
/h2
>
{
this
.
state
.
Choose
.
map
((
a
)
=>
<
div
>
<
input
type
=
"
radio
"
name
=
{
a
}
id
=
{
a
}
value
=
{
a
}
/
>
<
label
for
=
{
a
}
>
{
a
}
<
/label
>
<
/div>
)
}
<
div
className
=
"
App
"
>
정답을
입력하세요
<
/div
>
{
/* <div>
<input type="text" value={this.state.v} name="A" onChange={this.setAnswer} />
</div> */
}
<
button
type
=
"
button
"
onClick
=
{
this
.
setQuestion
,
3000
}
>
다음
<
/button
>
<
/div
>
)
}
}
else
{
return
(
<
div
className
=
"
Box
"
>
<
div
className
=
"
Main
"
>
<
h1
>
Calculus
<
/h1
>
<
/div
>
<
div
className
=
"
Name
"
>
이름을
입력하세요
<
input
onChange
=
{(
event
)
=>
{
console
.
log
(
event
.
target
.
value
)
}}
/
>
<
/div
>
<
button
className
=
"
QuizStart
"
onClick
=
{
this
.
ShowQuiz
}
>
Quiz
Start
!<
/button
>
<
/div
>
)
}
}
}
export
default
Quiz
;
\ 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