diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/contents/survey/QuestionModal.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/contents/survey/QuestionModal.jsx index 66e22ad..7cc790d 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/contents/survey/QuestionModal.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/contents/survey/QuestionModal.jsx @@ -8,8 +8,8 @@ import * as EgovNet from "api/egovFetch"; function QuestionModal({svySeq}){ - const [qtTag, setQtTag] = useState([]); - const [itemTag, setItemTag] = useState([]); + const [qtList, setQtList] = useState([]); + const [selectedQt, setSelectedQt] = useState(null); function getSurveyQt(){ EgovNet.requestFetch( @@ -18,19 +18,7 @@ function QuestionModal({svySeq}){ method: "GET" }, (resp) => { - - const temp = []; - resp.result.qtList.forEach(function (qt, index){ - temp.push( - - selectQt(qt.itemList)}> - - - - ) - }) - setQtTag(temp); - + setQtList(resp.result.qtList) }, function (resp) { console.log("err response : ", resp); @@ -38,42 +26,12 @@ function QuestionModal({svySeq}){ ); } - function selectQt(itemList){ - const temp = []; - itemList.forEach(function (item, index){ - temp.push( - - - - - - ) - }) - setItemTag(temp); - } - function addQt(){ - const temp = [...qtTag] - temp.push( - - - - - - ) - setQtTag(temp) + } function addItem(){ - const temp = [...itemTag] - temp.push( - - - - - - ) - setItemTag(temp) + } function editSurveyQt(e){ @@ -91,7 +49,7 @@ function QuestionModal({svySeq}){ - + @@ -99,7 +57,15 @@ function QuestionModal({svySeq}){ - {qtTag} + {qtList.map(qt=>{ + return ( + + + + ); + })} @@ -110,7 +76,32 @@ function QuestionModal({svySeq}){
+ {setSelectedQt(qt)}}/> +
- + + + + 질문유형 + + + {setSelectedQt({...selectedQt, qtType:1})}}/> + {setSelectedQt({...selectedQt, qtType:2})}}/> + {setSelectedQt({...selectedQt, qtType:3})}}/> + {setSelectedQt({...selectedQt, qtType:4})}}/> + + + + + 최대 선택 개수 + + + + + + 기타 여부 + + + + + @@ -118,7 +109,15 @@ function QuestionModal({svySeq}){ - {itemTag} + {selectedQt?.itemList.map(item=>{ + return ( + + + + ); + })}
+ +