![](/assets/images/project_default_logo.png)
--- client/views/pages/teacher/QuestionDetail.vue
+++ client/views/pages/teacher/QuestionDetail.vue
... | ... | @@ -4,181 +4,238 @@ |
4 | 4 |
</div> |
5 | 5 |
<div class="content-t"> |
6 | 6 |
<div class="board-wrap"> |
7 |
- <div class="tab-box"> |
|
8 |
- <label class="mr20 title1"> |
|
9 |
- <input type="radio" v-model="selectedTab" value="tab1" /> |
|
10 |
- 문제 유형 (일반형) |
|
11 |
- </label> |
|
12 |
- <label class="mr20 title1"> |
|
13 |
- <input type="radio" v-model="selectedTab" value="tab2" /> |
|
14 |
- 문제 유형 (O,X형) |
|
15 |
- </label> |
|
16 |
- <label class="mr20 title1"> |
|
17 |
- <input type="radio" v-model="selectedTab" value="tab3" /> |
|
18 |
- 문제 유형 (연결형) |
|
19 |
- </label> |
|
20 |
- <label class="mr20 title1"> |
|
21 |
- <input type="radio" v-model="selectedTab" value="tab4" /> |
|
22 |
- 문제 유형 (다중 정답형) |
|
23 |
- </label> |
|
24 |
- </div> |
|
25 |
- <hr> |
|
26 | 7 |
<div class="gd-col2 "> |
27 | 8 |
<div class="flex align-center mb20"> |
28 | 9 |
<label for="" class="title2">카테고리</label> |
29 | 10 |
<select v-model="selectedSearchOption" class="mr10 data-wrap"> |
30 |
- <option value="bbsTtl">제목</option> |
|
31 |
- <option value="bbsCnt">내용</option> |
|
32 |
- <option value="userNm">작성자</option> |
|
33 |
- <option value="bbsCls">카테고리</option> |
|
11 |
+ <option value="1">듣기 이해력(LC)</option> |
|
12 |
+ <option value="2">독해 이해력(RC)</option> |
|
13 |
+ <option value="4">쓰기(WT)</option> |
|
14 |
+ <option value="5">말하기(SP)</option> |
|
15 |
+ <option value="3">그외(ETC)</option> |
|
34 | 16 |
</select> |
35 | 17 |
</div> |
36 | 18 |
<div class="flex align-center mb20"> |
37 | 19 |
<label for="" class="title2">문제 유형</label> |
38 |
- <select v-model="selectedSearchOption" class="mr10 data-wrap"> |
|
39 |
- <option value="bbsTtl">제목</option> |
|
40 |
- <option value="bbsCnt">내용</option> |
|
41 |
- <option value="userNm">작성자</option> |
|
42 |
- <option value="bbsCls">카테고리</option> |
|
20 |
+ <select v-model="selectedSearchOption2" class="mr10 data-wrap"> |
|
21 |
+ <option value="prblm_type_001">Chapter3 페이지 문제</option> |
|
22 |
+ <option value="prblm_type_002">Chapter3_1 페이지 문제</option> |
|
23 |
+ <option value="prblm_type_003">Chapter3_2 페이지 문제</option> |
|
24 |
+ <option value="prblm_type_004">Chapter3_3 페이지 문제</option> |
|
25 |
+ <option value="prblm_type_005">Chapter3_3_1 페이지 문제</option> |
|
26 |
+ <option value="prblm_type_006">Chapter3_4 페이지 문제</option> |
|
27 |
+ <option value="prblm_type_007">Chapter3_5 페이지 문제</option> |
|
28 |
+ <option value="prblm_type_008">Chapter3_6 페이지 문제</option> |
|
29 |
+ <option value="prblm_type_009">Chapter3_7 페이지 문제</option> |
|
30 |
+ <option value="prblm_type_010">Chapter3_8 페이지 문제</option> |
|
31 |
+ <option value="prblm_type_011">Chapter3_9 페이지 문제</option> |
|
32 |
+ <option value="prblm_type_012">Chapter3_10 페이지 문제</option> |
|
33 |
+ <option value="prblm_type_013">Chapter3_11 페이지 문제</option> |
|
34 |
+ <option value="prblm_type_014">Chapter3_12 페이지 문제</option> |
|
35 |
+ <option value="prblm_type_015">Chapter3_13 페이지 문제</option> |
|
36 |
+ <option value="prblm_type_016">Chapter3_14 페이지 문제</option> |
|
37 |
+ <option value="prblm_type_017">Chapter3_15 페이지 문제</option> |
|
38 |
+ <option value="prblm_type_018">Chapter2_8 페이지 문제</option> |
|
39 |
+ <option value="prblm_type_019">Chapter2_7 페이지 문제</option> |
|
40 |
+ <option value="prblm_type_020">Chapter2_5 페이지 문제</option> |
|
41 |
+ <option value="prblm_type_021">Chapter2_6 페이지 문제</option> |
|
42 |
+ <option value="prblm_type_022">Chapter2_10 페이지 문제</option> |
|
43 |
+ <option value="prblm_type_023">Chapter2_11 페이지 문제</option> |
|
44 |
+ <option value="prblm_type_024">Chapter2_13 페이지 문제</option> |
|
43 | 45 |
</select> |
46 |
+ |
|
44 | 47 |
</div> |
48 |
+ |
|
45 | 49 |
<div class="flex align-center"> |
46 | 50 |
<label for="" class="title2">지문</label> |
47 |
- <select v-model="selectedSearchOption" class="mr10 data-wrap"> |
|
48 |
- <option value="bbsTtl">제목</option> |
|
49 |
- <option value="bbsCnt">내용</option> |
|
50 |
- <option value="userNm">작성자</option> |
|
51 |
- <option value="bbsCls">카테고리</option> |
|
51 |
+ <select name="" id="" v-model="book_id" @change="fetchUnits" class="mr10"> |
|
52 |
+ <option value="" disabled>교재를 선택하세요</option> |
|
53 |
+ <option v-for="book in books" :key="book.book_id" :value="book.book_id"> |
|
54 |
+ {{ book.book_nm }} |
|
55 |
+ </option> |
|
52 | 56 |
</select> |
53 |
- </div> |
|
54 |
- <div class="flex align-center"> |
|
55 |
- <label for="" class="title2">문제 지표</label> |
|
56 |
- <select v-model="selectedSearchOption" class="mr10 data-wrap"> |
|
57 |
- <option value="bbsTtl">제목</option> |
|
58 |
- <option value="bbsCnt">내용</option> |
|
59 |
- <option value="userNm">작성자</option> |
|
60 |
- <option value="bbsCls">카테고리</option> |
|
57 |
+ <select name="" id="" v-model="unit_id" @change="fetchTexts" class="mr10"> |
|
58 |
+ <option value="" disabled>단원을 선택하세요</option> |
|
59 |
+ <option v-for="unit in units" :key="unit.unitId" :value="unit.unitId"> |
|
60 |
+ {{ unit.unitName }} |
|
61 |
+ </option> |
|
62 |
+ </select> |
|
63 |
+ |
|
64 |
+ <select v-model="text_id" class="mr10 data-wrap"> |
|
65 |
+ <option value="" disabled>지문을 선택하세요</option> |
|
66 |
+ <option v-for="text in texts" :key="text.textId" :value="text.textId"> |
|
67 |
+ {{ text.textTtl }} |
|
68 |
+ </option> |
|
61 | 69 |
</select> |
62 | 70 |
</div> |
63 | 71 |
</div> |
64 | 72 |
<div class="flex align-center mb20 mt40"> |
65 | 73 |
<label for="" class="title2">문제 배점</label> |
66 |
- <input type="text" class="data-wrap"> |
|
74 |
+ <input type="text" class="data-wrap" v-model="prblm_scr"> |
|
67 | 75 |
</div> |
68 | 76 |
|
69 | 77 |
<div class="flex align-center mb20"> |
70 | 78 |
<label for="" class="title2">내용</label> |
71 |
- <textarea name="" id="" class="data-wrap"></textarea> |
|
79 |
+ <textarea name="" id="" class="data-wrap" v-model="prblm_expln"></textarea> |
|
72 | 80 |
</div> |
73 | 81 |
<div class="flex align-center mb20"> |
74 | 82 |
<label for="" class="title2">힌트</label> |
75 |
- <input type="text" class="data-wrap"> |
|
83 |
+ <input type="text" class="data-wrap" v-model="prblm_hint"> |
|
76 | 84 |
</div> |
77 |
- <div class="flex align-center mb20"> |
|
78 |
- <label for="" class="title2">첨부파일</label> |
|
79 |
- <input type="file" ref="fileInput" @change="handleFileUpload" /> |
|
85 |
+ <div class="flex align-center "> |
|
86 |
+ <label for="file" class="title2">첨부파일</label> |
|
87 |
+ <input type="file" ref="fileInput" @change="handleFileUpload" multiple /> |
|
80 | 88 |
</div> |
81 | 89 |
<hr> |
82 |
- <div v-if="selectedTab === 'tab1'"> |
|
83 |
- <div class="flex align-center mb20"> |
|
84 |
- <label for="" class="title2">답1</label> |
|
85 |
- <input type="text" class="data-wrap"> |
|
90 |
+ <div v-if="selectedSearchOption2 === ('prblm_type_008')"> |
|
91 |
+ <!--5지선다--> |
|
92 |
+ <div class="gd-col2 " v-for="i in 5" :key="i"> |
|
93 |
+ <div> |
|
94 |
+ <div class="flex align-center mb20 mr40"> |
|
95 |
+ <label :for="'answer' + i" class="title2">답{{ i }}</label> |
|
96 |
+ <input :id="'answer' + i" type="text" class="data-wrap" |
|
97 |
+ v-model="prblmDetail.answers[i].text" /> |
|
98 |
+ </div> |
|
99 |
+ <div class="flex align-center mb20"> |
|
100 |
+ <label :for="'correct' + i" class="title2">정답여부</label> |
|
101 |
+ <input :id="'correct' + i" type="checkbox" class="ui-checkbox" |
|
102 |
+ :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" /> |
|
103 |
+ </div> |
|
104 |
+ </div> |
|
105 |
+ <div class="flex align-center mb20"> |
|
106 |
+ <label :for="'file' + i" class="title2">첨부파일</label> |
|
107 |
+ <input type="file" :ref="'fileInput' + i" @change="handleDetailFileUpload(i)" multiple /> |
|
108 |
+ </div> |
|
86 | 109 |
</div> |
87 |
- <div class="flex align-center mb20"> |
|
88 |
- <label for="" class="title2">답2</label> |
|
89 |
- <input type="text" class="data-wrap"> |
|
90 |
- </div> |
|
91 |
- <div class="flex align-center mb20"> |
|
92 |
- <label for="" class="title2">답3</label> |
|
93 |
- <input type="text" class="data-wrap"> |
|
94 |
- </div> |
|
95 |
- <div class="flex align-center mb20"> |
|
96 |
- <label for="" class="title2">답4</label> |
|
97 |
- <input type="text" class="data-wrap"> |
|
98 |
- </div> |
|
99 |
- <div class="flex align-center mb20"> |
|
100 |
- <label for="" class="title2">해설</label> |
|
101 |
- <textarea name="" id="" class="data-wrap"></textarea> |
|
110 |
+ |
|
111 |
+ </div> |
|
112 |
+ <div v-else-if="['prblm_type_004', 'prblm_type_006', 'prblm_type_024'].includes(selectedSearchOption2)"> |
|
113 |
+ <!--4지선다--> |
|
114 |
+ <div class="gd-col2 " v-for="i in 4" :key="i"> |
|
115 |
+ <div> |
|
116 |
+ <div class="flex align-center mb20 mr40"> |
|
117 |
+ <label :for="'answer' + i" class="title2">답{{ i }}</label> |
|
118 |
+ <input :id="'answer' + i" type="text" class="data-wrap" |
|
119 |
+ v-model="prblmDetail.answers[i].text" /> |
|
120 |
+ </div> |
|
121 |
+ <div class="flex align-center mb20"> |
|
122 |
+ <label :for="'correct' + i" class="title2">정답여부</label> |
|
123 |
+ <input :id="'correct' + i" type="checkbox" class="ui-checkbox" |
|
124 |
+ :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" /> |
|
125 |
+ </div> |
|
126 |
+ </div> |
|
127 |
+ <div class="flex align-center mb20"> |
|
128 |
+ <label :for="'file' + i" class="title2">첨부파일</label> |
|
129 |
+ <input type="file" :ref="'fileInput' + i" @change="handleDetailFileUpload(i)" multiple /> |
|
130 |
+ </div> |
|
131 |
+ |
|
102 | 132 |
</div> |
103 | 133 |
</div> |
104 |
- <div v-else-if="selectedTab === 'tab2'"> |
|
134 |
+ <div |
|
135 |
+ v-else-if="['prblm_type_001', 'prblm_type_005', 'prblm_type_019', 'prblm_type_022'].includes(selectedSearchOption2)"> |
|
136 |
+ <!--3지선다--> |
|
137 |
+ <div class="gd-col2 " v-for="i in 3" :key="i"> |
|
138 |
+ <div> |
|
139 |
+ <div class="flex align-center mb20 mr40"> |
|
140 |
+ <label :for="'answer' + i" class="title2">답{{ i }}</label> |
|
141 |
+ <input :id="'answer' + i" type="text" class="data-wrap" |
|
142 |
+ v-model="prblmDetail.answers[i].text" /> |
|
143 |
+ </div> |
|
144 |
+ <div class="flex align-center mb20"> |
|
145 |
+ <label :for="'correct' + i" class="title2">정답여부</label> |
|
146 |
+ <input :id="'correct' + i" type="checkbox" class="ui-checkbox" |
|
147 |
+ :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" /> |
|
148 |
+ </div> |
|
149 |
+ </div> |
|
150 |
+ <div class="flex align-center mb20"> |
|
151 |
+ <label :for="'file' + i" class="title2">첨부파일</label> |
|
152 |
+ <input type="file" :ref="'fileInput' + i" @change="handleDetailFileUpload(i)" multiple /> |
|
153 |
+ </div> |
|
154 |
+ |
|
155 |
+ </div> |
|
156 |
+ </div> |
|
157 |
+ <div |
|
158 |
+ v-else-if="['prblm_type_002', 'prblm_type_003', 'prblm_type_007', 'prblm_type_023'].includes(selectedSearchOption2)"> |
|
159 |
+ <!--2지선다--> |
|
160 |
+ <div class="gd-col2 " v-for="i in 2" :key="i"> |
|
161 |
+ <div> |
|
162 |
+ <div class="flex align-center mb20 mr40"> |
|
163 |
+ <label :for="'answer' + i" class="title2">답{{ i }}</label> |
|
164 |
+ <input :id="'answer' + i" type="text" class="data-wrap" |
|
165 |
+ v-model="prblmDetail.answers[i].text" /> |
|
166 |
+ </div> |
|
167 |
+ <div class="flex align-center mb20"> |
|
168 |
+ <label :for="'correct' + i" class="title2">정답여부</label> |
|
169 |
+ <input :id="'correct' + i" type="checkbox" class="ui-checkbox" |
|
170 |
+ :checked="prblmDetail.correctIndex === i" @change="setCorrectAnswer(i)" /> |
|
171 |
+ </div> |
|
172 |
+ </div> |
|
173 |
+ <div class="flex align-center mb20"> |
|
174 |
+ <label :for="'file' + i" class="title2">첨부파일</label> |
|
175 |
+ <input type="file" :ref="'fileInput' + i" @change="handleDetailFileUpload(i)" multiple /> |
|
176 |
+ </div> |
|
177 |
+ |
|
178 |
+ </div> |
|
179 |
+ </div> |
|
180 |
+ <div v-else-if="selectedSearchOption2 === 'prblm_type_009'"> |
|
181 |
+ <!--OX문제--> |
|
105 | 182 |
<div class="flex align-center mb20"> |
106 | 183 |
<label for="" class="title2">답</label> |
107 |
- <select v-model="selectedSearchOption" class="mr10 data-wrap"> |
|
184 |
+ <select v-model="prblmDetail.answer1" class="mr10 data-wrap"> |
|
108 | 185 |
<option value="bbsTtl">O</option> |
109 | 186 |
<option value="bbsCnt">X</option> |
110 | 187 |
</select> |
111 | 188 |
</div> |
112 | 189 |
<div class="flex align-center mb20"> |
113 |
- <label for="" class="title2">해설</label> |
|
114 |
- <textarea name="" id="" class="data-wrap"></textarea> |
|
190 |
+ <label :for="'file' + i" class="title2">첨부파일</label> |
|
191 |
+ <input type="file" :ref="'fileInput' + 1" @change="handleDetailFileUpload(1)" multiple /> |
|
115 | 192 |
</div> |
193 |
+ |
|
116 | 194 |
</div> |
117 |
- <div v-else-if="selectedTab === 'tab3'"> |
|
195 |
+ <div |
|
196 |
+ v-else-if="['prblm_type_010', 'prblm_type_011', 'prblm_type_012', 'prblm_type_013', 'prblm_type_014', |
|
197 |
+ 'prblm_type_015', 'prblm_type_016', 'prblm_type_017', 'prblm_type_018', 'prblm_type_020', 'prblm_type_021'].includes(selectedSearchOption2)"> |
|
198 |
+ <!--서술형--> |
|
118 | 199 |
<div class="gd-col2 "> |
119 |
- <div class="flex align-center mb20 mr40"> |
|
120 |
- <label for="" class="title2">문제1</label> |
|
121 |
- <input type="text" class="data-wrap"> |
|
200 |
+ <div class="flex align-center mb20"> |
|
201 |
+ <label for="" class="title2">답</label> |
|
202 |
+ <input type="text" class="data-wrap" v-model="prblmDetail.answer1"> |
|
122 | 203 |
</div> |
123 | 204 |
<div class="flex align-center mb20"> |
124 |
- <label for="" class="title2">답1</label> |
|
125 |
- <input type="text" class="data-wrap"> |
|
205 |
+ <label :for="'file' + i" class="title2">첨부파일</label> |
|
206 |
+ <input type="file" :ref="'fileInput' + 1" @change="handleDetailFileUpload(1)" multiple /> |
|
126 | 207 |
</div> |
127 |
- <div class="flex align-center mb20 mr40"> |
|
128 |
- <label for="" class="title2">문제2</label> |
|
129 |
- <input type="text" class="data-wrap"> |
|
130 |
- </div> |
|
131 |
- <div class="flex align-center mb20"> |
|
132 |
- <label for="" class="title2">답2</label> |
|
133 |
- <input type="text" class="data-wrap"> |
|
134 |
- </div> |
|
135 |
- <div class="flex align-center mb20 mr40"> |
|
136 |
- <label for="" class="title2">문제3</label> |
|
137 |
- <input type="text" class="data-wrap"> |
|
138 |
- </div> |
|
139 |
- <div class="flex align-center mb20 "> |
|
140 |
- <label for="" class="title2">답3</label> |
|
141 |
- <input type="text" class="data-wrap"> |
|
142 |
- </div> |
|
143 |
- <div class="flex align-center mb20 mr40"> |
|
144 |
- <label for="" class="title2">문제4</label> |
|
145 |
- <input type="text" class="data-wrap"> |
|
146 |
- </div> |
|
147 |
- <div class="flex align-center mb20"> |
|
148 |
- <label for="" class="title2">답4</label> |
|
149 |
- <input type="text" class="data-wrap"> |
|
150 |
- </div> |
|
151 |
- </div> |
|
152 |
- <div class="flex align-center mb20"> |
|
153 |
- <label for="" class="title2">해설</label> |
|
154 |
- <textarea name="" id="" class="data-wrap"></textarea> |
|
208 |
+ |
|
155 | 209 |
</div> |
156 | 210 |
</div> |
157 |
- <div v-else-if="selectedTab === 'tab4'"> |
|
158 |
- <div class="flex align-center mb20 mr40"> |
|
159 |
- <label for="" class="title2">문제1</label> |
|
160 |
- <input type="text" class="data-wrap"> |
|
161 |
- <input type="checkbox" class="ui-checkbox ml30"> |
|
162 |
- </div> |
|
163 |
- <div class="flex align-center mb20 mr40"> |
|
164 |
- <label for="" class="title2">문제2</label> |
|
165 |
- <input type="text" class="data-wrap"> |
|
166 |
- <input type="checkbox" class="ui-checkbox ml30"> |
|
167 |
- </div> |
|
168 |
- <div class="flex align-center mb20 mr40"> |
|
169 |
- <label for="" class="title2">문제3</label> |
|
170 |
- <input type="text" class="data-wrap"> |
|
171 |
- <input type="checkbox" class="ui-checkbox ml30"> |
|
172 |
- </div> |
|
173 |
- <div class="flex align-center mb20 mr40"> |
|
174 |
- <label for="" class="title2">문제4</label> |
|
175 |
- <input type="text" class="data-wrap"> |
|
176 |
- <input type="checkbox" class="ui-checkbox ml30"> |
|
177 |
- </div> |
|
178 |
- <div class="flex align-center mb20"> |
|
179 |
- <label for="" class="title2">해설</label> |
|
180 |
- <textarea name="" id="" class="data-wrap"></textarea> |
|
181 |
- </div> |
|
211 |
+ <div class="flex align-center mb20"> |
|
212 |
+ <label for="" class="title2">해설</label> |
|
213 |
+ <textarea name="" id="" class="data-wrap" v-model="prblm_cmmt"></textarea> |
|
214 |
+ </div> |
|
215 |
+ <hr> |
|
216 |
+ <div class="flex align-center mb20 mt40"> |
|
217 |
+ <label for="" class="title2">문제 지표 1</label> |
|
218 |
+ <input type="text" class="data-wrap" v-model="prblm_mtr1"> |
|
219 |
+ </div> |
|
220 |
+ <div class="flex align-center mb20 mt40"> |
|
221 |
+ <label for="" class="title2">문제 지표 2</label> |
|
222 |
+ <input type="text" class="data-wrap" v-model="prblm_mtr2"> |
|
223 |
+ </div> |
|
224 |
+ <div class="flex align-center mb20 mt40"> |
|
225 |
+ <label for="" class="title2">문제 지표 3</label> |
|
226 |
+ <input type="text" class="data-wrap" v-model="prblm_mtr3"> |
|
227 |
+ </div> |
|
228 |
+ <div class="flex align-center mb20 mt40"> |
|
229 |
+ <label for="" class="title2">문제 지표 4</label> |
|
230 |
+ <input type="text" class="data-wrap" v-model="prblm_mtr4"> |
|
231 |
+ </div> |
|
232 |
+ <div class="flex align-center mb20 mt40"> |
|
233 |
+ <label for="" class="title2">문제 지표 5</label> |
|
234 |
+ <input type="text" class="data-wrap" v-model="prblm_mtr5"> |
|
235 |
+ </div> |
|
236 |
+ <div class="flex align-center mb20 mt40"> |
|
237 |
+ <label for="" class="title2">문제 지표 6</label> |
|
238 |
+ <input type="text" class="data-wrap" v-model="prblm_mtr6"> |
|
182 | 239 |
</div> |
183 | 240 |
|
184 | 241 |
</div> |
... | ... | @@ -187,10 +244,10 @@ |
187 | 244 |
목록 |
188 | 245 |
</button> |
189 | 246 |
<div class="flex"> |
190 |
- <button type="button" title="글쓰기" class="new-btn mr10"> |
|
247 |
+ <button type="button" title="글쓰기" class="new-btn mr10" @click="deletePost"> |
|
191 | 248 |
삭제 |
192 | 249 |
</button> |
193 |
- <button type="button" title="글쓰기" class="new-btn"> |
|
250 |
+ <button type="button" title="글쓰기" class="new-btn" @click="submitForm"> |
|
194 | 251 |
수정 |
195 | 252 |
</button> |
196 | 253 |
</div> |
... | ... | @@ -211,6 +268,35 @@ |
211 | 268 |
prblm: {}, |
212 | 269 |
dataList: [], |
213 | 270 |
problemDetail: [], |
271 |
+ |
|
272 |
+ selectedSearchOption: '', |
|
273 |
+ selectedSearchOption2: '', |
|
274 |
+ book_id: '', |
|
275 |
+ unit_id: '', |
|
276 |
+ text_id: '', |
|
277 |
+ prblm_scr: '', |
|
278 |
+ prblm_expln: '', |
|
279 |
+ prblm_hint: '', |
|
280 |
+ prblm_cmmt: '', |
|
281 |
+ prblm_mtr1: '', |
|
282 |
+ prblm_mtr2: '', |
|
283 |
+ prblm_mtr3: '', |
|
284 |
+ prblm_mtr4: '', |
|
285 |
+ prblm_mtr5: '', |
|
286 |
+ prblm_mtr6: '', |
|
287 |
+ prblmDetail: { |
|
288 |
+ answers: { |
|
289 |
+ 1: { text: '', isCorrect: 'N', fileMngId: null }, |
|
290 |
+ 2: { text: '', isCorrect: 'N', fileMngId: null }, |
|
291 |
+ 3: { text: '', isCorrect: 'N', fileMngId: null }, |
|
292 |
+ 4: { text: '', isCorrect: 'N', fileMngId: null }, |
|
293 |
+ 5: { text: '', isCorrect: 'N', fileMngId: null }, |
|
294 |
+ }, |
|
295 |
+ correctIndex: null, // 정답으로 선택된 답의 인덱스 |
|
296 |
+ }, |
|
297 |
+ books: [], |
|
298 |
+ units: [], |
|
299 |
+ texts: [], |
|
214 | 300 |
} |
215 | 301 |
}, |
216 | 302 |
methods: { |
... | ... | @@ -235,15 +321,263 @@ |
235 | 321 |
vm.dataList = res.data.problem; |
236 | 322 |
vm.problemDetail = res.data.problemDetail; |
237 | 323 |
|
324 |
+ vm.selectedSearchOption = vm.dataList.prblmCtgryId; |
|
325 |
+ vm.selectedSearchOption2 = vm.dataList.prblmTypeId; |
|
326 |
+ vm.book_id = vm.dataList.bookId; |
|
327 |
+ vm.unit_id = vm.dataList.unitId; |
|
328 |
+ vm.text_id = vm.dataList.textId; |
|
329 |
+ vm.prblm_scr = vm.dataList.prblmScr; |
|
330 |
+ vm.prblm_expln = vm.dataList.prblmExpln; |
|
331 |
+ vm.prblm_hint = vm.dataList.prblmHint; |
|
332 |
+ vm.prblm_cmmt = vm.dataList.prblmCmmt; |
|
333 |
+ vm.prblm_mtr1 = vm.dataList.prblmMtr1; |
|
334 |
+ vm.prblm_mtr2 = vm.dataList.prblmMtr2; |
|
335 |
+ vm.prblm_mtr3 = vm.dataList.prblmMtr3; |
|
336 |
+ vm.prblm_mtr4 = vm.dataList.prblmMtr4; |
|
337 |
+ vm.prblm_mtr5 = vm.dataList.prblmMtr5; |
|
338 |
+ vm.prblm_mtr6 = vm.dataList.prblmMtr6; |
|
339 |
+ |
|
340 |
+ if (vm.problemDetail.length > 0) { |
|
341 |
+ vm.prblmDetail.answers = vm.problemDetail.reduce((acc, detail, index) => { |
|
342 |
+ acc[index + 1] = { |
|
343 |
+ text: detail.prblmDtlExpln, |
|
344 |
+ isCorrect: detail.prblmYn === 'Y' ? 'Y' : 'N', |
|
345 |
+ fileMngId: detail.fileMngId || null |
|
346 |
+ }; |
|
347 |
+ return acc; |
|
348 |
+ }, {}); |
|
349 |
+ |
|
350 |
+ vm.prblmDetail.correctIndex = vm.problemDetail.findIndex(detail => detail.prblmYn === 'Y'); |
|
351 |
+ |
|
352 |
+ if (vm.dataList.prblmTypeId === 'prblm_type_009') { |
|
353 |
+ vm.prblmDetail.answer1 = vm.problemDetail.find(detail => detail.prblmYn === 'Y') ? 'O' : 'X'; |
|
354 |
+ } |
|
355 |
+ } |
|
356 |
+ |
|
238 | 357 |
}) |
239 | 358 |
.catch(function (error) { |
240 | 359 |
console.log("problem - error : ", error); |
241 | 360 |
}); |
242 | 361 |
}, |
243 | 362 |
|
363 |
+ // 문제 수정 |
|
364 |
+ async submitForm() { |
|
365 |
+ // 필요한 모든 필드를 검사합니다. |
|
366 |
+ if (!this.selectedSearchOption) { |
|
367 |
+ alert("카테고리를 지정해 주세요."); |
|
368 |
+ return; |
|
369 |
+ } |
|
370 |
+ |
|
371 |
+ if (!this.selectedSearchOption2) { |
|
372 |
+ alert("문제 유형을 지정해 주세요."); |
|
373 |
+ return; |
|
374 |
+ } |
|
375 |
+ |
|
376 |
+ if (!this.prblm_scr) { |
|
377 |
+ alert("문제 배점을 입력해 주세요."); |
|
378 |
+ return; |
|
379 |
+ } |
|
380 |
+ |
|
381 |
+ if (!this.prblm_expln) { |
|
382 |
+ alert("문제 내용을 입력해 주세요."); |
|
383 |
+ return; |
|
384 |
+ } |
|
385 |
+ |
|
386 |
+ const payload = { |
|
387 |
+ prblmId: this.dataList.prblmId, |
|
388 |
+ prblmCtgryId: this.selectedSearchOption, // 카테고리 |
|
389 |
+ prblmTypeId: this.selectedSearchOption2, // 문제 유형 |
|
390 |
+ prblmScr: this.prblm_scr, // 문제 배점 |
|
391 |
+ prblmExpln: this.prblm_expln, // 내용 |
|
392 |
+ prblmHint: this.prblm_hint, // 힌트 |
|
393 |
+ prblmCmmt: this.prblm_cmmt, // 해설 |
|
394 |
+ textId: this.text_id, // 지문 아이디 |
|
395 |
+ unitId: this.unit_id, // 단원 아이디 |
|
396 |
+ bookId: this.book_id, // 교재 아이디 |
|
397 |
+ // userId: this.user_id, // 유저 아이디 |
|
398 |
+ userId: 'USID_000000000000004', // 유저 아이디 |
|
399 |
+ prblmMtr1: this.prblm_mtr1, // 문제 지표 |
|
400 |
+ prblmMtr2: this.prblm_mtr2, |
|
401 |
+ prblmMtr3: this.prblm_mtr3, |
|
402 |
+ prblmMtr4: this.prblm_mtr4, |
|
403 |
+ prblmMtr5: this.prblm_mtr5, |
|
404 |
+ prblmMtr6: this.prblm_mtr6, |
|
405 |
+ fileMngId: this.file_mng_id // 첨부파일 ID |
|
406 |
+ }; |
|
407 |
+ |
|
408 |
+ try { |
|
409 |
+ const response = await axios.post('/problem/updateProblem.json', payload); |
|
410 |
+ console.log('성공:', response.data); |
|
411 |
+ const problemDetails = await this.prepareProblemDetails(); |
|
412 |
+ await this.submitDetailForm(problemDetails); |
|
413 |
+ |
|
414 |
+ this.goToPage('QuestionList'); |
|
415 |
+ |
|
416 |
+ } catch (error) { |
|
417 |
+ console.error('오류:', error); |
|
418 |
+ // 오류 처리 로직 추가 |
|
419 |
+ } |
|
420 |
+ }, |
|
421 |
+ |
|
422 |
+ // 문제 상세 업로드 |
|
423 |
+ async submitDetailForm(problemDetails) { |
|
424 |
+ |
|
425 |
+ try { |
|
426 |
+ const response = await axios.post('/problem/updateProblemDetail.json', problemDetails); |
|
427 |
+ console.log('성공:', response.data); |
|
428 |
+ } catch (error) { |
|
429 |
+ console.error('오류:', error); |
|
430 |
+ // 오류 처리 로직 추가 |
|
431 |
+ } |
|
432 |
+ }, |
|
433 |
+ |
|
434 |
+ // 상세 정보 세팅하기 |
|
435 |
+ async prepareProblemDetails() { |
|
436 |
+ const details = []; |
|
437 |
+ const answers = this.prblmDetail.answers; |
|
438 |
+ |
|
439 |
+ let answerCount = 0; |
|
440 |
+ |
|
441 |
+ if (this.selectedSearchOption2 === 'prblm_type_008') { |
|
442 |
+ answerCount = 5; |
|
443 |
+ } else if (['prblm_type_004', 'prblm_type_006', 'prblm_type_024'].includes(this.selectedSearchOption2)) { |
|
444 |
+ answerCount = 4; |
|
445 |
+ } else if (['prblm_type_001', 'prblm_type_005', 'prblm_type_019', 'prblm_type_022'].includes(this.selectedSearchOption2)) { |
|
446 |
+ answerCount = 3; |
|
447 |
+ } else if (['prblm_type_002', 'prblm_type_003', 'prblm_type_007', 'prblm_type_023'].includes(this.selectedSearchOption2)) { |
|
448 |
+ answerCount = 2; |
|
449 |
+ } else { |
|
450 |
+ answerCount = 1; |
|
451 |
+ } |
|
452 |
+ |
|
453 |
+ for (let i = 1; i <= answerCount; i++) { |
|
454 |
+ details.push({ |
|
455 |
+ prblmDtlId: this.problemDetail[i - 1].prblmDtlId, |
|
456 |
+ prblmDtlExpln: answers[i].text || '', |
|
457 |
+ prblmYn: answers[i].isCorrect, // isCorrect가 'Y' 또는 'N'으로 설정됨 |
|
458 |
+ fileMngId: answers[i].fileMngId, |
|
459 |
+ }); |
|
460 |
+ } |
|
461 |
+ |
|
462 |
+ return details; |
|
463 |
+ }, |
|
464 |
+ |
|
465 |
+ setCorrectAnswer(index) { |
|
466 |
+ this.prblmDetail.correctIndex = index; |
|
467 |
+ // 선택된 인덱스의 답만 'Y'로 설정하고, 나머지는 'N'으로 설정 |
|
468 |
+ for (let i = 1; i <= 5; i++) { |
|
469 |
+ this.prblmDetail.answers[i].isCorrect = i === index ? 'Y' : 'N'; |
|
470 |
+ } |
|
471 |
+ }, |
|
472 |
+ |
|
473 |
+ resetPrblmDetail() { |
|
474 |
+ this.prblmDetail = { |
|
475 |
+ |
|
476 |
+ answers: { |
|
477 |
+ 1: { text: '', isCorrect: 'N', fileMngId: null }, |
|
478 |
+ 2: { text: '', isCorrect: 'N', fileMngId: null }, |
|
479 |
+ 3: { text: '', isCorrect: 'N', fileMngId: null }, |
|
480 |
+ 4: { text: '', isCorrect: 'N', fileMngId: null }, |
|
481 |
+ 5: { text: '', isCorrect: 'N', fileMngId: null }, |
|
482 |
+ }, |
|
483 |
+ correctIndex: null, |
|
484 |
+ }; |
|
485 |
+ this.selectedFiles = {}; |
|
486 |
+ }, |
|
487 |
+ |
|
488 |
+ // 문제 삭제 |
|
489 |
+ deletePost() { |
|
490 |
+ const result = confirm('데이터를 삭제 하시겠습니까?') |
|
491 |
+ if (result) { |
|
492 |
+ |
|
493 |
+ } else { |
|
494 |
+ alert("삭제를 취소했습니다") |
|
495 |
+ return; |
|
496 |
+ } |
|
497 |
+ |
|
498 |
+ axios.post("/problem/deleteProblem.json", { prblmId: this.dataList.prblmId }, { |
|
499 |
+ headers: { |
|
500 |
+ "Content-Type": "application/json; charset=UTF-8", |
|
501 |
+ } |
|
502 |
+ }) |
|
503 |
+ .then(response => { |
|
504 |
+ alert(response.data.message); |
|
505 |
+ this.goToPage('TextList'); |
|
506 |
+ }) |
|
507 |
+ .catch(error => { |
|
508 |
+ console.error("Error deleting post:", error); |
|
509 |
+ alert("게시글 삭제에 오류가 발생했습니다."); |
|
510 |
+ }); |
|
511 |
+ }, |
|
512 |
+ |
|
513 |
+ |
|
514 |
+ // 교재 정보 가져오기 |
|
515 |
+ fetchBooks() { |
|
516 |
+ axios({ |
|
517 |
+ url: "/book/findAll.json", |
|
518 |
+ method: "post", |
|
519 |
+ headers: { |
|
520 |
+ "Content-Type": "application/json; charset=UTF-8", |
|
521 |
+ }, |
|
522 |
+ }) |
|
523 |
+ .then(response => { |
|
524 |
+ console.log(response.data) |
|
525 |
+ this.books = response.data; |
|
526 |
+ this.text_id = ''; |
|
527 |
+ }) |
|
528 |
+ .catch(error => { |
|
529 |
+ console.error("fetchBooks - error: ", error); |
|
530 |
+ alert("교재 목록을 불러오는 중 오류가 발생했습니다."); |
|
531 |
+ }); |
|
532 |
+ }, |
|
533 |
+ |
|
534 |
+ // 단원 정보 가져오기 |
|
535 |
+ fetchUnits() { |
|
536 |
+ if (!this.book_id) return; |
|
537 |
+ |
|
538 |
+ axios({ |
|
539 |
+ url: "/unit/unitList.json", |
|
540 |
+ method: "post", |
|
541 |
+ headers: { |
|
542 |
+ "Content-Type": "application/json; charset=UTF-8", |
|
543 |
+ }, |
|
544 |
+ data: { |
|
545 |
+ "bookId": this.book_id |
|
546 |
+ }, |
|
547 |
+ }) |
|
548 |
+ .then(response => { |
|
549 |
+ this.units = response.data; |
|
550 |
+ this.text_id = ''; |
|
551 |
+ }) |
|
552 |
+ .catch(error => { |
|
553 |
+ console.error("fetchUnits - error: ", error); |
|
554 |
+ alert("단원 목록을 불러오는 중 오류가 발생했습니다."); |
|
555 |
+ }); |
|
556 |
+ }, |
|
557 |
+ |
|
558 |
+ // 지문 정보 가져오기 |
|
559 |
+ fetchTexts() { |
|
560 |
+ axios({ |
|
561 |
+ url: "/text/textSearch.json", |
|
562 |
+ method: "post", |
|
563 |
+ headers: { |
|
564 |
+ "Content-Type": "application/json; charset=UTF-8", |
|
565 |
+ }, |
|
566 |
+ data: { |
|
567 |
+ "unitId": this.unit_id |
|
568 |
+ }, |
|
569 |
+ }) |
|
570 |
+ .then(response => { |
|
571 |
+ this.texts = response.data.list; |
|
572 |
+ }) |
|
573 |
+ .catch(error => { |
|
574 |
+ console.error("fetchTexts - error: ", error); |
|
575 |
+ alert("지문 목록을 불러오는 중 오류가 발생했습니다."); |
|
576 |
+ }); |
|
577 |
+ }, |
|
578 |
+ |
|
244 | 579 |
}, |
245 | 580 |
watch: { |
246 |
- |
|
247 | 581 |
}, |
248 | 582 |
computed: { |
249 | 583 |
|
... | ... | @@ -252,6 +586,13 @@ |
252 | 586 |
SvgIcon |
253 | 587 |
}, |
254 | 588 |
mounted() { |
589 |
+ let prblm = JSON.parse(sessionStorage.getItem("selectQuestionList")); |
|
590 |
+ this.book_id = prblm.bookId; |
|
591 |
+ this.unit_id = prblm.unitId; |
|
592 |
+ |
|
593 |
+ this.fetchBooks(); |
|
594 |
+ this.fetchUnits(); |
|
595 |
+ |
|
255 | 596 |
this.problemSearch(); |
256 | 597 |
} |
257 | 598 |
} |
--- client/views/pages/teacher/QuestionInsert.vue
+++ client/views/pages/teacher/QuestionInsert.vue
... | ... | @@ -300,10 +300,10 @@ |
300 | 300 |
<button type="button" title="글쓰기" class="new-btn" @click="goToPage('QuestionList')"> |
301 | 301 |
목록 |
302 | 302 |
</button> |
303 |
- <div class="flex"> |
|
303 |
+ <div class="flex"><!-- |
|
304 | 304 |
<button type="button" title="글쓰기" class="new-btn mr10"> |
305 | 305 |
취소 |
306 |
- </button> |
|
306 |
+ </button>--> |
|
307 | 307 |
<button type="button" title="글쓰기" class="new-btn" @click="submitForm"> |
308 | 308 |
등록 |
309 | 309 |
</button> |
... | ... | @@ -428,7 +428,7 @@ |
428 | 428 |
prblmExpln: this.prblm_expln, // 내용 |
429 | 429 |
prblmHint: this.prblm_hint, // 힌트 |
430 | 430 |
prblmCmmt: this.prblm_cmmt, // 해설 |
431 |
- // text_id: this.text_id, // 지문 아이디 |
|
431 |
+ textId: this.text_id, // 지문 아이디 |
|
432 | 432 |
unitId: this.unit_id, // 단원 아이디 |
433 | 433 |
bookId: this.book_id, // 교재 아이디 |
434 | 434 |
// userId: this.user_id, // 유저 아이디 |
... | ... | @@ -465,7 +465,6 @@ |
465 | 465 |
|
466 | 466 |
// 문제 상세 업로드 |
467 | 467 |
async submitDetailForm(problemDetails) { |
468 |
- console.log('Submitting Problem Details:', problemDetails); // 디버깅 |
|
469 | 468 |
|
470 | 469 |
try { |
471 | 470 |
const response = await axios.post('/problem/insertProblemDetail.json', problemDetails); |
--- client/views/pages/teacher/TextDetail.vue
+++ client/views/pages/teacher/TextDetail.vue
... | ... | @@ -161,7 +161,6 @@ |
161 | 161 |
.then(function (res) { |
162 | 162 |
console.log("fileInfo - response : ", res.data.list[0]); |
163 | 163 |
vm.file = res.data.list[0]; |
164 |
- sessionStorage.setItem("file", JSON.stringify(vm.file)); |
|
165 | 164 |
}) |
166 | 165 |
.catch(function (error) { |
167 | 166 |
console.log("result - error : ", error); |
... | ... | @@ -176,7 +175,8 @@ |
176 | 175 |
textUrl: this.post.textUrl, |
177 | 176 |
textTypeId: this.post.textTypeId, |
178 | 177 |
bookId: this.post.bookId, |
179 |
- unitId: this.post.unitId |
|
178 |
+ unitId: this.post.unitId, |
|
179 |
+ fileMngId: this.post.fileMngId, |
|
180 | 180 |
}; |
181 | 181 |
console.log(this.newPost) |
182 | 182 |
|
... | ... | @@ -205,6 +205,14 @@ |
205 | 205 |
} |
206 | 206 |
}, |
207 | 207 |
deletePost() { |
208 |
+ const result = confirm('데이터를 삭제 하시겠습니까?') |
|
209 |
+ if (result) { |
|
210 |
+ |
|
211 |
+ } else { |
|
212 |
+ alert("삭제를 취소했습니다") |
|
213 |
+ return; |
|
214 |
+ } |
|
215 |
+ |
|
208 | 216 |
axios.post("/text/textDelete.json", { textId: this.textId }, { |
209 | 217 |
headers: { |
210 | 218 |
"Content-Type": "application/json; charset=UTF-8", |
... | ... | @@ -216,7 +224,7 @@ |
216 | 224 |
}) |
217 | 225 |
.catch(error => { |
218 | 226 |
console.error("Error deleting post:", error); |
219 |
- alert("게시글 삭제에 오류가 발생했습니다."); |
|
227 |
+ alert("지문 삭제에 오류가 발생했습니다."); |
|
220 | 228 |
}); |
221 | 229 |
}, |
222 | 230 |
fetchBooks() { |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?