jichoi / lms_front star
박민혁 박민혁 2024-08-21
240821 박민혁 하드코딩 수정
@3973492bbad61888cae77bef547df98603f676ad
client/views/pages/teacher/QuestionDetail.vue
--- client/views/pages/teacher/QuestionDetail.vue
+++ client/views/pages/teacher/QuestionDetail.vue
@@ -18,32 +18,10 @@
                 <div class="flex align-center mb20">
                     <label for="" class="title2">문제 유형</label>
                     <select v-model="selectedSearchOption2" class="mr10 data-wrap">
-                        <option value="prblm_type_001">Chapter3 페이지 문제</option>
-                        <option value="prblm_type_002">Chapter3_1 페이지 문제</option>
-                        <option value="prblm_type_003">Chapter3_2 페이지 문제</option>
-                        <option value="prblm_type_004">Chapter3_3 페이지 문제</option>
-                        <option value="prblm_type_005">Chapter3_3_1 페이지 문제</option>
-                        <option value="prblm_type_006">Chapter3_4 페이지 문제</option>
-                        <option value="prblm_type_007">Chapter3_5 페이지 문제</option>
-                        <option value="prblm_type_008">Chapter3_6 페이지 문제</option>
-                        <option value="prblm_type_009">Chapter3_7 페이지 문제</option>
-                        <option value="prblm_type_010">Chapter3_8 페이지 문제</option>
-                        <option value="prblm_type_011">Chapter3_9 페이지 문제</option>
-                        <option value="prblm_type_012">Chapter3_10 페이지 문제</option>
-                        <option value="prblm_type_013">Chapter3_11 페이지 문제</option>
-                        <option value="prblm_type_014">Chapter3_12 페이지 문제</option>
-                        <option value="prblm_type_015">Chapter3_13 페이지 문제</option>
-                        <option value="prblm_type_016">Chapter3_14 페이지 문제</option>
-                        <option value="prblm_type_017">Chapter3_15 페이지 문제</option>
-                        <option value="prblm_type_018">Chapter2_8 페이지 문제</option>
-                        <option value="prblm_type_019">Chapter2_7 페이지 문제</option>
-                        <option value="prblm_type_020">Chapter2_5 페이지 문제</option>
-                        <option value="prblm_type_021">Chapter2_6 페이지 문제</option>
-                        <option value="prblm_type_022">Chapter2_10 페이지 문제</option>
-                        <option value="prblm_type_023">Chapter2_11 페이지 문제</option>
-                        <option value="prblm_type_024">Chapter2_13 페이지 문제</option>
+                        <option v-for="prblmT in problemType" :key="prblmT.prblm_type_id" :value="prblmT">
+                            {{ prblmT.prblm_type_nm }}
+                        </option>
                     </select>
-
                 </div>
 
                 <div class="flex align-center">
@@ -90,7 +68,7 @@
                 <input type="file" ref="fileInput" @change="handleFileUpload" multiple />
             </div>
             <hr>
-            <div v-if="selectedSearchOption2 === ('prblm_type_008')">
+            <div v-if="selectedSearchOption2.prblm_type_cls === '5지선다'">
                 <!--5지선다-->
                 <div class="gd-col2 " v-for="i in 5" :key="i">
                     <div>
@@ -107,7 +85,7 @@
                     </div>
                     <div class="flex align-center mb20">
                         <label :for="'file' + i" class="title2">첨부파일</label>
-                        <div v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
+                        <div  v-if="prblmDetail.answers[i] && prblmDetail.answers[i].fileInfo" v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
                             <label>{{ data.fileNm }}</label>
                         </div>
 
@@ -116,7 +94,7 @@
                 </div>
 
             </div>
-            <div v-else-if="['prblm_type_004', 'prblm_type_006', 'prblm_type_024'].includes(selectedSearchOption2)">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === '4지선다'">
                 <!--4지선다-->
                 <div class="gd-col2 " v-for="i in 4" :key="i">
                     <div>
@@ -133,7 +111,7 @@
                     </div>
                     <div class="flex align-center mb20">
                         <label :for="'file' + i" class="title2">첨부파일</label>
-                        <div v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
+                        <div  v-if="prblmDetail.answers[i] && prblmDetail.answers[i].fileInfo" v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
                             <label>{{ data.fileNm }}</label>
                         </div>
 
