@zykjcommon/questions 0.0.23 → 0.0.25

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.25",
4
4
  "main": "src/components/questions/entry.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -12,7 +12,7 @@
12
12
  "build:lib": "vue-cli-service build --target lib src/components/questions/buildEntry.js --name zykjcommon-questions"
13
13
  },
14
14
  "dependencies": {
15
- "@zykjcommon/questions": "^0.0.20",
15
+ "@zykjcommon/questions": "^0.0.24",
16
16
  "alife-logger": "^1.8.30",
17
17
  "axios": "^0.26.0",
18
18
  "cookie": "^0.4.1",
@@ -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:{
@@ -6,10 +6,11 @@
6
6
  :bus="eventBus"
7
7
  :questionInfo="responsiveObj.curQuestionInfo"
8
8
  :screenRepairH="140"
9
+ @getIsAnswered="getIsAnswered"
9
10
  :screenScale="1.08"
10
11
  :ref="'question'"/>
11
12
  </div>
12
- <div class="footer" @click="submit"></div>
13
+ <div class="footer" @click="submit">{{isAnswered}}</div>
13
14
  </div>
14
15
  </template>
15
16
 
@@ -38,7 +39,8 @@ interface dataInterface{
38
39
  loading:boolean,
39
40
  warnText:string,
40
41
  eventBus:any,
41
- token:string
42
+ token:string,
43
+ isAnswered:boolean
42
44
  }
43
45
 
44
46
  interface responsiveData{
@@ -76,7 +78,8 @@ export default defineComponent({
76
78
  routeName:route.name as string,
77
79
  loading:false,
78
80
  warnText:'',
79
- token
81
+ token,
82
+ isAnswered:false
80
83
  })
81
84
 
82
85
  //需要响应式放里面
@@ -99,6 +102,10 @@ export default defineComponent({
99
102
  })
100
103
 
101
104
 
105
+ function getIsAnswered(nv:boolean){
106
+ data.isAnswered = nv
107
+ }
108
+
102
109
  function quitQuestion(){
103
110
  fun.postMessageByType('close')
104
111
  }
@@ -136,7 +143,7 @@ export default defineComponent({
136
143
  "link_answer_data": [],
137
144
  "analysis": "",
138
145
  "difficulty_level_str": "简单",
139
- "update_date": "2023-08-12 11:38:15",
146
+ "update_date": "2023-08-12 16:30:13",
140
147
  "content_model_list": [],
141
148
  "reference_answer": "",
142
149
  "word_id_list": [],
@@ -175,39 +182,39 @@ export default defineComponent({
175
182
  "small_type_option_list": [
176
183
  {
177
184
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
178
- "content_type": 2,
185
+ "content_type": 3,
179
186
  "file_type": 1,
180
187
  "name": "sss",
181
188
  "id": 3489,
182
189
  "thumbnail_url": "",
183
- "option_content": "3489"
190
+ "option_content": "哈哈"
184
191
  },
185
192
  {
186
193
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
187
- "content_type": 2,
194
+ "content_type": 3,
188
195
  "file_type": 1,
189
196
  "name": "sss",
190
197
  "id": 3489,
191
198
  "thumbnail_url": "",
192
- "option_content": "3489"
199
+ "option_content": "呵呵"
193
200
  },
194
201
  {
195
202
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
196
- "content_type": 2,
203
+ "content_type": 3,
197
204
  "file_type": 1,
198
205
  "name": "sss",
199
206
  "id": 3489,
200
207
  "thumbnail_url": "",
201
- "option_content": "3489"
208
+ "option_content": "哈哈"
202
209
  },
203
210
  {
204
211
  "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
205
- "content_type": 2,
212
+ "content_type": 3,
206
213
  "file_type": 1,
207
214
  "name": "sss",
208
215
  "id": 3489,
209
216
  "thumbnail_url": "",
210
- "option_content": "3489"
217
+ "option_content": "呵呵"
211
218
  }
212
219
  ],
213
220
  "big_type_option_list": [
@@ -261,7 +268,56 @@ export default defineComponent({
261
268
  },
262
269
  "correct_mapping_list": []
263
270
  },
264
- "exam_options_data": [],
271
+ "exam_options_data": [
272
+ {
273
+ "data": {
274
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
275
+ "content_type": 3,
276
+ "file_type": 1,
277
+ "name": "sss",
278
+ "id": 3489,
279
+ "thumbnail_url": "",
280
+ "option_content": "呵呵"
281
+ },
282
+ "index": 2
283
+ },
284
+ {
285
+ "data": {
286
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
287
+ "content_type": 3,
288
+ "file_type": 1,
289
+ "name": "sss",
290
+ "id": 3489,
291
+ "thumbnail_url": "",
292
+ "option_content": "哈哈"
293
+ },
294
+ "index": 1
295
+ },
296
+ {
297
+ "data": {
298
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
299
+ "content_type": 3,
300
+ "file_type": 1,
301
+ "name": "sss",
302
+ "id": 3489,
303
+ "thumbnail_url": "",
304
+ "option_content": "哈哈"
305
+ },
306
+ "index": 3
307
+ },
308
+ {
309
+ "data": {
310
+ "file_url": "https://dev-resource.thedeer.cn/pre/resource-media/image/3629e13ac107f35a57a43f23155c6203u27fvk1q7jvlnc07.png-quality_80",
311
+ "content_type": 3,
312
+ "file_type": 1,
313
+ "name": "sss",
314
+ "id": 3489,
315
+ "thumbnail_url": "",
316
+ "option_content": "呵呵"
317
+ },
318
+ "index": 4
319
+ }
320
+ ],
265
321
  "draw_img": null,
266
322
  "correct_multiple_index_set": [],
267
323
  "correct_link_list": [],
@@ -284,7 +340,38 @@ export default defineComponent({
284
340
  "phone": "12345678905",
285
341
  "applicant_name": "李老丹"
286
342
  },
287
- "answer_map": {}
343
+ "answer_map": {
344
+ "13898":{
345
+ "scratch_answer_json": "",
346
+ "question_type": 17,
347
+ "single_index": 0,
348
+ "question_id": 13898,
349
+ "is_correct": "0",
350
+ "gap_data": [],
351
+ "oss_temp_url": "",
352
+ "answer_use_time": 0,
353
+ "classify_mapping_list": [
354
+ {
355
+ "big_type_index": 1,
356
+ "small_type_index_list": [
357
+ 1,
358
+ 2,
359
+ 4
360
+ ]
361
+ },
362
+ {
363
+ "big_type_index": 2,
364
+ "small_type_index_list": [
365
+ 3
366
+ ]
367
+ }
368
+ ],
369
+ "code_file_oss_temp_path": "",
370
+ "multiple_index_set": [],
371
+ "judge": false,
372
+ "subjective_answer": ""
373
+ }
374
+ }
288
375
  },
289
376
  "error_code": 0,
290
377
  "message": "success",
@@ -315,7 +402,8 @@ export default defineComponent({
315
402
  ...toRefs(data),
316
403
  responsiveObj,
317
404
  quitQuestion,
318
- submit
405
+ submit,
406
+ getIsAnswered
319
407
  }
320
408
  }
321
409
  })
@@ -335,6 +423,10 @@ export default defineComponent({
335
423
  .footer{
336
424
  width: 100%;
337
425
  height: 60px;
426
+ line-height: 60px;
338
427
  background: rgb(252, 120, 38);
428
+ font-size: 20px;
429
+ text-align: center;
430
+ color:#fff;
339
431
  }
340
432
  </style>