@zykjcommon/questions 0.0.1

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.
Files changed (115) hide show
  1. package/.browserslistrc +3 -0
  2. package/.env +7 -0
  3. package/.env.buildTest +9 -0
  4. package/.env.development +9 -0
  5. package/.env.production +13 -0
  6. package/.env.test +12 -0
  7. package/@types/global.d.ts +33 -0
  8. package/@types/shims-vue.d.ts +6 -0
  9. package/@types/shims-vuex.d.ts +15 -0
  10. package/auto-imports.d.ts +6 -0
  11. package/babel.config.js +5 -0
  12. package/components.d.ts +23 -0
  13. package/design/App.vue +60 -0
  14. package/design/main.js +23 -0
  15. package/design/views/dialog/contentDialog.vue +18 -0
  16. package/design/views/dialog/contentDialog2.vue +18 -0
  17. package/design/views/dialog/contentDialog3.vue +19 -0
  18. package/design/views/exam/analysis.vue +208 -0
  19. package/design/views/exam/exam.vue +355 -0
  20. package/design/views/home/illustrate.vue +45 -0
  21. package/design/views/home/login.vue +43 -0
  22. package/design/vueMapper.js +8 -0
  23. package/design/vueMapperTree.js +2 -0
  24. package/dist/demo.html +1 -0
  25. package/dist/zykjcommon-questions.common.js +12817 -0
  26. package/dist/zykjcommon-questions.css +1 -0
  27. package/dist/zykjcommon-questions.umd.js +12836 -0
  28. package/dist/zykjcommon-questions.umd.min.js +18 -0
  29. package/index.js +10 -0
  30. package/package.json +61 -0
  31. package/public/favicon.ico +0 -0
  32. package/public/index.html +19 -0
  33. package/public/static/js/jquery.html2json.js +169 -0
  34. package/public/static/js/jquery.json2html.js +137 -0
  35. package/public/static/js/jquery.min.js +2 -0
  36. package/public/static/js/json2html.js +447 -0
  37. package/readme +8 -0
  38. package/src/App.vue +37 -0
  39. package/src/assets/img/afei.jpg +0 -0
  40. package/src/assets/img/audio-ico.gif +0 -0
  41. package/src/assets/img/audio-ico.png +0 -0
  42. package/src/assets/img/bc-type-bg.png +0 -0
  43. package/src/assets/img/big-close.png +0 -0
  44. package/src/assets/img/big-next.png +0 -0
  45. package/src/assets/img/big-pre.png +0 -0
  46. package/src/assets/img/book-bg.png +0 -0
  47. package/src/assets/img/checkbox-cur.png +0 -0
  48. package/src/assets/img/checkbox.png +0 -0
  49. package/src/assets/img/cpp-bg.png +0 -0
  50. package/src/assets/img/deer-logo.png +0 -0
  51. package/src/assets/img/header-bg-2.png +0 -0
  52. package/src/assets/img/header-bg.png +0 -0
  53. package/src/assets/img/illustrate-bg.png +0 -0
  54. package/src/assets/img/loading.gif +0 -0
  55. package/src/assets/img/login-bg.png +0 -0
  56. package/src/assets/img/login-box-bg.png +0 -0
  57. package/src/assets/img/login-box-logo.png +0 -0
  58. package/src/assets/img/logo.png +0 -0
  59. package/src/assets/img/logoByText.png +0 -0
  60. package/src/assets/img/py-bg.png +0 -0
  61. package/src/assets/img/pygame-bg.png +0 -0
  62. package/src/assets/img/radio-cur.png +0 -0
  63. package/src/assets/img/radio.png +0 -0
  64. package/src/assets/img/return-top-hover.png +0 -0
  65. package/src/assets/img/return-top.png +0 -0
  66. package/src/assets/img/sb3-bg.png +0 -0
  67. package/src/assets/img/star-ico.png +0 -0
  68. package/src/assets/img/tab-mark.png +0 -0
  69. package/src/assets/img/video-play-btn.png +0 -0
  70. package/src/assets/js/arms.js +16 -0
  71. package/src/assets/js/bus.js +14 -0
  72. package/src/assets/js/fun.js +883 -0
  73. package/src/assets/js/helper.js +575 -0
  74. package/src/assets/js/http.js +219 -0
  75. package/src/assets/js/md5.js +260 -0
  76. package/src/assets/js/rem.js +33 -0
  77. package/src/assets/js/validation.js +216 -0
  78. package/src/assets/js/zykjcommon-questions.umd.min.js +18 -0
  79. package/src/assets/logo.png +0 -0
  80. package/src/assets/scss/dialog/dialog.scss +144 -0
  81. package/src/assets/scss/exam/exam.scss +256 -0
  82. package/src/assets/scss/home/home.scss +222 -0
  83. package/src/assets/scss/index.scss +80 -0
  84. package/src/assets/scss/questions/index.scss +345 -0
  85. package/src/common/const.ts +15 -0
  86. package/src/components/common/ContentDialog.vue +172 -0
  87. package/src/components/common/IframeComponent.vue +101 -0
  88. package/src/components/common/Loading.vue +45 -0
  89. package/src/components/common/MediaLooker.vue +171 -0
  90. package/src/components/common/TextAreaEditor.vue +121 -0
  91. package/src/components/exam/QuestionCard.vue +494 -0
  92. package/src/components/exam/QuestionHeader.vue +87 -0
  93. package/src/components/exam/TimeCounter.vue +107 -0
  94. package/src/components/questions/QuestionReader.js +20 -0
  95. package/src/components/questions/Question_SingleChoice.vue +208 -0
  96. package/src/components/questions/buildEntry.js +12 -0
  97. package/src/components/questions/developmentEntry.js +11 -0
  98. package/src/components/questions/mixin.js +64 -0
  99. package/src/main.ts +176 -0
  100. package/src/router/exam.ts +50 -0
  101. package/src/router/index.ts +33 -0
  102. package/src/store/exam.ts +199 -0
  103. package/src/store/index.ts +22 -0
  104. package/src/types/common/index.ts +4 -0
  105. package/src/types/exam/exam.ts +10 -0
  106. package/src/views/exam/Analysis.vue +516 -0
  107. package/src/views/exam/Default.vue +28 -0
  108. package/src/views/exam/Exam.vue +594 -0
  109. package/src/views/exam/ReviewPaper.vue +178 -0
  110. package/src/views/exam/ReviewQuestion.vue +167 -0
  111. package/tasks/vueMapper.js +37 -0
  112. package/tasks/vueMapperTree.js +42 -0
  113. package/tsconfig.json +46 -0
  114. package/tslint.json +19 -0
  115. package/vue.config.js +107 -0
