Commit 82235092cdc57396bf242d9b2122588083a3268e

Authored by 梁保满
1 parent 9f01990b

导入或者修改答案没有答案报错,修改答案题目类型调整

src/views/basic/ask/index.vue
@@ -8,41 +8,93 @@ @@ -8,41 +8,93 @@
8 <div class="select-box"> 8 <div class="select-box">
9 <div class="sel-item"> 9 <div class="sel-item">
10 <span class="sel-label">班级:</span> 10 <span class="sel-label">班级:</span>
11 - <el-select class="sel" v-model="query.classId" placeholder="选择班级" @change="changeclass">  
12 - <el-option v-for="item in classList" :key="item.value" :label="item.label" :value="item.value"> 11 + <el-select
  12 + class="sel"
  13 + v-model="query.classId"
  14 + placeholder="选择班级"
  15 + @change="changeclass"
  16 + >
  17 + <el-option
  18 + v-for="item in classList"
  19 + :key="item.value"
  20 + :label="item.label"
  21 + :value="item.value"
  22 + >
13 </el-option> 23 </el-option>
14 </el-select> 24 </el-select>
15 </div> 25 </div>
16 - <div class="sel-item sel-item2"> 26 + <div class="sel-item sel-item2" v-if="role == 'ROLE_BANZHUREN'">
17 <span class="sel-label">科目:</span> 27 <span class="sel-label">科目:</span>
18 <div class="sel-d"> 28 <div class="sel-d">
19 <p class="p-all"> 29 <p class="p-all">
20 - <el-checkbox :indeterminate="isIndeterminate" v-model="allSubject"  
21 - @change="handleCheckAllChange">全选</el-checkbox> 30 + <el-checkbox
  31 + :indeterminate="isIndeterminate"
  32 + v-model="allSubject"
  33 + @change="handleCheckAllChange"
  34 + >全选</el-checkbox
  35 + >
22 </p> 36 </p>
23 <p class="sel-p"> 37 <p class="sel-p">
24 - <el-checkbox-group v-model="query.subjectNames" @change="handleChecked">  
25 - <el-checkbox v-for="item in subjectList" :label="item" :key="item">{{ item  
26 - }}</el-checkbox> 38 + <el-checkbox-group
  39 + v-model="query.subjectNames"
  40 + @change="handleChecked"
  41 + >
  42 + <el-checkbox
  43 + v-for="item in subjectList"
  44 + :label="item"
  45 + :key="item"
  46 + >{{ item }}</el-checkbox
  47 + >
27 </el-checkbox-group> 48 </el-checkbox-group>
28 </p> 49 </p>
29 </div> 50 </div>
30 </div> 51 </div>
  52 + <div class="sel-item sel-item2" v-else>
  53 + <span class="sel-label">科目:</span>
  54 + <div class="sel-d">
  55 + <p class="sel-p">
  56 + <el-radio-group v-model="query.subjectNames">
  57 + <el-radio
  58 + v-for="item in subjectList"
  59 + :label="item"
  60 + :key="item"
  61 + >{{ item }}</el-radio
  62 + >
  63 + </el-radio-group>
  64 + </p>
  65 + </div>
  66 + </div>
31 <div class="sel-item"> 67 <div class="sel-item">
32 <span class="sel-label">日期:</span> 68 <span class="sel-label">日期:</span>
33 <div class="d1"> 69 <div class="d1">
34 - <el-date-picker v-model="query.startDay" type="date" @change="handleChangeTimeStart" placeholder="选择日期时间"  
35 - value-format="yyyy-MM-dd"> 70 + <el-date-picker
  71 + v-model="query.startDay"
  72 + type="date"
  73 + @change="handleChangeTimeStart"
  74 + placeholder="选择日期时间"
  75 + value-format="yyyy-MM-dd"
  76 + >
36 </el-date-picker> 77 </el-date-picker>
37 ~ 78 ~
38 - <el-date-picker v-model="query.endDay" type="date" placeholder="选择日期时间" @change="handleChangeTimeEnd"  
39 - value-format="yyyy-MM-dd"> 79 + <el-date-picker
  80 + v-model="query.endDay"
  81 + type="date"
  82 + placeholder="选择日期时间"
  83 + @change="handleChangeTimeEnd"
  84 + value-format="yyyy-MM-dd"
  85 + >