@@ -142,8 +120,7 @@
 
                 </div>
             </div>
-            <div
-                v-else-if="['prblm_type_001', 'prblm_type_005', 'prblm_type_018', 'prblm_type_019', 'prblm_type_022'].includes(selectedSearchOption2)">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === '3지선다'">
                 <!--3지선다-->
                 <div class="gd-col2 " v-for="i in 3" :key="i">
                     <div>
@@ -160,15 +137,14 @@
                     </div>
                     <div class="flex align-center mb20">
                         <label :for="'file' + i" class="title2">첨부파일</label>
-                        <div v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
+                        <div  v-if="prblmDetail.answers[i] && prblmDetail.answers[i].fileInfo" v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
                             <label>{{ data.fileNm }}</label>
                         </div>
                         <input type="file" :ref="'fileInput' + i" @change="handleDetailFileUpload(i)" multiple />
                     </div>
                 </div>
             </div>
-            <div
-                v-else-if="['prblm_type_002', 'prblm_type_003', 'prblm_type_007', 'prblm_type_023'].includes(selectedSearchOption2)">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === '2지선다'">
                 <!--2지선다-->
                 <div class="gd-col2 " v-for="i in 2" :key="i">
                     <div>
@@ -185,7 +161,7 @@
                     </div>
                     <div class="flex align-center mb20">
                         <label :for="'file' + i" class="title2">첨부파일</label>
-                        <div v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
+                        <div  v-if="prblmDetail.answers[i] && prblmDetail.answers[i].fileInfo" v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
                             <label>{{ data.fileNm }}</label>
                         </div>
 
@@ -194,7 +170,7 @@
 
                 </div>
             </div>
-            <div v-else-if="selectedSearchOption2 === 'prblm_type_009'">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === 'OX 문제'">
                 <!--OX문제-->
                 <div class="flex align-center mb20">
                     <label for="" class="title2">답</label>
@@ -205,16 +181,14 @@
                 </div>
                 <div class="flex align-center mb20">
                     <label :for="'file' + i" class="title2">첨부파일</label>
-                    <div v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
+                    <div v-if="prblmDetail.answers[i] && prblmDetail.answers[i].fileInfo" v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
                         <label>{{ data.fileNm }}</label>
                     </div>
 
                     <input type="file" :ref="'fileInput' + 1" @change="handleDetailFileUpload(1)" multiple />
                 </div>
             </div>
-            <div
-                v-else-if="['prblm_type_010', 'prblm_type_011', 'prblm_type_012', 'prblm_type_013', 'prblm_type_014',
-                    'prblm_type_015', 'prblm_type_016', 'prblm_type_017', 'prblm_type_020', 'prblm_type_021'].includes(selectedSearchOption2)">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === '서술형'">
                 <!--서술형-->
                 <div class="gd-col2 ">
                     <div class="flex align-center mb20">
@@ -223,7 +197,7 @@
                     </div>
                     <div class="flex align-center mb20">
                         <label :for="'file' + i" class="title2">첨부파일</label>
-                        <div v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
+                        <div  v-if="prblmDetail.answers[i] && prblmDetail.answers[i].fileInfo" v-for="(data, index) in prblmDetail.answers[i].fileInfo" :key="index">
                             <label>{{ data.fileNm }}</label>
                         </div>
 
@@ -293,8 +267,10 @@
             dataList: [],
             problemDetail: [],
 
+            problemType: [],
             selectedSearchOption: '',
-            selectedSearchOption2: '',
+            selectedSearchOption2: {
+            },
             book_id: '',
             unit_id: '',
             text_id: '',
@@ -365,7 +341,9 @@
                 });
 
                 vm.selectedSearchOption = vm.dataList.prblmCtgryId;
-                vm.selectedSearchOption2 = vm.dataList.prblmTypeId;
+                vm.selectedSearchOption2.prblm_type_id = vm.dataList.prblmTypeId;
+                vm.selectedSearchOption2.prblm_type_cls = vm.dataList.prblmTypeCls;
+                vm.selectedSearchOption2.prblm_type_nm = vm.dataList.prblmTypeNm;
                 vm.book_id = vm.dataList.bookId;
                 vm.unit_id = vm.dataList.unitId;
                 vm.text_id = vm.dataList.textId;