@@ -0,0 +1,594 @@
1
+ <template>
2
+ <div class="white-mask" v-if="showBlur"></div>
3
+ <div class="exam" :class="{'showBlur':showBlur}">
4
+ <QuestionHeader :resData="responsiveObj.resData"></QuestionHeader>
5
+ <div class="content-outter">
6
+ <div class="content">
7
+ <div class="content-left">
8
+ <div class="return-top" v-returnTop></div>
9
+ <!-- <div class="intro">
10
+ <div class="intro-tit">测评说明:</div>
11
+ <div class="intro-txt">{{responsiveObj.resData.exam_description}}</div>
12
+ </div>-->
13
+ <div class="question-main">
14
+ <ul class="question-list">
15
+ <li v-for="(item,index) in responsiveObj.questionList" :id="'question'+ index">
16
+ <component :is="item.questionComponent"
17
+ :questionInfo="item"
18
+ :key="'question'+ index"
19
+ :ref="'question'+ index"/>
20
+ </li>
21
+ </ul>
22
+ </div>
23
+ </div>
24
+ <div class="content-right">
25
+ <!-- {{responsiveObj.questionList}}-->
26
+ <QuestionCard v-model:questionList="responsiveObj.questionList"></QuestionCard>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </div>
31
+
32
+ <ContentDialog v-model:visible="warnVisible"
33
+ @confirm="quitQuestion"
34
+ :hide-cancel="true"
35
+ :confirmText="'我知道了'">
36
+ <template #content>
37
+ <div class="con-text-1" style="margin-top: 0.3rem">{{warnText}}</div>
38
+ </template>
39
+ </ContentDialog>
40
+
41
+ <Loading :loading="loading"></Loading>
42
+ </template>
43
+
44
+ <script lang="ts">
45
+ import {defineComponent, ref, toRefs, reactive, watch, computed, onMounted,getCurrentInstance} from 'vue'
46
+ // import QuestionReader from '@src/components/questions/QuestionReader.js'
47
+ import QuestionCard from '@src/components/exam/QuestionCard.vue'
48
+ import QuestionHeader from '@src/components/exam/QuestionHeader.vue'
49
+ import TimeCounter from '@src/components/exam/TimeCounter.vue'
50
+ import {createNamespacedHelpers} from 'vuex-composition-helpers';
51
+ import {useRouter,useRoute} from 'vue-router'
52
+ import fun from "@/assets/js/fun";
53
+ import bus from "@/assets/js/bus";
54
+ import {questionMapper} from '@src/common/const.ts'
55
+
56
+ interface dataInterface{
57
+ showBlur:boolean,
58
+ examInfo:any,
59
+ warnVisible:boolean,
60
+ autoSubmitTimer:any,
61
+ routeName:string,
62
+ loading:boolean,
63
+ warnText:string
64
+ }
65
+
66
+ interface responsiveData{
67
+ questionList:Array<any>,
68
+ resData:any
69
+ }
70
+
71
+
72
+ export default defineComponent({
73
+ components: {
74
+ // ...QuestionReader,
75
+ QuestionCard,
76
+ QuestionHeader,
77
+ TimeCounter,
78
+ // Question_SingleChoice:(aaa as any).Question_SingleChoice
79
+ },
80
+ setup(props,context) {
81
+ const {useState, useActions,useMutations} = createNamespacedHelpers('exam'); // specific module name
82
+ const {getExamPaperActions,resetExamActions} = useActions(['getExamPaperActions','resetExamActions'])
83
+ let {examInfo} = useState(['examInfo'])
84
+ let route = useRoute()
85
+ let router = useRouter()
86
+ const currentInstance:any = getCurrentInstance()
87
+ let _this = currentInstance.proxy
88
+ //不需要响应式或者写死的数据放里面
89
+ let data:dataInterface = reactive({
90
+ showBlur:false,
91
+ examInfo,
92
+ autoSubmitTimer:null,
93
+ warnVisible:false,
94
+ routeName:route.name as string,
95
+ loading:false,
96
+ warnText:''
97
+ })
98
+
99
+ //需要响应式放里面
100
+ let responsiveObj:{value:responsiveData} = ref({
101
+ questionList:[],
102
+ resData:{}
103
+ })
104
+
105
+
106
+
107
+ onMounted(()=>{
108
+ // resetExamActions({examId:29})
109
+ getExamPaper()
110
+ })
111
+
112
+
113
+ bus.$on('showBlur',()=>{
114
+ data.showBlur = true
115
+ })
116
+
117
+
118
+ function quitQuestion(){
119
+ fun.postMessageByType('close')
120
+ }
121
+
122
+ function getExamPaper(){
123
+ let res = {
124
+ "data": {
125
+ "examination_paper": {
126
+ "have_not_auto_check_question": false,
127
+ "size": 23,
128
+ "question_list": [
129
+ {
130
+ "question_type_str": "单选题",
131
+ "data_mode": 1,
132
+ "correct_judge": "",
133
+ "is_auto_check": "",
134
+ "content": "[{\"<>\":\"p\",\"text\":\"He arrived here ________. The teacher felt ________.\"}]",
135
+ "correct_subjective_answer": "",
136
+ "auto_check": true,
137
+ "options_data": [
138
+ {
139
+ "file_url": "",
140
+ "content_type": 1,
141
+ "file_type": 0,
142
+ "name": "",
143
+ "id": 0,
144
+ "thumbnail_url": "",
145
+ "option_content": "late, angry"
146
+ },
147
+ {
148
+ "file_url": "",
149
+ "content_type": 1,
150
+ "file_type": 0,
151
+ "name": "",
152
+ "id": 0,
153
+ "thumbnail_url": "",
154
+ "option_content": "lately, angrily"
155
+ },
156
+ {
157
+ "file_url": "",
158
+ "content_type": 1,
159
+ "file_type": 0,
160
+ "name": "",
161
+ "id": 0,
162
+ "thumbnail_url": "",
163
+ "option_content": " late, angrily"
164
+ },
165
+ {
166
+ "file_url": "",
167
+ "content_type": 1,
168
+ "file_type": 0,
169
+ "name": "",
170
+ "id": 0,
171
+ "thumbnail_url": "",
172
+ "option_content": "lately, angry"
173
+ }
174
+ ],
175
+ "score": "1.00",
176
+ "sub_questions": [],
177
+ "style_type": "SELECT_R-T",
178
+ "template_file_full_url": "",
179
+ "question_name": "He arrived here ________. The teacher felt ________.",
180
+ "correct_rate": "",
181
+ "knowledge_name": "词汇",
182
+ "page_location_list": [],
183
+ "code_type": 0,
184
+ "difficulty_level": "1",
185
+ "question_index": "",
186
+ "correct_single_index": 0,
187
+ "question_type": "1",
188
+ "media_resources": [],
189
+ "analysis": "",
190
+ "question_id": "13091",
191
+ "difficulty_level_str": "简单",
192
+ "update_date": "",
193
+ "exam_options_data": [
194
+ {
195
+ "data": {
196
+ "file_url": "",
197
+ "content_type": 1,
198
+ "file_type": 0,
199
+ "name": "",
200
+ "id": 0,
201
+ "thumbnail_url": "",
202
+ "option_content": "late, angry"
203
+ },
204
+ "index": 1
205
+ },
206
+ {
207
+ "data": {
208
+ "file_url": "",
209
+ "content_type": 1,
210
+ "file_type": 0,
211
+ "name": "",
212
+ "id": 0,
213
+ "thumbnail_url": "",
214
+ "option_content": "lately, angrily"
215
+ },
216
+ "index": 2
217
+ },
218
+ {
219
+ "data": {
220
+ "file_url": "",
221
+ "content_type": 1,
222
+ "file_type": 0,
223
+ "name": "",
224
+ "id": 0,
225
+ "thumbnail_url": "",
226
+ "option_content": " late, angrily"
227
+ },
228
+ "index": 3
229
+ },
230
+ {
231
+ "data": {
232
+ "file_url": "",
233
+ "content_type": 1,
234
+ "file_type": 0,
235
+ "name": "",
236
+ "id": 0,
237
+ "thumbnail_url": "",
238
+ "option_content": "lately, angry"
239
+ },
240
+ "index": 4
241
+ }
242
+ ],
243
+ "exam_link_answer_data": [],
244
+ "reference_file_full_url": "",
245
+ "correct_multiple_index_set": [],
246
+ "hint": "Multiple choice.1",
247
+ "knowledge_id": "2"
248
+ },
249
+ {
250
+ "question_type_str": "单选题",
251
+ "data_mode": 1,
252
+ "correct_judge": "",
253
+ "is_auto_check": "",
254
+ "content": "[{\"<>\":\"p\",\"text\":\"Your brother is very noisy. Please tell him _________ in the library.\"}]",
255
+ "correct_subjective_answer": "",
256
+ "auto_check": true,
257
+ "options_data": [
258
+ {
259
+ "file_url": "",
260
+ "content_type": 1,
261
+ "file_type": 0,
262
+ "name": "",
263
+ "id": 0,
264
+ "thumbnail_url": "",
265
+ "option_content": "not talk loudly"
266
+ },
267
+ {
268
+ "file_url": "",
269
+ "content_type": 1,
270
+ "file_type": 0,
271
+ "name": "",
272
+ "id": 0,
273
+ "thumbnail_url": "",
274
+ "option_content": " talk loudly"
275
+ },
276
+ {
277
+ "file_url": "",
278
+ "content_type": 1,
279
+ "file_type": 0,
280
+ "name": "",
281
+ "id": 0,
282
+ "thumbnail_url": "",
283
+ "option_content": " to talk loudly"
284
+ },
285
+ {
286
+ "file_url": "",
287
+ "content_type": 1,
288
+ "file_type": 0,
289
+ "name": "",
290
+ "id": 0,
291
+ "thumbnail_url": "",
292
+ "option_content": "not to talk loudly"
293
+ }
294
+ ],
295
+ "score": "1.00",
296
+ "sub_questions": [],
297
+ "style_type": "SELECT_R-T",
298
+ "template_file_full_url": "",
299
+ "question_name": "Your brother is very noisy. Please tell him _________ in the library.",
300
+ "correct_rate": "",
301
+ "knowledge_name": "",
302
+ "page_location_list": [],
303
+ "code_type": 0,
304
+ "difficulty_level": "2",
305
+ "question_index": "",
306
+ "correct_single_index": 0,
307
+ "question_type": "1",
308
+ "media_resources": [],
309
+ "analysis": "",
310
+ "question_id": "13092",
311
+ "difficulty_level_str": "困难",
312
+ "update_date": "",
313
+ "exam_options_data": [
314
+ {
315
+ "data": {
316
+ "file_url": "",
317
+ "content_type": 1,
318
+ "file_type": 0,
319
+ "name": "",
320
+ "id": 0,
321
+ "thumbnail_url": "",
322
+ "option_content": "not talk loudly"
323
+ },
324
+ "index": 1
325
+ },
326
+ {
327
+ "data": {
328
+ "file_url": "",
329
+ "content_type": 1,
330
+ "file_type": 0,
331
+ "name": "",
332
+ "id": 0,
333
+ "thumbnail_url": "",
334
+ "option_content": " talk loudly"
335
+ },
336
+ "index": 2
337
+ },
338
+ {
339
+ "data": {
340
+ "file_url": "",
341
+ "content_type": 1,
342
+ "file_type": 0,
343
+ "name": "",
344
+ "id": 0,
345
+ "thumbnail_url": "",
346
+ "option_content": " to talk loudly"
347
+ },
348
+ "index": 3
349
+ },
350
+ {
351
+ "data": {
352
+ "file_url": "",
353
+ "content_type": 1,
354
+ "file_type": 0,
355
+ "name": "",
356
+ "id": 0,
357
+ "thumbnail_url": "",
358
+ "option_content": "not to talk loudly"
359
+ },
360
+ "index": 4
361
+ }
362
+ ],
363
+ "exam_link_answer_data": [],
364
+ "reference_file_full_url": "",
365
+ "correct_multiple_index_set": [],
366
+ "hint": "Multiple choice.2",
367
+ "knowledge_id": ""
368
+ },
369
+ {
370
+ "question_type_str": "判断题",
371
+ "data_mode": 1,
372
+ "correct_judge": "",
373
+ "is_auto_check": "",
374
+ "content": "[{\"<>\":\"p\",\"html\":[{\"<>\":\"img\",\"src\":\"https://dev-resource.thedeer.cn/pre/resource-testing/image/7677e1e508a1e20a64e43e70dc2bbca24fp612otogstv5zx.png\",\"alt\":\"image.png\",\"title\":\"\",\"base_src\":\"resource-testing/image/7677e1e508a1e20a64e43e70dc2bbca24fp612otogstv5zx.png\"}]},{\"<>\":\"p\",\"text\":\"运行以下代码后,可以观察到角色在舞台上右转 4 次正好一圈。\"}]",
375
+ "correct_subjective_answer": "",
376
+ "auto_check": true,
377
+ "options_data": [],
378
+ "score": "6.00",
379
+ "sub_questions": [],
380
+ "style_type": "JUDGE_R",
381
+ "template_file_full_url": "",
382
+ "question_name": "运行以下代码后,可以观察到角色在舞台上右转 4 次正好一圈。",
383
+ "correct_rate": "",
384
+ "knowledge_name": "",
385
+ "page_location_list": [],
386
+ "code_type": 0,
387
+ "difficulty_level": "2",
388
+ "question_index": "",
389
+ "correct_single_index": 0,
390
+ "question_type": "3",
391
+ "media_resources": [],
392
+ "analysis": "",
393
+ "question_id": "12917",
394
+ "difficulty_level_str": "困难",
395
+ "update_date": "2022-05-19 11:34:35",
396
+ "exam_options_data": [],
397
+ "exam_link_answer_data": [],
398
+ "reference_file_full_url": "",
399
+ "correct_multiple_index_set": [],
400
+ "hint": "判断以下说法是否正确",
401
+ "knowledge_id": ""
402
+ }
403
+ ],
404
+ "examination_duration": 5400,
405
+ "examination_id": 495,
406
+ "examination_name": "校招考试(仿真数据,勿调整)",
407
+ "examination_record_id": 47288,
408
+ "skin_type": 1
409
+ },
410
+ "online_exam_name": "校招考试(仿真数据,勿调整)",
411
+ "remain_second": 59920,
412
+ "exam_description": "",
413
+ "applicant_simple_info": {
414
+ "applicant_id": "154",
415
+ "phone": "12345678905",
416
+ "applicant_name": "李老丹"
417
+ },
418
+ "answer_map": {
419
+ "13091": {
420
+ "answer_use_time": 0,
421
+ "scratch_answer_json": "",
422
+ "question_type": 0,
423
+ "code_file_oss_temp_path": "",
424
+ "multiple_index_set": [],
425
+ "single_index": 1,
426
+ "judge": false,
427
+ "question_id": 13091,
428
+ "is_correct": "",
429
+ "gap_data": [],
430
+ "subjective_answer": "",
431
+ "oss_temp_url": ""
432
+ },
433
+ "13092": {
434
+ "answer_use_time": 0,
435
+ "scratch_answer_json": "",
436
+ "question_type": 0,
437
+ "code_file_oss_temp_path": "",
438
+ "multiple_index_set": [],
439
+ "single_index": 4,
440
+ "judge": false,
441
+ "question_id": 13092,
442
+ "is_correct": "",
443
+ "gap_data": [],
444
+ "subjective_answer": "",
445
+ "oss_temp_url": ""
446
+ },
447
+ "12917": {
448
+ "answer_use_time": 0,
449
+ "scratch_answer_json": "",
450
+ "question_type": 0,
451
+ "code_file_oss_temp_path": "",
452
+ "multiple_index_set": [],
453
+ "single_index": 0,
454
+ "judge": false,
455
+ "question_id": 12917,
456
+ "is_correct": "",
457
+ "gap_data": [],
458
+ "subjective_answer": "",
459
+ "oss_temp_url": ""
460
+ }
461
+ }
462
+ },
463
+ "error_code": 0,
464
+ "message": "success",
465
+ "tid": "8f4f6e7b2287471fbc22ff5a3f4182e5.1822.16892350452200069",
466
+ "ts": 1689235045453
467
+ }
468
+ let {examination_paper,answer_map,remain_second} = res.data
469
+ let {question_list} = examination_paper
470
+
471
+ //todo 测试数据
472
+ responsiveObj.value.resData = res.data
473
+ responsiveObj.value.resData.remain_second = responsiveObj.value.resData.remain_second * 1000
474
+ // responsiveObj.value.resData.remain_second = 0
475
+ parseQuestionListItem(question_list,answer_map)
476
+ // responsiveObj.value.questionList = question_list.slice(0,1)
477
+ responsiveObj.value.questionList = question_list
478
+ }
479
+
480
+
481
+ function parseQuestionListItem(question_list:Array<any>,answer_map:any,parentIndex:any = undefined){
482
+ /*setTimeout(()=>{
483
+ // let editorContentWidth = (document.querySelector('.editor-content') as any)
484
+ // console.log(editorContentWidth,777);
485
+ console.log(jQuery('.editor-content').width());
486
+ let editorContent = jQuery('.editor-content')
487
+ let contentWidth = editorContent.width()
488
+ let imgs = editorContent.find('img')
489
+ console.log(contentWidth,123);
490
+ imgs.each((index:number,img:any)=>{
491
+ console.log(img.width,99);
492
+ if(img.width > contentWidth){
493
+ img.width = contentWidth
494
+ img.height = 'auto'
495
+ }
496
+ })
497
+ // console.log(imgs,1);
498
+ },500)*/
499
+ question_list.forEach((item:any,index:number)=>{
500
+ item.questionComponent = questionMapper[item.question_type]
501
+ if(parentIndex === undefined){
502
+ item.questionIndex = index + 1
503
+ }else{
504
+ item.questionIndex = (parentIndex + 1) + '-' + (index + 1)
505
+ item.questionIndex2 = index + 1
506
+ }
507
+ if(answer_map && answer_map.hasOwnProperty(item.question_id)){
508
+ item.answerMap = answer_map[item.question_id]
509
+ }else{
510
+ item.answerMap = null
511
+ }
512
+ let question_type = item.question_type
513
+ if(question_type == 3){
514
+ //判断题手动构造选项数组
515
+ item.exam_options_data = [
516
+ {
517
+ index:1,data:{
518
+ name:'正确'
519
+ }
520
+ },
521
+ {
522
+ index:2,data:{
523
+ name:'错误'
524
+ }
525
+ }
526
+ ]
527
+ }else{
528
+ if(item.exam_options_data && item.exam_options_data.length){
529
+ item.exam_options_data.forEach((subItem:any,subIndex:number)=>{
530
+ subItem.enIndex = fun.indexToEnIndex(subIndex+1)
531
+ })
532
+ }
533
+ }
534
+
535
+ //转化富文本
536
+ try{
537
+ let contentArr = JSON.parse(item.content)
538
+ // console.log(contentArr,333);
539
+ let contentWidth = jQuery('.question-list').width() - 30
540
+ parseContent(contentArr,contentWidth)
541
+ item.htmlContent = $.json2html({}, contentArr);
542
+ }catch(e){
543
+ item.htmlContent = item.content
544
+ console.log('json2html转化出错:', e);
545
+ }
546
+ //如果是阅读题要递归解析
547
+ if(item.sub_questions && item.sub_questions.length){
548
+ parseQuestionListItem(item.sub_questions,answer_map,index)
549
+ }
550
+
551
+ })
552
+ // console.log(question_list,33333);
553
+ }
554
+
555
+ //图片宽度超出框架的时候把宽度设置成框架大小
556
+ function parseContent(arr:any,contentWidth:number){
557
+ arr.forEach((item:any)=>{
558
+ if(item['<>'] === 'img'){
559
+ if(item.hasOwnProperty('width')){
560
+ let width = Number(item.width)
561
+ if(width > contentWidth){
562
+ item.width = Math.floor(contentWidth)
563
+ item.height && delete item.height
564
+ }
565
+ }
566
+ }
567
+ if(item.html && item.html.length){
568
+ parseContent(item.html,contentWidth)
569
+ }
570
+ })
571
+ }
572
+
573
+
574
+ return {
575
+ ...toRefs(data),
576
+ responsiveObj,
577
+ quitQuestion
578
+ }
579
+ }
580
+ })
581
+ </script>
582
+ <style lang="scss" scoped>
583
+ .showBlur{
584
+ filter:blur(5px);
585
+ }
586
+ .white-mask{
587
+ width: 100%;
588
+ height: 100%;
589
+ position: fixed;
590
+ left:0;
591
+ top:0;
592
+ z-index:666;
593
+ }
594
+ </style>