yks-element 1.0.0 → 1.0.4

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 (308) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -4
  3. package/lib/theme-chalk/alert.css +1 -0
  4. package/lib/theme-chalk/aside.css +1 -0
  5. package/lib/theme-chalk/autocomplete.css +1 -0
  6. package/lib/theme-chalk/avatar.css +1 -0
  7. package/lib/theme-chalk/backtop.css +1 -0
  8. package/lib/theme-chalk/badge.css +1 -0
  9. package/lib/theme-chalk/base.css +1 -0
  10. package/lib/theme-chalk/breadcrumb-item.css +0 -0
  11. package/lib/theme-chalk/breadcrumb.css +1 -0
  12. package/lib/theme-chalk/button-group.css +0 -0
  13. package/lib/theme-chalk/button.css +1 -0
  14. package/lib/theme-chalk/buttons.css +1 -0
  15. package/lib/theme-chalk/calendar.css +1 -0
  16. package/lib/theme-chalk/card.css +1 -0
  17. package/lib/theme-chalk/carousel-item.css +1 -0
  18. package/lib/theme-chalk/carousel.css +1 -0
  19. package/lib/theme-chalk/cascader-panel.css +1 -0
  20. package/lib/theme-chalk/cascader.css +1 -0
  21. package/lib/theme-chalk/checkbox-button.css +0 -0
  22. package/lib/theme-chalk/checkbox-group.css +0 -0
  23. package/lib/theme-chalk/checkbox.css +1 -0
  24. package/lib/theme-chalk/col.css +1 -0
  25. package/lib/theme-chalk/collapse-item.css +0 -0
  26. package/lib/theme-chalk/collapse.css +1 -0
  27. package/lib/theme-chalk/color-picker.css +1 -0
  28. package/lib/theme-chalk/common.css +1 -0
  29. package/lib/theme-chalk/container.css +1 -0
  30. package/lib/theme-chalk/date-picker.css +1 -0
  31. package/lib/theme-chalk/descriptions-item.css +1 -0
  32. package/lib/theme-chalk/descriptions.css +1 -0
  33. package/lib/theme-chalk/dialog.css +1 -0
  34. package/lib/theme-chalk/display.css +1 -0
  35. package/lib/theme-chalk/divider.css +1 -0
  36. package/lib/theme-chalk/drawer.css +1 -0
  37. package/lib/theme-chalk/dropdown-item.css +0 -0
  38. package/lib/theme-chalk/dropdown-menu.css +0 -0
  39. package/lib/theme-chalk/dropdown.css +1 -0
  40. package/lib/theme-chalk/element-ui.css +1 -0
  41. package/lib/theme-chalk/element-variables.css +0 -0
  42. package/lib/theme-chalk/element.css +1 -0
  43. package/lib/theme-chalk/empty.css +1 -0
  44. package/{dist/fonts/element-icons.732389de.ttf → lib/theme-chalk/fonts/element-icons.ttf} +0 -0
  45. package/{dist/fonts/element-icons.535877f5.woff → lib/theme-chalk/fonts/element-icons.woff} +0 -0
  46. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  47. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  48. package/lib/theme-chalk/footer.css +1 -0
  49. package/lib/theme-chalk/form-item.css +0 -0
  50. package/lib/theme-chalk/form.css +1 -0
  51. package/lib/theme-chalk/header.css +1 -0
  52. package/lib/theme-chalk/icon.css +1 -0
  53. package/lib/theme-chalk/icons.css +1 -0
  54. package/lib/theme-chalk/image.css +1 -0
  55. package/lib/theme-chalk/index.css +1 -0
  56. package/lib/theme-chalk/infinite-scroll.css +0 -0
  57. package/lib/theme-chalk/infiniteScroll.css +0 -0
  58. package/lib/theme-chalk/input-number.css +1 -0
  59. package/lib/theme-chalk/input.css +1 -0
  60. package/lib/theme-chalk/link.css +1 -0
  61. package/lib/theme-chalk/loading.css +1 -0
  62. package/lib/theme-chalk/main.css +1 -0
  63. package/lib/theme-chalk/menu-item-group.css +0 -0
  64. package/lib/theme-chalk/menu-item.css +0 -0
  65. package/lib/theme-chalk/menu.css +1 -0
  66. package/lib/theme-chalk/message-box.css +1 -0
  67. package/lib/theme-chalk/message.css +1 -0
  68. package/lib/theme-chalk/multimedia.css +1 -0
  69. package/lib/theme-chalk/notification.css +1 -0
  70. package/lib/theme-chalk/option-group.css +1 -0
  71. package/lib/theme-chalk/option.css +1 -0
  72. package/lib/theme-chalk/page-header.css +1 -0
  73. package/lib/theme-chalk/pagination.css +1 -0
  74. package/lib/theme-chalk/paginations.css +1 -0
  75. package/lib/theme-chalk/popconfirm.css +1 -0
  76. package/lib/theme-chalk/popover.css +1 -0
  77. package/lib/theme-chalk/popper.css +1 -0
  78. package/lib/theme-chalk/progress.css +1 -0
  79. package/lib/theme-chalk/radio-button.css +1 -0
  80. package/lib/theme-chalk/radio-group.css +1 -0
  81. package/lib/theme-chalk/radio.css +1 -0
  82. package/lib/theme-chalk/rate.css +1 -0
  83. package/lib/theme-chalk/reset.css +1 -0
  84. package/lib/theme-chalk/result.css +1 -0
  85. package/lib/theme-chalk/row.css +1 -0
  86. package/lib/theme-chalk/scrollbar.css +1 -0
  87. package/lib/theme-chalk/scrollbars.css +1 -0
  88. package/lib/theme-chalk/select-dropdown.css +1 -0
  89. package/lib/theme-chalk/select.css +1 -0
  90. package/lib/theme-chalk/selects.css +1 -0
  91. package/lib/theme-chalk/skeleton-item.css +1 -0
  92. package/lib/theme-chalk/skeleton.css +1 -0
  93. package/lib/theme-chalk/slider.css +1 -0
  94. package/lib/theme-chalk/spinner.css +1 -0
  95. package/lib/theme-chalk/step.css +1 -0
  96. package/lib/theme-chalk/steps.css +1 -0
  97. package/lib/theme-chalk/submenu.css +0 -0
  98. package/lib/theme-chalk/switch.css +1 -0
  99. package/lib/theme-chalk/tab-pane.css +0 -0
  100. package/lib/theme-chalk/table-column.css +1 -0
  101. package/lib/theme-chalk/table.css +1 -0
  102. package/lib/theme-chalk/tables.css +1 -0
  103. package/lib/theme-chalk/tabs.css +1 -0
  104. package/lib/theme-chalk/tag.css +1 -0
  105. package/lib/theme-chalk/time-picker.css +1 -0
  106. package/lib/theme-chalk/time-select.css +1 -0
  107. package/lib/theme-chalk/timeline-item.css +1 -0
  108. package/lib/theme-chalk/timeline.css +1 -0
  109. package/lib/theme-chalk/tinymce.css +1 -0
  110. package/lib/theme-chalk/tooltip.css +1 -0
  111. package/lib/theme-chalk/topic.css +1 -0
  112. package/lib/theme-chalk/transfer.css +1 -0
  113. package/lib/theme-chalk/tree.css +1 -0
  114. package/lib/theme-chalk/upload.css +1 -0
  115. package/lib/theme-chalk/uploadfile.css +1 -0
  116. package/lib/theme-chalk/video.css +1 -0
  117. package/lib/yks.js +1 -0
  118. package/package.json +101 -51
  119. package/packages/Dialog/index.js +8 -0
  120. package/packages/Dialog/src/index.vue +89 -0
  121. package/packages/Multimedia/index.js +8 -0
  122. package/packages/Multimedia/src/index.vue +136 -0
  123. package/packages/Pagination/index.js +8 -0
  124. package/packages/Pagination/src/index.vue +111 -0
  125. package/packages/Scrollbar/index.js +8 -0
  126. package/packages/Scrollbar/src/index.vue +20 -0
  127. package/packages/Select/index.js +8 -0
  128. package/packages/Select/src/index.vue +350 -0
  129. package/packages/Select/src/option.vue +29 -0
  130. package/packages/Table/index.js +8 -0
  131. package/packages/Table/src/index.vue +141 -0
  132. package/packages/Tinymce/index.js +8 -0
  133. package/packages/Tinymce/src/config.js +25 -0
  134. package/packages/Tinymce/src/index.vue +450 -0
  135. package/packages/Topic/index.js +23 -0
  136. package/packages/Topic/src/attachment.vue +114 -0
  137. package/packages/Topic/src/audioFrequency.vue +114 -0
  138. package/packages/Topic/src/clozeFillInBlanks.vue +237 -0
  139. package/packages/Topic/src/compound.vue +191 -0
  140. package/packages/Topic/src/config.js +132 -0
  141. package/packages/Topic/src/fillInBlanks.vue +242 -0
  142. package/packages/Topic/src/indefiniteChoice.vue +0 -0
  143. package/packages/Topic/src/judgment.vue +110 -0
  144. package/packages/Topic/src/matching.vue +0 -0
  145. package/packages/Topic/src/multiple.vue +163 -0
  146. package/packages/Topic/src/pictureAnswer.vue +113 -0
  147. package/packages/Topic/src/shortAnswer.vue +124 -0
  148. package/packages/Topic/src/single.vue +163 -0
  149. package/packages/UploadFile/index.js +8 -0
  150. package/packages/UploadFile/src/index.vue +358 -0
  151. package/packages/Video/index.js +8 -0
  152. package/packages/Video/src/index.vue +204 -0
  153. package/packages/assets/mixins/topic.js +137 -0
  154. package/packages/assets/utils/index.js +83 -0
  155. package/packages/assets/utils/topic.js +132 -0
  156. package/packages/icon/default/icons.js +182 -0
  157. package/packages/icon/default/icons.min.js +1 -0
  158. package/packages/icon/default/index.js +7 -0
  159. package/packages/icon/ks-pdf.png +0 -0
  160. package/packages/icon/ks-ppt.png +0 -0
  161. package/packages/icon/ks-word.png +0 -0
  162. package/packages/icon/ks-xslx.png +0 -0
  163. package/packages/icon/music-bg.png +0 -0
  164. package/packages/icon/video-bg.png +0 -0
  165. package/packages/index.js +221 -0
  166. package/packages/option/index.js +6 -0
  167. package/packages/styles/_mixin.scss +93 -0
  168. package/packages/styles/_variables.scss +40 -0
  169. package/packages/styles/alert.scss +147 -0
  170. package/packages/styles/aside.scss +7 -0
  171. package/packages/styles/autocomplete.scss +80 -0
  172. package/packages/styles/avatar.scss +51 -0
  173. package/packages/styles/backtop.scss +22 -0
  174. package/packages/styles/badge.scss +57 -0
  175. package/packages/styles/base.scss +2 -0
  176. package/packages/styles/breadcrumb-item.scss +0 -0
  177. package/packages/styles/breadcrumb.scss +55 -0
  178. package/packages/styles/button-group.scss +0 -0
  179. package/packages/styles/button.scss +262 -0
  180. package/packages/styles/buttons.scss +59 -0
  181. package/packages/styles/calendar.scss +79 -0
  182. package/packages/styles/card.scss +32 -0
  183. package/packages/styles/carousel-item.scss +50 -0
  184. package/packages/styles/carousel.scss +161 -0
  185. package/packages/styles/cascader-panel.scss +120 -0
  186. package/packages/styles/cascader.scss +182 -0
  187. package/packages/styles/checkbox-button.scss +0 -0
  188. package/packages/styles/checkbox-group.scss +0 -0
  189. package/packages/styles/checkbox.scss +359 -0
  190. package/packages/styles/col.scss +156 -0
  191. package/packages/styles/collapse-item.scss +0 -0
  192. package/packages/styles/collapse.scss +63 -0
  193. package/packages/styles/color-picker.scss +384 -0
  194. package/packages/styles/common/popup.scss +42 -0
  195. package/packages/styles/common/transition.scss +99 -0
  196. package/packages/styles/common/var.scss +1028 -0
  197. package/packages/styles/common.scss +204 -0
  198. package/packages/styles/container.scss +14 -0
  199. package/packages/styles/date-picker/date-picker.scss +97 -0
  200. package/packages/styles/date-picker/date-range-picker.scss +101 -0
  201. package/packages/styles/date-picker/date-table.scss +151 -0
  202. package/packages/styles/date-picker/month-table.scss +82 -0
  203. package/packages/styles/date-picker/picker-panel.scss +117 -0
  204. package/packages/styles/date-picker/picker.scss +197 -0
  205. package/packages/styles/date-picker/time-picker.scss +85 -0
  206. package/packages/styles/date-picker/time-range-picker.scss +31 -0
  207. package/packages/styles/date-picker/time-spinner.scss +110 -0
  208. package/packages/styles/date-picker/year-table.scss +51 -0
  209. package/packages/styles/date-picker.scss +12 -0
  210. package/packages/styles/descriptions-item.scss +42 -0
  211. package/packages/styles/descriptions.scss +111 -0
  212. package/packages/styles/dialog.scss +123 -0
  213. package/packages/styles/display.scss +12 -0
  214. package/packages/styles/divider.scss +47 -0
  215. package/packages/styles/drawer.scss +219 -0
  216. package/packages/styles/dropdown-item.scss +0 -0
  217. package/packages/styles/dropdown-menu.scss +0 -0
  218. package/packages/styles/dropdown.scss +182 -0
  219. package/packages/styles/element-ui.scss +135 -0
  220. package/packages/styles/element-variables.scss +794 -0
  221. package/packages/styles/element.scss +86 -0
  222. package/packages/styles/empty.scss +45 -0
  223. package/packages/styles/fonts/element-icons.ttf +0 -0
  224. package/packages/styles/fonts/element-icons.woff +0 -0
  225. package/packages/styles/fonts/iconfont.ttf +0 -0
  226. package/packages/styles/fonts/iconfont.woff +0 -0
  227. package/packages/styles/footer.scss +8 -0
  228. package/packages/styles/form-item.scss +0 -0
  229. package/packages/styles/form.scss +167 -0
  230. package/packages/styles/header.scss +8 -0
  231. package/packages/styles/icon.scss +1167 -0
  232. package/packages/styles/icons.scss +69 -0
  233. package/packages/styles/image.scss +179 -0
  234. package/packages/styles/index.scss +18 -0
  235. package/packages/styles/infinite-scroll.scss +0 -0
  236. package/packages/styles/infiniteScroll.scss +0 -0
  237. package/packages/styles/input-number.scss +180 -0
  238. package/packages/styles/input.scss +360 -0
  239. package/packages/styles/link.scss +81 -0
  240. package/packages/styles/loading.scss +96 -0
  241. package/packages/styles/main.scss +12 -0
  242. package/packages/styles/menu-item-group.scss +0 -0
  243. package/packages/styles/menu-item.scss +0 -0
  244. package/packages/styles/menu.scss +289 -0
  245. package/packages/styles/message-box.scss +226 -0
  246. package/packages/styles/message.scss +120 -0
  247. package/packages/styles/mixins/_button.scss +81 -0
  248. package/packages/styles/mixins/config.scss +4 -0
  249. package/packages/styles/mixins/function.scss +44 -0
  250. package/packages/styles/mixins/mixins.scss +190 -0
  251. package/packages/styles/mixins/utils.scss +39 -0
  252. package/packages/styles/multimedia.scss +58 -0
  253. package/packages/styles/notification.scss +99 -0
  254. package/packages/styles/option-group.scss +42 -0
  255. package/packages/styles/option.scss +36 -0
  256. package/packages/styles/page-header.scss +41 -0
  257. package/packages/styles/pagination.scss +295 -0
  258. package/packages/styles/paginations.scss +33 -0
  259. package/packages/styles/popconfirm.scss +16 -0
  260. package/packages/styles/popover.scss +40 -0
  261. package/packages/styles/popper.scss +101 -0
  262. package/packages/styles/progress.scss +141 -0
  263. package/packages/styles/radio-button.scss +113 -0
  264. package/packages/styles/radio-group.scss +9 -0
  265. package/packages/styles/radio.scss +199 -0
  266. package/packages/styles/rate.scss +49 -0
  267. package/packages/styles/reset.scss +79 -0
  268. package/packages/styles/result.scss +61 -0
  269. package/packages/styles/row.scss +43 -0
  270. package/packages/styles/scrollbar.scss +72 -0
  271. package/packages/styles/scrollbars.scss +5 -0
  272. package/packages/styles/select-dropdown.scss +62 -0
  273. package/packages/styles/select.scss +152 -0
  274. package/packages/styles/selects.scss +98 -0
  275. package/packages/styles/skeleton-item.scss +84 -0
  276. package/packages/styles/skeleton.scss +40 -0
  277. package/packages/styles/slider.scss +250 -0
  278. package/packages/styles/spinner.scss +44 -0
  279. package/packages/styles/step.scss +317 -0
  280. package/packages/styles/steps.scss +20 -0
  281. package/packages/styles/submenu.scss +0 -0
  282. package/packages/styles/switch.scss +116 -0
  283. package/packages/styles/tab-pane.scss +0 -0
  284. package/packages/styles/table-column.scss +97 -0
  285. package/packages/styles/table.scss +564 -0
  286. package/packages/styles/tables.scss +45 -0
  287. package/packages/styles/tabs.scss +602 -0
  288. package/packages/styles/tag.scss +163 -0
  289. package/packages/styles/time-picker.scss +8 -0
  290. package/packages/styles/time-select.scss +37 -0
  291. package/packages/styles/timeline-item.scss +86 -0
  292. package/packages/styles/timeline.scss +14 -0
  293. package/packages/styles/tinymce.scss +43 -0
  294. package/packages/styles/tooltip.scss +141 -0
  295. package/packages/styles/topic.scss +57 -0
  296. package/packages/styles/transfer.scss +227 -0
  297. package/packages/styles/tree.scss +123 -0
  298. package/packages/styles/upload.scss +603 -0
  299. package/packages/styles/uploadfile.scss +34 -0
  300. package/packages/styles/video.scss +98 -0
  301. package/types/index.d.ts +4 -0
  302. package/dist/demo.html +0 -10
  303. package/dist/yks.common.js +0 -64801
  304. package/dist/yks.css +0 -1
  305. package/dist/yks.umd.js +0 -64811
  306. package/dist/yks.umd.min.js +0 -15
  307. package/packages/button/index.vue +0 -16
  308. package/packages/index.ts +0 -12
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <div>
3
+ <div class="topic-stem__label required__label">题干</div>
4
+ <yks-tinymce
5
+ key="itemContent"
6
+ v-model="fromData.itemContent"
7
+ :toolbar="toolbar"
8
+ :plugins="plugins"
9
+ :charLimit="topicDataExtent.itemContentLength || 20000"
10
+ :fileParams="getFileTypes('stem', fromData.stemAttrs)"
11
+ :uploadFileToHwCloud="uploadFileToHwCloud"
12
+ :uploadFileFunction="uploadFileFunction"
13
+ menubar=""
14
+ height="200px"
15
+ @change="($event) => getTinymceEdit($event, 'stem')"
16
+ @delte="($event) => handleDelteAttrs($event, 'stem', fromData.stemAttrs)"
17
+ />
18
+ <div class="topic-stem__label required__label">标准答案</div>
19
+ <yks-tinymce
20
+ key="answer"
21
+ v-model="fromData.answer"
22
+ :toolbar="toolbar"
23
+ :plugins="plugins"
24
+ :charLimit="topicDataExtent.answerLength || 5000"
25
+ :fileParams="getFileTypes('answer', fromData.answerAttrs)"
26
+ :uploadFileToHwCloud="uploadFileToHwCloud"
27
+ :uploadFileFunction="uploadFileFunction"
28
+ menubar=""
29
+ height="200px"
30
+ @change="($event) => getTinymceEdit($event, 'answer')"
31
+ @delte="($event) => handleDelteAttrs($event, 'answer', fromData.answerAttrs)"
32
+ />
33
+ <div class="topic-stem__label">答案解析</div>
34
+ <yks-tinymce
35
+ key="description"
36
+ v-model="fromData.description"
37
+ :toolbar="toolbar"
38
+ :plugins="plugins"
39
+ :charLimit="topicDataExtent.descriptionLength || 20000"
40
+ :fileParams="getFileTypes('analysis', fromData.descriptionAttrs)"
41
+ :uploadFileToHwCloud="uploadFileToHwCloud"
42
+ :uploadFileFunction="uploadFileFunction"
43
+ menubar=""
44
+ height="200px"
45
+ @change="($event) => getTinymceEdit($event, 'analysis')"
46
+ @delte="($event) => handleDelteAttrs($event, 'analysis', fromData.descriptionAttrs)"
47
+ />
48
+ </div>
49
+ </template>
50
+ <script>
51
+ import TopicMixins from 'yks/assets/mixins/topic'
52
+ import { stemItemType, shortItemType, analysisItemType } from './config'
53
+
54
+ export default {
55
+ name: 'YksAudiofrequency',
56
+ mixins: [TopicMixins],
57
+ methods: {
58
+ /**
59
+ * data 富文本数据
60
+ * field 对象名
61
+ * type 类型
62
+ */
63
+ getTinymceEdit(data, type) {
64
+ switch (type) {
65
+ case 'stem':
66
+ data.itemAttr.type = stemItemType[data.itemAttr.type]
67
+ this.fromData.itemContent = data.value
68
+ if (data.itemAttr.type && data.itemAttr.content) {
69
+ this.fromData.stemAttrs.push(data.itemAttr)
70
+ }
71
+ break
72
+ case 'answer':
73
+ data.itemAttr.type = shortItemType[data.itemAttr.type]
74
+ this.fromData.answer = data.value
75
+ if (data.itemAttr.type && data.itemAttr.content) {
76
+ this.fromData.answerAttrs.push(data.itemAttr)
77
+ }
78
+ break
79
+ case 'analysis':
80
+ data.itemAttr.type = analysisItemType[data.itemAttr.type]
81
+ this.fromData.description = data.value
82
+
83
+ if (data.itemAttr.type && data.itemAttr.content) {
84
+ this.fromData.descriptionAttrs.push(data.itemAttr)
85
+ }
86
+ break
87
+ default:
88
+ break
89
+ }
90
+ this.$emit('change', this.fromData)
91
+ },
92
+
93
+ handleDelteAttrs(data, type, list, row = {}) {
94
+ const listAttrs = list
95
+ listAttrs.splice(data.index, 1)
96
+ switch (type) {
97
+ case 'stem':
98
+ this.fromData.stemAttrs = listAttrs
99
+ break
100
+ case 'answer':
101
+ this.fromData.answerAttrs = listAttrs
102
+ break
103
+ case 'analysis':
104
+ this.fromData.descriptionAttrs = listAttrs
105
+ break
106
+ default:
107
+ break
108
+ }
109
+ this.$emit('change', this.fromData)
110
+ }
111
+ }
112
+ }
113
+ </script>
114
+
@@ -0,0 +1,237 @@
1
+ <template>
2
+ <div class="yks-topics">
3
+ <div class="topic-stem__label required__label">题干</div>
4
+ <yks-tinymce
5
+ ref="stemTinymceEdit"
6
+ key="itemContent"
7
+ v-model="fromData.itemContent"
8
+ :toolbar="toolbar"
9
+ :plugins="plugins"
10
+ :charLimit="topicDataExtent.itemContentLength || 20000"
11
+ :fileParams="getFileTypes('stem', fromData.stemAttrs)"
12
+ menubar=""
13
+ height="200px"
14
+ @change="($event) => getTinymceEdit($event, 'stem')"
15
+ @delte="($event) => handleDelteAttrs($event, 'stem', fromData.stemAttrs)"
16
+ />
17
+ <div class="yks-flex yks-mt10">
18
+ <el-button type="primary" class="yks-mr10" @click="handleFillInBlanks"
19
+ >插入填空符</el-button
20
+ >
21
+ <span class="yks-fs-12 yks-info">请在题干中你需要的位置插入填空符,并在下方编辑对应答案</span>
22
+ </div>
23
+
24
+ <div class="yks-flex cloze-single">
25
+ <span class="single-single__label required__label">答案</span>
26
+ <span class="yks-fs-12 yks-info">考生需要在每个空内输入正确的答案</span>
27
+ </div>
28
+ <div
29
+ v-for="(item, index) in fromData.itemList"
30
+ :key="`itemList${index}`"
31
+ class="yks-flex yks-mb10 v-start"
32
+ >
33
+ <span class="yks-w_60 yks-mr10">填空{{ index + 1 }}</span>
34
+ <yks-tinymce
35
+ key="content"
36
+ v-model="item.content"
37
+ :toolbar="toolbarSpare"
38
+ :plugins="plugins"
39
+ :charLimit="topicDataExtent.answerLength || 5000"
40
+ :fileParams="getFileTypes('option', item.optionAttrs)"
41
+ inline
42
+ height="60px"
43
+ menubar=""
44
+ class="flex-1 radio-tinymce"
45
+ @change="($event) => changeItem($event, item)"
46
+ @delte="($event) => handleDelteAttrs($event, 'option', item.optionAttrs, item)"
47
+ />
48
+ <el-input-number
49
+ v-model="item.score"
50
+ controls-position="right"
51
+ placeholder="分值"
52
+ class="yks-mr10"
53
+ size="large"
54
+ :min="0"
55
+ :step="0.5"
56
+ :max="100"
57
+ ></el-input-number>
58
+ <el-button type="text" class="yks-danger" @click="handleDelte(index)">删除</el-button>
59
+ </div>
60
+
61
+ <div class="fill__other">
62
+ <div class="text__warning">
63
+ 1、如果勾选考生端开启数学公式编辑器,在PC端考生答题页面,本题答题区域考生可以使用数据公式编辑器。
64
+ <br />
65
+ 2、如果勾选按答案自动判分,需要考生填写内容须跟答案完全相同,才能得分,录入答案时,请不要加多余的空格标点符号等干扰字符,考生考后系统自动出分。
66
+ <br />
67
+ 3、如果没有勾选按答案自动判分,考生答卷需等待管理员后台手工判分。
68
+ </div>
69
+ <div class="yks-mt10">
70
+ <el-checkbox v-model="fromData.mathematical"
71
+ >开启数学公式编辑器(只适用于PC端答题)</el-checkbox
72
+ >
73
+ <div class="yks-mt10">
74
+ <el-checkbox v-model="fromData.automaticScoring" true-label="1" false-label="0"
75
+ >按答案自动判分</el-checkbox
76
+ >
77
+ </div>
78
+ <div v-if="fromData.automaticScoring === '1'" class="yks-mt10">
79
+ <el-checkbox v-model="fromData.outOfOrder" true-label="1" false-label="0"
80
+ >允许考生答案与参考答案顺序不一致</el-checkbox
81
+ >
82
+ <el-checkbox v-model="fromData.neglect" true-label="1" false-label="0"
83
+ >忽略大小写</el-checkbox
84
+ >
85
+ </div>
86
+ </div>
87
+ </div>
88
+
89
+ <div class="topic-stem__label">答案解析</div>
90
+ <yks-tinymce
91
+ key="description"
92
+ v-model="fromData.description"
93
+ :toolbar="toolbar"
94
+ :plugins="plugins"
95
+ :charLimit="topicDataExtent.descriptionLength || 20000"
96
+ :fileParams="getFileTypes('analysis', fromData.descriptionAttrs)"
97
+ menubar=""
98
+ height="200px"
99
+ @change="($event) => getTinymceEdit($event, 'analysis')"
100
+ @delte="($event) => handleDelteAttrs($event, 'analysis', fromData.descriptionAttrs)"
101
+ />
102
+ </div>
103
+ </template>
104
+ <script>
105
+ import TopicMixins from 'yks/assets/mixins/topic'
106
+ import { stemItemType, optionItemType, analysisItemType } from './config'
107
+
108
+ export default {
109
+ name: 'YksClozefillinblanks',
110
+ mixins: [TopicMixins],
111
+ methods: {
112
+ /**
113
+ * data 富文本数据
114
+ * field 对象名
115
+ * type 类型
116
+ */
117
+ getTinymceEdit(data, type) {
118
+ switch (type) {
119
+ case 'stem':
120
+ data.itemAttr.type = stemItemType[data.itemAttr.type]
121
+ if (data.itemAttr.type && data.itemAttr.content) {
122
+ this.fromData.stemAttrs.push(data.itemAttr)
123
+ }
124
+ // eslint-disable-next-line no-case-declarations
125
+ const list = data.value.match(/<input ([^>|]+)>/g, '') || []
126
+ // eslint-disable-next-line no-case-declarations
127
+ const editor = this.$refs.stemTinymceEdit
128
+ if ((this.fromData.itemList || []).length !== list.length && !this.processing) {
129
+ const { itemContent } = this.fromData
130
+ this.$message.error('请从下方填空符删除!')
131
+ this.fromData.itemContent = itemContent.replace(
132
+ /<input ([^>|]+)\/>/g,
133
+ (all, value) => {
134
+ const attributes = value.replace('disabled="disabled"', '')
135
+ return `<input ${attributes} disabled="disabled" />`
136
+ }
137
+ )
138
+ this.$nextTick(() => {
139
+ editor.keepLastIndex()
140
+ })
141
+ } else {
142
+ this.fromData.itemContent = data.value
143
+ }
144
+ break
145
+ case 'analysis':
146
+ data.itemAttr.type = analysisItemType[data.itemAttr.type]
147
+ this.fromData.description = data.value
148
+ if (data.itemAttr.type && data.itemAttr.content) {
149
+ this.fromData.descriptionAttrs.push(data.itemAttr)
150
+ }
151
+ break
152
+ default:
153
+ break
154
+ }
155
+ this.$emit('change', this.fromData)
156
+ },
157
+
158
+ changeItem(data, row) {
159
+ data.itemAttr.type = optionItemType[data.itemAttr.type]
160
+ if (data.itemAttr.type && data.itemAttr.content) {
161
+ row.optionAttrs.push(data.itemAttr)
162
+ this.$set(row, 'optionAttrs', row.optionAttrs)
163
+ }
164
+ this.$set(row, 'content', data.value)
165
+ this.$emit('change', this.fromData)
166
+ },
167
+
168
+ handleDelte(index) {
169
+ const list = this.fromData.itemContent.match(/<input ([^>|]+)>/g, '') || []
170
+ const classId = this.fromData.itemList[index].classId
171
+ if (classId) {
172
+ const subIndex = list.findIndex((v) => v.search(classId) !== -1)
173
+ this.fromData.itemList.splice(index, 1)
174
+ const editor = this.$refs.stemTinymceEdit
175
+ editor.deleFillItem(subIndex)
176
+ } else {
177
+ this.fromData.itemList.splice(index, 1)
178
+ const editor = this.$refs.stemTinymceEdit
179
+ editor.deleFillItem(index)
180
+ }
181
+
182
+ this.$emit('change', this.fromData)
183
+ },
184
+
185
+ handleFillInBlanks() {
186
+ if (this.fromData.itemList.length >= 40) {
187
+ return
188
+ }
189
+
190
+ const value = Date.now()
191
+ this.processing = true
192
+ const editor = this.$refs.stemTinymceEdit
193
+ editor.handleFillInBlanks(this.fromData.itemList.length, value)
194
+ const { itemContent } = this.fromData
195
+ let index = 0
196
+ this.fromData.itemContent = itemContent.replace(/<input ([^>|]+)\/>/g, (all, value) => {
197
+ index += 1
198
+ return `<input value="${index}" ${value} />`
199
+ })
200
+ const list = this.fromData.itemContent.match(/<input ([^>|]+)>/g, '') || []
201
+ const subIndex = list.findIndex((v) => v.search(value) !== -1)
202
+ this.fromData.itemList.splice(subIndex, 0, {
203
+ optionName: '',
204
+ content: '',
205
+ score: '',
206
+ optionAttrs: [],
207
+ classId: value
208
+ })
209
+ this.$nextTick(() => {
210
+ editor.keepLastIndex()
211
+ this.$emit('change', this.fromData)
212
+ })
213
+ this.processing = false
214
+ },
215
+
216
+ handleDelteAttrs(data, type, list, row = {}) {
217
+ const listAttrs = list
218
+ listAttrs.splice(data.index, 1)
219
+ switch (type) {
220
+ case 'stem':
221
+ this.fromData.stemAttrs = listAttrs
222
+ break
223
+ case 'option':
224
+ this.$set(row, 'optionAttrs', listAttrs)
225
+ break
226
+ case 'analysis':
227
+ this.fromData.descriptionAttrs = listAttrs
228
+ break
229
+ default:
230
+ break
231
+ }
232
+ this.$emit('change', this.fromData)
233
+ }
234
+ }
235
+ }
236
+ </script>
237
+
@@ -0,0 +1,191 @@
1
+ <template>
2
+ <div class="yks-topics">
3
+ <div class="topic-stem__label required__label">题干</div>
4
+ <yks-tinymce
5
+ key="itemContent"
6
+ v-model="fromData.itemContent"
7
+ :toolbar="toolbar"
8
+ :plugins="plugins"
9
+ :charLimit="topicDataExtent.itemContentLength || 20000"
10
+ :fileParams="getFileTypes('stem', fromData.stemAttrs)"
11
+ :uploadFileToHwCloud="uploadFileToHwCloud"
12
+ :uploadFileFunction="uploadFileFunction"
13
+ menubar=""
14
+ height="200px"
15
+ @change="($event) => getTinymceEdit($event, 'stem')"
16
+ @delte="($event) => handleDelteAttrs($event, 'stem', fromData.stemAttrs)"
17
+ />
18
+
19
+ <div
20
+ v-for="(item, index) in fromData.compoundList"
21
+ :key="`compoundList${index}`"
22
+ class="yks-ml10"
23
+ >
24
+ <div class="yks-flex cloze-single">
25
+ <span class="single-single__label required__label"
26
+ >{{ index + 1 }}) {{ topic[item.componentId] }}</span
27
+ >
28
+ <span class="yks-fs-12 yks-mr10">分值</span>
29
+ <span class="flex-1">
30
+ <el-input-number
31
+ v-model="item.score"
32
+ :min="0"
33
+ :step="0.5"
34
+ :max="100"
35
+ ></el-input-number>
36
+ <el-button
37
+ v-if="index > 0"
38
+ type="text"
39
+ class="yks-ml10"
40
+ @click="handleShiftItem('up', index)"
41
+ >上移题目</el-button
42
+ >
43
+ <el-button
44
+ v-if="
45
+ index + 1 !== fromData.compoundList.length &&
46
+ fromData.compoundList.length > 0
47
+ "
48
+ type="text"
49
+ class="yks-ml10"
50
+ @click="handleShiftItem('down', index)"
51
+ >下移题目</el-button
52
+ >
53
+ </span>
54
+ <el-button
55
+ v-if="fromData.compoundList.length > 1"
56
+ type="text"
57
+ class="yks-danger"
58
+ @click="handleDelte(index)"
59
+ >删除</el-button
60
+ >
61
+ </div>
62
+ <component
63
+ :is="getComponentId(item.componentId)"
64
+ v-model="item.itemContentList"
65
+ :topicDataExtent="topicDataExtent"
66
+ :uploadFileToHwCloud="uploadFileToHwCloud"
67
+ ></component>
68
+ </div>
69
+
70
+ <div class="yks-flex h-between compound-button">
71
+ <el-button type="primary" @click="handleAddItem('single')">添加单选题</el-button>
72
+ <el-button type="primary" @click="handleAddItem('judgment')">添加判断题</el-button>
73
+ <el-button type="primary" @click="handleAddItem('multiple')">添加多选题</el-button>
74
+ <el-button type="primary" @click="handleAddItem('short_answer')">添加简答题</el-button>
75
+ </div>
76
+ </div>
77
+ </template>
78
+ <script>
79
+ import TopicMixins from 'yks/assets/mixins/topic'
80
+ import { analysisItemType, stemItemType, itemDataLists } from './config'
81
+ import Single from './single'
82
+ import Multiple from './multiple'
83
+ import Judgment from './judgment'
84
+ import ShortAnswer from './shortAnswer'
85
+
86
+ export default {
87
+ name: 'YksCompound',
88
+ components: { Single, Multiple, Judgment, ShortAnswer },
89
+ mixins: [TopicMixins],
90
+ methods: {
91
+ handleDelte(index) {
92
+ this.fromData.compoundList.splice(index, 1)
93
+ this.$emit('change', this.fromData)
94
+ },
95
+
96
+ handleAddItem(value) {
97
+ const params = {
98
+ itemContentList: {
99
+ answer: '',
100
+ itemContent: '',
101
+ itemList: itemDataLists(),
102
+ stemAttrs: [],
103
+ answerAttrs: [],
104
+ descriptionAttrs: [],
105
+ description: ''
106
+ },
107
+ score: 0,
108
+ componentId: value
109
+ }
110
+
111
+ switch (value) {
112
+ case 'multiple':
113
+ params.itemContentList.answer = []
114
+ break
115
+ case 'judgment':
116
+ params.itemContentList.itemList = []
117
+ break
118
+ case 'short_answer':
119
+ params.itemContentList.itemList = []
120
+ break
121
+ }
122
+ this.fromData.compoundList.push(params)
123
+ this.$emit('change', this.fromData)
124
+ },
125
+
126
+ /**
127
+ * data 富文本数据
128
+ * field 对象名
129
+ * type 类型
130
+ */
131
+ getTinymceEdit(data, type) {
132
+ switch (type) {
133
+ case 'stem':
134
+ data.itemAttr.type = stemItemType[data.itemAttr.type]
135
+ this.fromData.itemContent = data.value
136
+ if (data.itemAttr.type && data.itemAttr.content) {
137
+ this.fromData.stemAttrs.push(data.itemAttr)
138
+ }
139
+ break
140
+ case 'analysis':
141
+ data.itemAttr.type = analysisItemType[data.itemAttr.type]
142
+ this.fromData.description = data.value
143
+ if (data.itemAttr.type && data.itemAttr.content) {
144
+ this.fromData.descriptionAttrs.push(data.itemAttr)
145
+ }
146
+ break
147
+ default:
148
+ break
149
+ }
150
+ this.$emit('change', this.fromData)
151
+ },
152
+
153
+ handleShiftItem(type, index) {
154
+ const { compoundList } = this.fromData
155
+ if (type === 'up') {
156
+ compoundList[index] = compoundList.splice(index - 1, 1, compoundList[index])[0]
157
+ } else {
158
+ compoundList[index] = compoundList.splice(index + 1, 1, compoundList[index])[0]
159
+ }
160
+ this.fromData.compoundList = compoundList
161
+ this.$emit('change', this.fromData)
162
+ },
163
+
164
+ getComponentId(value) {
165
+ if (value === 'short_answer') {
166
+ return 'shortAnswer'
167
+ }
168
+ return value
169
+ },
170
+
171
+ handleDelteAttrs(data, type, list, row = {}) {
172
+ const listAttrs = list
173
+ listAttrs.splice(data.index, 1)
174
+ switch (type) {
175
+ case 'stem':
176
+ this.fromData.stemAttrs = listAttrs
177
+ break
178
+ case 'option':
179
+ this.$set(row, 'optionAttrs', listAttrs)
180
+ break
181
+ case 'analysis':
182
+ this.fromData.descriptionAttrs = listAttrs
183
+ break
184
+ default:
185
+ break
186
+ }
187
+ this.$emit('change', this.fromData)
188
+ }
189
+ }
190
+ }
191
+ </script>
@@ -0,0 +1,132 @@
1
+ /**
2
+ * uploadRecording 录音
3
+ * uploadVideo 视频
4
+ * uploadAudio 音频
5
+ * uploadFile 文件
6
+ */
7
+
8
+ export const toolbar = [
9
+ 'bold underline italic strikethrough | kityformula-editor subscript superscript charmap | link image | table | removeformat | uploadRecording uploadVideo uploadAudio uploadFile'
10
+ ]
11
+
12
+ /* 选项、填空等 */
13
+ export const toolbarSpare = ['kityformula-editor subscript superscript charmap']
14
+
15
+ /* 插件 */
16
+ export const plugins = ['kityformula-editor powerpaste lists image media table charmap imagetools']
17
+
18
+ /* 选项字符 */
19
+ export const letter = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N']
20
+
21
+ /* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件):题干 / 标题 - 类型 */
22
+ export const stemItemType = {
23
+ recording: 'stem_voiceRecord',
24
+ video: 'stem_video',
25
+ audio: 'stem_audio',
26
+ file: 'stem_document'
27
+ }
28
+
29
+ /* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件): 标准答案 - 类型 */
30
+ export const shortItemType = {
31
+ recording: 'answer_voiceRecord',
32
+ video: 'answer_video',
33
+ audio: 'answer_audio',
34
+ file: 'answer_document'
35
+ }
36
+
37
+ /* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件): 选项 - 类型 */
38
+ export const optionItemType = {
39
+ recording: 'option_voiceRecord',
40
+ video: 'option_video',
41
+ audio: 'option_audio',
42
+ file: 'option_document'
43
+ }
44
+
45
+ /* 自定义添加菜单项(录音、上传视频、上传音乐、上传文件): 答案解析 - 类型 */
46
+ export const analysisItemType = {
47
+ recording: 'description_voiceRecord',
48
+ video: 'description_video',
49
+ audio: 'description_audio',
50
+ file: 'description_document'
51
+ }
52
+
53
+ /**
54
+ * 获取题类型
55
+ * @param {string} type
56
+ * @return {Object}
57
+ */
58
+ export const getFileType = (type, data) => {
59
+ if (data) {
60
+ let params = {}
61
+ switch (type) {
62
+ case 'stem':
63
+ params = {
64
+ stem_voiceRecord: 'recording',
65
+ stem_video: 'video',
66
+ stem_audio: 'audio',
67
+ stem_document: 'file'
68
+ }
69
+ break
70
+ case 'answer':
71
+ params = {
72
+ answer_voiceRecord: 'recording',
73
+ answer_video: 'video',
74
+ answer_audio: 'audio',
75
+ answer_document: 'file'
76
+ }
77
+ break
78
+ case 'option':
79
+ params = {
80
+ option_voiceRecord: 'recording',
81
+ option_video: 'video',
82
+ option_audio: 'audio',
83
+ option_document: 'file'
84
+ }
85
+ break
86
+ case 'analysis':
87
+ params = {
88
+ description_voiceRecord: 'recording',
89
+ description_video: 'video',
90
+ description_audio: 'audio',
91
+ description_document: 'file'
92
+ }
93
+ break
94
+ }
95
+ const fileType = params[data.type]
96
+
97
+ return {
98
+ ...data,
99
+ fileType
100
+ }
101
+ }
102
+ return false
103
+ }
104
+
105
+ export const itemDataLists = () => {
106
+ return [
107
+ {
108
+ optionName: 'A',
109
+ content: '',
110
+ optionAttrs: [],
111
+ score: ''
112
+ },
113
+ {
114
+ optionName: 'B',
115
+ content: '',
116
+ optionAttrs: [],
117
+ score: ''
118
+ },
119
+ {
120
+ optionName: 'C',
121
+ content: '',
122
+ optionAttrs: [],
123
+ score: ''
124
+ },
125
+ {
126
+ optionName: 'D',
127
+ content: '',
128
+ optionAttrs: [],
129
+ score: ''
130
+ }
131
+ ]
132
+ }