From 47e443e000c90bef4917d0506688708abfe97450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=84=9D=20=EC=B5=9C?= Date: Thu, 7 Mar 2024 18:06:17 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=A4=EB=AC=B8=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/contents/survey/QuestionModal.jsx | 101 +++++++++--------- 1 file changed, 50 insertions(+), 51 deletions(-) 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 ( + + + + ); + })}
+ +