Commit c6d01df3 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

a

parent e67f66d7
......@@ -2,46 +2,71 @@ import React, { useState } from 'react';
let list = []
let QnAadmins = []
let QnAadmin = {}
function AdminQuiz() {
const [question, setQuestion] = useState('')
const [choose, setChoose] = useState('')
const [answer, setAnswer] = useState('')
const [selectOption, setselectOption] = useState(1)
const handleChangeQuestion = (event) => {
QnAadmin['Q'] = event.target.value
setQuestion(event.target.value)
}
const handleChangeChoose = (event) => {
QnAadmin['Choose'] = event.target.value
setChoose(event.target.value)
}
const handleChangeanswer = (event) => {
QnAadmin['A'] = event.target.value
setAnswer(event.target.value)
}
function addSelectOption() {
list.push(
<div className="input-group">
<div className="input-group-prepend">
<div className="input-group-text">
<input type="radio" name="answer" />
<input type="radio" id={selectOption + 1} name="answer" />
</div>
</div>
<input type="text" className="form-control" placeholder="보기를 입력하세요" onChange={handleChangeChoose} />
<input type="text" class="form-control" placeholder="보기를 입력하세요" onChange={handleChangeChoose} />
</div>
)
setselectOption(selectOption + 1)
}
function handleClick() {
alert('입력이 완료되었습니다')
// localStorage.setItem('Q', question)
// localStorage.setItem('Choose', choose)
// localStorage.setItem('Answer', answer)
// localStorage.setItem('P', password)
// localStorage.setItem('AP', adminpassword)
// localStorage.setItem('T', time * 1000)
function handleClick() {
if (!question) {
alert('문제가 입력되지 않았습니다.')
}
else if (!choose) {
alert('보기가 입력되지 않았습니다.')
}
else if (!answer) {
alert('정답이 입력되지 않았습니다.')
}
else {
console.log(QnAadmin)
QnAadmins.push(QnAadmin)
localStorage.setItem('QnA', JSON.stringify(QnAadmins))
console.log(QnAadmins)
alert('입력이 완료되었습니다.')
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment