Commit 813d4d64428327ee5d4d555560744c9fcef27758
1 parent
e3b0e3e7
批量设置答案添加输入
Showing
6 changed files
with
171 additions
and
21 deletions
src/components/backBox.vue
@@ -11,10 +11,20 @@ | @@ -11,10 +11,20 @@ | ||
11 | </template> | 11 | </template> |
12 | 12 | ||
13 | <script> | 13 | <script> |
14 | +import BusEvent from "@/utils/busEvent"; | ||
14 | export default { | 15 | export default { |
15 | name: "back", | 16 | name: "back", |
17 | + props:{ | ||
18 | + params:{ | ||
19 | + type:Object, | ||
20 | + default:function(){ | ||
21 | + return {} | ||
22 | + } | ||
23 | + } | ||
24 | + }, | ||
16 | methods: { | 25 | methods: { |
17 | back() { | 26 | back() { |
27 | + BusEvent.$emit("querySel", this.params); | ||
18 | this.$router.go(-1); | 28 | this.$router.go(-1); |
19 | }, | 29 | }, |
20 | }, | 30 | }, |
src/components/setAnswer.vue
@@ -90,8 +90,15 @@ | @@ -90,8 +90,15 @@ | ||
90 | <p>{{ setSubPro(formAns.qusType) }}:</p> | 90 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
91 | <p class="ipt"> | 91 | <p class="ipt"> |
92 | <el-input | 92 | <el-input |
93 | + v-if="formAns.qusType == 2 || formAns.qusType == 3" | ||
93 | v-model="formAns.answerList" | 94 | v-model="formAns.answerList" |
94 | - @keydown.native="keydownAnswer($event)" | 95 | + @keydown.native="keydownAnswer($event, formAns.qusType)" |
96 | + @input="setAllAnswer($event, formAns.qusType)" | ||
97 | + ></el-input> | ||
98 | + <el-input | ||
99 | + v-if="formAns.qusType == 4" | ||
100 | + v-model="formAns.answerList" | ||
101 | + readonly="" | ||
95 | ></el-input> | 102 | ></el-input> |
96 | </p> | 103 | </p> |
97 | <p class="answer-box"> | 104 | <p class="answer-box"> |
@@ -195,7 +202,7 @@ export default { | @@ -195,7 +202,7 @@ export default { | ||
195 | let types = [{}]; | 202 | let types = [{}]; |
196 | let addndex = 0; | 203 | let addndex = 0; |
197 | this.FormQuestionList?.map((sub, index) => { | 204 | this.FormQuestionList?.map((sub, index) => { |
198 | - if (!!sub.questionType && sub.questionType!=5) { | 205 | + if (!!sub.questionType && sub.questionType != 5) { |
199 | if (sub.questionType == types[addndex].qusType) { | 206 | if (sub.questionType == types[addndex].qusType) { |
200 | //同类型批量答案+1 | 207 | //同类型批量答案+1 |
201 | types[addndex].subNum += 1; | 208 | types[addndex].subNum += 1; |
@@ -220,7 +227,7 @@ export default { | @@ -220,7 +227,7 @@ export default { | ||
220 | //不同类型时如果原有类型数量大于等于5,保存批量答案 | 227 | //不同类型时如果原有类型数量大于等于5,保存批量答案 |
221 | types[addndex].endIndex = | 228 | types[addndex].endIndex = |
222 | this.questionList[index - 1].questionIndex; | 229 | this.questionList[index - 1].questionIndex; |
223 | - types[addndex].index = index-1; | 230 | + types[addndex].index = index - 1; |
224 | addndex += 1; | 231 | addndex += 1; |
225 | types[addndex] = {}; | 232 | types[addndex] = {}; |
226 | } | 233 | } |
@@ -300,8 +307,35 @@ export default { | @@ -300,8 +307,35 @@ export default { | ||
300 | } | 307 | } |
301 | return tit; | 308 | return tit; |
302 | }, | 309 | }, |
303 | - keydownAnswer(event) { | ||
304 | - //快速答案设置禁止输入 | 310 | + // keydownAnswer(event) { |
311 | + // //快速答案设置禁止输入 | ||
312 | + // if ( | ||
313 | + // event.key == "Meta" || | ||
314 | + // event.key == "CapsLock" || | ||
315 | + // event.key == "Shift" || | ||
316 | + // event.key == "Enter" || | ||
317 | + // event.key == "Alt" || | ||
318 | + // event.key == "Backspace" || | ||
319 | + // event.key == "Delete" || | ||
320 | + // event.key == "ArrowUp" || | ||
321 | + // event.key == "ArrowDown" || | ||
322 | + // event.key == "ArrowLeft" || | ||
323 | + // event.key == "v" || | ||
324 | + // event.key == "V" || | ||
325 | + // event.key == "ArrowRight" | ||
326 | + // ) { | ||
327 | + // return; | ||
328 | + // } else { | ||
329 | + // event.returnValue = ""; | ||
330 | + // } | ||
331 | + // }, | ||
332 | + keydownAnswer(event, type) { | ||
333 | + let answerA = "ABCDEFG"; | ||
334 | + let answer_a = "abcdefg"; | ||
335 | + answerA = answerA.substring(0, this.formAns.subNum); | ||
336 | + answer_a = answer_a.substring(0, this.formAns.subNum); | ||
337 | + answerA += answer_a; | ||
338 | + answerA = type == 2 ? answerA : answerA + ","; | ||
305 | if ( | 339 | if ( |
306 | event.key == "Meta" || | 340 | event.key == "Meta" || |
307 | event.key == "CapsLock" || | 341 | event.key == "CapsLock" || |
@@ -316,12 +350,22 @@ export default { | @@ -316,12 +350,22 @@ export default { | ||
316 | event.key == "v" || | 350 | event.key == "v" || |
317 | event.key == "V" || | 351 | event.key == "V" || |
318 | event.key == "ArrowRight" | 352 | event.key == "ArrowRight" |
319 | - ) { | 353 | + ) |
320 | return; | 354 | return; |
321 | - } else { | 355 | + if (!answerA.includes(event.key)) { |
322 | event.returnValue = ""; | 356 | event.returnValue = ""; |
323 | } | 357 | } |
324 | }, | 358 | }, |
359 | + setAllAnswer(event, type) { | ||
360 | + let str = this.formAns.answerList; | ||
361 | + let str2 = checkAnswer( | ||
362 | + str, | ||
363 | + type, | ||
364 | + this.formAns.answerOptions.split(",").length, | ||
365 | + this.formAns.subNum | ||
366 | + ); | ||
367 | + this.formAns.answerList = str2; | ||
368 | + }, | ||
325 | setAnswer(type, ans) { | 369 | setAnswer(type, ans) { |
326 | let txt = ""; | 370 | let txt = ""; |
327 | if (type == 2) { | 371 | if (type == 2) { |
@@ -329,7 +373,7 @@ export default { | @@ -329,7 +373,7 @@ export default { | ||
329 | } else if (type == 3) { | 373 | } else if (type == 3) { |
330 | txt = ans + ","; | 374 | txt = ans + ","; |
331 | } else if (type == 4) { | 375 | } else if (type == 4) { |
332 | - txt = ans == 1 ? "✓" : "✗"; | 376 | + txt = ans == 1 ? "✓" : ans == 2 ? "✗" : ""; |
333 | } | 377 | } |
334 | return txt; | 378 | return txt; |
335 | }, | 379 | }, |
src/utils/busEvent.js
0 → 100644
src/views/examinationPaper/add.vue
@@ -519,8 +519,15 @@ | @@ -519,8 +519,15 @@ | ||
519 | <p>{{ setSubPro(formAns.qusType) }}:</p> | 519 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
520 | <p class="ipt"> | 520 | <p class="ipt"> |
521 | <el-input | 521 | <el-input |
522 | + v-if="formAns.qusType ==2 ||formAns.qusType==3" | ||
522 | v-model="formAns.answerList" | 523 | v-model="formAns.answerList" |
523 | - @keydown.native="keydownAnswer($event)" | 524 | + @keydown.native="keydownAnswer($event,formAns.qusType)" |
525 | + @input="setAllAnswer($event, formAns.qusType)" | ||
526 | + ></el-input> | ||
527 | + <el-input | ||
528 | + v-if="formAns.qusType ==4" | ||
529 | + v-model="formAns.answerList" | ||
530 | + readonly="" | ||
524 | ></el-input> | 531 | ></el-input> |
525 | </p> | 532 | </p> |
526 | <p class="answer-box"> | 533 | <p class="answer-box"> |
@@ -856,8 +863,35 @@ export default { | @@ -856,8 +863,35 @@ export default { | ||
856 | } | 863 | } |
857 | this.diaSetAns = false; | 864 | this.diaSetAns = false; |
858 | }, | 865 | }, |
859 | - keydownAnswer(event) { | ||
860 | - //快速答案设置禁止输入 | 866 | + // keydownAnswer(event) { |
867 | + // //快速答案设置禁止输入 | ||
868 | + // if ( | ||
869 | + // event.key == "Meta" || | ||
870 | + // event.key == "CapsLock" || | ||
871 | + // event.key == "Shift" || | ||
872 | + // event.key == "Enter" || | ||
873 | + // event.key == "Alt" || | ||
874 | + // event.key == "Backspace" || | ||
875 | + // event.key == "Delete" || | ||
876 | + // event.key == "ArrowUp" || | ||
877 | + // event.key == "ArrowDown" || | ||
878 | + // event.key == "ArrowLeft" || | ||
879 | + // event.key == "v" || | ||
880 | + // event.key == "V" || | ||
881 | + // event.key == "ArrowRight" | ||
882 | + // ) { | ||
883 | + // return; | ||
884 | + // } else { | ||
885 | + // event.returnValue = ""; | ||
886 | + // } | ||
887 | + // }, | ||
888 | + keydownAnswer(event, type) { | ||
889 | + let answerA = "ABCDEFG"; | ||
890 | + let answer_a = "abcdefg"; | ||
891 | + answerA = answerA.substring(0, this.formAns.subNum); | ||
892 | + answer_a = answer_a.substring(0, this.formAns.subNum); | ||
893 | + answerA += answer_a; | ||
894 | + answerA = type == 2 ? answerA : answerA + ","; | ||
861 | if ( | 895 | if ( |
862 | event.key == "Meta" || | 896 | event.key == "Meta" || |
863 | event.key == "CapsLock" || | 897 | event.key == "CapsLock" || |
@@ -872,12 +906,22 @@ export default { | @@ -872,12 +906,22 @@ export default { | ||
872 | event.key == "v" || | 906 | event.key == "v" || |
873 | event.key == "V" || | 907 | event.key == "V" || |
874 | event.key == "ArrowRight" | 908 | event.key == "ArrowRight" |
875 | - ) { | 909 | + ) |
876 | return; | 910 | return; |
877 | - } else { | 911 | + if (!answerA.includes(event.key)) { |
878 | event.returnValue = ""; | 912 | event.returnValue = ""; |
879 | } | 913 | } |
880 | }, | 914 | }, |
915 | + setAllAnswer(event, type){ | ||
916 | + let str = this.formAns.answerList; | ||
917 | + let str2 = checkAnswer( | ||
918 | + str, | ||
919 | + type, | ||
920 | + this.formAns.answerOptions.split(',').length, | ||
921 | + this.formAns.subNum | ||
922 | + ); | ||
923 | + this.formAns.answerList = str2; | ||
924 | + }, | ||
881 | setAnswer(type, ans) { | 925 | setAnswer(type, ans) { |
882 | let txt = ""; | 926 | let txt = ""; |
883 | if (type == 2) { | 927 | if (type == 2) { |
src/views/login/index.vue
@@ -95,8 +95,8 @@ export default { | @@ -95,8 +95,8 @@ export default { | ||
95 | loginForm: { | 95 | loginForm: { |
96 | // username: "15911715665", | 96 | // username: "15911715665", |
97 | // password: "715665", | 97 | // password: "715665", |
98 | - username: "18314340313", | ||
99 | - password: "Pw340313#", | 98 | + // username: "18314340313", |
99 | + // password: "Pw340313#", | ||
100 | // username: "18687826606", | 100 | // username: "18687826606", |
101 | // password: "Pw826606#", | 101 | // password: "Pw826606#", |
102 | // username: "18893712576", | 102 | // username: "18893712576", |
src/views/test/editAnswer.vue
@@ -220,8 +220,15 @@ | @@ -220,8 +220,15 @@ | ||
220 | <p>{{ setSubPro(formAns.qusType) }}:</p> | 220 | <p>{{ setSubPro(formAns.qusType) }}:</p> |
221 | <p class="ipt"> | 221 | <p class="ipt"> |
222 | <el-input | 222 | <el-input |
223 | + v-if="formAns.qusType == 2 || formAns.qusType == 3" | ||
223 | v-model="formAns.answerList" | 224 | v-model="formAns.answerList" |
224 | - @keydown.native="keydownAnswer($event)" | 225 | + @keydown.native="keydownAnswer($event, formAns.qusType)" |
226 | + @input="setAllAnswer($event, formAns.qusType)" | ||
227 | + ></el-input> | ||
228 | + <el-input | ||
229 | + v-if="formAns.qusType == 4" | ||
230 | + v-model="formAns.answerList" | ||
231 | + readonly="" | ||
225 | ></el-input> | 232 | ></el-input> |
226 | </p> | 233 | </p> |
227 | <p class="answer-box"> | 234 | <p class="answer-box"> |
@@ -377,8 +384,35 @@ export default { | @@ -377,8 +384,35 @@ export default { | ||
377 | 384 | ||
378 | return txt; | 385 | return txt; |
379 | }, | 386 | }, |
380 | - keydownAnswer(event) { | ||
381 | - //快速答案设置禁止输入 | 387 | + // keydownAnswer(event) { |
388 | + // //快速答案设置禁止输入 | ||
389 | + // if ( | ||
390 | + // event.key == "Meta" || | ||
391 | + // event.key == "CapsLock" || | ||
392 | + // event.key == "Shift" || | ||
393 | + // event.key == "Enter" || | ||
394 | + // event.key == "Alt" || | ||
395 | + // event.key == "Backspace" || | ||
396 | + // event.key == "Delete" || | ||
397 | + // event.key == "ArrowUp" || | ||
398 | + // event.key == "ArrowDown" || | ||
399 | + // event.key == "ArrowLeft" || | ||
400 | + // event.key == "v" || | ||
401 | + // event.key == "V" || | ||
402 | + // event.key == "ArrowRight" | ||
403 | + // ) { | ||
404 | + // return; | ||
405 | + // } else { | ||
406 | + // event.returnValue = ""; | ||
407 | + // } | ||
408 | + // }, | ||
409 | + keydownAnswer(event, type) { | ||
410 | + let answerA = "ABCDEFG"; | ||
411 | + let answer_a = "abcdefg"; | ||
412 | + answerA = answerA.substring(0, this.formAns.subNum); | ||
413 | + answer_a = answer_a.substring(0, this.formAns.subNum); | ||
414 | + answerA += answer_a; | ||
415 | + answerA = type == 2 ? answerA : answerA + ","; | ||
382 | if ( | 416 | if ( |
383 | event.key == "Meta" || | 417 | event.key == "Meta" || |
384 | event.key == "CapsLock" || | 418 | event.key == "CapsLock" || |
@@ -393,12 +427,22 @@ export default { | @@ -393,12 +427,22 @@ export default { | ||
393 | event.key == "v" || | 427 | event.key == "v" || |
394 | event.key == "V" || | 428 | event.key == "V" || |
395 | event.key == "ArrowRight" | 429 | event.key == "ArrowRight" |
396 | - ) { | 430 | + ) |
397 | return; | 431 | return; |
398 | - } else { | 432 | + if (!answerA.includes(event.key)) { |
399 | event.returnValue = ""; | 433 | event.returnValue = ""; |
400 | } | 434 | } |
401 | }, | 435 | }, |
436 | + setAllAnswer(event, type){ | ||
437 | + let str = this.formAns.answerList; | ||
438 | + let str2 = checkAnswer( | ||
439 | + str, | ||
440 | + type, | ||
441 | + this.formAns.answerOptions.split(',').length, | ||
442 | + this.formAns.subNum | ||
443 | + ); | ||
444 | + this.formAns.answerList = str2; | ||
445 | + }, | ||
402 | setAnswer(type, ans) { | 446 | setAnswer(type, ans) { |
403 | let txt = ""; | 447 | let txt = ""; |
404 | if (type == 2) { | 448 | if (type == 2) { |
@@ -406,7 +450,7 @@ export default { | @@ -406,7 +450,7 @@ export default { | ||
406 | } else if (type == 3) { | 450 | } else if (type == 3) { |
407 | txt = ans + ","; | 451 | txt = ans + ","; |
408 | } else if (type == 4) { | 452 | } else if (type == 4) { |
409 | - txt = ans == 1 ? "✓" : "✗"; | 453 | + txt = ans == 1 ? "✓" : ans == 2 ? "✗" : ""; |
410 | } | 454 | } |
411 | return txt; | 455 | return txt; |
412 | }, | 456 | }, |