Commit c6f2a55037ffa8f24066e6b5242f59d1a158c1d2

Authored by 梁保满
1 parent 23659274

创建备题组卷,修改备题

src/views/examinationPaper/add.vue
@@ -345,10 +345,8 @@ @@ -345,10 +345,8 @@
345 <template v-if="isUpload"> 345 <template v-if="isUpload">
346 <el-select v-model="subQuestions.questionType" placeholder="选择题目类型" 346 <el-select v-model="subQuestions.questionType" placeholder="选择题目类型"
347 @change="changeSubQuestions($event, subQuestions)"> 347 @change="changeSubQuestions($event, subQuestions)">
348 - <el-option label="单选题" :value="2"></el-option>  
349 - <el-option label="多选题" :value="3"></el-option>  
350 - <el-option label="判断题" :value="4"></el-option>  
351 - <el-option label="主观题" :value="5"></el-option> 348 + <el-option v-for="options in questionOptions" :label="options.label"
  349 + :value="options.value"></el-option>
352 </el-select> 350 </el-select>
353 </template> 351 </template>
354 <template v-else> 352 <template v-else>
@@ -385,7 +383,7 @@ @@ -385,7 +383,7 @@
385 </div> 383 </div>
386 <template v-if="isUpload"> 384 <template v-if="isUpload">
387 <div class="qs-upload"> 385 <div class="qs-upload">
388 - <el-popover placement="right" width="400" trigger="click"> 386 + <el-popover placement="right" width="600" trigger="click">
389 <div class="screenshot-box"> 387 <div class="screenshot-box">
390 <iframe class="screenshot" 388 <iframe class="screenshot"
391 v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')" 389 v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"
@@ -403,7 +401,7 @@ @@ -403,7 +401,7 @@
403 </el-popover> 401 </el-popover>
404 </div> 402 </div>
405 <div class="qs-upload"> 403 <div class="qs-upload">
406 - <el-popover placement="right" width="400" trigger="click"> 404 + <el-popover placement="right" width="600" trigger="click">
407 <div class="screenshot-box"> 405 <div class="screenshot-box">
408 <iframe class="screenshot" 406 <iframe class="screenshot"
409 v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')" 407 v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"
@@ -780,12 +778,18 @@ export default { @@ -780,12 +778,18 @@ export default {
780 }, 778 },
781 // 选择知识点 779 // 选择知识点
782 setKnowledge() { 780 setKnowledge() {
783 - let knowledge = this.stem.knowledge.map(item => {  
784 - return item.join("#")  
785 - }) 781 + // let knowledge = this.stem.knowledge.map(item => {
  782 + // return item.join("#")
  783 + // })
  784 + // this.form.questionList[this.stem.index].subQuestions[
  785 + // this.stem.indexs
  786 + // ].knowledge = knowledge.join(",")
  787 + let knowledge = this.stem.knowledge.join(",");
786 this.form.questionList[this.stem.index].subQuestions[ 788 this.form.questionList[this.stem.index].subQuestions[
787 this.stem.indexs 789 this.stem.indexs
788 - ].knowledge = knowledge.join(",") 790 + ].knowledge = knowledge.map(item => {
  791 + item = item.join("#")
  792 + })
789 this.dialogKnowledge = false; 793 this.dialogKnowledge = false;
790 }, 794 },
791 //end 795 //end
@@ -962,7 +966,6 @@ export default { @@ -962,7 +966,6 @@ export default {
962 return this.formAns.endIndex == item.questionIndex 966 return this.formAns.endIndex == item.questionIndex
963 } 967 }
964 ); 968 );
965 - console.log(EndIndex)  
966 for (let i = 0; i <= subNum; i++) { 969 for (let i = 0; i <= subNum; i++) {
967 let correctAnswer = ""; 970 let correctAnswer = "";
968 if (this.formAns.qusType == 2) { 971 if (this.formAns.qusType == 2) {
@@ -1291,6 +1294,7 @@ export default { @@ -1291,6 +1294,7 @@ export default {
1291 subQuestions.selectNum = 0; 1294 subQuestions.selectNum = 0;
1292 break; 1295 break;
1293 } 1296 }
  1297 + this.formateQuestion()
1294 }, 1298 },
1295 //添加选项 1299 //添加选项
1296 addOptions(subQuestions) { 1300 addOptions(subQuestions) {
src/views/examinationPaper/addAsk.vue
@@ -60,101 +60,107 @@ @@ -60,101 +60,107 @@
60 <div class="qs-upload" v-if="knowledgeData.length">知识点</div> 60 <div class="qs-upload" v-if="knowledgeData.length">知识点</div>
61 <div class="qs-set">操作</div> 61 <div class="qs-set">操作</div>
62 </li> 62 </li>
63 - <li v-for="(subQuestions, index) in form.questionList" :key="index">  
64 - <p class="set-ans-btn" v-if="subQuestions.qusType &&  
65 - subQuestions.subNum &&  
66 - subQuestions.subNum > 4  
67 - ">  
68 - <el-button type="primary" @click="setFormAns(index)">批量设置答案</el-button>  
69 - </p>  
70 - <div v-else class="sub-questions">  
71 - <div class="qs-num">  
72 - {{ index + 1 }}  
73 - </div>  
74 - <div class="qs-type">  
75 - <el-select v-model="subQuestions.questionType" placeholder="选择题目类型"  
76 - @change="changeSubQuestions($event, subQuestions)">  
77 - <el-option label="单选题" :value="2"></el-option>  
78 - <el-option label="多选题" :value="3"></el-option>  
79 - <el-option label="判断题" :value="4"></el-option>  
80 - <el-option label="主观题" :value="5"></el-option>  
81 - </el-select>  
82 - </div>  
83 - <div class="qs-score">  
84 - <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2"  
85 - v-model="subQuestions.score" label="单题分值"></el-input-number>  
86 - </div>  
87 - <div class="qs-partScore">  
88 - <p v-if="subQuestions.questionType != 3">--</p>  
89 - <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2"  
90 - :max="subQuestions.score" :step="0.5" v-model="subQuestions.partScore" label="漏选得分"></el-input-number>  
91 - </div>  
92 - <div class="qs-options qs-options2">  
93 - <p v-if="subQuestions.questionType == 5">--</p>  
94 - <p v-if="subQuestions.questionType == 4" class="answer-box">  
95 - <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''"  
96 - @click="subQuestions.correctAnswer = 1">✓</span>  
97 - <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''"  
98 - @click="subQuestions.correctAnswer = 2">✗</span>  
99 - </p>  
100 - <p v-if="subQuestions.questionType == 3" class="answer-box">  
101 - <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer?.includes(option)  
102 - ? 'active'  
103 - : ''  
104 - " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>  
105 - </p>  
106 - <p v-if="subQuestions.questionType == 2" class="answer-box">  
107 - <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer == option ? 'active' : ''  
108 - " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>  
109 - </p>  
110 - </div>  
111 - <div class="qs-upload">  
112 - <el-popover placement="right" width="400" trigger="click">  
113 - <div class="screenshot-box">  
114 - <iframe class="screenshot"  
115 - v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"  
116 - :src="subQuestions.screenshot"></iframe>  
117 - <img class="screenshot screenshot-img"  
118 - v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')"  
119 - :src="subQuestions.screenshot" alt="">  
120 - <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"  
121 - @click="openStem(subQuestions, index, 1)">重新选择图片</el-button></p>  
122 - </div>  
123 - <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"  
124 - icon="el-icon-tickets"></el-button>  
125 - </el-popover>  
126 - </div>  
127 - <div class="qs-upload">  
128 - <el-popover placement="right" width="400" trigger="click">  
129 - <div class="screenshot-box">  
130 - <iframe class="screenshot"  
131 - v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"  
132 - :src="subQuestions.answerScreenshot"></iframe>  
133 - <img class="screenshot screenshot-img"  
134 - v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')"  
135 - :src="subQuestions.answerScreenshot" alt="">  
136 - <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"  
137 - @click="openStem(subQuestions, index, 2)">{{ subQuestions.answerScreenshot ? "重新选择图片" :  
138 - "上传题目解析" }}</el-button>  
139 - </p>  
140 - </div>  
141 - <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"  
142 - icon="el-icon-tickets"></el-button>  
143 - </el-popover>  
144 - </div>  
145 - <div class="qs-upload" v-if="knowledgeData.length">  
146 - <el-button type="primary" circle size="mini" icon="el-icon-price-tag"  
147 - @click="openKnowledge(subQuestions, index)"></el-button>  
148 - </div>  
149 - <div class="qs-set">  
150 - <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(index)">  
151 - <el-button slot="reference" class="delete" type="danger" size="mini" circle  
152 - icon="el-icon-delete"></el-button>  
153 - </el-popconfirm>  
154 - </div>  
155 - </div>  
156 - </li>  
157 </ul> 63 </ul>
  64 + <template v-for="(question, index) in form.questionList">
  65 + <ul class="questions-ul">
  66 + <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs">
  67 + <p class="set-ans-btn" v-if="subQuestions.qusType &&
  68 + subQuestions.subNum &&
  69 + subQuestions.subNum > 4
  70 + ">
  71 + <el-button type="primary" @click="setFormAns(indexs, index)">批量设置答案</el-button>
  72 + </p>
  73 + <div v-else class="sub-questions">
  74 + <div class="qs-num">
  75 + {{ setNum(index, indexs, subQuestions) }}
  76 + </div>
  77 + <div class="qs-type">
  78 + <el-select v-model="subQuestions.questionType" placeholder="选择题目类型"
  79 + @change="changeSubQuestions($event, subQuestions)">
  80 + <el-option v-for="options in questionOptions" :label="options.label"
  81 + :value="options.value"></el-option>
  82 + </el-select>
  83 + </div>
  84 + <div class="qs-score">
  85 + <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2"
  86 + v-model="subQuestions.score" label="单题分值"></el-input-number>
  87 + </div>
  88 + <div class="qs-partScore">
  89 + <p v-if="subQuestions.questionType != 3">--</p>
  90 + <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2"
  91 + :max="subQuestions.score" :step="0.5" v-model="subQuestions.partScore"
  92 + label="漏选得分"></el-input-number>
  93 + </div>
  94 + <div class="qs-options qs-options2">
  95 + <p v-if="subQuestions.questionType == 5">--</p>
  96 + <p v-if="subQuestions.questionType == 4" class="answer-box">
  97 + <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
  98 + @click="subQuestions.correctAnswer = 1">✓</span>
  99 + <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
  100 + @click="subQuestions.correctAnswer = 2">✗</span>
  101 + </p>
  102 + <p v-if="subQuestions.questionType == 3" class="answer-box">
  103 + <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer?.includes(option)
  104 + ? 'active'
  105 + : ''
  106 + " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
  107 + </p>
  108 + <p v-if="subQuestions.questionType == 2" class="answer-box">
  109 + <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer == option ? 'active' : ''
  110 + " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
  111 + </p>
  112 + </div>
  113 +
  114 + <div class="qs-upload">
  115 + <el-popover placement="right" width="600" trigger="click">
  116 + <div class="screenshot-box">
  117 + <iframe class="screenshot"
  118 + v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"
  119 + :src="subQuestions.screenshot"></iframe>
  120 + <img class="screenshot screenshot-img"
  121 + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')"
  122 + :src="subQuestions.screenshot" alt="">
  123 + <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"
  124 + @click="openStem(subQuestions, index, indexs, 1)">{{ subQuestions.answerScreenshot ? "重新选择图片"
  125 + : "上传题干" }}</el-button>
  126 + </p>
  127 + </div>
  128 + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
  129 + icon="el-icon-tickets"></el-button>
  130 + </el-popover>
  131 + </div>
  132 + <div class="qs-upload">
  133 + <el-popover placement="right" width="600" trigger="click">
  134 + <div class="screenshot-box">
  135 + <iframe class="screenshot"
  136 + v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"
  137 + :src="subQuestions.answerScreenshot"></iframe>
  138 + <img class="screenshot screenshot-img"
  139 + v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')"
  140 + :src="subQuestions.answerScreenshot" alt="">
  141 + <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"
  142 + @click="openStem(subQuestions, index, indexs, 2)">{{ subQuestions.answerScreenshot ? "重新选择图片"
  143 + : "上传题目解析" }}</el-button>
  144 + </p>
  145 + </div>
  146 + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
  147 + icon="el-icon-tickets"></el-button>
  148 + </el-popover>
  149 + </div>
  150 + <div class="qs-upload" v-if="knowledgeData.length">
  151 + <el-button type="primary" circle size="mini" icon="el-icon-price-tag"
  152 + @click="openKnowledge(subQuestions, index, indexs)"></el-button>
  153 + </div>
  154 + <div class="qs-set">
  155 + <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(indexs, index)">
  156 + <el-button slot="reference" class="delete" type="danger" size="mini" circle
  157 + icon="el-icon-delete"></el-button>
  158 + </el-popconfirm>
  159 + </div>
  160 + </div>
  161 + </li>
  162 + </ul>
  163 + </template>
158 </div> 164 </div>
159 <el-dialog :close-on-click-modal="false" title="批量设置答案" :visible.sync="diaSetAns" width="400" 165 <el-dialog :close-on-click-modal="false" title="批量设置答案" :visible.sync="diaSetAns" width="400"
160 :modal-append-to-body="false"> 166 :modal-append-to-body="false">
@@ -252,13 +258,15 @@ @@ -252,13 +258,15 @@
252 <p class="name">{{ form.title }}</p> 258 <p class="name">{{ form.title }}</p>
253 </div> 259 </div>
254 <div class="question-box"> 260 <div class="question-box">
255 - <div class="screenshot-box" v-for="(subQuestions, index) in form.questionList" :key="index">  
256 - <iframe class="screenshot" v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"  
257 - :src="subQuestions.screenshot"></iframe>  
258 - <img class="screenshot screenshot-img"  
259 - v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" :src="subQuestions.screenshot"  
260 - alt="">  
261 - </div> 261 + <template v-for="question in form.questionList">
  262 + <div class="screenshot-box" v-for="subQuestions in question.subQuestions">
  263 + <iframe class="screenshot" v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"
  264 + :src="subQuestions.screenshot"></iframe>
  265 + <img class="screenshot screenshot-img"
  266 + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" :src="subQuestions.screenshot"
  267 + alt="">
  268 + </div>
  269 + </template>
262 </div> 270 </div>
263 <div class="btn-box"> 271 <div class="btn-box">
264 <el-button type="danger" plain round @click="linkBack">取消</el-button> 272 <el-button type="danger" plain round @click="linkBack">取消</el-button>
@@ -307,11 +315,12 @@ export default { @@ -307,11 +315,12 @@ export default {
307 { required: true, message: "请选择科目", trigger: "blur" }, 315 { required: true, message: "请选择科目", trigger: "blur" },
308 ], 316 ],
309 }, 317 },
310 - tagList: [],  
311 diaSetAns: false, //答案开关 318 diaSetAns: false, //答案开关
312 dialogKnowledge: false, //知识点 319 dialogKnowledge: false, //知识点
313 dialogStem: false, //截图开关 320 dialogStem: false, //截图开关
314 formAns: { 321 formAns: {
  322 + listIndex: 0, //大题位置
  323 + endIndex: 0, //相同题目最后一位题目的questionIndex
315 index: 0, //相同题目最后一位题目的位置 324 index: 0, //相同题目最后一位题目的位置
316 qusType: "", //题目类型 325 qusType: "", //题目类型
317 subNum: 0, //数量 326 subNum: 0, //数量
@@ -321,6 +330,7 @@ export default { @@ -321,6 +330,7 @@ export default {
321 stem: { 330 stem: {
322 type: 1, 331 type: 1,
323 index: 0, //大题位置 332 index: 0, //大题位置
  333 + indexs: 0, //小题位置
324 screenshot: "", //题干图片地址 334 screenshot: "", //题干图片地址
325 answerScreenshot: "", //题目解析图片地址 335 answerScreenshot: "", //题目解析图片地址
326 knowledge: [], //知识点 336 knowledge: [], //知识点
@@ -388,10 +398,10 @@ export default { @@ -388,10 +398,10 @@ export default {
388 methods: { 398 methods: {
389 // v1.5 399 // v1.5
390 //上传截图 400 //上传截图
391 - openStem(obj, index, type) { 401 + openStem(obj, index, indexs, type) {
392 this.stem.index = index; 402 this.stem.index = index;
393 - this.stem.screenshot = obj.screenshot || "";  
394 - this.stem.type = type 403 + this.stem.indexs = indexs;
  404 + this.stem.type = type;
395 if (type == 1) { 405 if (type == 1) {
396 this.stem.screenshot = obj.screenshot || ""; 406 this.stem.screenshot = obj.screenshot || "";
397 this.stem.answerScreenshot = ""; 407 this.stem.answerScreenshot = "";
@@ -399,17 +409,19 @@ export default { @@ -399,17 +409,19 @@ export default {
399 this.stem.answerScreenshot = obj.answerScreenshot || ""; 409 this.stem.answerScreenshot = obj.answerScreenshot || "";
400 this.stem.screenshot = ""; 410 this.stem.screenshot = "";
401 } 411 }
  412 +
402 this.dialogStem = true; 413 this.dialogStem = true;
403 }, 414 },
404 - //图片上传成功  
405 - upSuccess(res, file) { 415 +
  416 + // 图片上传成功
  417 + upSuccess(res) {
406 if (res && res.status == 0) { 418 if (res && res.status == 0) {
407 if (this.stem.type == 1) { 419 if (this.stem.type == 1) {
408 this.stem.screenshot = res.data.url; 420 this.stem.screenshot = res.data.url;
409 - this.form.questionList[this.stem.index].screenshot = this.stem.screenshot; 421 + this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot;
410 } else { 422 } else {
411 this.stem.answerScreenshot = res.data.url; 423 this.stem.answerScreenshot = res.data.url;
412 - this.form.questionList[this.stem.index].answerScreenshot = this.stem.answerScreenshot; 424 + this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].answerScreenshot = this.stem.answerScreenshot;
413 } 425 }
414 this.$message.success("上传成功"); 426 this.$message.success("上传成功");
415 } else { 427 } else {
@@ -423,7 +435,10 @@ export default { @@ -423,7 +435,10 @@ export default {
423 // 知识点 435 // 知识点
424 openKnowledge(obj, index) { 436 openKnowledge(obj, index) {
425 this.stem.index = index; 437 this.stem.index = index;
  438 + this.stem.indexs = indexs;
426 let knowledgeArr = (obj.knowledge && obj.knowledge.split(",")) || []; 439 let knowledgeArr = (obj.knowledge && obj.knowledge.split(",")) || [];
  440 + console.log(obj.knowledge)
  441 + console.log(knowledgeArr)
427 this.stem.knowledge = knowledgeArr.map(item => { 442 this.stem.knowledge = knowledgeArr.map(item => {
428 return item.split("#") 443 return item.split("#")
429 }) 444 })
@@ -432,7 +447,9 @@ export default { @@ -432,7 +447,9 @@ export default {
432 // 知识点 447 // 知识点
433 setKnowledge() { 448 setKnowledge() {
434 let knowledge = this.stem.knowledge.join(","); 449 let knowledge = this.stem.knowledge.join(",");
435 - this.form.questionList[this.stem.index].knowledge = knowledge.map(item => { 450 + this.form.questionList[this.stem.index].subQuestions[
  451 + this.stem.indexs
  452 + ].knowledge = knowledge.map(item => {
436 item = item.join("#") 453 item = item.join("#")
437 }) 454 })
438 this.dialogKnowledge = false; 455 this.dialogKnowledge = false;
@@ -462,6 +479,7 @@ export default { @@ -462,6 +479,7 @@ export default {
462 }); 479 });
463 }); 480 });
464 }, 481 },
  482 + //转换题型显示方式
465 setSubPro(type) { 483 setSubPro(type) {
466 let tit; 484 let tit;
467 switch (type) { 485 switch (type) {
@@ -480,70 +498,100 @@ export default { @@ -480,70 +498,100 @@ export default {
480 } 498 }
481 return tit; 499 return tit;
482 }, 500 },
  501 + //计算题号
  502 + setNum(index, indexs, sub) {
  503 + let lengths = 0;//所在大题之前的所有小题数量
  504 + let subIndex = 0;//所在大题的位置
  505 + for (let i = 0; i < index; i++) {
  506 + let subArr = this.form.questionList[i].subQuestions.filter((item) => {
  507 + return !!item.questionType;
  508 + });
  509 + lengths += subArr.length;
  510 + }
  511 + for (let i = 0; i < indexs; i++) {
  512 + if (!!this.form.questionList[index].subQuestions[i].questionType) {
  513 + subIndex += 1;
  514 + }
  515 + }
  516 + return lengths + subIndex + 1;
  517 + },
483 //整理问题 518 //整理问题
484 formateQuestion() { 519 formateQuestion() {
485 - let types = [{}];  
486 - let addndex = 0;  
487 this.formatQuestionList() 520 this.formatQuestionList()
488 - this.form.questionList.map((sub, index) => {  
489 - sub.questionIndex = index  
490 - if (!!sub.questionType) {  
491 - if (  
492 - sub.questionType == types[addndex].qusType &&  
493 - sub.questionType != 5  
494 - ) {  
495 - //同类型批量答案+1  
496 - types[addndex].subNum += 1; 521 + this.form.questionList?.map((item) => {
  522 + let types = [{}];
  523 + let addndex = 0;
  524 + item.subQuestions?.map((sub, index) => {
  525 + if (!!sub.questionType) {
497 if ( 526 if (
498 - types[addndex].answerOptions.length < sub.answerOptions.length 527 + sub.questionType == types[addndex].qusType &&
  528 + sub.questionType != 5
499 ) { 529 ) {
  530 + //同类型批量答案+1
  531 + types[addndex].subNum += 1;
  532 + if (
  533 + types[addndex].answerOptions.length < sub.answerOptions.length
  534 + ) {
  535 + types[addndex].answerOptions = sub.answerOptions;
  536 + }
  537 +
  538 + // types[addndex].answerList += this.setAnswer(
  539 + // sub.questionType,
  540 + // sub.correctAnswer
  541 + // );
  542 + types[addndex].answerList = "";
  543 + if (index == item.subQuestions.length - 1) {
  544 + //循环最后类型数量大于等于5,保存批量答案
  545 + if (types[addndex].subNum && types[addndex].subNum >= 5) {
  546 + types[addndex].endIndex = sub.questionIndex;
  547 + types[addndex].index = index;
  548 + }
  549 + }
  550 + } else {
  551 + if (types[addndex].subNum && types[addndex].subNum >= 5) {
  552 + //不同类型时如果原有类型数量大于等于5,保存批量答案
  553 + types[addndex].endIndex =
  554 + item.subQuestions[index - 1].questionIndex;
  555 + types[addndex].index = index - 1;
  556 + addndex += 1;
  557 + types[addndex] = {};
  558 + }
  559 + //不同类型初始化批量答案
  560 + types[addndex].qusType = sub.questionType;
  561 + types[addndex].subNum = 1;
500 types[addndex].answerOptions = sub.answerOptions; 562 types[addndex].answerOptions = sub.answerOptions;
  563 + types[addndex].answerList = "";
501 } 564 }
502 - types[addndex].answerList = "";  
503 - //循环最后类型数量大于等于5,保存批量答案  
504 - if (types[addndex].subNum >= 5) {  
505 - types[addndex].index = index;  
506 - }  
507 - } else {  
508 - if (types[addndex].subNum >= 5) {  
509 - //不同类型时如果原有类型数量大于等于5,保存批量答案  
510 - types[addndex].index = index - 1;  
511 - addndex += 1;  
512 - types[addndex] = {};  
513 - }  
514 - //不同类型初始化批量答案  
515 - types[addndex].qusType = sub.questionType;  
516 - types[addndex].subNum = 1;  
517 - types[addndex].answerOptions = sub.answerOptions;  
518 - types[addndex].answerList = ""; 565 + }
  566 + });
  567 + for (let i = 0; i < types.length; i++) {
  568 + if (types[i].subNum >= 5) {
  569 + item.subQuestions?.splice(
  570 + types[i].index + i + 1,
  571 + 0,
  572 + deepClone(types[i])
  573 + );
519 } 574 }
520 } 575 }
521 }); 576 });
522 - for (let i = 0; i < types.length; i++) {  
523 - if (types[i].subNum >= 5) {  
524 - this.form.questionList.splice(  
525 - types[i].index + i + 1,  
526 - 0,  
527 - deepClone(types[i])  
528 - );  
529 - }  
530 - }  
531 }, 577 },
532 //初始化要修改的答案 578 //初始化要修改的答案
533 - setFormAns(index) {  
534 - this.formAns = { ...this.form.questionList[index] };  
535 - let startIndex = index - this.formAns.subNum; //批量设置开始位置  
536 - this.formAns.answerList = []; 579 + setFormAns(indexs, index) {
  580 + this.formAns = { ...this.form.questionList[index].subQuestions[indexs] };
  581 + this.formAns.listIndex = index;
537 let answerList = ""; 582 let answerList = "";
538 - this.form.questionList.map((item, subIdx) => {  
539 - if (subIdx >= startIndex && subIdx < index) { 583 + let startIndex = indexs - this.formAns.subNum; //批量设置大难开始位置
  584 + this.form.questionList[index].subQuestions.map((item, subIdx) => {
  585 + if (subIdx >= startIndex && subIdx < indexs) {
540 answerList += this.setAnswer(item.questionType, item.correctAnswer); 586 answerList += this.setAnswer(item.questionType, item.correctAnswer);
  587 +
541 if (item.qusType == 3) { 588 if (item.qusType == 3) {
542 answerList = answerList.slice(0, -1); 589 answerList = answerList.slice(0, -1);
543 } 590 }
544 - this.formAns.answerList = answerList;  
545 } 591 }
546 }); 592 });
  593 + this.formAns.answerList = answerList;
  594 +
547 this.diaSetAns = true; 595 this.diaSetAns = true;
548 }, 596 },
549 insertTxtAndSetcursor(element, answerList, str) { 597 insertTxtAndSetcursor(element, answerList, str) {
@@ -593,15 +641,14 @@ export default { @@ -593,15 +641,14 @@ export default {
593 saveFormAns() { 641 saveFormAns() {
594 let EndIndex; 642 let EndIndex;
595 let subNum = this.formAns.subNum - 1; 643 let subNum = this.formAns.subNum - 1;
596 - this.form.questionList.some( 644 + this.form.questionList[this.formAns.listIndex].subQuestions.some(
597 (item, index) => { 645 (item, index) => {
598 - if (this.formAns.index == item.questionIndex) { 646 + if (this.formAns.endIndex == item.questionIndex) {
599 EndIndex = index; 647 EndIndex = index;
600 } 648 }
601 - return this.formAns.index == item.questionIndex 649 + return this.formAns.endIndex == item.questionIndex
602 } 650 }
603 ); 651 );
604 -  
605 for (let i = 0; i <= subNum; i++) { 652 for (let i = 0; i <= subNum; i++) {
606 let correctAnswer = ""; 653 let correctAnswer = "";
607 if (this.formAns.qusType == 2) { 654 if (this.formAns.qusType == 2) {
@@ -616,7 +663,7 @@ export default { @@ -616,7 +663,7 @@ export default {
616 ? 2 663 ? 2
617 : ""; 664 : "";
618 } 665 }
619 - this.form.questionList[ 666 + this.form.questionList[this.formAns.listIndex].subQuestions[
620 EndIndex - i 667 EndIndex - i
621 ].correctAnswer = correctAnswer; 668 ].correctAnswer = correctAnswer;
622 } 669 }
@@ -666,9 +713,9 @@ export default { @@ -666,9 +713,9 @@ export default {
666 setAnswer(type, ans) { 713 setAnswer(type, ans) {
667 let txt = ""; 714 let txt = "";
668 if (type == 2) { 715 if (type == 2) {
669 - txt = ans; 716 + txt = ans || "";
670 } else if (type == 3) { 717 } else if (type == 3) {
671 - txt = ans + ","; 718 + txt = (ans || "") + ",";
672 } else if (type == 4) { 719 } else if (type == 4) {
673 txt = ans == 1 ? "✓" : ans == 2 ? "✗" : ""; 720 txt = ans == 1 ? "✓" : ans == 2 ? "✗" : "";
674 } 721 }
@@ -701,14 +748,20 @@ export default { @@ -701,14 +748,20 @@ export default {
701 //删除批量操作数据 748 //删除批量操作数据
702 formatQuestionList() { 749 formatQuestionList() {
703 for (let i = 0; i < this.form.questionList.length; i++) { 750 for (let i = 0; i < this.form.questionList.length; i++) {
704 - if (this.form.questionList[i].qusType) {  
705 - this.form.questionList.splice(i, 1); 751 + for (
  752 + let j = 0;
  753 + j < this.form.questionList[i].subQuestions?.length;
  754 + j++
  755 + ) {
  756 + if (this.form.questionList[i].subQuestions[j]?.qusType) {
  757 + this.form.questionList[i].subQuestions?.splice(j, 1);
  758 + }
706 } 759 }
707 } 760 }
708 }, 761 },
709 //删除题 762 //删除题
710 - delTabData(index) {  
711 - this.form.questionList.splice(index, 1); 763 + delTabData(subIndex, index) {
  764 + this.form.questionList[index].subQuestions.splice(subIndex, 1);
712 this.formateQuestion() 765 this.formateQuestion()
713 }, 766 },
714 //切换题型 767 //切换题型
@@ -737,6 +790,7 @@ export default { @@ -737,6 +790,7 @@ export default {
737 subQuestions.selectNum = 0; 790 subQuestions.selectNum = 0;
738 break; 791 break;
739 } 792 }
  793 + this.formateQuestion()
740 }, 794 },
741 //设置多选答案 795 //设置多选答案
742 changAnswer(sub, option) { 796 changAnswer(sub, option) {
@@ -878,14 +932,22 @@ export default { @@ -878,14 +932,22 @@ export default {
878 } 932 }
879 } 933 }
880 this.form.questionList = data.questionList?.map((item) => { 934 this.form.questionList = data.questionList?.map((item) => {
  935 + let subQuestions =
  936 + item.subQuestions?.map((items) => {
  937 + return {
  938 + ...items,
  939 + selectNum: items.answerOptions?.split(",").length,
  940 + answerOptions: items.answerOptions || "A,B,C,D",
  941 + screenshot: items.screenshot || "",
  942 + correctAnswer: items.correctAnswer || "",
  943 + knowledge: items.knowledge || "",
  944 + };
  945 + }) || [];
881 return { 946 return {
882 - ...item,  
883 - selectNum: item.answerOptions?.split(",").length || 4,  
884 - answerOptions: item.answerOptions || "A,B,C,D",  
885 - screenshot: item.screenshot || "",  
886 - correctAnswer: item.correctAnswer || "",  
887 - knowledge: item.knowledge || "",  
888 - } 947 + questionTitle: item.questionTitle,
  948 + subQuestions: subQuestions,
  949 + show: false,
  950 + };
889 }); 951 });
890 } 952 }
891 }, 953 },
@@ -893,14 +955,14 @@ export default { @@ -893,14 +955,14 @@ export default {
893 </script> 955 </script>
894 <style> 956 <style>
895 .screenshot-box { 957 .screenshot-box {
896 - width: 400px; 958 + width: 600px;
897 } 959 }
898 960
899 .screenshot { 961 .screenshot {
900 width: 100%; 962 width: 100%;
901 box-shadow: none; 963 box-shadow: none;
902 border: none; 964 border: none;
903 - height: 300px; 965 + height: 400px;
904 } 966 }
905 967
906 .screenshot-img { 968 .screenshot-img {
@@ -1119,7 +1181,10 @@ export default { @@ -1119,7 +1181,10 @@ export default {
1119 1181
1120 .questions-ul { 1182 .questions-ul {
1121 border-left: 1px solid #e2e2e2; 1183 border-left: 1px solid #e2e2e2;
1122 - border-top: 1px solid #e2e2e2; 1184 +
  1185 + &:first-child {
  1186 + border-top: 1px solid #e2e2e2;
  1187 + }
1123 } 1188 }
1124 1189
1125 .el-input-number { 1190 .el-input-number {
src/views/examinationPaper/edit.vue
@@ -22,15 +22,28 @@ @@ -22,15 +22,28 @@
22 <p class="name" v-else>{{ form.title }}</p> 22 <p class="name" v-else>{{ form.title }}</p>
23 <p class="totals">卷面总分:{{ allScore }}分</p> 23 <p class="totals">卷面总分:{{ allScore }}分</p>
24 </div> 24 </div>
25 - <template v-if="this.form.type == 2">  
26 - <div v-for="(question, index) in questionList" :key="index">  
27 - <p class="question-title">  
28 - <span>{{ setBigNum(index) }}、</span>  
29 - <el-input class="ipt" v-model.trim="question.questionTitle" maxlength="30" placeholder="填写大题名称"></el-input>  
30 - <span>共 {{ setScore(question) }} 分</span>  
31 - </p>  
32 - <ul class="questions-ul">  
33 - <li class="sub-questions"> 25 + <div class="question-box">
  26 + <div class="questions-ul" :class="form.examType == 1 ? 'questions-ul2' : ''" v-if="form.examType == 1">
  27 + <div class="sub-questions">
  28 + <div class="qs-num">题号</div>
  29 + <div class="qs-type">题型</div>
  30 + <div class="qs-score">分数</div>
  31 + <div class="qs-partScore">漏选得分</div>
  32 + <div class="qs-options qs-options2">选项设置</div>
  33 + <div class="qs-set">题干</div>
  34 + <div class="qs-set">题目解析</div>
  35 + <div class="qs-set">知识点</div>
  36 + </div>
  37 + </div>
  38 + <div class="questions-ul" :class="form.examType == 1 ? 'questions-ul2' : ''"
  39 + v-for="(question, index) in questionList" :key="index">
  40 + <template v-if="form.examType == 2">
  41 + <p class="question-title">
  42 + <span>{{ setBigNum(index) }}、</span>
  43 + <el-input class="ipt" v-model.trim="question.questionTitle" maxlength="30" placeholder="填写大题名称"></el-input>
  44 + <span>共 {{ setScore(question) }} 分</span>
  45 + </p>
  46 + <div class="sub-questions">
34 <div class="qs-num">题号</div> 47 <div class="qs-num">题号</div>
35 <div class="qs-type">题型</div> 48 <div class="qs-type">题型</div>
36 <div class="qs-score">分数</div> 49 <div class="qs-score">分数</div>
@@ -39,182 +52,91 @@ @@ -39,182 +52,91 @@
39 <div class="qs-set">题干</div> 52 <div class="qs-set">题干</div>
40 <div class="qs-set">题目解析</div> 53 <div class="qs-set">题目解析</div>
41 <div class="qs-set">知识点</div> 54 <div class="qs-set">知识点</div>
42 - </li>  
43 - <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs">  
44 - <p class="set-ans-btn" v-if="subQuestions.qusType &&  
45 - subQuestions.subNum &&  
46 - subQuestions.subNum > 4  
47 - ">  
48 - <el-button type="primary" @click="setFormAns(indexs, index)">批量设置答案</el-button>  
49 - </p>  
50 - <div v-else class="sub-questions">  
51 - <div class="qs-num">{{ subQuestions.questionIndex }}</div>  
52 - <div class="qs-type">  
53 - {{ setSubPro(subQuestions.questionType) }}  
54 - </div>  
55 - <div class="qs-score">  
56 - <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" :step="1"  
57 - v-model="subQuestions.score" label="单题分值"></el-input-number>  
58 - </div>  
59 - <div class="qs-partScore">  
60 - <p v-if="subQuestions.questionType != 3">--</p>  
61 - <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2"  
62 - :max="subQuestions.score" :step="0.5" v-model="subQuestions.partScore" label="漏选得分"></el-input-number>  
63 - </div>  
64 - <div class="qs-options qs-options2">  
65 - <p v-if="subQuestions.questionType == 5">--</p>  
66 - <p v-if="subQuestions.questionType == 4" class="answer-box">  
67 - <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''"  
68 - @click="subQuestions.correctAnswer = 1">✓</span>  
69 - <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''"  
70 - @click="subQuestions.correctAnswer = 2">✗</span>  
71 - </p>  
72 - <p v-if="subQuestions.questionType == 3" class="answer-box">  
73 - <template v-for="option in subQuestions.answerOptions.split(',')">  
74 - <span v-if="option" class="answer-s" :class="subQuestions.correctAnswer.includes(option)  
75 - ? 'active'  
76 - : ''  
77 - " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>  
78 - </template>  
79 - </p>  
80 - <p v-if="subQuestions.questionType == 2" class="answer-box">  
81 - <template v-for="option in subQuestions.answerOptions.split(',')">  
82 - <span class="answer-s" v-if="option" :class="subQuestions.correctAnswer == option ? 'active' : ''  
83 - " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>  
84 - </template>  
85 - </p>  
86 - </div>  
87 - <div class="qs-set">  
88 - <el-popover placement="right" width="400" trigger="click">  
89 - <div class="screenshot-box">  
90 - <iframe class="screenshot"  
91 - v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"  
92 - :src="subQuestions.screenshot"></iframe>  
93 - <img class="screenshot screenshot-img"  
94 - v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')"  
95 - :src="subQuestions.screenshot" alt="">  
96 - <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"  
97 - @click="openStem(subQuestions, index, indexs, 1)">重新选择图片</el-button></p>  
98 - </div>  
99 - <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"  
100 - icon="el-icon-tickets"></el-button>  
101 - </el-popover>  
102 - </div>  
103 - <div class="qs-set">  
104 - <el-popover placement="right" width="400" trigger="click">  
105 - <div class="screenshot-box">  
106 - <iframe class="screenshot"  
107 - v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"  
108 - :src="subQuestions.answerScreenshot"></iframe>  
109 - <img class="screenshot screenshot-img"  
110 - v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')"  
111 - :src="subQuestions.answerScreenshot" alt="">  
112 - <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"  
113 - @click="openStem(subQuestions, index, indexs, 2)">重新选择图片</el-button></p>  
114 - </div>  
115 - <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"  
116 - icon="el-icon-tickets"></el-button>  
117 - </el-popover>  
118 - </div>  
119 - <div class="qs-set">  
120 - <el-button type="primary" circle size="mini" icon="el-icon-price-tag"  
121 - @click="openKnowledge(subQuestions, index, indexs)"></el-button>  
122 - </div>  
123 - </div>  
124 - </li>  
125 - </ul>  
126 - </div>  
127 - </template>  
128 - <ul class="questions-ul" v-else>  
129 - <li class="sub-questions">  
130 - <div class="qs-num">题号</div>  
131 - <div class="qs-type">题型</div>  
132 - <div class="qs-score">分数</div>  
133 - <div class="qs-partScore">漏选得分</div>  
134 - <div class="qs-options qs-options2">答案</div>  
135 - <div class="qs-set">题干</div>  
136 - </li>  
137 - <li v-for="(subQuestions, indexs) in questionList" :key="indexs">  
138 - <p class="set-ans-btn" v-if="subQuestions.qusType &&  
139 - subQuestions.subNum &&  
140 - subQuestions.subNum > 4  
141 - ">  
142 - <el-button type="primary" @click="setFormAns(indexs)">批量设置答案</el-button>  
143 - </p>  
144 - <div v-else class="sub-questions">  
145 - <div class="qs-num">{{ subQuestions.questionIndex }}</div>  
146 - <div class="qs-type">  
147 - {{ setSubPro(subQuestions.questionType) }}  
148 </div> 55 </div>
149 - <div class="qs-score">  
150 - {{ subQuestions.score }}  
151 - </div>  
152 - <div class="qs-partScore">  
153 - <p v-if="subQuestions.questionType != 3">--</p>  
154 - <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2" :max="subQuestions.score"  
155 - :step="0.5" v-model="subQuestions.partScore" label="漏选得分"></el-input-number>  
156 - </div>  
157 - <div class="qs-options qs-options2">  
158 - <p v-if="subQuestions.questionType == 5">--</p>  
159 - <p v-if="subQuestions.questionType == 4" class="answer-box">  
160 - <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''"  
161 - @click="subQuestions.correctAnswer = 1">✓</span>  
162 - <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''"  
163 - @click="subQuestions.correctAnswer = 2">✗</span>  
164 - </p>  
165 - <p v-if="subQuestions.questionType == 3" class="answer-box">  
166 - <template v-for="option in subQuestions.answerOptions.split(',')">  
167 - <span v-if="option" class="answer-s" :class="subQuestions.correctAnswer.includes(option)  
168 - ? 'active'  
169 - : ''  
170 - " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>  
171 - </template>  
172 - </p>  
173 - <p v-if="subQuestions.questionType == 2" class="answer-box">  
174 - <template v-for="option in subQuestions.answerOptions.split(',')">  
175 - <span class="answer-s" v-if="option" :class="subQuestions.correctAnswer == option ? 'active' : ''  
176 - " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>  
177 - </template>  
178 - </p>  
179 - </div>  
180 - <div class="qs-set">  
181 - <el-popover placement="right" width="400" trigger="click">  
182 - <div class="screenshot-box">  
183 - <iframe class="screenshot" v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"  
184 - :src="subQuestions.screenshot"></iframe>  
185 - <img class="screenshot screenshot-img"  
186 - v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')"  
187 - :src="subQuestions.screenshot" alt="">  
188 - <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"  
189 - @click="openStem(subQuestions, indexs, null, 1)">重新选择图片</el-button></p>  
190 - </div>  
191 - <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"  
192 - icon="el-icon-tickets"></el-button>  
193 - </el-popover>  
194 - </div>  
195 - <div class="qs-set">  
196 - <el-popover placement="right" width="400" trigger="click">  
197 - <div class="screenshot-box">  
198 - <iframe class="screenshot"  
199 - v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"  
200 - :src="subQuestions.answerScreenshot"></iframe>  
201 - <img class="screenshot screenshot-img"  
202 - v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')"  
203 - :src="subQuestions.answerScreenshot" alt="">  
204 - <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"  
205 - @click="openStem(subQuestions, indexs, null, 2)">重新选择图片</el-button></p>  
206 - </div>  
207 - <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"  
208 - icon="el-icon-tickets"></el-button>  
209 - </el-popover>  
210 - </div>  
211 - <div class="qs-set">  
212 - <el-button type="primary" circle size="mini" icon="el-icon-price-tag"  
213 - @click="openKnowledge(subQuestions, index, indexs)"></el-button> 56 + </template>
  57 + <div v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs">
  58 + <p class="set-ans-btn" v-if="subQuestions.qusType &&
  59 + subQuestions.subNum &&
  60 + subQuestions.subNum > 4
  61 + ">
  62 + <el-button type="primary" @click="setFormAns(indexs, index)">批量设置答案</el-button>
  63 + </p>
  64 + <div v-else class="sub-questions">
  65 + <div class="qs-num">{{ subQuestions.questionIndex }}</div>
  66 + <div class="qs-type">
  67 + {{ setSubPro(subQuestions.questionType) }}
  68 + </div>
  69 + <div class="qs-score">
  70 + <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" :step="1"
  71 + v-model="subQuestions.score" label="单题分值"></el-input-number>
  72 + </div>
  73 + <div class="qs-partScore">
  74 + <p v-if="subQuestions.questionType != 3">--</p>
  75 + <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2" :max="subQuestions.score"
  76 + :step="0.5" v-model="subQuestions.partScore" label="漏选得分"></el-input-number>
  77 + </div>
  78 + <div class="qs-options qs-options2">
  79 + <p v-if="subQuestions.questionType == 5">--</p>
  80 + <p v-if="subQuestions.questionType == 4" class="answer-box">
  81 + <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
  82 + @click="subQuestions.correctAnswer = 1">✓</span>
  83 + <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
  84 + @click="subQuestions.correctAnswer = 2">✗</span>
  85 + </p>
  86 + <p v-if="subQuestions.questionType == 3" class="answer-box">
  87 + <template v-for="option in subQuestions.answerOptions.split(',')">
  88 + <span v-if="option" class="answer-s" :class="subQuestions.correctAnswer.includes(option)
  89 + ? 'active'
  90 + : ''
  91 + " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
  92 + </template>
  93 + </p>
  94 + <p v-if="subQuestions.questionType == 2" class="answer-box">
  95 + <template v-for="option in subQuestions.answerOptions.split(',')">
  96 + <span class="answer-s" v-if="option" :class="subQuestions.correctAnswer == option ? 'active' : ''
  97 + " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
  98 + </template>
  99 + </p>
  100 + </div>
  101 + <div class="qs-set">
  102 + <el-popover placement="right" width="600" trigger="click">
  103 + <div class="screenshot-box">
  104 + <iframe class="screenshot" v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"
  105 + :src="subQuestions.screenshot"></iframe>
  106 + <img class="screenshot screenshot-img"
  107 + v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')"
  108 + :src="subQuestions.screenshot" alt="">
  109 + <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"
  110 + @click="openStem(subQuestions, index, indexs, 1)">重新选择图片</el-button></p>
  111 + </div>
  112 + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
  113 + icon="el-icon-tickets"></el-button>
  114 + </el-popover>
  115 + </div>
  116 + <div class="qs-set">
  117 + <el-popover placement="right" width="600" trigger="click">
  118 + <div class="screenshot-box">
  119 + <iframe class="screenshot"
  120 + v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"
  121 + :src="subQuestions.answerScreenshot"></iframe>
  122 + <img class="screenshot screenshot-img"
  123 + v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')"
  124 + :src="subQuestions.answerScreenshot" alt="">
  125 + <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"
  126 + @click="openStem(subQuestions, index, indexs, 2)">重新选择图片</el-button></p>
  127 + </div>
  128 + <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
  129 + icon="el-icon-tickets"></el-button>
  130 + </el-popover>
  131 + </div>
  132 + <div class="qs-set">
  133 + <el-button type="primary" circle size="mini" icon="el-icon-price-tag"
  134 + @click="openKnowledge(subQuestions, index, indexs)"></el-button>
  135 + </div>
214 </div> 136 </div>
215 </div> 137 </div>
216 - </li>  
217 - </ul> 138 + </div>
  139 + </div>
218 <div class="btn-box"> 140 <div class="btn-box">
219 <el-button type="danger" plain round @click="linkBack">取消</el-button> 141 <el-button type="danger" plain round @click="linkBack">取消</el-button>
220 <el-button type="primary" round @click="save">保存</el-button> 142 <el-button type="primary" round @click="save">保存</el-button>
@@ -318,9 +240,10 @@ export default { @@ -318,9 +240,10 @@ export default {
318 title: "", 240 title: "",
319 type: 1, 241 type: 1,
320 questionList: [], 242 questionList: [],
  243 + paperType: 1,//1 备题(随堂问) /2 组卷
  244 + //答题卡详情
321 form: { 245 form: {
322 - //答题卡详情  
323 - type: 2, 246 + examType: 2, //考试类型:0-未知/1-随堂问/2-即时测/3-xx考
324 title: "", 247 title: "",
325 tag: "", 248 tag: "",
326 subjectId: "", 249 subjectId: "",
@@ -393,6 +316,7 @@ export default { @@ -393,6 +316,7 @@ export default {
393 this.$store.getters.info.showRole || 316 this.$store.getters.info.showRole ||
394 this.$store.getters.info.permissions[0].role; 317 this.$store.getters.info.permissions[0].role;
395 this.type = this.$route.query.type || 1; 318 this.type = this.$route.query.type || 1;
  319 + this.paperType = this.$route.query.paperType || 1;
396 this.form.title = this.$route.query.title || ""; 320 this.form.title = this.$route.query.title || "";
397 this._QueryDetail(); 321 this._QueryDetail();
398 }, 322 },
@@ -418,13 +342,13 @@ export default { @@ -418,13 +342,13 @@ export default {
418 this.stem.screenshot = res.data.url; 342 this.stem.screenshot = res.data.url;
419 // this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot; 343 // this.form.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot;
420 if (this.stem.type == 1) { 344 if (this.stem.type == 1) {
421 - if (this.form.type == 2) { 345 + if (this.form.examType == 2) {
422 this.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot; 346 this.questionList[this.stem.index].subQuestions[this.stem.indexs].screenshot = this.stem.screenshot;
423 } else { 347 } else {
424 this.questionList[this.stem.index].screenshot = this.stem.screenshot; 348 this.questionList[this.stem.index].screenshot = this.stem.screenshot;
425 } 349 }
426 } else { 350 } else {
427 - if (this.form.type == 2) { 351 + if (this.form.examType == 2) {
428 this.questionList[this.stem.index].subQuestions[this.stem.indexs].answerScreenshot = this.stem.answerScreenshot; 352 this.questionList[this.stem.index].subQuestions[this.stem.indexs].answerScreenshot = this.stem.answerScreenshot;
429 } else { 353 } else {
430 this.questionList[this.stem.index].answerScreenshot = this.stem.answerScreenshot; 354 this.questionList[this.stem.index].answerScreenshot = this.stem.answerScreenshot;
@@ -449,7 +373,7 @@ export default { @@ -449,7 +373,7 @@ export default {
449 }, 373 },
450 // 选择知识点 374 // 选择知识点
451 setKnowledge() { 375 setKnowledge() {
452 - if (this.form.type == 2) { 376 + if (this.form.examType == 2) {
453 this.questionList[this.stem.index].subQuestions[ 377 this.questionList[this.stem.index].subQuestions[
454 this.stem.indexs 378 this.stem.indexs
455 ].knowledge = this.stem.knowledge.join(","); 379 ].knowledge = this.stem.knowledge.join(",");
@@ -609,7 +533,7 @@ export default { @@ -609,7 +533,7 @@ export default {
609 //初始化要修改的答案 533 //初始化要修改的答案
610 setFormAns(indexs, index) { 534 setFormAns(indexs, index) {
611 let answerList = ""; 535 let answerList = "";
612 - if (this.form.type == 2) { 536 + if (this.form.examType == 2) {
613 this.formAns = { ...this.questionList[index].subQuestions[indexs] }; 537 this.formAns = { ...this.questionList[index].subQuestions[indexs] };
614 this.formAns.listIndex = index; 538 this.formAns.listIndex = index;
615 let startIndex = indexs - this.formAns.subNum; //批量设置大难开始位置 539 let startIndex = indexs - this.formAns.subNum; //批量设置大难开始位置
@@ -642,7 +566,7 @@ export default { @@ -642,7 +566,7 @@ export default {
642 //批量修改答案 566 //批量修改答案
643 let EndIndex; 567 let EndIndex;
644 let subNum = this.formAns.subNum - 1; 568 let subNum = this.formAns.subNum - 1;
645 - if (this.form.type == 2) { 569 + if (this.form.examType == 2) {
646 this.questionList[this.formAns.listIndex].subQuestions.some( 570 this.questionList[this.formAns.listIndex].subQuestions.some(
647 (item, index) => { 571 (item, index) => {
648 if (this.formAns.endIndex == item.questionIndex) { 572 if (this.formAns.endIndex == item.questionIndex) {
@@ -674,7 +598,7 @@ export default { @@ -674,7 +598,7 @@ export default {
674 ? 2 598 ? 2
675 : ""; 599 : "";
676 } 600 }
677 - if (this.form.type == 2) { 601 + if (this.form.examType == 2) {
678 this.questionList[this.formAns.listIndex].subQuestions[ 602 this.questionList[this.formAns.listIndex].subQuestions[
679 EndIndex - i 603 EndIndex - i
680 ].correctAnswer = correctAnswer; 604 ].correctAnswer = correctAnswer;
@@ -686,7 +610,7 @@ export default { @@ -686,7 +610,7 @@ export default {
686 }, 610 },
687 async save() { 611 async save() {
688 for (let i = 0; i < this.questionList.length; i++) { 612 for (let i = 0; i < this.questionList.length; i++) {
689 - if (this.form.type == 2) { 613 + if (this.form.examType == 2) {
690 for (let j = 0; j < this.questionList[i].subQuestions.length; j++) { 614 for (let j = 0; j < this.questionList[i].subQuestions.length; j++) {
691 if (this.questionList[i].subQuestions[j].qusType) { 615 if (this.questionList[i].subQuestions[j].qusType) {
692 this.questionList[i].subQuestions.splice(j, 1); 616 this.questionList[i].subQuestions.splice(j, 1);
@@ -786,14 +710,13 @@ export default { @@ -786,14 +710,13 @@ export default {
786 return a.questionIndex - b.questionIndex; 710 return a.questionIndex - b.questionIndex;
787 }); 711 });
788 } 712 }
789 - this.form.type = 2  
790 this.formateQuestion() 713 this.formateQuestion()
791 } else { 714 } else {
792 this.$message.error(info); 715 this.$message.error(info);
793 } 716 }
794 }, 717 },
795 formateQuestion() { 718 formateQuestion() {
796 - if (this.form.type == 2) { 719 + if (this.form.examType == 2) {
797 this.questionList?.map((item) => { 720 this.questionList?.map((item) => {
798 let types = [{}]; 721 let types = [{}];
799 let addndex = 0; 722 let addndex = 0;
@@ -1039,6 +962,15 @@ export default { @@ -1039,6 +962,15 @@ export default {
1039 margin: 12px 0; 962 margin: 12px 0;
1040 } 963 }
1041 964
  965 +.questions-ul2 {
  966 + margin: 0;
  967 + border-top: none;
  968 +
  969 + &:nth-child(1) {
  970 + border-top: 1px solid #e2e2e2;
  971 + }
  972 +}
  973 +
1042 .sub-questions { 974 .sub-questions {
1043 width: 100%; 975 width: 100%;
1044 display: flex; 976 display: flex;
src/views/examinationPaper/index.vue
@@ -243,6 +243,7 @@ export default { @@ -243,6 +243,7 @@ export default {
243 path: "/examinationPaperEdit", 243 path: "/examinationPaperEdit",
244 query: { 244 query: {
245 paperId: item.id, 245 paperId: item.id,
  246 + paperType: this.query.type
246 }, 247 },
247 }); 248 });
248 }, 249 },