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
befbdcdb
Commit
befbdcdb
authored
Aug 12, 2020
by
Jiwon Yoon
Browse files
A
parent
a79e9b83
Changes
3
Show whitespace changes
Inline
Side-by-side
src/Admin.js
View file @
befbdcdb
...
@@ -3,26 +3,27 @@ import AdminQuiz from './AdminQuiz'
...
@@ -3,26 +3,27 @@ import AdminQuiz from './AdminQuiz'
import
AdminSetting
from
'
./AdminSetting
'
import
AdminSetting
from
'
./AdminSetting
'
let
QuizBtn
=
[]
let
QuizBtn
=
[]
function
Admin
()
{
function
Admin
()
{
const
[
result
,
setresult
]
=
useState
(
''
)
const
[
result
,
setresult
]
=
useState
(
''
)
const
[
QuizBtnCount
,
setQuizBtnCount
]
=
useState
(
4
)
const
[
QuizBtnCount
,
setQuizBtnCount
]
=
useState
(
4
)
function
handleClickSetting
(){
setresult
(
<
AdminSetting
/>
)
function
handleClickSetting
()
{
setresult
(
<
AdminSetting
/>
)
}
}
function
handleClickQuiz
(
)
{
function
handleClickQuiz
(
e
)
{
setresult
(
<
AdminQuiz
/>
)
setresult
(
<
AdminQuiz
name
=
{
e
.
target
.
id
}
/>
)
}
}
function
handleClickAddQuiz
(){
function
handleClickAddQuiz
()
{
QuizBtn
Count
.
push
(
QuizBtn
.
push
(
<
button
type
=
'
button
'
className
=
'
btn btn-outline-primary
'
id
=
{
QuizBtnCount
}
onClick
=
{
handleClickQuiz
}
>
Quiz
{
QuizBtnCount
}
<
/button
>
<
button
type
=
'
button
'
className
=
'
btn btn-outline-primary
'
id
=
{
QuizBtnCount
}
onClick
=
{
handleClickQuiz
}
>
Quiz
{
QuizBtnCount
}
<
/button
>
)
)
setQuizBtnCount
(
QuizBtnCount
+
1
)
setQuizBtnCount
(
QuizBtnCount
+
1
)
}
}
return
(
return
(
...
@@ -47,15 +48,7 @@ function Admin() {
...
@@ -47,15 +48,7 @@ function Admin() {
<
/div
>
<
/div
>
<
div
className
=
"
col-8
"
>
<
div
className
=
"
col-8
"
>
<
div
className
=
"
tab-content
"
id
=
"
v-pills-tabContent
"
>
<
div
className
=
"
tab-pane fade show active
"
id
=
"
setting
"
role
=
"
tabpanel
"
>
<
div
className
=
"
row d-flex justify-content-center
"
>
<
/div
>
<
/div
>
{
result
}
{
result
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/AdminQuiz.js
View file @
befbdcdb
import
React
,
{
useState
}
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
// import Admin from './Admin'
let
list
=
[]
let
list
=
[]
...
@@ -8,7 +9,7 @@ let QnAadmin = {}
...
@@ -8,7 +9,7 @@ let QnAadmin = {}
let
c
=
{}
let
c
=
{}
function
AdminQuiz
()
{
function
AdminQuiz
(
props
)
{
const
[
question
,
setQuestion
]
=
useState
(
''
)
const
[
question
,
setQuestion
]
=
useState
(
''
)
...
@@ -64,9 +65,11 @@ function AdminQuiz() {
...
@@ -64,9 +65,11 @@ function AdminQuiz() {
alert
(
'
정답이 입력되지 않았습니다.
'
)
alert
(
'
정답이 입력되지 않았습니다.
'
)
}
}
else
{
else
{
// let data = localStorage.getItem('QnA')
// data=data?JSON.parse(data):''
// QnAadmins.push(data)
console
.
log
(
QnAadmin
)
console
.
log
(
QnAadmin
)
QnAadmin
[
'
Choose
'
]
=
Object
.
values
(
c
)
QnAadmin
[
'
Choose
'
]
=
Object
.
values
(
c
)
QnAadmins
.
push
(
QnAadmin
)
QnAadmins
.
push
(
QnAadmin
)
localStorage
.
setItem
(
'
QnA
'
,
JSON
.
stringify
(
QnAadmins
))
localStorage
.
setItem
(
'
QnA
'
,
JSON
.
stringify
(
QnAadmins
))
console
.
log
(
QnAadmins
)
console
.
log
(
QnAadmins
)
...
@@ -80,12 +83,14 @@ function AdminQuiz() {
...
@@ -80,12 +83,14 @@ function AdminQuiz() {
return
(
return
(
<
div
className
=
""
id
=
"
Quiz1
"
>
<
div
className
=
""
id
=
"
Quiz1
"
>
<
h2
className
=
"
p-3 border text-center
"
>
문제만들기
<
/h2
>
<
h2
className
=
"
p-3 border text-center
"
>
{
String
(
props
.
name
)}
번
문제만들기
<
/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
"
className
=
"
form-control
"
onChange
=
{
handleChangeQuestion
}
placeholder
=
"
문제를 입력하세요
"
/>
<
/div
>
<
/div
>
<
div
className
=
"
p-3
"
>
<
span
className
=
"
font-weight-bold mr-2 h3
"
>
2
.
보기
입력하기
<
/span
>
<
div
className
=
"
p-3
"
>
<
div
className
=
"
p-3
"
>
<
div
className
=
"
input-group
"
>
<
div
className
=
"
input-group
"
>
<
div
className
=
"
input-group-prepend
"
>
<
div
className
=
"
input-group-prepend
"
>
...
@@ -98,6 +103,8 @@ function AdminQuiz() {
...
@@ -98,6 +103,8 @@ function AdminQuiz() {
{
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
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
p-3
"
>
<
div
className
=
"
p-3
"
>
<
span
className
=
"
font-weight-bold mr-2 h3
"
>
정답
:
<
/span
>
<
span
className
=
"
font-weight-bold mr-2 h3
"
>
정답
:
<
/span
>
...
...
src/App2.js
deleted
100644 → 0
View file @
a79e9b83
import
React
from
'
react
'
;
import
'
./App.css
'
;
function
App
()
{
return
(
<
div
>
<
header
>
<
Link
to
=
"
/
"
>
<
button
>
Calculus
<
/button
>
<
/Link
>
<
/header
>
<
hr
/>
<
/div
>
)
}
export
default
App
;
\ 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