40 </el-date-picker> 86 </el-date-picker>
41 </div> 87 </div>
42 <p class="p1"> 88 <p class="p1">
43 - <span @click="setDate(1)" :class="[date == 1 ? 'active' : '', 's1']">本周</span>  
44 - <span @click="setDate(2)" :class="[date == 2 ? 'active' : '', 's1']">本月</span>  
45 - <span @click="setDate(3)" :class="[date == 3 ? 'active' : '', 's1']">本季度</span> 89 + <span @click="setDate(1)" :class="[date == 1 ? 'active' : '', 's1']"
  90 + >本周</span
  91 + >
  92 + <span @click="setDate(2)" :class="[date == 2 ? 'active' : '', 's1']"
  93 + >本月</span
  94 + >
  95 + <span @click="setDate(3)" :class="[date == 3 ? 'active' : '', 's1']"
  96 + >本季度</span
  97 + >
46 </p> 98 </p>
47 </div> 99 </div>
48 </div> 100 </div>
@@ -72,8 +124,8 @@ export default { @@ -72,8 +124,8 @@ export default {
72 classList: [], //班级 124 classList: [], //班级
73 subjectList: [], //科目 125 subjectList: [], //科目
74 126
75 - isIndeterminate: true,//全选样式  
76 - allSubject: false,//全选状态 127 + isIndeterminate: true, //全选样式
  128 + allSubject: false, //全选状态
77 }; 129 };
78 }, 130 },
79 async created() { 131 async created() {
@@ -101,10 +153,11 @@ export default { @@ -101,10 +153,11 @@ export default {
101 this.query.subjectNames = val ? this.subjectList : []; 153 this.query.subjectNames = val ? this.subjectList : [];
102 }, 154 },
103 handleChecked(value) { 155 handleChecked(value) {
104 - console.log(value) 156 + console.log(value);
105 let checkedCount = value.length; 157 let checkedCount = value.length;
106 this.allSubject = checkedCount === this.subjectList.length; 158 this.allSubject = checkedCount === this.subjectList.length;
107 - this.isIndeterminate = checkedCount > 0 && checkedCount < this.subjectList.length; 159 + this.isIndeterminate =
  160 + checkedCount > 0 && checkedCount < this.subjectList.length;
108 }, 161 },
109 setDate(index) { 162 setDate(index) {
110 const that = this; 163 const that = this;
@@ -168,18 +221,18 @@ export default { @@ -168,18 +221,18 @@ export default {
168 }, 221 },
169 222
170 async changeclass() { 223 async changeclass() {
171 - this.allSubject = false  
172 - this.query.subjectNames = [] 224 + this.allSubject = false;
  225 + this.query.subjectNames = [];
173 await this._QuerySubjectList(); 226 await this._QuerySubjectList();
174 }, 227 },
175 228
176 async _QueryClassList() { 229 async _QueryClassList() {
177 const fetchClassList = 230 const fetchClassList =
178 this.role == "ROLE_BANZHUREN" 231 this.role == "ROLE_BANZHUREN"
179 - ? this.$request.cTClassList :  
180 - this.role == "ROLE_PERSONAL"  
181 - ? this.$request.pClassList  
182 - : this.$request.tClassList; 232 + ? this.$request.cTClassList
  233 + : this.role == "ROLE_PERSONAL"
  234 + ? this.$request.pClassList
  235 + : this.$request.tClassList;
183 const { data, status, info } = await fetchClassList(); 236 const { data, status, info } = await fetchClassList();
184 if (status === 0) { 237 if (status === 0) {
185 this.classList = data.list.map((item) => { 238 this.classList = data.list.map((item) => {
@@ -196,10 +249,10 @@ export default { @@ -196,10 +249,10 @@ export default {
196 async _QuerySubjectList() { 249 async _QuerySubjectList() {
197 const fetchSubjectList = 250 const fetchSubjectList =
198 this.role == "ROLE_BANZHUREN" 251 this.role == "ROLE_BANZHUREN"
199 - ? this.$request.cTSubjectList :  
200 - this.role == "ROLE_PERSONAL"  
201 - ? this.$request.pSubjectList  
202 - : this.$request.tSubjectList; 252 + ? this.$request.cTSubjectList
  253 + : this.role == "ROLE_PERSONAL"
  254 + ? this.$request.pSubjectList
  255 + : this.$request.tSubjectList;
203 256
204 const { data, status, info } = await fetchSubjectList({ 257 const { data, status, info } = await fetchSubjectList({
205 classId: this.query.classId, 258 classId: this.query.classId,
@@ -207,9 +260,11 @@ export default { @@ -207,9 +260,11 @@ export default {
207 if (status === 0) { 260 if (status === 0) {
208 this.subjectList = data.subjectNames || []; 261 this.subjectList = data.subjectNames || [];
209 if (this.role == "ROLE_BANZHUREN") { 262 if (this.role == "ROLE_BANZHUREN") {
210 - this.query.subjectNames = this.subjectList 263 + this.query.subjectNames = this.subjectList;
211 } else { 264 } else {
212 - this.subjectList.length ? this.query.subjectNames.push(this.subjectList[0]) : ""; 265 + this.subjectList.length
  266 + ? (this.query.subjectNames = this.subjectList[0])
  267 + : "";
213 } 268 }
214 } else { 269 } else {
215 this.$message.error(info); 270 this.$message.error(info);
@@ -219,29 +274,29 @@ export default { @@ -219,29 +274,29 @@ export default {
219 //回主页 274 //回主页
220 goHome() { 275 goHome() {
221 this.$router.push({ 276 this.$router.push({
222 - path: '/index'  
223 - }) 277 + path: "/index",
  278 + });
224 }, 279 },
225 //去列表 280 //去列表
226 goList() { 281 goList() {
227 let className; 282 let className;
228 - this.classList.map(item => { 283 + this.classList.map((item) => {
229 if (item.value == this.query.classId) { 284 if (item.value == this.query.classId) {
230 - className = item.label 285 + className = item.label;
231 } 286 }
232 - })  
233 - if(this.query.subjectNames.length == 0){  
234 - this.$message.warning("请选择科目!")  
235 - return 287 + });
  288 + if (this.query.subjectNames.length == 0) {
  289 + this.$message.warning("请选择科目!");
  290 + return;
236 } 291 }
237 this.$router.push({ 292 this.$router.push({
238 - path: '/askList', 293 + path: "/askList",
239 query: { 294 query: {
240 className: className, 295 className: className,
241 - params: JSON.stringify(this.query)  
242 - }  
243 - })  
244 - } 296 + params: JSON.stringify(this.query),
  297 + },
  298 + });
  299 + },
245 }, 300 },
246 }; 301 };
247 </script> 302 </script>
@@ -259,7 +314,7 @@ div::-webkit-scrollbar-thumb { @@ -259,7 +314,7 @@ div::-webkit-scrollbar-thumb {
259 <style lang="scss" scoped> 314 <style lang="scss" scoped>
260 .main { 315 .main {
261 height: 100%; 316 height: 100%;
262 - background: rgba($color: #000000, $alpha: .3); 317 + background: rgba($color: #000000, $alpha: 0.3);
263 display: flex; 318 display: flex;
264 justify-content: center; 319 justify-content: center;
265 } 320 }
src/views/basic/test/index.vue
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 <span class="sel-label">科目:</span> 59 <span class="sel-label">科目:</span>
60 <div class="sel-d"> 60 <div class="sel-d">
61 <p class="sel-p"> 61 <p class="sel-p">
62 - <el-radio-group v-model="query.subjectNames" @change="CheckedSub"> 62 + <el-radio-group v-model="query.subjectNames">
63 <el-radio 63 <el-radio
64 v-for="item in subjectList" 64 v-for="item in subjectList"
65 :label="item" 65 :label="item"
src/views/examinationPaper/addQs.vue
@@ -177,7 +177,7 @@ @@ -177,7 +177,7 @@
177 <p v-if="question.questionType == 3" class="answer-box"> 177 <p v-if="question.questionType == 3" class="answer-box">
178 <span 178 <span
179 class="answer-s" 179 class="answer-s"
180 - v-for="option in question.answerOptions.split(',')" 180 + v-for="option in question.answerOptions?.split(',')"
181 :class=" 181 :class="
182 question.correctAnswer?.includes(option) 182 question.correctAnswer?.includes(option)
183 ? 'active' 183 ? 'active'
@@ -191,7 +191,7 @@ @@ -191,7 +191,7 @@
191 <p v-if="question.questionType == 2" class="answer-box"> 191 <p v-if="question.questionType == 2" class="answer-box">
192 <span 192 <span
193 class="answer-s" 193 class="answer-s"
194 - v-for="option in question.answerOptions.split(',')" 194 + v-for="option in question.answerOptions?.split(',')"
195 :class=" 195 :class="
196 question.correctAnswer == option ? 'active' : '' 196 question.correctAnswer == option ? 'active' : ''
197 " 197 "
@@ -361,7 +361,7 @@ @@ -361,7 +361,7 @@
361 > 361 >
362 <span 362 <span
363 class="answer-s" 363 class="answer-s"
364 - v-for="option in subQuestions.answerOptions.split( 364 + v-for="option in subQuestions.answerOptions?.split(
365 ',' 365 ','
366 )" 366 )"
367 :class=" 367 :class="
@@ -380,7 +380,7 @@ @@ -380,7 +380,7 @@
380 > 380 >
381 <span 381 <span
382 class="answer-s" 382 class="answer-s"
383 - v-for="option in subQuestions.answerOptions.split( 383 + v-for="option in subQuestions.answerOptions?.split(
384 ',' 384 ','
385 )" 385 )"
386 :class=" 386 :class="
@@ -1115,7 +1115,7 @@ export default { @@ -1115,7 +1115,7 @@ export default {
1115 }, 1115 },
1116 //添加选项 1116 //添加选项
1117 addOptions(subQuestions) { 1117 addOptions(subQuestions) {
1118 - let length = subQuestions.answerOptions.split(",").length; 1118 + let length = subQuestions.answerOptions?.split(",").length || 0;
1119 if (length > 9) return; 1119 if (length > 9) return;
1120 subQuestions.selectNum = length + 1; 1120 subQuestions.selectNum = length + 1;
1121 subQuestions.answerOptions = this.rightOptions 1121 subQuestions.answerOptions = this.rightOptions
@@ -1124,7 +1124,7 @@ export default { @@ -1124,7 +1124,7 @@ export default {
1124 }, 1124 },
1125 //删除选项 1125 //删除选项
1126 removeOptions(subQuestions) { 1126 removeOptions(subQuestions) {
1127 - let length = subQuestions.answerOptions.split(",").length; 1127 + let length = subQuestions.answerOptions?.split(",").length || 0;
1128 if (length < 3) return; 1128 if (length < 3) return;
1129 subQuestions.selectNum = length - 1; 1129 subQuestions.selectNum = length - 1;
1130 subQuestions.answerOptions = this.rightOptions 1130 subQuestions.answerOptions = this.rightOptions
@@ -1497,6 +1497,7 @@ export default { @@ -1497,6 +1497,7 @@ export default {
1497 show: false, 1497 show: false,
1498 }; 1498 };
1499 } else { 1499 } else {
  1500 + item.correctAnswer = item.correctAnswer || "";
1500 return { 1501 return {
1501 ...item, 1502 ...item,
1502 }; 1503 };
src/views/examinationPaper/edit.vue
@@ -23,7 +23,10 @@ @@ -23,7 +23,10 @@
23 <p class="totals">卷面总分:{{ allScore }}分</p> 23 <p class="totals">卷面总分:{{ allScore }}分</p>
24 </div> 24 </div>
25 <div class="question-box"> 25 <div class="question-box">
26 - <ul class="questions-ul questions-ul2" v-if="examType == 1"> 26 + <ul
  27 + class="questions-ul questions-ul2"
  28 + v-if="!questionList[0]?.subQuestions"
  29 + >
27 <li class="sub-questions"> 30 <li class="sub-questions">
28 <div class="qs-num">题号</div> 31 <div class="qs-num">题号</div>
29 <div class="qs-type">题型</div> 32 <div class="qs-type">题型</div>
@@ -34,126 +37,10 @@ @@ -34,126 +37,10 @@
34 <div class="qs-set">题目解析</div> 37 <div class="qs-set">题目解析</div>
35 <div class="qs-set">知识点</div> 38 <div class="qs-set">知识点</div>
36 </li> 39 </li>
37 - <li v-for="(subQuestions, indexs) in questionList" :key="indexs">  
38 - <p  
39 - class="set-ans-btn"  
40 - v-if="  
41 - subQuestions.qusType &&  
42 - subQuestions.subNum &&  
43 - subQuestions.subNum > 4  
44 - "  
45 - >  
46 - <el-button type="primary" @click="setFormAns(indexs)"  
47 - >批量设置答案</el-button  
48 - >  
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 - {{ subQuestions.score }}  
57 - </div>  
58 - <div class="qs-partScore">  
59 - <p v-if="subQuestions.questionType != 3">--</p>  
60 - <el-input-number  
61 - class="number-ipt"  
62 - v-else  
63 - size="medium"  
64 - :min="0"  
65 - :precision="2"  
66 - :max="subQuestions.score"  
67 - :step="0.5"  
68 - v-model="subQuestions.partScore"  
69 - label="漏选得分"  
70 - ></el-input-number>  
71 - </div>  
72 - <div class="qs-options qs-options2">  
73 - <p v-if="subQuestions.questionType == 5">--</p>  
74 - <p v-if="subQuestions.questionType == 4" class="answer-box">  
75 - <span  
76 - class="answer-s"  
77 - :class="subQuestions.correctAnswer == 1 ? 'active' : ''"  
78 - @click="subQuestions.correctAnswer = 1"  
79 - >✓</span  
80 - >  
81 - <span  
82 - class="answer-s"  
83 - :class="subQuestions.correctAnswer == 2 ? 'active' : ''"  
84 - @click="subQuestions.correctAnswer = 2"  
85 - >✗</span  
86 - >  
87 - </p>  
88 - <p v-if="subQuestions.questionType == 3" class="answer-box">  
89 - <template  
90 - v-for="option in subQuestions.answerOptions?.split(',')"  
91 - >  
92 - <span  
93 - v-if="option"  
94 - class="answer-s"  
95 - :class="  
96 - subQuestions.correctAnswer.includes(option)  
97 - ? 'active'  
98 - : ''  
99 - "  
100 - :key="option"  
101 - @click="changAnswer(subQuestions, option)"  
102 - >{{ option }}</span  
103 - >  
104 - </template>  
105 - </p>  
106 - <p v-if="subQuestions.questionType == 2" class="answer-box">  
107 - <template  
108 - v-for="option in subQuestions.answerOptions?.split(',')"  
109 - >  
110 - <span  
111 - class="answer-s"  
112 - v-if="option"  
113 - :class="  
114 - subQuestions.correctAnswer == option ? 'active' : ''  
115 - "  
116 - :key="option"  
117 - @click="subQuestions.correctAnswer = option"  
118 - >{{ option }}</span  
119 - >  
120 - </template>  
121 - </p>  
122 - </div>  
123 - <div class="qs-set">  
124 - <el-button  
125 - class="icon-tickets"  
126 - type="primary"  
127 - circle  
128 - size="mini"  
129 - icon="el-icon-tickets"  
130 - @click="openStem(subQuestions, 1, indexs)"  
131 - ></el-button>  
132 - </div>  
133 - <div class="qs-set">  
134 - <el-button  
135 - class="icon-tickets"  
136 - type="primary"  
137 - circle  
138 - size="mini"  
139 - icon="el-icon-tickets"  
140 - @click="openStem(subQuestions, 2, indexs)"  
141 - ></el-button>  
142 - </div>  
143 - <div class="qs-set">  
144 - <el-button  
145 - type="primary"  
146 - circle  
147 - size="mini"  
148 - icon="el-icon-price-tag"  
149 - @click="openKnowledge(subQuestions, indexs)"  
150 - ></el-button>  
151 - </div>  
152 - </div>  
153 - </li>  
154 </ul> 40 </ul>
155 - <template v-if="examType == 2">  
156 - <template v-for="(question, index) in questionList"> 41 +
  42 + <template v-for="(question, index) in questionList">
  43 + <template v-if="question.subQuestions">
157 <p class="question-title" v-if="paperType == 2"> 44 <p class="question-title" v-if="paperType == 2">
158 <span>{{ setBigNum(index) }}、</span> 45 <span>{{ setBigNum(index) }}、</span>
159 <el-input 46 <el-input
@@ -249,7 +136,7 @@ @@ -249,7 +136,7 @@
249 v-if="option" 136 v-if="option"
250 class="answer-s" 137 class="answer-s"
251 :class=" 138 :class="
252 - subQuestions.correctAnswer.includes(option) 139 + subQuestions.correctAnswer?.includes(option)
253 ? 'active' 140 ? 'active'
254 : '' 141 : ''
255 " 142 "
@@ -309,6 +196,124 @@ @@ -309,6 +196,124 @@
309 </div> 196 </div>
310 </div> 197 </div>
311 </template> 198 </template>
  199 + <div v-else>
  200 + <p
  201 + class="set-ans-btn"
  202 + v-if="question.qusType && question.subNum && question.subNum > 4"
  203 + >
  204 + <el-button type="primary" @click="setFormAns(index)"
  205 + >批量设置答案</el-button
  206 + >
  207 + </p>
  208 + <div v-else class="sub-questions">
  209 + <div class="qs-num">{{ question.questionIndex }}</div>
  210 + <div class="qs-type">
  211 + {{ setSubPro(question.questionType) }}
  212 + </div>
  213 + <div class="qs-score">
  214 + <el-input-number
  215 + class="number-ipt"
  216 + size="medium"
  217 + :min="1"
  218 + :max="200"
  219 + :precision="2"
  220 + :step="1"
  221 + v-model="question.score"
  222 + label="单题分值"
  223 + ></el-input-number>
  224 + </div>
  225 + <div class="qs-partScore">
  226 + <p v-if="question.questionType != 3">--</p>
  227 + <el-input-number
  228 + class="number-ipt"
  229 + v-else
  230 + size="medium"
  231 + :min="0"
  232 + :precision="2"
  233 + :max="question.score"
  234 + :step="0.5"
  235 + v-model="question.partScore"
  236 + label="漏选得分"
  237 + ></el-input-number>
  238 + </div>
  239 + <div class="qs-options qs-options2">
  240 + <p v-if="question.questionType == 5">--</p>
  241 + <p v-if="question.questionType == 4" class="answer-box">
  242 + <span
  243 + class="answer-s"
  244 + :class="question.correctAnswer == 1 ? 'active' : ''"
  245 + @click="question.correctAnswer = 1"
  246 + >✓</span
  247 + >
  248 + <span
  249 + class="answer-s"
  250 + :class="question.correctAnswer == 2 ? 'active' : ''"
  251 + @click="question.correctAnswer = 2"
  252 + >✗</span
  253 + >
  254 + </p>
  255 + <p v-if="question.questionType == 3" class="answer-box">
  256 + <template
  257 + v-for="option in question.answerOptions?.split(',')"
  258 + >
  259 + <span
  260 + v-if="option"
  261 + class="answer-s"
  262 + :class="
  263 + question.correctAnswer?.includes(option) ? 'active' : ''
  264 + "
  265 + :key="option"
  266 + @click="changAnswer(question, option)"
  267 + >{{ option }}</span
  268 + >
  269 + </template>
  270 + </p>
  271 + <p v-if="question.questionType == 2" class="answer-box">
  272 + <template
  273 + v-for="option in question.answerOptions?.split(',')"
  274 + >
  275 + <span
  276 + class="answer-s"
  277 + v-if="option"
  278 + :class="question.correctAnswer == option ? 'active' : ''"
  279 + :key="option"
  280 + @click="question.correctAnswer = option"
  281 + >{{ option }}</span
  282 + >
  283 + </template>
  284 + </p>
  285 + </div>
  286 + <div class="qs-set">
  287 + <el-button
  288 + class="icon-tickets"
  289 + type="primary"
  290 + circle
  291 + size="mini"
  292 + icon="el-icon-tickets"
  293 + @click="openStem(question, 1, index)"
  294 + ></el-button>
  295 + </div>
  296 + <div class="qs-set">
  297 + <el-button
  298 + class="icon-tickets"
  299 + type="primary"
  300 + circle
  301 + size="mini"
  302 + icon="el-icon-tickets"
  303 + @click="openStem(question, 2, index)"
  304 + ></el-button>
  305 + </div>
  306 + <div class="qs-set">
  307 + <el-button
  308 + type="primary"
  309 + circle
  310 + size="mini"
  311 + icon="el-icon-price-tag"
  312 + @click="openKnowledge(question, index)"
  313 + ></el-button>
  314 + </div>
  315 + </div>
  316 + </div>
312 </template> 317 </template>
313 </div> 318 </div>
314 <div class="btn-box"> 319 <div class="btn-box">
@@ -750,8 +755,8 @@ export default { @@ -750,8 +755,8 @@ export default {
750 }, 0); 755 }, 0);
751 return Number(score).toFixed(2); 756 return Number(score).toFixed(2);
752 }, 757 },
  758 + //设置多选答案
753 changAnswer(sub, option) { 759 changAnswer(sub, option) {
754 - //设置多选答案  
755 let str = new RegExp(option, "g"); 760 let str = new RegExp(option, "g");
756 if (sub.correctAnswer?.includes(option)) { 761 if (sub.correctAnswer?.includes(option)) {
757 sub.correctAnswer = sub.correctAnswer.replace(str, ""); 762 sub.correctAnswer = sub.correctAnswer.replace(str, "");
@@ -1015,24 +1020,41 @@ export default { @@ -1015,24 +1020,41 @@ export default {
1015 ...this.form.paperModifyLog, 1020 ...this.form.paperModifyLog,
1016 }; 1021 };
1017 this.form = deepClone(data); 1022 this.form = deepClone(data);
1018 - questionList = deepClone(this.form.questionList); 1023 + questionList = this.form.questionList.map((item) => {
  1024 + if (item.subQuestions) {
  1025 + item.subQuestions.map((subQuestion) => {
  1026 + subQuestion.questionType == 2 || subQuestion.questionType == 3
  1027 + ? (subQuestion.answerOptions =
  1028 + subQuestion.answerOptions || "A,B,C,D")
  1029 + : "";
  1030 + subQuestion.correctAnswer = subQuestion.correctAnswer || "";
  1031 + });
  1032 + } else {
  1033 + item.questionType == 2 || item.questionType == 3
  1034 + ? (item.answerOptions = item.answerOptions || "A,B,C,D")
  1035 + : "";
  1036 + item.correctAnswer = item.correctAnswer || "";
  1037 + }
  1038 + return item;
  1039 + });
1019 } else { 1040 } else {
1020 questionList = data.list.sort((a, b) => { 1041 questionList = data.list.sort((a, b) => {
1021 return a.questionIndex - b.questionIndex; 1042 return a.questionIndex - b.questionIndex;
1022 }); 1043 });
1023 } 1044 }
1024 - this.formateQuestion(questionList); 1045 + this.questionList = questionList;
  1046 + this.formateQuestion();
1025 } else { 1047 } else {
1026 this.$message.error(info); 1048 this.$message.error(info);
1027 } 1049 }
1028 }, 1050 },
1029 - formateQuestion(arr) { 1051 + formateQuestion() {
  1052 + let arr = this.questionList;
1030 if (arr[0]?.subQuestions) { 1053 if (arr[0]?.subQuestions) {
1031 this.questionList = arr.map((item) => { 1054 this.questionList = arr.map((item) => {
1032 let types = [{}]; 1055 let types = [{}];
1033 let addndex = 0; 1056 let addndex = 0;
1034 item.subQuestions.map((sub, index) => { 1057 item.subQuestions.map((sub, index) => {
1035 - sub.answerOptions = sub.answerOptions || "A,B,C,D";  
1036 if (!!sub.questionType) { 1058 if (!!sub.questionType) {
1037 if ( 1059 if (
1038 sub.questionType == types[addndex].qusType && 1060 sub.questionType == types[addndex].qusType &&
@@ -1094,7 +1116,6 @@ export default { @@ -1094,7 +1116,6 @@ export default {
1094 let types = [{}]; 1116 let types = [{}];
1095 let addndex = 0; 1117 let addndex = 0;
1096 this.questionList = arr.map((sub, index) => { 1118 this.questionList = arr.map((sub, index) => {
1097 - sub.answerOptions = sub.answerOptions || "A,B,C,D";  
1098 if (!!sub.questionType) { 1119 if (!!sub.questionType) {
1099 if ( 1120 if (
1100 sub.questionType == types[addndex].qusType && 1121 sub.questionType == types[addndex].qusType &&