Commit dd0704fc authored by baesangjune's avatar baesangjune
Browse files

.

parent 16184ff8
...@@ -14,11 +14,8 @@ function Admin() { ...@@ -14,11 +14,8 @@ function Admin() {
} }
function handleClickQuiz(e) { function handleClickQuiz(e) {
(JSON.parse(localStorage.getItem('QnA')) === null) ? setresult(<AdminQuiz QuizNum={e.target.id} data={{Q:'x' , Choose:'x', A:'x'}} />) : setresult(<AdminQuiz QuizNum={e.target.id} data={JSON.parse(localStorage.getItem('QnA'))} />) (JSON.parse(localStorage.getItem('QnA')) === null) ? setresult(<AdminQuiz QuizNum={e.target.id} data={[{ Q: 'x', Choose: 'x', A: 'x' }]} />) : setresult(<AdminQuiz QuizNum={e.target.id} data={JSON.parse(localStorage.getItem('QnA'))} />)
console.log('data') }
console.log(data)
console.log(QuizNum)
}
function handleClickAddQuiz() { function handleClickAddQuiz() {
QuizBtn.push( QuizBtn.push(
......
...@@ -7,7 +7,6 @@ let QnAadmin = {} ...@@ -7,7 +7,6 @@ let QnAadmin = {}
let savechoose = {} let savechoose = {}
function AdminQuiz(props) { function AdminQuiz(props) {
const [question, setQuestion] = useState('') const [question, setQuestion] = useState('')
const [choose, setChoose] = useState('') const [choose, setChoose] = useState('')
const [answer, setAnswer] = useState('') const [answer, setAnswer] = useState('')
......
...@@ -4,6 +4,14 @@ import React, { useState } from 'react' ...@@ -4,6 +4,14 @@ import React, { useState } from 'react'
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
function Home() { function Home() {
let info=[{password:"0319", AdminPassword:"0001",Time : "30010"}] //수정.추가
if(JSON.parse(localStorage.getItem("Set")) === null){
}
else{
info = JSON.parse(localStorage.getItem("Set"))
} //수정. 추가
const [name, setName] = useState('') const [name, setName] = useState('')
const [password, SetPassword] = useState('') const [password, SetPassword] = useState('')
const [done, setDone] = useState(false) const [done, setDone] = useState(false)
......
...@@ -20,10 +20,10 @@ function Quiz() { ...@@ -20,10 +20,10 @@ function Quiz() {
//for each 사용하기 //for each 사용하기
let Solutions = [] //빈 배열 let Solutions = [] //빈 배열
console.log(localQnA) console.log(localQnA)
localQnA.map((x) => { //A만 꺼내서 q에 추가
// Answers.push(0) localQnA.forEach((element) => {
return Solutions.push(x.A) Solutions.push(Number(element.A))
}) });
useEffect(() => { useEffect(() => {
for (let i = 1; i <= Solutions.length; i++) { for (let i = 1; i <= Solutions.length; i++) {
Answers.push(0) Answers.push(0)
......
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