@zykjcommon/questions 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zykjcommon/questions",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "main": "src/components/questions/entry.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -24,7 +24,7 @@
24
24
  </div>
25
25
  <div class="list">
26
26
  <div class="list-item"
27
- :idx="index+1"
27
+ :idx="item.idx"
28
28
  :style="item.bgUrlCss"
29
29
  v-for="(item,index) in optionList"
30
30
  :key="index">
@@ -117,6 +117,7 @@ export default {
117
117
  if(nv){
118
118
  console.log(nv,33);
119
119
  this.parseLists(nv)
120
+ this.answerMap = nv.answerMap
120
121
  //回显答案
121
122
  if(nv.answerMap){
122
123
  if(this.mode === 'analysis'){
@@ -140,12 +141,19 @@ export default {
140
141
  cur.find('.append-item').each((subIndex,subItem)=>{
141
142
  small_type_index_list.push(Number($(subItem).attr('idx')))
142
143
  })
144
+ //答案升序排列
145
+ small_type_index_list = small_type_index_list.sort(function (a, b) {
146
+ return a-b
147
+ })
148
+ console.log(small_type_index_list,345);
143
149
  result.push({
144
150
  big_type_index:index+1,
145
151
  small_type_index_list
146
152
  })
147
153
  })
148
- return result
154
+ return {
155
+ classify_mapping_list:result
156
+ }
149
157
  },
150
158
  isAnswered(){
151
159
  let len = $(this.$el).find('.list .list-item').length
@@ -158,16 +166,19 @@ export default {
158
166
  },
159
167
  parseLists(nv){
160
168
  this.classify_question_info = nv.classify_question_info
161
- this.answerMap = nv.answerMap
162
-
163
- this.bigBgCss = `background: url(${this.classify_question_info.background_file.file_url}) no-repeat center;background-size: 100% 100%`
164
- this.bottomBgCss = `background: url(${this.classify_question_info.bottom_img_file.file_url}) no-repeat center;background-size: 100% 100%`
165
-
169
+ let exam_options_data = nv.exam_options_data
170
+ if(this.classify_question_info.background_file){
171
+ this.bigBgCss = `background: url(${this.classify_question_info.background_file.file_url}) no-repeat center;background-size: 100% 100%`
172
+ }
173
+ if(this.classify_question_info.bottom_img_file){
174
+ this.bottomBgCss = `background: url(${this.classify_question_info.bottom_img_file.file_url}) no-repeat center;background-size: 100% 100%`
175
+ }
166
176
  let optionList = []
167
- this.classify_question_info.small_type_option_list.forEach((item)=>{
177
+ exam_options_data.forEach((item)=>{
168
178
  optionList.push({
169
- content:item.option_content,
170
- bgUrlCss:`background: url(${item.file_url}) no-repeat center;background-size: 100% 100%`
179
+ content:item.data.option_content,
180
+ bgUrlCss:`background: url(${item.data.file_url}) no-repeat center;background-size: 100% 100%`,
181
+ idx:item.index
171
182
  })
172
183
  })
173
184
  this.optionList = optionList
@@ -199,6 +210,15 @@ export default {
199
210
  let html = document.getElementsByTagName("html")[0];
200
211
  html.style.fontSize = "";
201
212
  },
213
+ answeredNotify(){
214
+ let self = this
215
+ let answered = self.isAnswered()
216
+ self.$emit('getIsAnswered',answered)
217
+ self.mode === 'exam' && self.bus.$emit('questionCardChange',{
218
+ questionIndex:self.questionInfo.questionIndex - 1,
219
+ answered
220
+ })
221
+ },
202
222
  gesturestartListener(event){
203
223
  event.preventDefault()
204
224
  },
@@ -286,6 +306,7 @@ export default {
286
306
  self.moveDiv.off('transitionend')
287
307
  self.moveDiv = null
288
308
  appendItem.css({opacity:1})
309
+ self.answeredNotify()
289
310
  self.bindDragDomEvent(appendItem,options.op)
290
311
  }
291
312
  self.flag = true
@@ -306,6 +327,9 @@ export default {
306
327
  },
307
328
  dothings(){
308
329
  let self = this
330
+ if(this.answerMap && this.answerMap.classify_mapping_list && this.answerMap.classify_mapping_list.length){
331
+ this.setAnswerDo()
332
+ }
309
333
  self.bindDragDomEvent($(this.$el).find('.question-classify .list-item'),'go')
310
334
  $(document).on(self.mouseup,function(e){
311
335
  // e.preventDefault()
@@ -371,6 +395,32 @@ export default {
371
395
  })
372
396
  self.bindNextPrevEvent('next')
373
397
  self.bindNextPrevEvent('prev')
398
+ },
399
+ //回显答案
400
+ setAnswerDo(){
401
+ let self = this
402
+ let listItemIds = []
403
+ $(this.$el).find('.question-classify .list-item').each((index,item)=>{
404
+ listItemIds.push(Number($(item).attr('idx')))
405
+ })
406
+ this.answerMap.classify_mapping_list.forEach((item,index)=>{
407
+ item.small_type_index_list.forEach((subItem)=>{
408
+ let idx = listItemIds.findIndex((i)=>{
409
+ return i == subItem
410
+ })
411
+ if(idx > -1){
412
+ //找到一个删掉一个,要不会有问题
413
+ listItemIds.splice(idx,1)
414
+ let listItemDom = $(this.$el).find('.question-classify .list-item').eq(idx)
415
+ let attrIdx = listItemDom.attr('idx')
416
+ let appendItem = $(`<div class="append-item" idx="${attrIdx}" style="${self.listItemBgCss}"><div class="list-item-text">${listItemDom.find('.list-item-text').text()}</div></div>`)
417
+ self.bindDragDomEvent(appendItem,'back')
418
+ $(this.$el).find('.main-append').eq(index).append(appendItem)
419
+ listItemDom.remove()
420
+ }
421
+ })
422
+ })
423
+ this.answeredNotify()
374
424
  }
375
425
  },
376
426
  components:{
@@ -136,7 +136,7 @@ export default defineComponent({
136
136
  "link_answer_data": [],
137
137
  "analysis": "",
138
138
  "difficulty_level_str": "简单",
139
- "update_date": "2023-08-12 11:38:15",
139
+ "update_date": "2023-08-12 16:30:13",
140
140
  "content_model_list": [],
141
141
  "reference_answer": "",
142
142
  "word_id_list": [],
@@ -175,39 +175,39 @@ export default defineComponent({
175
175
  "small_type_option_list": [
176
176
  {
177
177
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
178
- "content_type": 2,
178
+ "content_type": 3,
179
179
  "file_type": 1,
180
180
  "name": "sss",
181
181
  "id": 3489,
182
182
  "thumbnail_url": "",
183
- "option_content": "3489"
183
+ "option_content": "哈哈"
184
184
  },
185
185
  {
186
186
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
187
- "content_type": 2,
187
+ "content_type": 3,
188
188
  "file_type": 1,
189
189
  "name": "sss",
190
190
  "id": 3489,
191
191
  "thumbnail_url": "",
192
- "option_content": "3489"
192
+ "option_content": "呵呵"
193
193
  },
194
194
  {
195
195
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
196
- "content_type": 2,
196
+ "content_type": 3,
197
197
  "file_type": 1,
198
198
  "name": "sss",
199
199
  "id": 3489,
200
200
  "thumbnail_url": "",
201
- "option_content": "3489"
201
+ "option_content": "哈哈"
202
202
  },
203
203
  {
204
204
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
205
- "content_type": 2,
205
+ "content_type": 3,
206
206
  "file_type": 1,
207
207
  "name": "sss",
208
208
  "id": 3489,
209
209
  "thumbnail_url": "",
210
- "option_content": "3489"
210
+ "option_content": "呵呵"
211
211
  }
212
212
  ],
213
213
  "big_type_option_list": [
@@ -261,7 +261,56 @@ export default defineComponent({
261
261
  },
262
262
  "correct_mapping_list": []
263
263
  },
264
- "exam_options_data": [],
264
+ "exam_options_data": [
265
+ {
266
+ "data": {
267
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
268
+ "content_type": 3,
269
+ "file_type": 1,
270
+ "name": "sss",
271
+ "id": 3489,
272
+ "thumbnail_url": "",
273
+ "option_content": "呵呵"
274
+ },
275
+ "index": 2
276
+ },
277
+ {
278
+ "data": {
279
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
280
+ "content_type": 3,
281
+ "file_type": 1,
282
+ "name": "sss",
283
+ "id": 3489,
284
+ "thumbnail_url": "",
285
+ "option_content": "哈哈"
286
+ },
287
+ "index": 1
288
+ },
289
+ {
290
+ "data": {
291
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
292
+ "content_type": 3,
293
+ "file_type": 1,
294
+ "name": "sss",
295
+ "id": 3489,
296
+ "thumbnail_url": "",
297
+ "option_content": "哈哈"
298
+ },
299
+ "index": 3
300
+ },
301
+ {
302
+ "data": {
303
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
304
+ "content_type": 3,
305
+ "file_type": 1,
306
+ "name": "sss",
307
+ "id": 3489,
308
+ "thumbnail_url": "",
309
+ "option_content": "呵呵"
310
+ },
311
+ "index": 4
312
+ }
313
+ ],
265
314
  "draw_img": null,
266
315
  "correct_multiple_index_set": [],
267
316
  "correct_link_list": [],
@@ -284,7 +333,38 @@ export default defineComponent({
284
333
  "phone": "12345678905",
285
334
  "applicant_name": "李老丹"
286
335
  },
287
- "answer_map": {}
336
+ "answer_map": {
337
+ "13898":{
338
+ "scratch_answer_json": "",
339
+ "question_type": 17,
340
+ "single_index": 0,
341
+ "question_id": 13898,
342
+ "is_correct": "0",
343
+ "gap_data": [],
344
+ "oss_temp_url": "",
345
+ "answer_use_time": 0,
346
+ "classify_mapping_list": [
347
+ {
348
+ "big_type_index": 1,
349
+ "small_type_index_list": [
350
+ 1,
351
+ 2,
352
+ 4
353
+ ]
354
+ },
355
+ {
356
+ "big_type_index": 2,
357
+ "small_type_index_list": [
358
+ 3
359
+ ]
360
+ }
361
+ ],
362
+ "code_file_oss_temp_path": "",
363
+ "multiple_index_set": [],
364
+ "judge": false,
365
+ "subjective_answer": ""
366
+ }
367
+ }
288
368
  },
289
369
  "error_code": 0,
290
370
  "message": "success",