Commit d4e9b596d5bca356f4413eba6ee90e66ae14e0de
1 parent
b248db27
手动创建组卷 删除题目,批量设置显示问题
Showing
1 changed file
with
141 additions
and
119 deletions
src/views/examinationPaper/add.vue
@@ -260,132 +260,153 @@ | @@ -260,132 +260,153 @@ | ||
260 | <div class="qs-options">选项设置</div> | 260 | <div class="qs-options">选项设置</div> |
261 | <div class="qs-set">操作</div> | 261 | <div class="qs-set">操作</div> |
262 | </li> | 262 | </li> |
263 | - <li | ||
264 | - class="sub-questions" | 263 | + <template |
265 | v-for="(subQuestions, indexs) in question.subQuestions" | 264 | v-for="(subQuestions, indexs) in question.subQuestions" |
266 | - :key="indexs" | ||
267 | > | 265 | > |
268 | - <div class="qs-num">{{ setNum(index, indexs) }}</div> | ||
269 | - <div class="qs-type"> | ||
270 | - <el-select | ||
271 | - v-model="subQuestions.questionType" | ||
272 | - placeholder="选择题目类型" | ||
273 | - @change="changeSubQuestions($event, subQuestions)" | ||
274 | - > | ||
275 | - <el-option label="单选题" :value="2"></el-option> | ||
276 | - <el-option label="多选题" :value="3"></el-option> | ||
277 | - <el-option label="判断题" :value="4"></el-option> | ||
278 | - <el-option label="主观题" :value="5"></el-option> | ||
279 | - </el-select> | ||
280 | - </div> | ||
281 | - <div class="qs-score"> | ||
282 | - <el-input-number | ||
283 | - class="number-ipt" | ||
284 | - size="medium" | ||
285 | - :min="1" | ||
286 | - :max="200" | ||
287 | - :precision="2" | ||
288 | - :step="1" | ||
289 | - v-model="subQuestions.score" | ||
290 | - label="单题分值" | ||
291 | - ></el-input-number> | ||
292 | - </div> | ||
293 | - <div class="qs-partScore"> | ||
294 | - <p v-if="subQuestions.questionType != 3">--</p> | ||
295 | - <el-input-number | ||
296 | - class="number-ipt" | ||
297 | - v-else | ||
298 | - size="medium" | ||
299 | - :min="0" | ||
300 | - :precision="2" | ||
301 | - :max="subQuestions.score" | ||
302 | - :step="0.5" | ||
303 | - v-model="subQuestions.partScore" | ||
304 | - label="漏选得分" | ||
305 | - ></el-input-number> | ||
306 | - </div> | ||
307 | - <div class="qs-options"> | ||
308 | - <p v-if="subQuestions.questionType == 5">--</p> | ||
309 | - <p v-if="subQuestions.questionType == 4" class="answer-box"> | ||
310 | - <span | ||
311 | - class="answer-s" | ||
312 | - :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | ||
313 | - @click="subQuestions.correctAnswer = 1" | ||
314 | - >✓</span | 266 | + <li |
267 | + v-if="!subQuestions.qusType && !subQuestions.subNum" | ||
268 | + class="sub-questions" | ||
269 | + :key="indexs" | ||
270 | + > | ||
271 | + <div class="qs-num">{{ setNum(index, indexs) }}</div> | ||
272 | + <div class="qs-type"> | ||
273 | + <el-select | ||
274 | + v-model="subQuestions.questionType" | ||
275 | + placeholder="选择题目类型" | ||
276 | + @change="changeSubQuestions($event, subQuestions)" | ||
315 | > | 277 | > |
316 | - <span | ||
317 | - class="answer-s" | ||
318 | - :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | ||
319 | - @click="subQuestions.correctAnswer = 2" | ||
320 | - >✗</span | 278 | + <el-option label="单选题" :value="2"></el-option> |
279 | + <el-option label="多选题" :value="3"></el-option> | ||
280 | + <el-option label="判断题" :value="4"></el-option> | ||
281 | + <el-option label="主观题" :value="5"></el-option> | ||
282 | + </el-select> | ||
283 | + </div> | ||
284 | + <div class="qs-score"> | ||
285 | + <el-input-number | ||
286 | + class="number-ipt" | ||
287 | + size="medium" | ||
288 | + :min="1" | ||
289 | + :max="200" | ||
290 | + :precision="2" | ||
291 | + :step="1" | ||
292 | + v-model="subQuestions.score" | ||
293 | + label="单题分值" | ||
294 | + ></el-input-number> | ||
295 | + </div> | ||
296 | + <div class="qs-partScore"> | ||
297 | + <p v-if="subQuestions.questionType != 3">--</p> | ||
298 | + <el-input-number | ||
299 | + class="number-ipt" | ||
300 | + v-else | ||
301 | + size="medium" | ||
302 | + :min="0" | ||
303 | + :precision="2" | ||
304 | + :max="subQuestions.score" | ||
305 | + :step="0.5" | ||
306 | + v-model="subQuestions.partScore" | ||
307 | + label="漏选得分" | ||
308 | + ></el-input-number> | ||
309 | + </div> | ||
310 | + <div class="qs-options"> | ||
311 | + <p v-if="subQuestions.questionType == 5">--</p> | ||
312 | + <p | ||
313 | + v-if="subQuestions.questionType == 4" | ||
314 | + class="answer-box" | ||
321 | > | 315 | > |
322 | - </p> | ||
323 | - <p v-if="subQuestions.questionType == 3" class="answer-box"> | ||
324 | - <span | ||
325 | - class="answer-s" | ||
326 | - v-for="option in subQuestions.answerOptions.split(',')" | ||
327 | - :class=" | ||
328 | - subQuestions.correctAnswer?.includes(option) | ||
329 | - ? 'active' | ||
330 | - : '' | ||
331 | - " | ||
332 | - :key="option" | ||
333 | - @click="changAnswer(subQuestions, option)" | ||
334 | - >{{ option }}</span | 316 | + <span |
317 | + class="answer-s" | ||
318 | + :class=" | ||
319 | + subQuestions.correctAnswer == 1 ? 'active' : '' | ||
320 | + " | ||
321 | + @click="subQuestions.correctAnswer = 1" | ||
322 | + >✓</span | ||
323 | + > | ||
324 | + <span | ||
325 | + class="answer-s" | ||
326 | + :class=" | ||
327 | + subQuestions.correctAnswer == 2 ? 'active' : '' | ||
328 | + " | ||
329 | + @click="subQuestions.correctAnswer = 2" | ||
330 | + >✗</span | ||
331 | + > | ||
332 | + </p> | ||
333 | + <p | ||
334 | + v-if="subQuestions.questionType == 3" | ||
335 | + class="answer-box" | ||
335 | > | 336 | > |
336 | - </p> | ||
337 | - <p v-if="subQuestions.questionType == 2" class="answer-box"> | ||
338 | - <span | ||
339 | - class="answer-s" | ||
340 | - v-for="option in subQuestions.answerOptions.split(',')" | ||
341 | - :class=" | ||
342 | - subQuestions.correctAnswer == option ? 'active' : '' | 337 | + <span |
338 | + class="answer-s" | ||
339 | + v-for="option in subQuestions.answerOptions.split( | ||
340 | + ',' | ||
341 | + )" | ||
342 | + :class=" | ||
343 | + subQuestions.correctAnswer?.includes(option) | ||
344 | + ? 'active' | ||
345 | + : '' | ||
346 | + " | ||
347 | + :key="option" | ||
348 | + @click="changAnswer(subQuestions, option)" | ||
349 | + >{{ option }}</span | ||
350 | + > | ||
351 | + </p> | ||
352 | + <p | ||
353 | + v-if="subQuestions.questionType == 2" | ||
354 | + class="answer-box" | ||
355 | + > | ||
356 | + <span | ||
357 | + class="answer-s" | ||
358 | + v-for="option in subQuestions.answerOptions.split( | ||
359 | + ',' | ||
360 | + )" | ||
361 | + :class=" | ||
362 | + subQuestions.correctAnswer == option ? 'active' : '' | ||
363 | + " | ||
364 | + :key="option" | ||
365 | + @click="subQuestions.correctAnswer = option" | ||
366 | + >{{ option }}</span | ||
367 | + > | ||
368 | + </p> | ||
369 | + <p | ||
370 | + v-if=" | ||
371 | + subQuestions.questionType == 3 || | ||
372 | + subQuestions.questionType == 2 | ||
343 | " | 373 | " |
344 | - :key="option" | ||
345 | - @click="subQuestions.correctAnswer = option" | ||
346 | - >{{ option }}</span | 374 | + class="answer-box answer-box2" |
347 | > | 375 | > |
348 | - </p> | ||
349 | - <p | ||
350 | - v-if=" | ||
351 | - subQuestions.questionType == 3 || | ||
352 | - subQuestions.questionType == 2 | ||
353 | - " | ||
354 | - class="answer-box answer-box2" | ||
355 | - > | ||
356 | - <el-button | ||
357 | - size="mini" | ||
358 | - type="primary" | ||
359 | - icon="el-icon-plus" | ||
360 | - circle | ||
361 | - @click="addOptions(subQuestions)" | ||
362 | - ></el-button> | ||
363 | - <el-button | ||
364 | - size="mini" | ||
365 | - type="primary" | ||
366 | - icon="el-icon-minus" | ||
367 | - round | ||
368 | - circle | ||
369 | - @click="removeOptions(subQuestions)" | ||
370 | - ></el-button> | ||
371 | - </p> | ||
372 | - </div> | ||
373 | - <div class="qs-set"> | ||
374 | - <el-popconfirm | ||
375 | - title="确定删除这道题吗?" | ||
376 | - @confirm="delTabData(indexs, index)" | ||
377 | - > | ||
378 | - <el-button | ||
379 | - slot="reference" | ||
380 | - class="delete" | ||
381 | - type="danger" | ||
382 | - size="mini" | ||
383 | - circle | ||
384 | - icon="el-icon-delete" | ||
385 | - ></el-button> | ||
386 | - </el-popconfirm> | ||
387 | - </div> | ||
388 | - </li> | 376 | + <el-button |
377 | + size="mini" | ||
378 | + type="primary" | ||
379 | + icon="el-icon-plus" | ||
380 | + circle | ||
381 | + @click="addOptions(subQuestions)" | ||
382 | + ></el-button> | ||
383 | + <el-button | ||
384 | + size="mini" | ||
385 | + type="primary" | ||
386 | + icon="el-icon-minus" | ||
387 | + round | ||
388 | + circle | ||
389 | + @click="removeOptions(subQuestions)" | ||
390 | + ></el-button> | ||
391 | + </p> | ||
392 | + </div> | ||
393 | + <div class="qs-set"> | ||
394 | + <el-popconfirm | ||
395 | + title="确定删除这道题吗?" | ||
396 | + @confirm="delTabData(indexs, index)" | ||
397 | + > | ||
398 | + <el-button | ||
399 | + slot="reference" | ||
400 | + class="delete" | ||
401 | + type="danger" | ||
402 | + size="mini" | ||
403 | + circle | ||
404 | + icon="el-icon-delete" | ||
405 | + ></el-button> | ||
406 | + </el-popconfirm> | ||
407 | + </div> | ||
408 | + </li> | ||
409 | + </template> | ||
389 | <li class="sub-questions"> | 410 | <li class="sub-questions"> |
390 | <div class="qs-num">添加</div> | 411 | <div class="qs-num">添加</div> |
391 | <div class="qs-type"> | 412 | <div class="qs-type"> |
@@ -1700,6 +1721,7 @@ export default { | @@ -1700,6 +1721,7 @@ export default { | ||
1700 | } | 1721 | } |
1701 | } | 1722 | } |
1702 | } | 1723 | } |
1724 | + console.log(this.form.questionList[0].subQuestions); | ||
1703 | }, | 1725 | }, |
1704 | openQuestion() { | 1726 | openQuestion() { |
1705 | this.questionForm = { ...questionForm }; | 1727 | this.questionForm = { ...questionForm }; |