@@ -397,7 +375,7 @@
                             text: detail.prblmDtlExpln,
                             isCorrect: detail.prblmYn === 'Y' ? 'Y' : 'N',
                             fileMngId: detail.fileMngId || null,
-                            fileInfo: fileInfo
+                            fileInfo: fileInfo || null,
                         };
                     }
 
@@ -425,7 +403,7 @@
                 return;
             }
 
-            if (!this.selectedSearchOption2) {
+            if (!this.selectedSearchOption2.prblm_type_id) {
                 alert("문제 유형을 지정해 주세요.");
                 return;
             }
@@ -443,7 +421,7 @@
             const payload = {
                 prblmId: this.dataList.prblmId,
                 prblmCtgryId: this.selectedSearchOption, // 카테고리
-                prblmTypeId: this.selectedSearchOption2, // 문제 유형
+                prblmTypeId: this.selectedSearchOption2.prblm_type_id, // 문제 유형
                 prblmScr: this.prblm_scr, // 문제 배점
                 prblmExpln: this.prblm_expln, // 내용
                 prblmHint: this.prblm_hint, // 힌트
@@ -503,17 +481,18 @@
 
             let answerCount = 0;
 
-            if (this.selectedSearchOption2 === 'prblm_type_008') {
+            if (this.selectedSearchOption2.prblm_type_cls === '5지선다') {
                 answerCount = 5;
-            } else if (['prblm_type_004', 'prblm_type_006', 'prblm_type_024'].includes(this.selectedSearchOption2)) {
+            } else if (this.selectedSearchOption2.prblm_type_cls === '4지선다') {
                 answerCount = 4;
-            } else if (['prblm_type_001', 'prblm_type_005', 'prblm_type_018', 'prblm_type_019', 'prblm_type_022'].includes(this.selectedSearchOption2)) {
+            } else if (this.selectedSearchOption2.prblm_type_cls === '3지선다') {
                 answerCount = 3;
-            } else if (['prblm_type_002', 'prblm_type_003', 'prblm_type_007', 'prblm_type_023'].includes(this.selectedSearchOption2)) {
+            } else if (this.selectedSearchOption2.prblm_type_cls === '2지선다') {
                 answerCount = 2;
             } else {
                 answerCount = 1;
             }
+
 
             for (let i = 1; i <= answerCount; i++) {
                 if (this.selectedFiles[i] && this.selectedFiles[i].length > 0) {
@@ -545,11 +524,11 @@
             this.prblmDetail = {
 
                 answers: {
-                    1: { text: '', isCorrect: 'N', fileMngId: null },
-                    2: { text: '', isCorrect: 'N', fileMngId: null },
-                    3: { text: '', isCorrect: 'N', fileMngId: null },
-                    4: { text: '', isCorrect: 'N', fileMngId: null },
-                    5: { text: '', isCorrect: 'N', fileMngId: null },
+                    1: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
+                    2: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
+                    3: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
+                    4: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
+                    5: { text: '', isCorrect: 'N', fileMngId: null, fileInfo: '' },
                 },
                 correctIndex: null,
             };
@@ -695,10 +674,32 @@
                 console.log("result - error : ", error);
                 return [];
             }
-        }
+        },
 
+        // 문제 유형 정보 가져오기
+        selectProblemType(){
+            axios({
+                url: "/problem/selectType.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+            })
+                .then(response => {
+                    this.problemType = response.data;
+                })
+                .catch(error => {
+                    console.error("selectProblemType - error: ", error);
+                });
+        },
     },
     watch: {
+        selectedSearchOption2(newVal, oldVal) {
+            if (newVal !== oldVal) {
+                this.resetPrblmDetail();
+            }
+        }
+
     },
     computed: {
 
@@ -715,6 +716,7 @@
         this.fetchUnits();
         this.fetchTexts();
 
+        this.selectProblemType();
         this.problemSearch();
     }
 }
client/views/pages/teacher/QuestionInsert.vue
--- client/views/pages/teacher/QuestionInsert.vue
+++ client/views/pages/teacher/QuestionInsert.vue
@@ -40,30 +40,9 @@
                 <div class="flex align-center mb20">
                     <label for="" class="title2">문제 유형</label>
                     <select v-model="selectedSearchOption2" class="mr10 data-wrap">
-                        <option value="prblm_type_001">Chapter3 페이지 문제</option>
-                        <option value="prblm_type_002">Chapter3_1 페이지 문제</option>
-                        <option value="prblm_type_003">Chapter3_2 페이지 문제</option>
-                        <option value="prblm_type_004">Chapter3_3 페이지 문제</option>
-                        <option value="prblm_type_005">Chapter3_3_1 페이지 문제</option>
-                        <option value="prblm_type_006">Chapter3_4 페이지 문제</option>
-                        <option value="prblm_type_007">Chapter3_5 페이지 문제</option>
-                        <option value="prblm_type_008">Chapter3_6 페이지 문제</option>
-                        <option value="prblm_type_009">Chapter3_7 페이지 문제</option>
-                        <option value="prblm_type_010">Chapter3_8 페이지 문제</option>
-                        <option value="prblm_type_011">Chapter3_9 페이지 문제</option>
-                        <option value="prblm_type_012">Chapter3_10 페이지 문제</option>
-                        <option value="prblm_type_013">Chapter3_11 페이지 문제</option>
-                        <option value="prblm_type_014">Chapter3_12 페이지 문제</option>
-                        <option value="prblm_type_015">Chapter3_13 페이지 문제</option>
-                        <option value="prblm_type_016">Chapter3_14 페이지 문제</option>
-                        <option value="prblm_type_017">Chapter3_15 페이지 문제</option>
-                        <option value="prblm_type_018">Chapter2_8 페이지 문제</option>
-                        <option value="prblm_type_019">Chapter2_7 페이지 문제</option>
-                        <option value="prblm_type_020">Chapter2_5 페이지 문제</option>
-                        <option value="prblm_type_021">Chapter2_6 페이지 문제</option>
-                        <option value="prblm_type_022">Chapter2_10 페이지 문제</option>
-                        <option value="prblm_type_023">Chapter2_11 페이지 문제</option>
-                        <option value="prblm_type_024">Chapter2_13 페이지 문제</option>
+                        <option v-for="prblmT in problemType" :key="prblmT.prblm_type_id" :value="prblmT">
+                            {{ prblmT.prblm_type_nm }}
+                        </option>
                     </select>
 
                 </div>
@@ -109,18 +88,19 @@
                 <input type="file" ref="fileInput" @change="handleFileUpload" multiple />
             </div>
             <hr>
-            <div v-if="selectedSearchOption2 === ('prblm_type_008')">
+            <div v-if="selectedSearchOption2.prblm_type_cls === '5지선다'">
                 <!--5지선다-->
                 <div class="gd-col2 " v-for="i in 5" :key="i">
                     <div>
                         <div class="flex align-center mb20 mr40">
-                        <label :for="'answer' + i" class="title2">답{{ i }}</label>
-                        <input :id="'answer' + i" type="text" class="data-wrap" v-model="prblmDetail.answers[i].text" />
-                    </div>
-                    <div class="flex align-center mb20">
-                        <label :for="'correct' + i" class="title2">정답여부</label>
-                        <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
-                            :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
+                            <label :for="'answer' + i" class="title2">답{{ i }}</label>
+                            <input :id="'answer' + i" type="text" class="data-wrap"
+                                v-model="prblmDetail.answers[i].text" />
+                        </div>
+                        <div class="flex align-center mb20">
+                            <label :for="'correct' + i" class="title2">정답여부</label>
+                            <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
+                                :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
                         </div>
                     </div>
                     <div class="flex align-center mb20">
@@ -130,18 +110,19 @@
                 </div>
 
             </div>
-            <div v-else-if="['prblm_type_004', 'prblm_type_006', 'prblm_type_024'].includes(selectedSearchOption2)">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === '4지선다'">
                 <!--4지선다-->
                 <div class="gd-col2 " v-for="i in 4" :key="i">
                     <div>
                         <div class="flex align-center mb20 mr40">
-                        <label :for="'answer' + i" class="title2">답{{ i }}</label>
-                        <input :id="'answer' + i" type="text" class="data-wrap" v-model="prblmDetail.answers[i].text" />
-                    </div>
-                    <div class="flex align-center mb20">
-                        <label :for="'correct' + i" class="title2">정답여부</label>
-                        <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
-                            :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
+                            <label :for="'answer' + i" class="title2">답{{ i }}</label>
+                            <input :id="'answer' + i" type="text" class="data-wrap"
+                                v-model="prblmDetail.answers[i].text" />
+                        </div>
+                        <div class="flex align-center mb20">
+                            <label :for="'correct' + i" class="title2">정답여부</label>
+                            <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
+                                :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
                         </div>
                     </div>
                     <div class="flex align-center mb20">
@@ -152,18 +133,19 @@
                 </div>
             </div>
             <div
-                v-else-if="['prblm_type_001', 'prblm_type_005', 'prblm_type_019', 'prblm_type_022'].includes(selectedSearchOption2)">
+                v-else-if="selectedSearchOption2.prblm_type_cls === '3지선다'">
                 <!--3지선다-->
                 <div class="gd-col2 " v-for="i in 3" :key="i">
                     <div>
                         <div class="flex align-center mb20 mr40">
-                        <label :for="'answer' + i" class="title2">답{{ i }}</label>
-                        <input :id="'answer' + i" type="text" class="data-wrap" v-model="prblmDetail.answers[i].text" />
-                    </div>
-                    <div class="flex align-center mb20">
-                        <label :for="'correct' + i" class="title2">정답여부</label>
-                        <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
-                            :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
+                            <label :for="'answer' + i" class="title2">답{{ i }}</label>
+                            <input :id="'answer' + i" type="text" class="data-wrap"
+                                v-model="prblmDetail.answers[i].text" />
+                        </div>
+                        <div class="flex align-center mb20">
+                            <label :for="'correct' + i" class="title2">정답여부</label>
+                            <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
+                                :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
                         </div>
                     </div>
                     <div class="flex align-center mb20">
@@ -174,18 +156,19 @@
                 </div>
             </div>
             <div
-                v-else-if="['prblm_type_002', 'prblm_type_003', 'prblm_type_007', 'prblm_type_023'].includes(selectedSearchOption2)">
+                v-else-if="selectedSearchOption2.prblm_type_cls === '2지선다'">
                 <!--2지선다-->
                 <div class="gd-col2 " v-for="i in 2" :key="i">
                     <div>
                         <div class="flex align-center mb20 mr40">
-                        <label :for="'answer' + i" class="title2">답{{ i }}</label>
-                        <input :id="'answer' + i" type="text" class="data-wrap" v-model="prblmDetail.answers[i].text" />
-                    </div>
-                    <div class="flex align-center mb20">
-                        <label :for="'correct' + i" class="title2">정답여부</label>
-                        <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
-                            :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
+                            <label :for="'answer' + i" class="title2">답{{ i }}</label>
+                            <input :id="'answer' + i" type="text" class="data-wrap"
+                                v-model="prblmDetail.answers[i].text" />
+                        </div>
+                        <div class="flex align-center mb20">
+                            <label :for="'correct' + i" class="title2">정답여부</label>
+                            <input :id="'correct' + i" type="checkbox" class="ui-checkbox"
+                                :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" />
                         </div>
                     </div>
                     <div class="flex align-center mb20">
@@ -195,7 +178,7 @@
 
                 </div>
             </div>
-            <div v-else-if="selectedSearchOption2 === 'prblm_type_009'">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === 'OX 문제'">
                 <!--OX문제-->
                 <div class="flex align-center mb20">
                     <label for="" class="title2">답</label>
@@ -205,14 +188,12 @@
                     </select>
                 </div>
                 <div class="flex align-center mb20">
-                        <label :for="'file' + i" class="title2">첨부파일</label>
-                        <input type="file" :ref="'fileInput' + 1" @change="handleDetailFileUpload(1)" multiple />
-                    </div>
+                    <label :for="'file' + i" class="title2">첨부파일</label>
+                    <input type="file" :ref="'fileInput' + 1" @change="handleDetailFileUpload(1)" multiple />
+                </div>
 
             </div>
-            <div
-                v-else-if="['prblm_type_010', 'prblm_type_011', 'prblm_type_012', 'prblm_type_013', 'prblm_type_014',
-                    'prblm_type_015', 'prblm_type_016', 'prblm_type_017', 'prblm_type_018', 'prblm_type_020', 'prblm_type_021'].includes(selectedSearchOption2)">
+            <div v-else-if="selectedSearchOption2.prblm_type_cls === '서술형'">
                 <!--서술형-->
                 <div class="gd-col2 ">
                     <div class="flex align-center mb20">
@@ -325,7 +306,7 @@
             mdiMagnify: mdiMagnify,
             selectedTab: '1',
             selectedSearchOption: '1', // 카테고리 선택
-            selectedSearchOption2: 'prblm_type_001',
+            selectedSearchOption2: '',
             text_id: '',
             prblm_ctgry_id: '', // 카테고리 ID
             prblm_type_id: '', // 문제 유형 ID
@@ -348,6 +329,7 @@
             prblm_mtr6: '',
             selectedFiles: {},
 
+            problemType: [],
             prblmDetail: {
                 answers: {
                     1: { text: '', isCorrect: 'N', fileMngId: null },
@@ -406,7 +388,7 @@
                 return;
             }
 
-            if (!this.selectedSearchOption2) {
+            if (!this.selectedSearchOption2.prblm_type_id) {
                 alert("문제 유형을 지정해 주세요.");
                 return;
             }
@@ -423,7 +405,7 @@
 
             const payload = {
                 prblmCtgryId: this.selectedSearchOption, // 카테고리
-                prblmTypeId: this.selectedSearchOption2, // 문제 유형
+                prblmTypeId: this.selectedSearchOption2.prblm_type_id, // 문제 유형
                 prblmScr: this.prblm_scr, // 문제 배점
                 prblmExpln: this.prblm_expln, // 내용
                 prblmHint: this.prblm_hint, // 힌트
@@ -431,7 +413,7 @@
                 textId: this.text_id, // 지문 아이디
                 unitId: this.unit_id, // 단원 아이디
                 bookId: this.book_id, // 교재 아이디
-               // userId: this.user_id, // 유저 아이디
+                // userId: this.user_id, // 유저 아이디
                 userId: 'USID_000000000000004', // 유저 아이디
                 prblmMtr1: this.prblm_mtr1, // 문제 지표
                 prblmMtr2: this.prblm_mtr2,
@@ -482,13 +464,13 @@
 
             let answerCount = 0;
 
-            if (this.selectedSearchOption2 === 'prblm_type_008') {
+            if (this.selectedSearchOption2.prblm_type_cls === '5지선다') {
                 answerCount = 5;
-            } else if (['prblm_type_004', 'prblm_type_006', 'prblm_type_024'].includes(this.selectedSearchOption2)) {
+            } else if (this.selectedSearchOption2.prblm_type_cls === '4지선다') {
                 answerCount = 4;
-            } else if (['prblm_type_001', 'prblm_type_005', 'prblm_type_019', 'prblm_type_022'].includes(this.selectedSearchOption2)) {
+            } else if (this.selectedSearchOption2.prblm_type_cls === '3지선다') {
                 answerCount = 3;
-            } else if (['prblm_type_002', 'prblm_type_003', 'prblm_type_007', 'prblm_type_023'].includes(this.selectedSearchOption2)) {
+            } else if (this.selectedSearchOption2.prblm_type_cls === '2지선다') {
                 answerCount = 2;
             } else {
                 answerCount = 1;
@@ -521,7 +503,7 @@
 
         resetPrblmDetail() {
             this.prblmDetail = {
-                
+
                 answers: {
                     1: { text: '', isCorrect: 'N', fileMngId: null },
                     2: { text: '', isCorrect: 'N', fileMngId: null },
@@ -598,6 +580,22 @@
                     alert("지문 목록을 불러오는 중 오류가 발생했습니다.");
                 });
         },
+        // 문제 유형 정보 가져오기
+        selectProblemType() {
+            axios({
+                url: "/problem/selectType.json",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json; charset=UTF-8",
+                },
+            })
+                .then(response => {
+                    this.problemType = response.data;
+                })
+                .catch(error => {
+                    console.error("selectProblemType - error: ", error);
+                });
+        },
 
     },
     watch: {
@@ -621,6 +619,7 @@
         this.fetchBooks();
         this.fetchUnits();
         this.fetchTexts();
+        this.selectProblemType();
     }
 }
 
Add a comment
List