@qxs-bns/components 0.0.29 → 0.0.30

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 (172) hide show
  1. package/es/package.json.mjs +1 -1
  2. package/es/src/data-chart/src/components/area.vue2.mjs +1 -1
  3. package/es/src/data-chart/src/components/area.vue2.mjs.map +1 -1
  4. package/es/src/data-chart/src/components/bar.vue.mjs +1 -1
  5. package/es/src/data-chart/src/components/bar.vue.mjs.map +1 -1
  6. package/es/src/data-chart/src/components/funnel.vue.mjs +1 -1
  7. package/es/src/data-chart/src/components/funnel.vue.mjs.map +1 -1
  8. package/es/src/data-chart/src/components/line.vue2.mjs +1 -1
  9. package/es/src/data-chart/src/components/line.vue2.mjs.map +1 -1
  10. package/es/src/data-chart/src/components/pie.vue.mjs +1 -1
  11. package/es/src/data-chart/src/components/pie.vue.mjs.map +1 -1
  12. package/es/src/data-chart/src/components/radar.vue.mjs +1 -1
  13. package/es/src/data-chart/src/components/radar.vue.mjs.map +1 -1
  14. package/es/src/data-chart/src/components/scatter-simple.vue.mjs +1 -1
  15. package/es/src/data-chart/src/components/scatter-simple.vue.mjs.map +1 -1
  16. package/es/src/data-chart/src/components/scatter.vue.mjs +1 -1
  17. package/es/src/data-chart/src/components/scatter.vue.mjs.map +1 -1
  18. package/es/src/data-chart/src/components/table.vue.mjs +1 -1
  19. package/es/src/data-chart/src/components/table.vue.mjs.map +1 -1
  20. package/es/src/data-chart/src/data-chart.vue.mjs +1 -1
  21. package/es/src/data-chart/src/data-chart.vue.mjs.map +1 -1
  22. package/es/src/data-chart/src/utils/useCharts.mjs +1 -1
  23. package/es/src/data-chart/src/utils/useCharts.mjs.map +1 -1
  24. package/es/src/file-upload/src/file-upload.vue.mjs +1 -1
  25. package/es/src/file-upload/src/file-upload.vue.mjs.map +1 -1
  26. package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs +1 -1
  27. package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs.map +1 -1
  28. package/es/src/image-upload/src/image-upload.vue.mjs +1 -1
  29. package/es/src/image-upload/src/image-upload.vue.mjs.map +1 -1
  30. package/es/src/photo-crop-tool/src/composables.mjs +1 -1
  31. package/es/src/photo-crop-tool/src/composables.mjs.map +1 -1
  32. package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs +1 -1
  33. package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs.map +1 -1
  34. package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
  35. package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
  36. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
  37. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs.map +1 -1
  38. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs +1 -1
  39. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs.map +1 -1
  40. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs +1 -1
  41. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs.map +1 -1
  42. package/es/src/subject-list/src/components/subject-scale.vue.mjs +1 -1
  43. package/es/src/subject-list/src/components/subject-scale.vue.mjs.map +1 -1
  44. package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
  45. package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
  46. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs +1 -1
  47. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs.map +1 -1
  48. package/es/src/subject-list/src/subject-list.vue.mjs +1 -1
  49. package/es/src/subject-list/src/subject-list.vue.mjs.map +1 -1
  50. package/es/src/subject-type/src/subject-type.vue.mjs +1 -1
  51. package/es/src/subject-type/src/subject-type.vue.mjs.map +1 -1
  52. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs +1 -1
  53. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs.map +1 -1
  54. package/lib/package.json.cjs +1 -1
  55. package/lib/src/data-chart/src/components/area.vue2.cjs +1 -1
  56. package/lib/src/data-chart/src/components/area.vue2.cjs.map +1 -1
  57. package/lib/src/data-chart/src/components/bar.vue.cjs +1 -1
  58. package/lib/src/data-chart/src/components/bar.vue.cjs.map +1 -1
  59. package/lib/src/data-chart/src/components/funnel.vue.cjs +1 -1
  60. package/lib/src/data-chart/src/components/funnel.vue.cjs.map +1 -1
  61. package/lib/src/data-chart/src/components/line.vue2.cjs +1 -1
  62. package/lib/src/data-chart/src/components/line.vue2.cjs.map +1 -1
  63. package/lib/src/data-chart/src/components/pie.vue.cjs +1 -1
  64. package/lib/src/data-chart/src/components/pie.vue.cjs.map +1 -1
  65. package/lib/src/data-chart/src/components/radar.vue.cjs +1 -1
  66. package/lib/src/data-chart/src/components/radar.vue.cjs.map +1 -1
  67. package/lib/src/data-chart/src/components/scatter-simple.vue.cjs +1 -1
  68. package/lib/src/data-chart/src/components/scatter-simple.vue.cjs.map +1 -1
  69. package/lib/src/data-chart/src/components/scatter.vue.cjs +1 -1
  70. package/lib/src/data-chart/src/components/scatter.vue.cjs.map +1 -1
  71. package/lib/src/data-chart/src/components/table.vue.cjs +1 -1
  72. package/lib/src/data-chart/src/components/table.vue.cjs.map +1 -1
  73. package/lib/src/data-chart/src/data-chart.vue.cjs +1 -1
  74. package/lib/src/data-chart/src/data-chart.vue.cjs.map +1 -1
  75. package/lib/src/data-chart/src/utils/useCharts.cjs +1 -1
  76. package/lib/src/data-chart/src/utils/useCharts.cjs.map +1 -1
  77. package/lib/src/file-upload/src/file-upload.vue.cjs +1 -1
  78. package/lib/src/file-upload/src/file-upload.vue.cjs.map +1 -1
  79. package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs +1 -1
  80. package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs.map +1 -1
  81. package/lib/src/image-upload/src/image-upload.vue.cjs +1 -1
  82. package/lib/src/image-upload/src/image-upload.vue.cjs.map +1 -1
  83. package/lib/src/photo-crop-tool/src/composables.cjs +1 -1
  84. package/lib/src/photo-crop-tool/src/composables.cjs.map +1 -1
  85. package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs +1 -1
  86. package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs.map +1 -1
  87. package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
  88. package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
  89. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
  90. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs.map +1 -1
  91. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs +1 -1
  92. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs.map +1 -1
  93. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs +1 -1
  94. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs.map +1 -1
  95. package/lib/src/subject-list/src/components/subject-scale.vue.cjs +1 -1
  96. package/lib/src/subject-list/src/components/subject-scale.vue.cjs.map +1 -1
  97. package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
  98. package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
  99. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs +1 -1
  100. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs.map +1 -1
  101. package/lib/src/subject-list/src/subject-list.vue.cjs +1 -1
  102. package/lib/src/subject-list/src/subject-list.vue.cjs.map +1 -1
  103. package/lib/src/subject-type/src/subject-type.vue.cjs +1 -1
  104. package/lib/src/subject-type/src/subject-type.vue.cjs.map +1 -1
  105. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs +1 -1
  106. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs.map +1 -1
  107. package/package.json +8 -6
  108. package/types/index.d.ts +0 -6
  109. package/types/index.d.ts.map +0 -1
  110. package/types/src/base/style/css.d.ts +0 -2
  111. package/types/src/base/style/css.d.ts.map +0 -1
  112. package/types/src/base/style/index.d.ts +0 -2
  113. package/types/src/base/style/index.d.ts.map +0 -1
  114. package/types/src/components.d.ts +0 -11
  115. package/types/src/components.d.ts.map +0 -1
  116. package/types/src/data-chart/index.d.ts +0 -4
  117. package/types/src/data-chart/index.d.ts.map +0 -1
  118. package/types/src/data-chart/src/analyze.d.ts +0 -23
  119. package/types/src/data-chart/src/analyze.d.ts.map +0 -1
  120. package/types/src/data-chart/src/utils/config.d.ts +0 -41
  121. package/types/src/data-chart/src/utils/config.d.ts.map +0 -1
  122. package/types/src/data-chart/src/utils/injectionKeys.d.ts +0 -3
  123. package/types/src/data-chart/src/utils/injectionKeys.d.ts.map +0 -1
  124. package/types/src/data-chart/src/utils/useCharts.d.ts +0 -16
  125. package/types/src/data-chart/src/utils/useCharts.d.ts.map +0 -1
  126. package/types/src/data-chart/style/index.d.ts +0 -3
  127. package/types/src/data-chart/style/index.d.ts.map +0 -1
  128. package/types/src/defaults.d.ts +0 -6
  129. package/types/src/defaults.d.ts.map +0 -1
  130. package/types/src/file-upload/index.d.ts +0 -4
  131. package/types/src/file-upload/index.d.ts.map +0 -1
  132. package/types/src/file-upload/style/index.d.ts +0 -3
  133. package/types/src/file-upload/style/index.d.ts.map +0 -1
  134. package/types/src/fixed-action-bar/index.d.ts +0 -4
  135. package/types/src/fixed-action-bar/index.d.ts.map +0 -1
  136. package/types/src/fixed-action-bar/style/index.d.ts +0 -3
  137. package/types/src/fixed-action-bar/style/index.d.ts.map +0 -1
  138. package/types/src/image-upload/index.d.ts +0 -4
  139. package/types/src/image-upload/index.d.ts.map +0 -1
  140. package/types/src/image-upload/style/index.d.ts +0 -3
  141. package/types/src/image-upload/style/index.d.ts.map +0 -1
  142. package/types/src/make-installer.d.ts +0 -9
  143. package/types/src/make-installer.d.ts.map +0 -1
  144. package/types/src/photo-crop-tool/index.d.ts +0 -4
  145. package/types/src/photo-crop-tool/index.d.ts.map +0 -1
  146. package/types/src/photo-crop-tool/src/composables.d.ts +0 -7
  147. package/types/src/photo-crop-tool/src/composables.d.ts.map +0 -1
  148. package/types/src/photo-crop-tool/style/index.d.ts +0 -3
  149. package/types/src/photo-crop-tool/style/index.d.ts.map +0 -1
  150. package/types/src/subject-action/index.d.ts +0 -4
  151. package/types/src/subject-action/index.d.ts.map +0 -1
  152. package/types/src/subject-action/style/index.d.ts +0 -3
  153. package/types/src/subject-action/style/index.d.ts.map +0 -1
  154. package/types/src/subject-layout/index.d.ts +0 -4
  155. package/types/src/subject-layout/index.d.ts.map +0 -1
  156. package/types/src/subject-layout/style/index.d.ts +0 -3
  157. package/types/src/subject-layout/style/index.d.ts.map +0 -1
  158. package/types/src/subject-list/index.d.ts +0 -4
  159. package/types/src/subject-list/index.d.ts.map +0 -1
  160. package/types/src/subject-list/style/index.d.ts +0 -3
  161. package/types/src/subject-list/style/index.d.ts.map +0 -1
  162. package/types/src/subject-type/index.d.ts +0 -4
  163. package/types/src/subject-type/index.d.ts.map +0 -1
  164. package/types/src/subject-type/style/index.d.ts +0 -3
  165. package/types/src/subject-type/style/index.d.ts.map +0 -1
  166. package/types/src/tiny-mce-editor/index.d.ts +0 -4
  167. package/types/src/tiny-mce-editor/index.d.ts.map +0 -1
  168. package/types/src/tiny-mce-editor/style/index.d.ts +0 -3
  169. package/types/src/tiny-mce-editor/style/index.d.ts.map +0 -1
  170. package/types/src/withInstall.d.ts +0 -4
  171. package/types/src/withInstall.d.ts.map +0 -1
  172. package/types/tsconfig.tsbuildinfo +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"subject-single.vue.cjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-single.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\nimport { setGuid } from '@qxs-bns/utils'\nimport { ElMessage } from 'element-plus'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: number\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(false)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(1)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref()\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n } else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || setGuid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n // let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n // if (v.resultItem) {\n // examAnswerRelationType = 1\n // }\n // if (v.answerRelations?.length) {\n // examAnswerRelationType = 2\n // }\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n }\n console.log(answerCheckType.value, 111)\n \n\n if(answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n // const customId = props.id || setGuid()\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n if (props.isKey) {\n isKey.value = props.isKey\n }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-checkbox>\n </template>\n <template v-else>\n <el-radio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }} \n {{ item.isCorrect ? '(支持选项)' : '' }} \n {{ examAnswerRelationType === 1 ? (item.resultItem? '(已设置结果项)' : '(未设置结果项)' ) : ''}} \n {{ examAnswerRelationType === 2 ? (item.answerRelations?.length? '(已设置关联)' : '(未设置关联)') : '' }}\n </el-radio>\n </template>\n </div>\n </div>\n </template>\n <template v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <el-select\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <el-option\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n >\n </el-option>\n </el-select>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-select\n v-model=\"orderList\"\n mode=\"multiple\"\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :isKey=\"isKey\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <el-dialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"resultItem\" \n v-bind=\"attrs\"\n style=\"width: 100%;\" />\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onCloseResult\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveResult\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answersIndex","ref","isKey","answerCheckType","examAnswerRelationType","answers","title","isCorrect","leastAnswerCount","analysis","showRichText","richText","startTime","showRichContent","resultItem","titlePlaceholder","computed","type","orderList","leastAnswerOptions","items","count","value","length","push","label","reverse","addAnswer","isSave","customAnswerId","setGuid","deleteRichText","save","ElMessage","error","msg","isSetCorrectAnswer","correctAnswerCount","forEach","v","i","String","fromCharCode","Set","map","item","size","console","log","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","it","event","splice","examAnswerId","customId"],"mappings":"wuDAYA,MAAMA,EAAQC,EAoBRC,EAAQC,EAERC,EAAQC,EAAAA,WAERC,EAAeC,MAAI,GACnBC,EAAQD,OAAI,GACZE,EAAkBF,MAAI,GACtBG,EAAyBH,MAAI,GAC7BI,EAAUJ,EAAAA,IAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD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pBxC,EAAasB,MAAQkB,EACrB1B,EAAWQ,MAAQjB,EAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,EAAgBS,OAAQ,GAH1B,IAAsBkB,iRA3ItB,SAAqBK,GACdA,EAAAhB,eAAiBgB,EAAKuC,cAAgBtD,EAAAA,UACrClC,EAAA,cAAeF,EAAM2F,SAAUxC,EAAI"}
1
+ {"version":3,"file":"subject-single.vue.cjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-single.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\nimport { setGuid } from '@qxs-bns/utils'\nimport { ElMessage } from 'element-plus'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: number\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(false)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(1)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref()\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n } else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || setGuid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n // let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n // if (v.resultItem) {\n // examAnswerRelationType = 1\n // }\n // if (v.answerRelations?.length) {\n // examAnswerRelationType = 2\n // }\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n }\n console.log(answerCheckType.value, 111)\n \n\n if(answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n // const customId = props.id || setGuid()\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n if (props.isKey) {\n isKey.value = props.isKey\n }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-checkbox>\n </template>\n <template v-else>\n <el-radio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }} \n {{ item.isCorrect ? '(支持选项)' : '' }} \n {{ examAnswerRelationType === 1 ? (item.resultItem? '(已设置结果项)' : '(未设置结果项)' ) : ''}} \n {{ examAnswerRelationType === 2 ? (item.answerRelations?.length? '(已设置关联)' : '(未设置关联)') : '' }}\n </el-radio>\n </template>\n </div>\n </div>\n </template>\n <template v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <el-select\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <el-option\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n >\n </el-option>\n </el-select>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-select\n v-model=\"orderList\"\n mode=\"multiple\"\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :isKey=\"isKey\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <el-dialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"resultItem\" \n v-bind=\"attrs\"\n style=\"width: 100%;\" />\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onCloseResult\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveResult\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answersIndex","ref","isKey","answerCheckType","examAnswerRelationType","answers","title","isCorrect","leastAnswerCount","analysis","showRichText","richText","startTime","showRichContent","resultItem","titlePlaceholder","computed","type","orderList","leastAnswerOptions","items","count","value","length","push","label","reverse","addAnswer","isSave","customAnswerId","setGuid","deleteRichText","save","ElMessage","error","msg","isSetCorrectAnswer","correctAnswerCount","forEach","v","i","String","fromCharCode","Set","map","item","size","console","log","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","it","event","splice","examAnswerId","customId"],"mappings":"ktDAYA,MAAMA,EAAQC,EAoBRC,EAAQC,EAERC,EAAQC,EAAAA,WAERC,EAAeC,MAAI,GACnBC,EAAQD,OAAI,GACZE,EAAkBF,MAAI,GACtBG,EAAyBH,MAAI,GAC7BI,EAAUJ,EAAAA,IAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,KAGPC,EAAmBP,EAAAA,MACnBK,EAAQL,MAAI,IACZQ,EAAWR,MAAI,IACfS,EAAeT,OAAI,GACnBU,EAAWV,MAAI,IACfW,EAAYX,MAAI,GAChBY,EAAkBZ,OAAI,GACtBa,EAAab,MAAY,IACzBc,EAAmBC,EAAAA,UAAS,IACb,WAAftB,EAAMuB,KACD,MAEe,aAAfvB,EAAMuB,KACN,MAGA,QAILC,EAAYjB,EAAcA,IAAA,IAE1BkB,EAAqBH,EAAAA,UAAS,KAClC,MAAMI,EAAQ,GAEd,IAAA,IAASC,EADMhB,EAAQiB,MAAMC,OACJF,EAAQ,EAAGA,IAClCD,EAAMI,KAAK,CACTC,MAAO,OAAOJ,KACdC,MAAOD,IAGX,OAAOD,EAAMM,SAAQ,IAEvB,SAASC,IACHjC,EAAMkC,QAGVvB,EAAQiB,MAAME,KAAK,CACjBlB,MAAO,GACPC,WAAW,EACXsB,eAAgBC,EAAQA,WACzB,CA+BH,SAASC,IACPrB,EAAaY,OAAQ,EACrBX,EAASW,MAAQ,EAAA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gC,UAAUC,aAAeJ,IAClF,OAAOC,EAASlC,OAAOC,aAAa,GAAKiC,EAAOzB,WAAa,GAAKwB,CAAA,IACjEK,OAAOC,QAAO,CAIjBtF,EAAMe,WACRA,EAASa,MAAQ5B,EAAMe,UAGrBf,EAAM4D,sBACR3C,EAASW,MAAQ5B,EAAM4D,oBACvB5C,EAAaY,OAAQ,EACvB,+9IAzJO,SAAW2D,EAASC,GACR,WAAfxF,EAAMuB,MAEJiE,GACM7E,EAAAiB,MAAMgB,SAASqC,IACjBA,IAAWM,IACbN,EAAOpE,WAAY,EAAA,IAIzB0E,EAAG1E,UAAY2E,GACS,aAAfxF,EAAMuB,OAEfgE,EAAG1E,UAAY2E,EACjB,6hBArBF,SAAsBjC,GAChB5C,EAAQiB,MAAMC,OAAS,GAAK7B,EAAMkC,QAG9BvB,EAAAiB,MAAM6D,OAAOlC,EAAO,EAAC,+JA8JTT,IACpBxC,EAAasB,MAAQkB,EACrB1B,EAAWQ,MAAQjB,EAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,EAAgBS,OAAQ,GAH1B,IAAsBkB,iRA3ItB,SAAqBK,GACdA,EAAAhB,eAAiBgB,EAAKuC,cAAgBtD,EAAAA,UACrClC,EAAA,cAAeF,EAAM2F,SAAUxC,EAAI"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es"),t=require("vue"),l=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),n=require("element-plus"),o=require("../../../subject-action/src/subject-action.vue.cjs"),r=require("../../../subject-layout/src/subject-layout.vue.cjs"),i=require("../../../tiny-mce-editor/src/tiny-mce-editor.vue.cjs"),s=require("vue-demi");const d={class:"preview"},u={class:"content"},c={class:"title"},m={key:0},f=["innerHTML"],p={class:"content flex flex-col"},v={key:1,class:"flex",style:{"margin-top":"10px",color:"#a8abb2"}},x={class:"title"},V={class:"flex"},y={style:{flex:"1"},class:"margin-bottom"},E={class:"margin-bottom flex flex-items-center"},g={class:"flex"},N={style:{flex:"1"}},w={class:"margin-bottom answer-list"},k={class:"label flex flex-justify-end"},h={class:"answer-tags"},C={class:"operation"},B={key:0,class:"margin-bottom flex"},b={style:{flex:"1"}},S={key:1,class:"margin-bottom flex"},q={style:{flex:"1"}},I={class:"flex flex-justify-end"};var j=t.defineComponent({__name:"subject-text-fill",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examExpand:{type:String,required:!1},examAnswerSettingVO:{type:Object,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(j,{emit:O}){const A=j,R=O,T=s.useAttrs(),_=s.ref([{title:"",tag:"",showInput:!1}]),L=s.ref(""),M=s.ref(""),D=s.ref(),U=s.ref(""),F=s.ref(!1),z=s.ref(""),P=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],H=s.ref(["isInOrder","isIgnoreCase"]);function G(){_.value.push({title:"",tag:"",showInput:!1})}function $(){F.value=!1,z.value=""}function J(){if(L.value){if(D.value||U.value){if(!D.value)return void n.ElMessage.error("请完善答题设置!");if(!U.value)return void n.ElMessage.error("请输入问题正确答案!");if(_.value.length!==D.value)return void n.ElMessage.error("关键词个数设置有误!");const e=[];if(_.value.forEach(((t,l)=>{t.title||e.push(`关键词${l+1}未设置`)})),e.length>0)return void n.ElMessage.error(e.join(","))}R("save",{title:L.value,answers:_.value.filter((e=>e.title)).map((e=>({title:e.title}))),analysis:M.value,isSetCorrectAnswer:!!U.value,examExpand:U.value,examAnswerSettingBO:{isIgnoreCase:H.value?.includes("isIgnoreCase"),isInOrder:H.value?.includes("isInOrder"),keywordCount:D.value},examRichTextContent:F.value?z.value:""})}else n.ElMessage.error("题目标题不能为空!")}s.onMounted((function(){A.title&&(L.value=A.title),A.answerList&&A.answerList.length&&(_.value=A.answerList),A.examAnswerSettingVO&&(H.value=H.value.filter((e=>"isIgnoreCase"===e&&A.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&A.examAnswerSettingVO?.isInOrder))),A.examAnswerSettingVO?.keywordCount&&(D.value=A.examAnswerSettingVO?.keywordCount),A.examExpand&&(U.value=A.examExpand),A.analysis&&(M.value=A.analysis),A.examRichTextContent&&(z.value=A.examRichTextContent,F.value=!0)}));const K=a.useNamespace("subject-text-fill");return(a,n)=>{const s=e.ElCheckbox,j=e.ElInput,O=e.ElInputNumber,Q=e.ElCheckboxGroup,W=e.ElTag,X=e.ElIcon,Y=e.ElButton,Z=e.ElLink;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(K).e("text-fill-exam"))},[t.createVNode(r.default,{"show-edit":a.isEdit},{preview:t.withCtx((()=>[t.createElementVNode("div",d,[t.createElementVNode("div",u,[t.createElementVNode("span",c,t.toDisplayString(a.orderIndex+1)+"."+t.toDisplayString(t.unref(L))+"(问答题)",1),t.unref(F)?(t.openBlock(),t.createElementBlock("div",m,[t.createElementVNode("div",{innerHTML:t.unref(z)},null,8,f)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",p,[t.unref(_).some((e=>e.title))?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(_),((e,l)=>(t.openBlock(),t.createBlock(s,{key:l,class:"radio",disabled:!0},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(e.title),1)])),_:2},1024)))),128)):t.createCommentVNode("v-if",!0)]),t.unref(U)?(t.openBlock(),t.createElementBlock("div",v,[t.createElementVNode("span",x,"正确答案:"+t.toDisplayString(t.unref(U)),1)])):t.createCommentVNode("v-if",!0)])])])),edit:t.withCtx((()=>[t.createElementVNode("div",V,[n[12]||(n[12]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"题目:")],-1)),t.createElementVNode("div",y,[t.createVNode(j,{modelValue:t.unref(L),"onUpdate:modelValue":n[0]||(n[0]=e=>t.isRef(L)?L.value=e:null),type:"textarea",rows:2,placeholder:"【问答题】请输入问题",maxlength:200,"show-word-limit":"",disabled:a.isSave},null,8,["modelValue","disabled"])])]),t.createElementVNode("div",E,[n[13]||(n[13]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"答题设置:")],-1)),n[14]||(n[14]=t.createElementVNode("span",null,"共答对",-1)),t.createVNode(O,{modelValue:t.unref(D),"onUpdate:modelValue":n[1]||(n[1]=e=>t.isRef(D)?D.value=e:null),style:{width:"100px",margin:"0 10px"},min:1},null,8,["modelValue"]),n[15]||(n[15]=t.createElementVNode("span",{style:{"margin-right":"10px"}},"个关键词,算是正确的",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(P,(e=>t.createVNode(Q,{key:e.value,modelValue:t.unref(H),"onUpdate:modelValue":n[2]||(n[2]=e=>t.isRef(H)?H.value=e:null)},{default:t.withCtx((()=>[t.createVNode(s,{label:e.value,class:"margin-left-10"},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(e.label),1)])),_:2},1032,["label"])])),_:2},1032,["modelValue"]))),64))]),t.createElementVNode("div",g,[n[16]||(n[16]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"答案:")],-1)),t.createElementVNode("div",N,[t.createVNode(j,{modelValue:t.unref(U),"onUpdate:modelValue":n[3]||(n[3]=e=>t.isRef(U)?U.value=e:null),type:"textarea",rows:2,placeholder:"请输入正确答案",maxlength:200,"show-word-limit":"",disabled:a.isSave},null,8,["modelValue","disabled"])])]),t.createElementVNode("div",w,[n[17]||(n[17]=t.createElementVNode("span",{style:{"padding-left":"60px"}},"*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(_),((e,n)=>(t.openBlock(),t.createElementBlock("div",{key:n,class:"answer-item flex flex-items-center"},[t.createElementVNode("div",k,[t.createElementVNode("span",null,"关键词"+t.toDisplayString(n+1)+":",1)]),t.createElementVNode("div",h,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.title.split(","),(l=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:l},[l?(t.openBlock(),t.createBlock(W,{key:0,closable:"",onClose:t=>function(e,t){if(e){const l=t.title.split(","),a=l.findIndex((t=>t===e));a>-1&&(l.splice(a,1),t.title=l.join(","))}}(l,e)},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(l),1)])),_:2},1032,["onClose"])):t.createCommentVNode("v-if",!0)],64)))),128)),a.isSave?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.showInput?(t.openBlock(),t.createBlock(j,{key:0,modelValue:e.tag,"onUpdate:modelValue":t=>e.tag=t,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(e)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(t.openBlock(),t.createBlock(Y,{key:1,size:"small",onClick:t=>e.showInput=!0},{default:t.withCtx((()=>[t.createVNode(X,null,{default:t.withCtx((()=>[t.createVNode(t.unref(l.Plus))])),_:1}),t.createElementVNode("span",null,t.toDisplayString(e.title?"添加同义词":"添加关键词"),1)])),_:2},1032,["onClick"]))],64))]),t.createElementVNode("div",C,[t.createVNode(X,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.CirclePlus),{class:t.normalizeClass([{disabled:a.isSave}]),onClick:G},null,8,["class"])])),_:1}),t.createVNode(X,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.Remove),{class:t.normalizeClass([{disabled:t.unref(_).length<2||a.isSave}]),onClick:e=>function(e){_.value.length<2||A.isSave||_.value.splice(e,1)}(n)},null,8,["class","onClick"])])),_:2},1024)])])))),128))]),a.showAnalysis?(t.openBlock(),t.createElementBlock("div",B,[n[18]||(n[18]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"解析:")],-1)),t.createElementVNode("div",b,[t.createVNode(j,{modelValue:t.unref(M),"onUpdate:modelValue":n[4]||(n[4]=e=>t.isRef(M)?M.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):t.createCommentVNode("v-if",!0),t.unref(F)?(t.openBlock(),t.createElementBlock("div",S,[n[20]||(n[20]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"富文本:")],-1)),t.createElementVNode("div",q,[t.createVNode(i.default,t.mergeProps({"model-value":t.unref(z),"onUpdate:modelValue":n[5]||(n[5]=e=>t.isRef(z)?z.value=e:null)},t.unref(T),{style:{width:"100%"}}),null,16,["model-value"]),t.createElementVNode("div",I,[t.createVNode(Z,{type:"danger",onClick:$},{default:t.withCtx((()=>n[19]||(n[19]=[t.createTextVNode(" 删除富文本 ")]))),_:1})])])])):t.createCommentVNode("v-if",!0)])),default:t.withCtx((()=>[a.showAction?(t.openBlock(),t.createBlock(o.default,{key:0,"is-edit":a.isEdit,"is-set":a.isSet,showOtherOption:!1,examAnswerRelationType:A.examAnswerRelationType,onMoveUp:n[6]||(n[6]=e=>R("move","up")),onMoveDown:n[7]||(n[7]=e=>R("move","down")),onDelete:n[8]||(n[8]=e=>R("delete")),onSave:J,onEdit:n[9]||(n[9]=e=>R("edit")),onAdd:n[10]||(n[10]=e=>R("add",e)),onOnShowRichText:n[11]||(n[11]=e=>F.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):t.createCommentVNode("v-if",!0)])),_:1},8,["show-edit"])],2)}}});exports.default=j;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es"),t=require("vue"),l=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),n=require("element-plus"),o=require("../../../subject-action/src/subject-action.vue.cjs"),r=require("../../../subject-layout/src/subject-layout.vue.cjs"),i=require("../../../tiny-mce-editor/src/tiny-mce-editor.vue.cjs");const s={class:"preview"},d={class:"content"},u={class:"title"},c={key:0},m=["innerHTML"],f={class:"content flex flex-col"},p={key:1,class:"flex",style:{"margin-top":"10px",color:"#a8abb2"}},v={class:"title"},x={class:"flex"},V={style:{flex:"1"},class:"margin-bottom"},y={class:"margin-bottom flex flex-items-center"},E={class:"flex"},g={style:{flex:"1"}},N={class:"margin-bottom answer-list"},w={class:"label flex flex-justify-end"},k={class:"answer-tags"},h={class:"operation"},C={key:0,class:"margin-bottom flex"},B={style:{flex:"1"}},b={key:1,class:"margin-bottom flex"},S={style:{flex:"1"}},I={class:"flex flex-justify-end"};var q=t.defineComponent({__name:"subject-text-fill",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examExpand:{type:String,required:!1},examAnswerSettingVO:{type:Object,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(q,{emit:j}){const O=q,A=j,R=t.useAttrs(),T=t.ref([{title:"",tag:"",showInput:!1}]),_=t.ref(""),L=t.ref(""),M=t.ref(),D=t.ref(""),U=t.ref(!1),F=t.ref(""),z=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],P=t.ref(["isInOrder","isIgnoreCase"]);function H(){T.value.push({title:"",tag:"",showInput:!1})}function G(){U.value=!1,F.value=""}function $(){if(_.value){if(M.value||D.value){if(!M.value)return void n.ElMessage.error("请完善答题设置!");if(!D.value)return void n.ElMessage.error("请输入问题正确答案!");if(T.value.length!==M.value)return void n.ElMessage.error("关键词个数设置有误!");const e=[];if(T.value.forEach(((t,l)=>{t.title||e.push(`关键词${l+1}未设置`)})),e.length>0)return void n.ElMessage.error(e.join(","))}A("save",{title:_.value,answers:T.value.filter((e=>e.title)).map((e=>({title:e.title}))),analysis:L.value,isSetCorrectAnswer:!!D.value,examExpand:D.value,examAnswerSettingBO:{isIgnoreCase:P.value?.includes("isIgnoreCase"),isInOrder:P.value?.includes("isInOrder"),keywordCount:M.value},examRichTextContent:U.value?F.value:""})}else n.ElMessage.error("题目标题不能为空!")}t.onMounted((function(){O.title&&(_.value=O.title),O.answerList&&O.answerList.length&&(T.value=O.answerList),O.examAnswerSettingVO&&(P.value=P.value.filter((e=>"isIgnoreCase"===e&&O.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&O.examAnswerSettingVO?.isInOrder))),O.examAnswerSettingVO?.keywordCount&&(M.value=O.examAnswerSettingVO?.keywordCount),O.examExpand&&(D.value=O.examExpand),O.analysis&&(L.value=O.analysis),O.examRichTextContent&&(F.value=O.examRichTextContent,U.value=!0)}));const J=a.useNamespace("subject-text-fill");return(a,n)=>{const q=e.ElCheckbox,j=e.ElInput,K=e.ElInputNumber,Q=e.ElCheckboxGroup,W=e.ElTag,X=e.ElIcon,Y=e.ElButton,Z=e.ElLink;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(J).e("text-fill-exam"))},[t.createVNode(r.default,{"show-edit":a.isEdit},{preview:t.withCtx((()=>[t.createElementVNode("div",s,[t.createElementVNode("div",d,[t.createElementVNode("span",u,t.toDisplayString(a.orderIndex+1)+"."+t.toDisplayString(t.unref(_))+"(问答题)",1),t.unref(U)?(t.openBlock(),t.createElementBlock("div",c,[t.createElementVNode("div",{innerHTML:t.unref(F)},null,8,m)])):t.createCommentVNode("v-if",!0),t.createElementVNode("div",f,[t.unref(T).some((e=>e.title))?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(t.unref(T),((e,l)=>(t.openBlock(),t.createBlock(q,{key:l,class:"radio",disabled:!0},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(e.title),1)])),_:2},1024)))),128)):t.createCommentVNode("v-if",!0)]),t.unref(D)?(t.openBlock(),t.createElementBlock("div",p,[t.createElementVNode("span",v,"正确答案:"+t.toDisplayString(t.unref(D)),1)])):t.createCommentVNode("v-if",!0)])])])),edit:t.withCtx((()=>[t.createElementVNode("div",x,[n[12]||(n[12]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"题目:")],-1)),t.createElementVNode("div",V,[t.createVNode(j,{modelValue:t.unref(_),"onUpdate:modelValue":n[0]||(n[0]=e=>t.isRef(_)?_.value=e:null),type:"textarea",rows:2,placeholder:"【问答题】请输入问题",maxlength:200,"show-word-limit":"",disabled:a.isSave},null,8,["modelValue","disabled"])])]),t.createElementVNode("div",y,[n[13]||(n[13]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"答题设置:")],-1)),n[14]||(n[14]=t.createElementVNode("span",null,"共答对",-1)),t.createVNode(K,{modelValue:t.unref(M),"onUpdate:modelValue":n[1]||(n[1]=e=>t.isRef(M)?M.value=e:null),style:{width:"100px",margin:"0 10px"},min:1},null,8,["modelValue"]),n[15]||(n[15]=t.createElementVNode("span",{style:{"margin-right":"10px"}},"个关键词,算是正确的",-1)),(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(z,(e=>t.createVNode(Q,{key:e.value,modelValue:t.unref(P),"onUpdate:modelValue":n[2]||(n[2]=e=>t.isRef(P)?P.value=e:null)},{default:t.withCtx((()=>[t.createVNode(q,{label:e.value,class:"margin-left-10"},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(e.label),1)])),_:2},1032,["label"])])),_:2},1032,["modelValue"]))),64))]),t.createElementVNode("div",E,[n[16]||(n[16]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"答案:")],-1)),t.createElementVNode("div",g,[t.createVNode(j,{modelValue:t.unref(D),"onUpdate:modelValue":n[3]||(n[3]=e=>t.isRef(D)?D.value=e:null),type:"textarea",rows:2,placeholder:"请输入正确答案",maxlength:200,"show-word-limit":"",disabled:a.isSave},null,8,["modelValue","disabled"])])]),t.createElementVNode("div",N,[n[17]||(n[17]=t.createElementVNode("span",{style:{"padding-left":"60px"}},"*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'",-1)),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(T),((e,n)=>(t.openBlock(),t.createElementBlock("div",{key:n,class:"answer-item flex flex-items-center"},[t.createElementVNode("div",w,[t.createElementVNode("span",null,"关键词"+t.toDisplayString(n+1)+":",1)]),t.createElementVNode("div",k,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.title.split(","),(l=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:l},[l?(t.openBlock(),t.createBlock(W,{key:0,closable:"",onClose:t=>function(e,t){if(e){const l=t.title.split(","),a=l.findIndex((t=>t===e));a>-1&&(l.splice(a,1),t.title=l.join(","))}}(l,e)},{default:t.withCtx((()=>[t.createTextVNode(t.toDisplayString(l),1)])),_:2},1032,["onClose"])):t.createCommentVNode("v-if",!0)],64)))),128)),a.isSave?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.showInput?(t.openBlock(),t.createBlock(j,{key:0,modelValue:e.tag,"onUpdate:modelValue":t=>e.tag=t,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(e)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(t.openBlock(),t.createBlock(Y,{key:1,size:"small",onClick:t=>e.showInput=!0},{default:t.withCtx((()=>[t.createVNode(X,null,{default:t.withCtx((()=>[t.createVNode(t.unref(l.Plus))])),_:1}),t.createElementVNode("span",null,t.toDisplayString(e.title?"添加同义词":"添加关键词"),1)])),_:2},1032,["onClick"]))],64))]),t.createElementVNode("div",h,[t.createVNode(X,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.CirclePlus),{class:t.normalizeClass([{disabled:a.isSave}]),onClick:H},null,8,["class"])])),_:1}),t.createVNode(X,{class:"icon"},{default:t.withCtx((()=>[t.createVNode(t.unref(l.Remove),{class:t.normalizeClass([{disabled:t.unref(T).length<2||a.isSave}]),onClick:e=>function(e){T.value.length<2||O.isSave||T.value.splice(e,1)}(n)},null,8,["class","onClick"])])),_:2},1024)])])))),128))]),a.showAnalysis?(t.openBlock(),t.createElementBlock("div",C,[n[18]||(n[18]=t.createElementVNode("div",{class:"label flex flex-justify-end"},[t.createElementVNode("span",null,"解析:")],-1)),t.createElementVNode("div",B,[t.createVNode(j,{modelValue:t.unref(L),"onUpdate:modelValue":n[4]||(n[4]=e=>t.isRef(L)?L.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):t.createCommentVNode("v-if",!0),t.unref(U)?(t.openBlock(),t.createElementBlock("div",b,[n[20]||(n[20]=t.createElementVNode("div",{class:"label flex flex-justify-center"},[t.createElementVNode("span",null,"富文本:")],-1)),t.createElementVNode("div",S,[t.createVNode(i.default,t.mergeProps({"model-value":t.unref(F),"onUpdate:modelValue":n[5]||(n[5]=e=>t.isRef(F)?F.value=e:null)},t.unref(R),{style:{width:"100%"}}),null,16,["model-value"]),t.createElementVNode("div",I,[t.createVNode(Z,{type:"danger",onClick:G},{default:t.withCtx((()=>n[19]||(n[19]=[t.createTextVNode(" 删除富文本 ")]))),_:1})])])])):t.createCommentVNode("v-if",!0)])),default:t.withCtx((()=>[a.showAction?(t.openBlock(),t.createBlock(o.default,{key:0,"is-edit":a.isEdit,"is-set":a.isSet,showOtherOption:!1,examAnswerRelationType:O.examAnswerRelationType,onMoveUp:n[6]||(n[6]=e=>A("move","up")),onMoveDown:n[7]||(n[7]=e=>A("move","down")),onDelete:n[8]||(n[8]=e=>A("delete")),onSave:$,onEdit:n[9]||(n[9]=e=>A("edit")),onAdd:n[10]||(n[10]=e=>A("add",e)),onOnShowRichText:n[11]||(n[11]=e=>U.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):t.createCommentVNode("v-if",!0)])),_:1},8,["show-edit"])],2)}}});exports.default=q;
2
2
  //# sourceMappingURL=subject-text-fill.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-text-fill.vue.cjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-text-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Plus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\n\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n isEdit: boolean\n isSet: boolean\n examExpand?: string\n examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\n keywordCount: number\n }\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n tag: string\n showInput: boolean\n}[]>([{\n title: '',\n tag: '',\n showInput: false,\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst keywordCount = ref()\nconst correct = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\n\nconst checkList = [\n {\n label: '答案不分顺序',\n value: 'isInOrder',\n },\n {\n label: '忽略大小写',\n value: 'isIgnoreCase',\n },\n]\n\nconst isCheckList = ref(['isInOrder', 'isIgnoreCase'])\n\nfunction handleAddTag(item: any) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n}\n\nfunction closeTag(tag: string, item: any) {\n if (tag) {\n const tags = item.title.split(',')\n const index = tags.findIndex((i: string) => i === tag)\n if (index > -1) {\n tags.splice(index, 1)\n item.title = tags.join(',')\n }\n }\n}\n\nfunction addAnswer() {\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 2 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n\n if (keywordCount.value || correct.value) {\n if (!keywordCount.value) {\n ElMessage.error('请完善答题设置!')\n return\n }\n\n if (!correct.value) {\n ElMessage.error('请输入问题正确答案!')\n return\n }\n\n if (answers.value.length !== keywordCount.value) {\n ElMessage.error('关键词个数设置有误!')\n return\n }\n const msg: string[] = []\n answers.value.forEach((item, index) => {\n if (!item.title) {\n msg.push(`关键词${index + 1}未设置`)\n }\n })\n if (msg.length > 0) {\n ElMessage.error(msg.join(','))\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.filter((i: any) => i.title).map((item: any) => {\n return { title: item.title }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: !!correct.value,\n examExpand: correct.value,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n ...{ keywordCount: keywordCount.value },\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.examAnswerSettingVO) {\n // 仅保留与设置匹配的选项\n isCheckList.value = isCheckList.value.filter(item =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\n )\n }\n\n if (props.examAnswerSettingVO?.keywordCount) {\n keywordCount.value = props.examAnswerSettingVO?.keywordCount\n }\n\n if (props.examExpand) {\n correct.value = props.examExpand\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-text-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('text-fill-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div class=\"content\">\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(问答题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"content flex flex-col\">\n <template v-if=\"answers.some(item => item.title)\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n {{ item.title }}\n </el-checkbox>\n </template>\n </div>\n <div\n v-if=\"correct\"\n class=\"flex\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:{{ correct }}</span>\n </div>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\" class=\"margin-bottom\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"【问答题】请输入问题\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>答题设置:</span>\n </div>\n <span>共答对</span>\n <el-input-number\n v-model=\"keywordCount\"\n style=\"width: 100px;margin: 0 10px;\"\n :min=\"1\"\n />\n <span style=\"margin-right: 10px;\">个关键词,算是正确的</span>\n <el-checkbox-group\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <el-checkbox :label=\"item.value\" class=\"margin-left-10\">\n {{ item.label }}\n </el-checkbox>\n </el-checkbox-group>\n </div>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"correct\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入正确答案\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom answer-list\">\n <span style=\"padding-left: 60px;\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>关键词{{ index + 1 }}:</span>\n </div>\n\n <div class=\"answer-tags\">\n <template\n v-for=\"i in item.title.split(',')\"\n :key=\"i\"\n >\n <el-tag\n v-if=\"i\"\n closable\n @close=\"closeTag(i, item)\"\n >\n {{ i }}\n </el-tag>\n </template>\n <template v-if=\"!isSave\">\n <el-input\n v-if=\"item.showInput\"\n v-model=\"item.tag\"\n style=\"width: 80px;\"\n @blur=\"() => handleAddTag(item)\"\n />\n <el-button\n v-else\n size=\"small\"\n @click=\"item.showInput = true\"\n >\n <el-icon><Plus /></el-icon>\n <span>{{ item.title ? '添加同义词' : '添加关键词' }}</span>\n </el-button>\n </template>\n </div>\n <div class=\"operation\">\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 2 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n <div v-if=\"showAnalysis\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-end\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"type => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","tag","showInput","analysis","keywordCount","correct","showRichText","richText","checkList","label","value","isCheckList","addAnswer","push","deleteRichText","save","ElMessage","error","length","msg","forEach","item","index","join","filter","i","map","isSetCorrectAnswer","examExpand","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","onMounted","answerList","examAnswerSettingVO","ns","useNamespace","tags","split","findIndex","splice","isSave"],"mappings":"yoDAQA,MAAMA,EAAQC,EAmBRC,EAAQC,EAERC,EAAQC,EAAAA,WAERC,EAAUC,EAAAA,IAIX,CAAC,CACJC,MAAO,GACPC,IAAK,GACLC,WAAW,KAGPF,EAAQD,MAAI,IACZI,EAAWJ,MAAI,IACfK,EAAeL,EAAAA,MACfM,EAAUN,MAAI,IACdO,EAAeP,OAAI,GACnBQ,EAAWR,MAAI,IAEfS,EAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,EAAcZ,EAAAA,IAAI,CAAC,YAAa,iBAqBtC,SAASa,IACPd,EAAQY,MA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AAqBN,cAC1C,cAATT,GAAwB7B,EAAM4C,qBAAqBJ,aAIvDxC,EAAM4C,qBAAqBhC,eAChBA,EAAAM,MAAQlB,EAAM4C,qBAAqBhC,cAG9CZ,EAAMoC,aACRvB,EAAQK,MAAQlB,EAAMoC,YAGpBpC,EAAMW,WACRA,EAASO,MAAQlB,EAAMW,UAGrBX,EAAMyC,sBACR1B,EAASG,MAAQlB,EAAMyC,oBACvB3B,EAAaI,OAAQ,EACvB,IAII,MAAA2B,EAAKC,eAAa,wgHArHf,SAASrC,EAAaoB,GAC7B,GAAIpB,EAAK,CACP,MAAMsC,EAAOlB,EAAKrB,MAAMwC,MAAM,KACxBlB,EAAQiB,EAAKE,WAAWhB,GAAcA,IAAMxB,IAC9CqB,GAAQ,IACLiB,EAAAG,OAAOpB,EAAO,GACdD,EAAArB,MAAQuC,EAAKhB,KAAK,KACzB,CACF,yXAhBF,SAAsBF,GACpBA,EAAKnB,WAAY,EACbmB,EAAKpB,MACPoB,EAAKrB,MAAQqB,EAAKrB,MAAQ,CAACqB,EAAKrB,MAAOqB,EAAKpB,KAAKsB,KAAK,KAAOF,EAAKpB,IAClEoB,EAAKpB,IAAM,GACb,kuBAsBF,SAAsBqB,GAChBxB,EAAQY,MAAMQ,OAAS,GAAK1B,EAAMmD,QAG9B7C,EAAAY,MAAMgC,OAAOpB,EAAO,EAAC"}
1
+ {"version":3,"file":"subject-text-fill.vue.cjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-text-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Plus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\n\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n isEdit: boolean\n isSet: boolean\n examExpand?: string\n examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\n keywordCount: number\n }\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n tag: string\n showInput: boolean\n}[]>([{\n title: '',\n tag: '',\n showInput: false,\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst keywordCount = ref()\nconst correct = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\n\nconst checkList = [\n {\n label: '答案不分顺序',\n value: 'isInOrder',\n },\n {\n label: '忽略大小写',\n value: 'isIgnoreCase',\n },\n]\n\nconst isCheckList = ref(['isInOrder', 'isIgnoreCase'])\n\nfunction handleAddTag(item: any) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n}\n\nfunction closeTag(tag: string, item: any) {\n if (tag) {\n const tags = item.title.split(',')\n const index = tags.findIndex((i: string) => i === tag)\n if (index > -1) {\n tags.splice(index, 1)\n item.title = tags.join(',')\n }\n }\n}\n\nfunction addAnswer() {\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 2 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n\n if (keywordCount.value || correct.value) {\n if (!keywordCount.value) {\n ElMessage.error('请完善答题设置!')\n return\n }\n\n if (!correct.value) {\n ElMessage.error('请输入问题正确答案!')\n return\n }\n\n if (answers.value.length !== keywordCount.value) {\n ElMessage.error('关键词个数设置有误!')\n return\n }\n const msg: string[] = []\n answers.value.forEach((item, index) => {\n if (!item.title) {\n msg.push(`关键词${index + 1}未设置`)\n }\n })\n if (msg.length > 0) {\n ElMessage.error(msg.join(','))\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.filter((i: any) => i.title).map((item: any) => {\n return { title: item.title }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: !!correct.value,\n examExpand: correct.value,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n ...{ keywordCount: keywordCount.value },\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.examAnswerSettingVO) {\n // 仅保留与设置匹配的选项\n isCheckList.value = isCheckList.value.filter(item =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\n )\n }\n\n if (props.examAnswerSettingVO?.keywordCount) {\n keywordCount.value = props.examAnswerSettingVO?.keywordCount\n }\n\n if (props.examExpand) {\n correct.value = props.examExpand\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-text-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('text-fill-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div class=\"content\">\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(问答题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"content flex flex-col\">\n <template v-if=\"answers.some(item => item.title)\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n {{ item.title }}\n </el-checkbox>\n </template>\n </div>\n <div\n v-if=\"correct\"\n class=\"flex\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:{{ correct }}</span>\n </div>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\" class=\"margin-bottom\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"【问答题】请输入问题\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>答题设置:</span>\n </div>\n <span>共答对</span>\n <el-input-number\n v-model=\"keywordCount\"\n style=\"width: 100px;margin: 0 10px;\"\n :min=\"1\"\n />\n <span style=\"margin-right: 10px;\">个关键词,算是正确的</span>\n <el-checkbox-group\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <el-checkbox :label=\"item.value\" class=\"margin-left-10\">\n {{ item.label }}\n </el-checkbox>\n </el-checkbox-group>\n </div>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"correct\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入正确答案\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom answer-list\">\n <span style=\"padding-left: 60px;\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>关键词{{ index + 1 }}:</span>\n </div>\n\n <div class=\"answer-tags\">\n <template\n v-for=\"i in item.title.split(',')\"\n :key=\"i\"\n >\n <el-tag\n v-if=\"i\"\n closable\n @close=\"closeTag(i, item)\"\n >\n {{ i }}\n </el-tag>\n </template>\n <template v-if=\"!isSave\">\n <el-input\n v-if=\"item.showInput\"\n v-model=\"item.tag\"\n style=\"width: 80px;\"\n @blur=\"() => handleAddTag(item)\"\n />\n <el-button\n v-else\n size=\"small\"\n @click=\"item.showInput = true\"\n >\n <el-icon><Plus /></el-icon>\n <span>{{ item.title ? '添加同义词' : '添加关键词' }}</span>\n </el-button>\n </template>\n </div>\n <div class=\"operation\">\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 2 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n <div v-if=\"showAnalysis\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-end\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"type => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","tag","showInput","analysis","keywordCount","correct","showRichText","richText","checkList","label","value","isCheckList","addAnswer","push","deleteRichText","save","ElMessage","error","length","msg","forEach","item","index","join","filter","i","map","isSetCorrectAnswer","examExpand","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","onMounted","answerList","examAnswerSettingVO","ns","useNamespace","tags","split","findIndex","splice","isSave"],"mappings":"mnDAQA,MAAMA,EAAQC,EAmBRC,EAAQC,EAERC,EAAQC,EAAAA,WAERC,EAAUC,EAAAA,IAIX,CAAC,CACJC,MAAO,GACPC,IAAK,GACLC,WAAW,KAGPF,EAAQD,MAAI,IACZI,EAAWJ,MAAI,IACfK,EAAeL,EAAAA,MACfM,EAAUN,MAAI,IACdO,EAAeP,OAAI,GACnBQ,EAAWR,MAAI,IAEfS,EAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,EAAcZ,EAAAA,IAAI,CAAC,YAAa,iBAqBtC,SAASa,IACPd,EAAQY,MAAMG,KAAK,CACjBb,MAAO,GACPC,IAAK,GACLC,WAAW,GACZ,CAUH,SAASY,IACPR,EAAaI,OAAQ,EACrBH,EAASG,MAAQ,EAAA,CAGnB,SAASK,IACH,GAACf,EAAMU,MAAP,CAKA,GAAAN,EAAaM,OAASL,EAAQK,MAAO,CACnC,IAACN,EAAaM,MAEhB,YADAM,EAAAA,UAAUC,MAAM,YAId,IAACZ,EAAQK,MAEX,YADAM,EAAAA,UAAUC,MAAM,cAIlB,GAAInB,EAAQY,MAAMQ,SAAWd,EAAaM,MAExC,YADAM,EAAAA,UAAUC,MAAM,cAGlB,MAAME,EAAgB,GAMlB,GALJrB,EAAQY,MAAMU,SAAQ,CAACC,EAAMC,KACtBD,EAAKrB,OACRmB,EAAIN,KAAK,MAAMS,EAAQ,OAAM,IAG7BH,EAAID,OAAS,EAEf,YADAF,EAAAA,UAAUC,MAAME,EAAII,KAAK,KAE3B,CAGF7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AKnB,WAAY,EACbmB,EAAKpB,MACPoB,EAAKrB,MAAQqB,EAAKrB,MAAQ,CAACqB,EAAKrB,MAAOqB,EAAKpB,KAAKsB,KAAK,KAAOF,EAAKpB,IAClEoB,EAAKpB,IAAM,GACb,kuBAsBF,SAAsBqB,GAChBxB,EAAQY,MAAMQ,OAAS,GAAK1B,EAAMmD,QAG9B7C,EAAAY,MAAMgC,OAAOpB,EAAO,EAAC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("./components/subject-blank-fill.vue.cjs"),n=require("./components/subject-scale.vue.cjs"),s=require("./components/subject-single.vue.cjs"),i=require("./components/subject-text-fill.vue.cjs"),a=require("./components/SubjectRichText.vue.cjs"),o=require("./components/SubjectPageEnd.vue.cjs"),l=require("@qxs-bns/hooks"),r=require("@qxs-bns/utils"),c=require("vue-demi"),d=require("element-plus/es");const u={class:"subject-list-wrapper"};var x=e.defineComponent({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(x,{expose:p,emit:m}){const w=x,v=c.ref([]),y=m,h=c.useAttrs();function f(){let e=0,t=!1;return v.value.map(((n,s,i)=>{"page_end"===n.answerType&&(e++,t=s===i.length-1)})),t?e:e+1}function T(e,t,n){console.log(t,"index"),t||0===t?v.value.splice(t+1,0,{customId:r.setGuid(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:n}):v.value.push({customId:r.setGuid(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:n})}function A(e,t){if("up"===t&&e>0){const[t]=v.value.splice(e,1);v.value.splice(e-1,0,t)}else if("down"===t&&e<v.value.length-1){const[t]=v.value.splice(e,1);v.value.splice(e+1,0,t)}}function E(e,t){for(let n=0;n<v.value.length;n++)e===n&&(v.value[e]={...v.value[e],...t,isEdit:!1,examAnswerRelationType:t.examAnswerRelationType})}function R(e){v.value.splice(e,1),d.ElMessage.success("删除成功")}function k(e,t){y("setRelation",e,t)}p({addSubject:T,currentList:v,uploadExcel:function(e){v.value=v.value.concat(e)},addExam:function(e){const t=[];e.answers?.map((e=>{t.push({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect})})),v.value.push({...e,customId:r.setGuid(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:t,isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1})},setAnswerRelation:function(e,t,n){console.log(e,t,n,111),console.log(v.value,222),e.length&&v.value.forEach((s=>{s.customId===t&&s.answer.forEach((t=>{t.customAnswerId===n&&(t.answerRelations=e)}))}))}}),c.watch((()=>w.subjectList),(e=>{e&&(v.value=[...e])}),{immediate:!0});const S=l.useNamespace("subject-list");return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(S).e("list-exam"))},[e.createElementVNode("div",u,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v),((r,c)=>(e.openBlock(),e.createElementBlock("div",{key:c+r.examId||r.title},[["single","multiple","sort"].includes(r.answerType)?(e.openBlock(),e.createBlock(s.default,e.mergeProps({key:0,ref_for:!0},e.unref(h),{"order-index":c,title:r.title,type:r.answerType,"exam-id":r.examId,isKey:r.isKey,"is-save":!r.isRealCanDel,customId:r.customId,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"least-answer-count":r.leastAnswerCount,"is-edit":r.isEdit||!1,"show-action":!l.isPreview,"exam-expand":r.examExpand,answerCheckType:r.answerCheckType,"exam-rich-text-content":r.examRichTextContent,examAnswerRelationType:r.examAnswerRelationType,onSetRelation:k,onMove:e=>A(c,e),onDelete:e=>R(c),onSave:e=>E(c,e),onEdit:e=>r.isEdit=!0,onAdd:(e,t)=>T(e,c,t)}),null,16,["order-index","title","type","exam-id","isKey","is-save","customId","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answerCheckType","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===r.answerType?(e.openBlock(),e.createBlock(n.default,e.mergeProps({key:1,ref_for:!0},e.unref(h),{"order-index":c,title:r.title,"is-save":!r.isRealCanDel,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"is-edit":r.isEdit||!1,"scale-question-list":r.scaleQuestionList,"show-action":!l.isPreview,"exam-rich-text-content":r.examRichTextContent,examAnswerRelationType:r.examAnswerRelationType,onMove:e=>A(c,e),onDelete:e=>R(c),onSave:e=>E(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","is-edit","scale-question-list","show-action","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===r.answerType?(e.openBlock(),e.createBlock(t.default,e.mergeProps({key:2,ref_for:!0},e.unref(h),{"order-index":c,title:r.title,"is-save":!r.isRealCanDel,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"show-action":!l.isPreview,"is-edit":r.isEdit||!1,"exam-answer-setting-v-o":r.examAnswerSettingVO||{},"exam-rich-text-content":r.examRichTextContent,examAnswerRelationType:r.examAnswerRelationType,onMove:e=>A(c,e),onDelete:e=>R(c),onSave:e=>E(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-answer-setting-v-o","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===r.answerType?(e.openBlock(),e.createBlock(i.default,e.mergeProps({key:3,ref_for:!0},e.unref(h),{"order-index":c,title:r.title,"is-save":!r.isRealCanDel,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"show-action":!l.isPreview,"is-edit":r.isEdit||!1,"exam-expand":r.examExpand,"exam-answer-setting-v-o":r.examAnswerSettingVO||{},examAnswerRelationType:r.examAnswerRelationType,"exam-rich-text-content":r.examRichTextContent,onMove:e=>A(c,e),onDelete:e=>R(c),onSave:e=>E(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-expand","exam-answer-setting-v-o","examAnswerRelationType","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===r.answerType?(e.openBlock(),e.createBlock(a.default,e.mergeProps({key:4,ref_for:!0},e.unref(h),{"order-index":c,richTextContent:r.richTextContent,"is-set":r.hasSet||!1,"is-save":!r.isRealCanDel,"is-edit":r.isEdit||!1,"show-action":!l.isPreview,onMove:e=>A(c,e),onDelete:e=>R(c),examAnswerRelationType:r.examAnswerRelationType,onSave:e=>E(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","richTextContent","is-set","is-save","is-edit","show-action","onMove","onDelete","examAnswerRelationType","onSave","onEdit","onAdd"])):"page_end"===r.answerType?(e.openBlock(),e.createBlock(o.default,{"total-page":f(),key:c,"current-page-index":(e=>{const t=v.value.filter((e=>"page_end"===e.answerType));let n=0;return t.forEach(((t,s)=>{e===t.id&&(n=s+1)})),n})(r.id),item:r,"order-index":c,"is-edit":r.isEdit||!1,"is-set":r.hasSet||!1,"is-save":!r.isRealCanDel,examAnswerRelationType:r.examAnswerRelationType,onMove:e=>A(c,e),onDelete:e=>R(c),onSave:e=>E(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)},null,8,["total-page","current-page-index","item","order-index","is-edit","is-set","is-save","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):e.createCommentVNode("v-if",!0)])))),128))])],2))}});exports.default=x;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("./components/subject-blank-fill.vue.cjs"),n=require("./components/subject-scale.vue.cjs"),s=require("./components/subject-single.vue.cjs"),i=require("./components/subject-text-fill.vue.cjs"),a=require("./components/SubjectRichText.vue.cjs"),o=require("./components/SubjectPageEnd.vue.cjs"),l=require("@qxs-bns/hooks"),r=require("@qxs-bns/utils"),c=require("element-plus/es");const d={class:"subject-list-wrapper"};var u=e.defineComponent({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(u,{expose:p,emit:x}){const m=u,w=e.ref([]),v=x,y=e.useAttrs();function h(){let e=0,t=!1;return w.value.map(((n,s,i)=>{"page_end"===n.answerType&&(e++,t=s===i.length-1)})),t?e:e+1}function T(e,t,n){console.log(t,"index"),t||0===t?w.value.splice(t+1,0,{customId:r.setGuid(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:n}):w.value.push({customId:r.setGuid(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:n})}function f(e,t){if("up"===t&&e>0){const[t]=w.value.splice(e,1);w.value.splice(e-1,0,t)}else if("down"===t&&e<w.value.length-1){const[t]=w.value.splice(e,1);w.value.splice(e+1,0,t)}}function A(e,t){for(let n=0;n<w.value.length;n++)e===n&&(w.value[e]={...w.value[e],...t,isEdit:!1,examAnswerRelationType:t.examAnswerRelationType})}function R(e){w.value.splice(e,1),c.ElMessage.success("删除成功")}function E(e,t){v("setRelation",e,t)}p({addSubject:T,currentList:w,uploadExcel:function(e){w.value=w.value.concat(e)},addExam:function(e){const t=[];e.answers?.map((e=>{t.push({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect})})),w.value.push({...e,customId:r.setGuid(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:t,isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1})},setAnswerRelation:function(e,t,n){e.length&&w.value?.map((s=>{s.customId===t&&s.answers?.map((t=>{t.customAnswerId===n&&(t.answerRelations=e)}))}))}}),e.watch((()=>m.subjectList),(e=>{e&&(w.value=[...e])}),{immediate:!0});const k=l.useNamespace("subject-list");return(l,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(k).e("list-exam"))},[e.createElementVNode("div",d,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),((r,c)=>(e.openBlock(),e.createElementBlock("div",{key:c+r.examId||r.title},[["single","multiple","sort"].includes(r.answerType)?(e.openBlock(),e.createBlock(s.default,e.mergeProps({key:0,ref_for:!0},e.unref(y),{"order-index":c,title:r.title,type:r.answerType,"exam-id":r.examId,isKey:r.isKey,"is-save":!r.isRealCanDel,customId:r.customId,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"least-answer-count":r.leastAnswerCount,"is-edit":r.isEdit||!1,"show-action":!l.isPreview,"exam-expand":r.examExpand,answerCheckType:r.answerCheckType,"exam-rich-text-content":r.examRichTextContent,examAnswerRelationType:r.examAnswerRelationType,onSetRelation:E,onMove:e=>f(c,e),onDelete:e=>R(c),onSave:e=>A(c,e),onEdit:e=>r.isEdit=!0,onAdd:(e,t)=>T(e,c,t)}),null,16,["order-index","title","type","exam-id","isKey","is-save","customId","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answerCheckType","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===r.answerType?(e.openBlock(),e.createBlock(n.default,e.mergeProps({key:1,ref_for:!0},e.unref(y),{"order-index":c,title:r.title,"is-save":!r.isRealCanDel,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"is-edit":r.isEdit||!1,"scale-question-list":r.scaleQuestionList,"show-action":!l.isPreview,"exam-rich-text-content":r.examRichTextContent,examAnswerRelationType:r.examAnswerRelationType,onMove:e=>f(c,e),onDelete:e=>R(c),onSave:e=>A(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","is-edit","scale-question-list","show-action","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===r.answerType?(e.openBlock(),e.createBlock(t.default,e.mergeProps({key:2,ref_for:!0},e.unref(y),{"order-index":c,title:r.title,"is-save":!r.isRealCanDel,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"show-action":!l.isPreview,"is-edit":r.isEdit||!1,"exam-answer-setting-v-o":r.examAnswerSettingVO||{},"exam-rich-text-content":r.examRichTextContent,examAnswerRelationType:r.examAnswerRelationType,onMove:e=>f(c,e),onDelete:e=>R(c),onSave:e=>A(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-answer-setting-v-o","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===r.answerType?(e.openBlock(),e.createBlock(i.default,e.mergeProps({key:3,ref_for:!0},e.unref(y),{"order-index":c,title:r.title,"is-save":!r.isRealCanDel,"is-set":r.hasSet||!1,"answer-list":r.answers,analysis:r.analysis,"show-action":!l.isPreview,"is-edit":r.isEdit||!1,"exam-expand":r.examExpand,"exam-answer-setting-v-o":r.examAnswerSettingVO||{},examAnswerRelationType:r.examAnswerRelationType,"exam-rich-text-content":r.examRichTextContent,onMove:e=>f(c,e),onDelete:e=>R(c),onSave:e=>A(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-expand","exam-answer-setting-v-o","examAnswerRelationType","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===r.answerType?(e.openBlock(),e.createBlock(a.default,e.mergeProps({key:4,ref_for:!0},e.unref(y),{"order-index":c,richTextContent:r.richTextContent,"is-set":r.hasSet||!1,"is-save":!r.isRealCanDel,"is-edit":r.isEdit||!1,"show-action":!l.isPreview,onMove:e=>f(c,e),onDelete:e=>R(c),examAnswerRelationType:r.examAnswerRelationType,onSave:e=>A(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)}),null,16,["order-index","richTextContent","is-set","is-save","is-edit","show-action","onMove","onDelete","examAnswerRelationType","onSave","onEdit","onAdd"])):"page_end"===r.answerType?(e.openBlock(),e.createBlock(o.default,{"total-page":h(),key:c,"current-page-index":(e=>{const t=w.value.filter((e=>"page_end"===e.answerType));let n=0;return t?.forEach(((t,s)=>{e===t.id&&(n=s+1)})),n})(r.id),item:r,"order-index":c,"is-edit":r.isEdit||!1,"is-set":r.hasSet||!1,"is-save":!r.isRealCanDel,examAnswerRelationType:r.examAnswerRelationType,onMove:e=>f(c,e),onDelete:e=>R(c),onSave:e=>A(c,e),onEdit:e=>r.isEdit=!0,onAdd:e=>T(e,c,null)},null,8,["total-page","current-page-index","item","order-index","is-edit","is-set","is-save","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):e.createCommentVNode("v-if",!0)])))),128))])],2))}});exports.default=u;
2
2
  //# sourceMappingURL=subject-list.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-list.vue.cjs","sources":["../../../../../../packages/components/src/subject-list/src/subject-list.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// import isEqual from 'lodash/isEqual'\nimport SubjectBlankFill from './components/subject-blank-fill.vue'\nimport SubjectScale from './components/subject-scale.vue'\nimport SubjectSingle from './components/subject-single.vue'\nimport SubjectTextFill from './components/subject-text-fill.vue'\nimport SubjectRichText from './components/SubjectRichText.vue'\nimport SubjectPageEnd from './components/SubjectPageEnd.vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { setGuid } from '@qxs-bns/utils'\n\ndefineOptions({\n name: 'QxsSubjectList',\n})\n\nconst props = defineProps<{\n subjectList: any[]\n isPreview: boolean\n}>()\nconst currentList = ref([] as any)\nconst emits = defineEmits(['setRelation'])\n\nconst attrs = useAttrs()\n\ndefineExpose({\n addSubject,\n currentList,\n uploadExcel,\n addExam,\n setAnswerRelation,\n})\n\nfunction totalPageIndex() {\n let totalPageIndex = 0\n let isLastPageIndex = false\n currentList.value.map((v: any, i: number, arr: any) => {\n if (v.answerType === 'page_end') {\n totalPageIndex++\n isLastPageIndex = i === arr.length - 1\n }\n })\n // 假设最后是一个分页器认为是最后一页\n return isLastPageIndex ? totalPageIndex : totalPageIndex + 1\n}\n\nfunction currentPageIndex() {\n return (currentId: any) => {\n const currentPageList = currentList.value.filter(\n (v: any) => v.answerType === 'page_end'\n )\n let currentIndex = 0\n currentPageList.forEach((c: any, i: number) => {\n if (currentId === c.id) {\n currentIndex = i + 1\n }\n })\n return currentIndex\n }\n}\n\nfunction addSubject(type: string, index: number, examAnswerRelationType: number | null) {\n console.log(index, 'index')\n if (index || index === 0) {\n currentList.value.splice(index + 1, 0, {\n customId: setGuid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n else {\n currentList.value.push({\n customId: setGuid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n}\n\nfunction addExam(item: any) {\n const answerList: any[] = []\n item.answers?.map((v: any) => {\n answerList.push({\n ...v,\n title: v.answer,\n answerId: v.examAnswerId,\n isCorrect: v.isCorrect,\n })\n })\n currentList.value.push({\n ...item,\n customId: setGuid(),\n answerType: item.richTextContent ? 'rich_text' : item.examTypeEnum,\n answers: answerList,\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n })\n}\nfunction uploadExcel(list: any[]) {\n currentList.value = currentList.value.concat(list)\n}\n\nfunction move(index: number, type: 'up' | 'down') {\n if (type === 'up' && index > 0) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index - 1, 0, item)\n }\n else if (type === 'down' && index < currentList.value.length - 1) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index + 1, 0, item)\n }\n}\n\nfunction saveSubject(index: number, item: any) {\n for (let idx = 0; idx < currentList.value.length; idx++) {\n if (index === idx) {\n currentList.value[index] =\n {\n ...currentList.value[index],\n ...item,\n isEdit: false,\n examAnswerRelationType: item.examAnswerRelationType,\n }\n }\n }\n}\n\nfunction deleteSubject(index: number) {\n currentList.value.splice(index, 1)\n ElMessage.success('删除成功')\n}\n\nfunction setRelation(customId: number, examAnswers: any) {\n emits('setRelation', customId, examAnswers)\n}\n\nfunction setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string,) {\n // 给examId设置答案关联\n console.log(answerRelations, customId, customAnswerId, 111);\n console.log(currentList.value, 222);\n if (answerRelations.length) {\n currentList.value.forEach((c: any) => {\n if (c.customId === customId) {\n c.answer.forEach((c: any) => {\n if (c.customAnswerId === customAnswerId) {\n c.answerRelations = answerRelations\n }\n })\n }\n })\n }\n}\nwatch(() => props.subjectList, (newList: any) => {\n if (newList) {\n currentList.value = [...newList]\n }\n}, { immediate: true })\nconst ns = useNamespace('subject-list')\n</script>\n\n<template>\n <div :class=\"ns.e('list-exam')\">\n <div class=\"subject-list-wrapper\">\n <div v-for=\"(item, index) in currentList\" :key=\"index + item.examId || item.title\">\n <template v-if=\"['single', 'multiple', 'sort'].includes(item.answerType)\">\n <SubjectSingle \n v-bind=\"attrs\" \n :order-index=\"index\" \n :title=\"item.title\" \n :type=\"item.answerType\"\n :exam-id=\"item.examId\"\n :isKey=\"item.isKey\" \n :is-save=\"!item.isRealCanDel\" \n :customId=\"item.customId\" \n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\" \n :analysis=\"item.analysis\" \n :least-answer-count=\"item.leastAnswerCount\"\n :is-edit=\"item.isEdit || false\" \n :show-action=\"!isPreview\" \n :exam-expand=\"item.examExpand\"\n :answerCheckType=\"item.answerCheckType\" \n :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\"\n @setRelation=\"setRelation\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string, examAnswerRelationType: number) => addSubject(type, index, examAnswerRelationType)\" />\n </template>\n <SubjectScale v-bind=\"attrs\" v-else-if=\"item.answerType === 'scale'\" :order-index=\"index\" :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :is-edit=\"item.isEdit || false\" :scale-question-list=\"item.scaleQuestionList\"\n :show-action=\"!isPreview\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectBlankFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'blank_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectTextFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'text_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-expand=\"item.examExpand\" :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" :exam-rich-text-content=\"item.examRichTextContent\"\n @move=\"(type: 'up' | 'down') => move(index, type)\" @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectRichText v-bind=\"attrs\" v-else-if=\"item.answerType === 'rich_text'\" :order-index=\"index\"\n :richTextContent=\"item.richTextContent\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :is-edit=\"item.isEdit || false\" :show-action=\"!isPreview\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" :examAnswerRelationType=\"item.examAnswerRelationType\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectPageEnd v-else-if=\"item.answerType === 'page_end'\" :total-page=\"totalPageIndex()\" :key=\"index\"\n :current-page-index=\"currentPageIndex()(item.id)\" :item=\"item\" :order-index=\"index\"\n :is-edit=\"item.isEdit || false\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","currentList","ref","emits","__emit","attrs","useAttrs","totalPageIndex","isLastPageIndex","value","map","v","i","arr","answerType","length","addSubject","type","index","examAnswerRelationType","console","log","splice","customId","setGuid","analysis","scaleQuestionList","isSave","isEdit","isRealCanDel","hasSet","push","move","item","saveSubject","idx","deleteSubject","ElMessage","success","setRelation","examAnswers","__expose","uploadExcel","list","concat","addExam","answerList","answers","title","answer","answerId","examAnswerId","isCorrect","richTextContent","examTypeEnum","setAnswerRelation","answerRelations","customAnswerId","forEach","c","watch","subjectList","newList","immediate","ns","useNamespace","currentId","currentPageList","filter","currentIndex","id"],"mappings":"guBAeA,MAAMA,EAAQC,EAIRC,EAAcC,EAAIA,IAAA,IAClBC,EAAQC,EAERC,EAAQC,EAAAA,WAUd,SAASC,IACP,IAAIA,EAAiB,EACjBC,GAAkB,EAQf,OAPPP,EAAYQ,MAAMC,KAAI,CAACC,EAAQC,EAAWC,KACnB,aAAjBF,EAAEG,aACJP,IACkBC,EAAAI,IAAMC,EAAIE,OAAS,EAAA,IAIlCP,EAAkBD,EAAiBA,EAAiB,CAAA,CAkBpD,SAAAS,EAAWC,EAAcC,EAAeC,GACvCC,QAAAC,IAAIH,EAAO,SACfA,GAAmB,IAAVA,EACXjB,EAAYQ,MAAMa,OAAOJ,EAAQ,EAAG,EAAG,CACrCK,SAAUC,EAAAA,UACVV,WAAYG,EACZQ,SAAU,GACVC,kBAAmB,GACnBC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRX,2BAIFlB,EAAYQ,MAAMsB,KAAK,CACrBR,SAAUC,EAAAA,UACVV,WAAYG,EACZQ,SAAU,GACVC,kBAAmB,GACnBC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRX,0BAEJ,CA4BO,SAAAa,EAAKd,EAAeD,GACvB,GAAS,OAATA,GAAiBC,EAAQ,EAAG,CAC9B,MAAOe,GAAQhC,EAAYQ,MAAMa,OAAOJ,EAAO,GAC/CjB,EAAYQ,MAAMa,OAAOJ,EAAQ,EAAG,EAAGe,EAAI,SAE3B,SAAThB,GAAmBC,EAAQjB,EAAYQ,MAAMM,OAAS,EAAG,CAChE,MAAOkB,GAAQhC,EAAYQ,MAAMa,OA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AAM,IAAM7D,EAAM8D,cAAcC,IAC1BA,IACU7D,EAAAQ,MAAQ,IAAIqD,GAAO,GAEhC,CAAEC,WAAW,IACV,MAAAC,EAAKC,eAAa,goIA5Hf,CAACC,IACA,MAAAC,EAAkBlE,EAAYQ,MAAM2D,QACvCzD,GAA4B,aAAjBA,EAAEG,aAEhB,IAAIuD,EAAe,EAMZ,OALSF,EAAAT,SAAQ,CAACC,EAAQ/C,KAC3BsD,IAAcP,EAAEW,KAClBD,EAAezD,EAAI,EAAA,IAGhByD,CAAA"}
1
+ {"version":3,"file":"subject-list.vue.cjs","sources":["../../../../../../packages/components/src/subject-list/src/subject-list.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// import isEqual from 'lodash/isEqual'\nimport SubjectBlankFill from './components/subject-blank-fill.vue'\nimport SubjectScale from './components/subject-scale.vue'\nimport SubjectSingle from './components/subject-single.vue'\nimport SubjectTextFill from './components/subject-text-fill.vue'\nimport SubjectRichText from './components/SubjectRichText.vue'\nimport SubjectPageEnd from './components/SubjectPageEnd.vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { setGuid } from '@qxs-bns/utils'\n\ndefineOptions({\n name: 'QxsSubjectList',\n})\n\nconst props = defineProps<{\n subjectList: any[]\n isPreview: boolean\n}>()\nconst currentList = ref([] as any)\nconst emits = defineEmits(['setRelation'])\n\nconst attrs = useAttrs()\n\ndefineExpose({\n addSubject,\n currentList,\n uploadExcel,\n addExam,\n setAnswerRelation,\n})\n\nfunction totalPageIndex() {\n let totalPageIndex = 0\n let isLastPageIndex = false\n currentList.value.map((v: any, i: number, arr: any) => {\n if (v.answerType === 'page_end') {\n totalPageIndex++\n isLastPageIndex = i === arr.length - 1\n }\n })\n // 假设最后是一个分页器认为是最后一页\n return isLastPageIndex ? totalPageIndex : totalPageIndex + 1\n}\n\nfunction currentPageIndex() {\n return (currentId: any) => {\n const currentPageList = currentList.value.filter(\n (v: any) => v.answerType === 'page_end'\n )\n let currentIndex = 0\n currentPageList?.forEach((c: any, i: number) => {\n if (currentId === c.id) {\n currentIndex = i + 1\n }\n })\n return currentIndex\n }\n}\n\nfunction addSubject(type: string, index: number, examAnswerRelationType: number | null) {\n console.log(index, 'index')\n if (index || index === 0) {\n currentList.value.splice(index + 1, 0, {\n customId: setGuid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n else {\n currentList.value.push({\n customId: setGuid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n}\n\nfunction addExam(item: any) {\n const answerList: any[] = []\n item.answers?.map((v: any) => {\n answerList.push({\n ...v,\n title: v.answer,\n answerId: v.examAnswerId,\n isCorrect: v.isCorrect,\n })\n })\n currentList.value.push({\n ...item,\n customId: setGuid(),\n answerType: item.richTextContent ? 'rich_text' : item.examTypeEnum,\n answers: answerList,\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n })\n}\nfunction uploadExcel(list: any[]) {\n currentList.value = currentList.value.concat(list)\n}\n\nfunction move(index: number, type: 'up' | 'down') {\n if (type === 'up' && index > 0) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index - 1, 0, item)\n }\n else if (type === 'down' && index < currentList.value.length - 1) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index + 1, 0, item)\n }\n}\n\nfunction saveSubject(index: number, item: any) {\n for (let idx = 0; idx < currentList.value.length; idx++) {\n if (index === idx) {\n currentList.value[index] =\n {\n ...currentList.value[index],\n ...item,\n isEdit: false,\n examAnswerRelationType: item.examAnswerRelationType,\n }\n }\n }\n}\n\nfunction deleteSubject(index: number) {\n currentList.value.splice(index, 1)\n ElMessage.success('删除成功')\n}\n\nfunction setRelation(customId: number, examAnswers: any) {\n emits('setRelation', customId, examAnswers)\n}\n\nfunction setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string,) {\n // 给examId设置答案关联\n if (answerRelations.length) {\n currentList.value?.map((v: any) => {\n if(v.customId === customId) {\n v.answers?.map((c: any) => {\n // 判断类型\n if(c.customAnswerId === customAnswerId) {\n c.answerRelations = answerRelations\n }\n })\n }\n })\n }\n}\n\nwatch(() => props.subjectList, (newList: any) => {\n if (newList) {\n currentList.value = [...newList]\n }\n}, { immediate: true })\n\nconst ns = useNamespace('subject-list')\n</script>\n\n<template>\n <div :class=\"ns.e('list-exam')\">\n <div class=\"subject-list-wrapper\">\n <div v-for=\"(item, index) in currentList\" :key=\"index + item.examId || item.title\">\n <template v-if=\"['single', 'multiple', 'sort'].includes(item.answerType)\">\n <SubjectSingle \n v-bind=\"attrs\" \n :order-index=\"index\" \n :title=\"item.title\" \n :type=\"item.answerType\"\n :exam-id=\"item.examId\"\n :isKey=\"item.isKey\" \n :is-save=\"!item.isRealCanDel\" \n :customId=\"item.customId\" \n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\" \n :analysis=\"item.analysis\" \n :least-answer-count=\"item.leastAnswerCount\"\n :is-edit=\"item.isEdit || false\" \n :show-action=\"!isPreview\" \n :exam-expand=\"item.examExpand\"\n :answerCheckType=\"item.answerCheckType\" \n :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\"\n @setRelation=\"setRelation\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string, examAnswerRelationType: number) => addSubject(type, index, examAnswerRelationType)\" />\n </template>\n <SubjectScale v-bind=\"attrs\" v-else-if=\"item.answerType === 'scale'\" :order-index=\"index\" :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :is-edit=\"item.isEdit || false\" :scale-question-list=\"item.scaleQuestionList\"\n :show-action=\"!isPreview\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectBlankFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'blank_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectTextFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'text_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-expand=\"item.examExpand\" :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" :exam-rich-text-content=\"item.examRichTextContent\"\n @move=\"(type: 'up' | 'down') => move(index, type)\" @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectRichText v-bind=\"attrs\" v-else-if=\"item.answerType === 'rich_text'\" :order-index=\"index\"\n :richTextContent=\"item.richTextContent\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :is-edit=\"item.isEdit || false\" :show-action=\"!isPreview\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" :examAnswerRelationType=\"item.examAnswerRelationType\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectPageEnd v-else-if=\"item.answerType === 'page_end'\" :total-page=\"totalPageIndex()\" :key=\"index\"\n :current-page-index=\"currentPageIndex()(item.id)\" :item=\"item\" :order-index=\"index\"\n :is-edit=\"item.isEdit || false\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","currentList","ref","emits","__emit","attrs","useAttrs","totalPageIndex","isLastPageIndex","value","map","v","i","arr","answerType","length","addSubject","type","index","examAnswerRelationType","console","log","splice","customId","setGuid","analysis","scaleQuestionList","isSave","isEdit","isRealCanDel","hasSet","push","move","item","saveSubject","idx","deleteSubject","ElMessage","success","setRelation","examAnswers","__expose","uploadExcel","list","concat","addExam","answerList","answers","title","answer","answerId","examAnswerId","isCorrect","richTextContent","examTypeEnum","setAnswerRelation","answerRelations","customAnswerId","c","watch","subjectList","newList","immediate","ns","useNamespace","currentId","currentPageList","filter","currentIndex","forEach","id"],"mappings":"0sBAeA,MAAMA,EAAQC,EAIRC,EAAcC,EAAIA,IAAA,IAClBC,EAAQC,EAERC,EAAQC,EAAAA,WAUd,SAASC,IACP,IAAIA,EAAiB,EACjBC,GAAkB,EAQf,OAPPP,EAAYQ,MAAMC,KAAI,CAACC,EAAQC,EAAWC,KACnB,aAAjBF,EAAEG,aACJ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B,EAAW,CA1H/BC,EAAA,CACXzB,aACAf,cACAyC,YAoFF,SAAqBC,GACnB1C,EAAYQ,MAAQR,EAAYQ,MAAMmC,OAAOD,EAAI,EApFjDE,QA8DF,SAAiBZ,GACf,MAAMa,EAAoB,GACrBb,EAAAc,SAASrC,KAAKC,IACjBmC,EAAWf,KAAK,IACXpB,EACHqC,MAAOrC,EAAEsC,OACTC,SAAUvC,EAAEwC,aACZC,UAAWzC,EAAEyC,WACd,IAEHnD,EAAYQ,MAAMsB,KAAK,IAClBE,EACHV,SAAUC,EAAAA,UACVV,WAAYmB,EAAKoB,gBAAkB,YAAcpB,EAAKqB,aACtDP,QAASD,EACTnB,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,GACT,EAhFDyB,kBAwHO,SAAkBC,EAAsBjC,EAAkBkC,GAE7DD,EAAgBzC,QACNd,EAAAQ,OAAOC,KAAKC,IACnBA,EAAEY,WAAaA,GACdZ,EAAAoC,SAASrC,KAAKgD,IAEXA,EAAED,iBAAmBA,IACtBC,EAAEF,gBAAkBA,EAAA,GAEvB,GAGP,IAGFG,EAAAA,OAAM,IAAM5D,EAAM6D,cAAcC,IAC1BA,IACU5D,EAAAQ,MAAQ,IAAIoD,GAAO,GAEhC,CAAEC,WAAW,IAEV,MAAAC,EAAKC,eAAa,goIA7Hf,CAACC,IACA,MAAAC,EAAkBjE,EAAYQ,MAAM0D,QACvCxD,GAA4B,aAAjBA,EAAEG,aAEhB,IAAIsD,EAAe,EAMZ,OALUF,GAAAG,SAAQ,CAACX,EAAQ9C,KAC5BqD,IAAcP,EAAEY,KAClBF,EAAexD,EAAI,EAAA,IAGhBwD,CAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),l=require("@qxs-bns/hooks"),t=require("vue-demi");const n={class:"type-item"},c={class:"base-subject"},a=["onClick"],s={class:"type-item"},r={class:"base-subject flex"},o=["onClick"],i={class:"type-item"},p={class:"base-subject flex"},m=["onClick"];var d=e.defineComponent({name:"QxsSubjectType",__name:"subject-type",emits:["select"],setup(d,{emit:u}){const y=u,b=t.ref([{type:"single",label:"单选题"},{type:"multiple",label:"多选题"},{type:"blank_fill",label:"填空题"},{type:"text_fill",label:"问答题"},{type:"scale",label:"量表题"},{type:"sort",label:"排序题"}]),k=t.ref([{type:"rich_text",label:"富文本"},{type:"page_end",label:"分页器"}]),E=t.ref([{type:"single",label:"单选题"},{type:"multiple",label:"多选题"}]),v=l.useNamespace("subject-type");return(l,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(v).e("type-list"))},[e.createElementVNode("div",n,[t[0]||(t[0]=e.createElementVNode("div",null,"普通题目类型",-1)),e.createElementVNode("div",c,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(l=>(e.openBlock(),e.createElementBlock("div",{key:l.type,class:"item flex-center",onClick:e=>y("select",l.type)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1)],8,a)))),128))])]),e.createElementVNode("div",s,[t[1]||(t[1]=e.createElementVNode("div",null,"其他",-1)),e.createElementVNode("div",r,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(k),(l=>(e.openBlock(),e.createElementBlock("div",{key:l.type,class:"item flex-center",onClick:e=>y("select",l.type)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1)],8,o)))),128))])]),e.createElementVNode("div",i,[t[2]||(t[2]=e.createElementVNode("div",null,"互动问答类型(支持设置结果项)",-1)),e.createElementVNode("div",p,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),(l=>(e.openBlock(),e.createElementBlock("div",{key:l.type,class:"item flex-center",onClick:e=>y("select",l.type,!0)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1)],8,m)))),128))])])],2))}});exports.default=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),l=require("@qxs-bns/hooks");const t={class:"type-item"},n={class:"base-subject"},c=["onClick"],a={class:"type-item"},s={class:"base-subject flex"},r=["onClick"],o={class:"type-item"},i={class:"base-subject flex"},p=["onClick"];var m=e.defineComponent({name:"QxsSubjectType",__name:"subject-type",emits:["select"],setup(m,{emit:d}){const u=d,y=e.ref([{type:"single",label:"单选题"},{type:"multiple",label:"多选题"},{type:"blank_fill",label:"填空题"},{type:"text_fill",label:"问答题"},{type:"scale",label:"量表题"},{type:"sort",label:"排序题"}]),b=e.ref([{type:"rich_text",label:"富文本"},{type:"page_end",label:"分页器"}]),k=e.ref([{type:"single",label:"单选题"},{type:"multiple",label:"多选题"}]),E=l.useNamespace("subject-type");return(l,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(E).e("type-list"))},[e.createElementVNode("div",t,[m[0]||(m[0]=e.createElementVNode("div",null,"普通题目类型",-1)),e.createElementVNode("div",n,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(y),(l=>(e.openBlock(),e.createElementBlock("div",{key:l.type,class:"item flex-center",onClick:e=>u("select",l.type)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1)],8,c)))),128))])]),e.createElementVNode("div",a,[m[1]||(m[1]=e.createElementVNode("div",null,"其他",-1)),e.createElementVNode("div",s,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(b),(l=>(e.openBlock(),e.createElementBlock("div",{key:l.type,class:"item flex-center",onClick:e=>u("select",l.type)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1)],8,r)))),128))])]),e.createElementVNode("div",o,[m[2]||(m[2]=e.createElementVNode("div",null,"互动问答类型(支持设置结果项)",-1)),e.createElementVNode("div",i,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(k),(l=>(e.openBlock(),e.createElementBlock("div",{key:l.type,class:"item flex-center",onClick:e=>u("select",l.type,!0)},[e.createElementVNode("span",null,e.toDisplayString(l.label),1)],8,p)))),128))])])],2))}});exports.default=m;
2
2
  //# sourceMappingURL=subject-type.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-type.vue.cjs","sources":["../../../../../../packages/components/src/subject-type/src/subject-type.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useNamespace } from '@qxs-bns/hooks'\n\ndefineOptions({\n name: 'QxsSubjectType',\n})\nconst emits = defineEmits(['select'])\nconst subjectOptions = ref([\n {\n type: 'single',\n label: '单选题',\n }, {\n type: 'multiple',\n label: '多选题',\n },\n {\n type: 'blank_fill',\n label: '填空题',\n },\n {\n type: 'text_fill',\n label: '问答题',\n },\n {\n type: 'scale',\n label: '量表题',\n },\n {\n type: 'sort',\n label: '排序题',\n },\n])\nconst otherOptions = ref([\n {\n type: 'rich_text',\n label: '富文本',\n },\n {\n type: 'page_end',\n label: '分页器',\n },\n])\nconst interactionOptions = ref([\n {\n type: 'single',\n label: '单选题',\n }, {\n type: 'multiple',\n label: '多选题',\n },\n])\nconst ns = useNamespace('subject-type')\n\n</script>\n\n<template>\n <div :class=\"ns.e('type-list')\">\n <div class=\"type-item\">\n <div>普通题目类型</div>\n <div class=\"base-subject\">\n <div v-for=\"item in subjectOptions\" :key=\"item.type\" class=\"item flex-center\"\n @click=\"emits('select', item.type)\">\n <span>{{ item.label }}</span>\n </div>\n </div>\n </div>\n <div class=\"type-item\">\n <div>其他</div>\n <div class=\"base-subject flex\">\n <div v-for=\"item in otherOptions\" :key=\"item.type\" class=\"item flex-center\" @click=\"emits('select', item.type)\">\n <span>{{ item.label }}</span>\n </div>\n </div>\n </div>\n <div class=\"type-item\">\n <div>互动问答类型(支持设置结果项)</div>\n <div class=\"base-subject flex\">\n <div v-for=\"item in interactionOptions\" :key=\"item.type\" class=\"item flex-center\"\n @click=\"emits('select', item.type, true)\">\n <span>{{ item.label }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n"],"names":["emits","__emit","subjectOptions","ref","type","label","otherOptions","interactionOptions","ns","useNamespace"],"mappings":"0bAMA,MAAMA,EAAQC,EACRC,EAAiBC,EAAAA,IAAI,CACzB,CACEC,KAAM,SACNC,MAAO,OACN,CACDD,KAAM,WACNC,MAAO,OAET,CACED,KAAM,aACNC,MAAO,OAET,CACED,KAAM,YACNC,MAAO,OAET,CACED,KAAM,QACNC,MAAO,OAET,CACED,KAAM,OACNC,MAAO,SAGLC,EAAeH,EAAAA,IAAI,CACvB,CACEC,KAAM,YACNC,MAAO,OAET,CACED,KAAM,WACNC,MAAO,SAGLE,EAAqBJ,EAAAA,IAAI,CAC7B,CACEC,KAAM,SACNC,MAAO,OACN,CACDD,KAAM,WACNC,MAAO,SAGLG,EAAKC,eAAa"}
1
+ {"version":3,"file":"subject-type.vue.cjs","sources":["../../../../../../packages/components/src/subject-type/src/subject-type.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useNamespace } from '@qxs-bns/hooks'\n\ndefineOptions({\n name: 'QxsSubjectType',\n})\nconst emits = defineEmits(['select'])\nconst subjectOptions = ref([\n {\n type: 'single',\n label: '单选题',\n }, {\n type: 'multiple',\n label: '多选题',\n },\n {\n type: 'blank_fill',\n label: '填空题',\n },\n {\n type: 'text_fill',\n label: '问答题',\n },\n {\n type: 'scale',\n label: '量表题',\n },\n {\n type: 'sort',\n label: '排序题',\n },\n])\nconst otherOptions = ref([\n {\n type: 'rich_text',\n label: '富文本',\n },\n {\n type: 'page_end',\n label: '分页器',\n },\n])\nconst interactionOptions = ref([\n {\n type: 'single',\n label: '单选题',\n }, {\n type: 'multiple',\n label: '多选题',\n },\n])\nconst ns = useNamespace('subject-type')\n\n</script>\n\n<template>\n <div :class=\"ns.e('type-list')\">\n <div class=\"type-item\">\n <div>普通题目类型</div>\n <div class=\"base-subject\">\n <div v-for=\"item in subjectOptions\" :key=\"item.type\" class=\"item flex-center\"\n @click=\"emits('select', item.type)\">\n <span>{{ item.label }}</span>\n </div>\n </div>\n </div>\n <div class=\"type-item\">\n <div>其他</div>\n <div class=\"base-subject flex\">\n <div v-for=\"item in otherOptions\" :key=\"item.type\" class=\"item flex-center\" @click=\"emits('select', item.type)\">\n <span>{{ item.label }}</span>\n </div>\n </div>\n </div>\n <div class=\"type-item\">\n <div>互动问答类型(支持设置结果项)</div>\n <div class=\"base-subject flex\">\n <div v-for=\"item in interactionOptions\" :key=\"item.type\" class=\"item flex-center\"\n @click=\"emits('select', item.type, true)\">\n <span>{{ item.label }}</span>\n </div>\n </div>\n </div>\n </div>\n</template>\n"],"names":["emits","__emit","subjectOptions","ref","type","label","otherOptions","interactionOptions","ns","useNamespace"],"mappings":"oaAMA,MAAMA,EAAQC,EACRC,EAAiBC,EAAAA,IAAI,CACzB,CACEC,KAAM,SACNC,MAAO,OACN,CACDD,KAAM,WACNC,MAAO,OAET,CACED,KAAM,aACNC,MAAO,OAET,CACED,KAAM,YACNC,MAAO,OAET,CACED,KAAM,QACNC,MAAO,OAET,CACED,KAAM,OACNC,MAAO,SAGLC,EAAeH,EAAAA,IAAI,CACvB,CACEC,KAAM,YACNC,MAAO,OAET,CACED,KAAM,WACNC,MAAO,SAGLE,EAAqBJ,EAAAA,IAAI,CAC7B,CACEC,KAAM,SACNC,MAAO,OACN,CACDD,KAAM,WACNC,MAAO,SAGLG,EAAKC,eAAa"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),i=require("@qxs-bns/hooks"),n=require("lodash-es"),t=require("tinymce/tinymce");require("tinymce/themes/silver/theme"),require("tinymce/icons/default/icons"),require("tinymce/models/dom"),require("tinymce/plugins/autolink"),require("tinymce/plugins/autoresize"),require("tinymce/plugins/fullscreen"),require("tinymce/plugins/image"),require("tinymce/plugins/insertdatetime"),require("tinymce/plugins/link"),require("tinymce/plugins/lists"),require("tinymce/plugins/media"),require("tinymce/plugins/preview"),require("tinymce/plugins/table"),require("tinymce/plugins/wordcount"),require("tinymce/plugins/code"),require("tinymce/plugins/searchreplace"),require("tinymce/plugins/nonbreaking");var r=require("vue-demi");const u=["id","name"];var a=e.defineComponent({name:"QxsTinyMceEditor",__name:"tiny-mce-editor",props:{modelValue:{type:String,required:!0,default:""},config:{type:Object,required:!1,default:()=>({})},assetsBasePath:{type:String,required:!1,default:""}},emits:["update:modelValue"],setup(a,{emit:s}){const l=s,o=i.useNamespace("file-upload"),c=r.computed({get:()=>a.modelValue,set(e){l("update:modelValue",e)}}),m=r.ref(`tiny-mce-textarea-${Date.now()}-${Math.random().toString(36).substr(2,9)}`),d=a.assetsBasePath||"/node_modules/@qxs-bns/components/"+((void 0).DEV?"src/tiny-mce-editor/public/":"es/public/tiny-mce-editor/"),p={selector:`textarea#${m.value}`,promotion:!1,license_key:"gpl",elementpath:!1,language:"zh-Hans",language_url:`${d}tinymce/langs/zh-Hans.js`,skin_url:`${d}tinymce/skins/ui/oxide`,content_css:`${d}tinymce/skins/content/default/content.min.css`,min_height:250,max_height:600,plugins:"autolink autoresize fullscreen image insertdatetime link lists media preview table wordcount code searchreplace nonbreaking",toolbar:"undo redo | bold italic underline strikethrough | blocks | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | forecolor backcolor removeformat | link image media table insertdatetime searchreplace | preview code",branding:!1,autoresize:!0,menubar:!1,nonbreaking_force_tab:!0,toolbar_mode:"sliding",insertdatetime_formats:["%Y年%m月%d日","%H点%M分%S秒","%Y-%m-%d","%H:%M:%S"],setup:e=>{e.on("input change undo redo",(()=>{c.value=e.getContent()})),e.on("init",(()=>{e.setContent(c.value)})),a.config?.expandSetup?.(e)}},g=r.computed((()=>{const e=p;return a.config.images_upload_handler||("string"==typeof e.plugins?e.plugins=e.plugins.replace("image",""):Array.isArray(e.plugins)&&(e.plugins=e.plugins.filter((e=>"image"!==e)))),n.merge(e,a.config)}));return r.onMounted((async()=>{"undefined"!=typeof window&&t.init(g.value)})),(i,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(o).e("tiny-mce"))},[e.createCommentVNode(" 使用动态生成的 id "),e.withDirectives(e.createElementVNode("textarea",{id:e.unref(m),"onUpdate:modelValue":n[0]||(n[0]=i=>e.isRef(c)?c.value=i:null),name:e.unref(m)},null,8,u),[[e.vModelText,e.unref(c)]])],2))}});exports.default=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),i=require("@qxs-bns/hooks"),n=require("lodash-es"),t=require("tinymce/tinymce");require("tinymce/themes/silver/theme"),require("tinymce/icons/default/icons"),require("tinymce/models/dom"),require("tinymce/plugins/autolink"),require("tinymce/plugins/autoresize"),require("tinymce/plugins/fullscreen"),require("tinymce/plugins/image"),require("tinymce/plugins/insertdatetime"),require("tinymce/plugins/link"),require("tinymce/plugins/lists"),require("tinymce/plugins/media"),require("tinymce/plugins/preview"),require("tinymce/plugins/table"),require("tinymce/plugins/wordcount"),require("tinymce/plugins/code"),require("tinymce/plugins/searchreplace"),require("tinymce/plugins/nonbreaking");const r=["id","name"];var u=e.defineComponent({name:"QxsTinyMceEditor",__name:"tiny-mce-editor",props:{modelValue:{type:String,required:!0,default:""},config:{type:Object,required:!1,default:()=>({})},assetsBasePath:{type:String,required:!1,default:""}},emits:["update:modelValue"],setup(u,{emit:s}){const a=s,l=i.useNamespace("file-upload"),o=e.computed({get:()=>u.modelValue,set(e){a("update:modelValue",e)}}),c=e.ref(`tiny-mce-textarea-${Date.now()}-${Math.random().toString(36).substr(2,9)}`),m=u.assetsBasePath||"/node_modules/@qxs-bns/components/"+((void 0).DEV?"src/tiny-mce-editor/public/":"es/public/tiny-mce-editor/"),d={selector:`textarea#${c.value}`,promotion:!1,license_key:"gpl",elementpath:!1,language:"zh-Hans",language_url:`${m}tinymce/langs/zh-Hans.js`,skin_url:`${m}tinymce/skins/ui/oxide`,content_css:`${m}tinymce/skins/content/default/content.min.css`,min_height:250,max_height:600,plugins:"autolink autoresize fullscreen image insertdatetime link lists media preview table wordcount code searchreplace nonbreaking",toolbar:"undo redo | bold italic underline strikethrough | blocks | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | forecolor backcolor removeformat | link image media table insertdatetime searchreplace | preview code",branding:!1,autoresize:!0,menubar:!1,nonbreaking_force_tab:!0,toolbar_mode:"sliding",insertdatetime_formats:["%Y年%m月%d日","%H点%M分%S秒","%Y-%m-%d","%H:%M:%S"],setup:e=>{e.on("input change undo redo",(()=>{o.value=e.getContent()})),e.on("init",(()=>{e.setContent(o.value)})),u.config?.expandSetup?.(e)}},p=e.computed((()=>{const e=d;return u.config.images_upload_handler||("string"==typeof e.plugins?e.plugins=e.plugins.replace("image",""):Array.isArray(e.plugins)&&(e.plugins=e.plugins.filter((e=>"image"!==e)))),n.merge(e,u.config)}));return e.onMounted((async()=>{"undefined"!=typeof window&&t.init(p.value)})),(i,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(l).e("tiny-mce"))},[e.createCommentVNode(" 使用动态生成的 id "),e.withDirectives(e.createElementVNode("textarea",{id:e.unref(c),"onUpdate:modelValue":n[0]||(n[0]=i=>e.isRef(o)?o.value=i:null),name:e.unref(c)},null,8,r),[[e.vModelText,e.unref(o)]])],2))}});exports.default=u;
2
2
  //# sourceMappingURL=tiny-mce-editor.vue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tiny-mce-editor.vue.cjs","sources":["../../../../../../packages/components/src/tiny-mce-editor/src/tiny-mce-editor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor, RawEditorOptions } from \"tinymce/tinymce\";\nimport { useNamespace } from \"@qxs-bns/hooks\";\nimport { merge } from \"lodash-es\";\nimport tinymce from \"tinymce/tinymce\";\n\n// 导入核心功能\nimport \"tinymce/themes/silver/theme\";\nimport \"tinymce/icons/default/icons\";\nimport \"tinymce/models/dom\";\n\nimport \"tinymce/plugins/autolink\";\nimport \"tinymce/plugins/autoresize\";\nimport \"tinymce/plugins/fullscreen\";\nimport \"tinymce/plugins/image\";\nimport \"tinymce/plugins/insertdatetime\";\nimport \"tinymce/plugins/link\";\nimport \"tinymce/plugins/lists\";\nimport \"tinymce/plugins/media\";\nimport \"tinymce/plugins/preview\";\nimport \"tinymce/plugins/table\";\nimport \"tinymce/plugins/wordcount\";\nimport \"tinymce/plugins/code\";\nimport \"tinymce/plugins/searchreplace\";\nimport \"tinymce/plugins/nonbreaking\";\n\ndefineOptions({\n name: \"QxsTinyMceEditor\",\n});\n\nconst {\n modelValue = \"\",\n config = {},\n assetsBasePath = \"\",\n} = defineProps<{\n modelValue: string;\n config?: RawEditorOptions & {\n expandSetup?: RawEditorOptions[\"setup\"];\n };\n assetsBasePath?: string;\n}>();\n\nconst emit = defineEmits([\"update:modelValue\"]);\n\nconst ns = useNamespace(\"file-upload\");\n\nconst colorScheme = \"light\";\n\nconst content = computed({\n get() {\n return modelValue;\n },\n set(val) {\n emit(\"update:modelValue\", val);\n },\n});\n\n// 生成唯一的 id\nconst uniqueId = ref(\n `tiny-mce-textarea-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`\n);\n\nconst basePath =\n assetsBasePath ||\n `/node_modules/@qxs-bns/components/${\n import.meta.env.DEV\n ? \"src/tiny-mce-editor/public/\"\n : \"es/public/tiny-mce-editor/\"\n }`;\nconst defaultSetting: RawEditorOptions = {\n // 使用动态生成的 id\n selector: `textarea#${uniqueId.value}`,\n promotion: false, // 禁用推广信息\n license_key: \"gpl\",\n elementpath: false,\n language: \"zh-Hans\",\n\n language_url: `${basePath}tinymce/langs/zh-Hans.js`,\n skin_url: `${basePath}${\n colorScheme === \"light\"\n ? \"tinymce/skins/ui/oxide\"\n : \"tinymce/skins/ui/oxide-dark\"\n }`,\n content_css: `${basePath}${\n colorScheme === \"light\"\n ? \"tinymce/skins/content/default/content.min.css\"\n : \"tinymce/skins/content/dark/content.min.css\"\n }`,\n min_height: 250,\n max_height: 600,\n plugins:\n \"autolink autoresize fullscreen image insertdatetime link lists media preview table wordcount code searchreplace nonbreaking\",\n toolbar:\n \"undo redo | bold italic underline strikethrough | blocks | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | forecolor backcolor removeformat | link image media table insertdatetime searchreplace | preview code\",\n branding: false,\n autoresize: true,\n menubar: false,\n nonbreaking_force_tab: true,\n toolbar_mode: \"sliding\",\n insertdatetime_formats: [\n \"%Y年%m月%d日\",\n \"%H点%M分%S秒\",\n \"%Y-%m-%d\",\n \"%H:%M:%S\",\n ],\n // https://www.tiny.cloud/docs/tinymce/6/file-image-upload/#images_upload_handler\n // images_upload_handler: async (blobInfo: any, progress: any) => {\n // // blobInfo, succFun, failFun, progress\n // const files = blobInfo.blob()\n // const formData = new FormData()\n // formData.append('image', files)\n\n // const { res, error } = await useApi({\n // // ...commonUrls.uploadImage,\n // params: {\n // bucketType: classify,\n // },\n // data: formData,\n // onUploadProgress: (e: any) => {\n // progress((e.loaded / e.total) * 100)\n // },\n // })\n // if (res) {\n // const { normal } = res\n // console.log('normal: ', res)\n // return normal\n // }\n // if (error) {\n // console.log(error.message)\n // return Promise.reject(error.message)\n // }\n // },\n setup: (editor: Editor) => {\n // 监听编辑器内容变化\n editor.on(\"input change undo redo\", () => {\n content.value = editor.getContent();\n });\n\n // 编辑器初始化完成后设置内容\n editor.on(\"init\", () => {\n editor.setContent(content.value);\n });\n\n config?.expandSetup?.(editor);\n },\n};\n\nconst initSetting = computed(() => {\n const dealDefaultSetting = defaultSetting;\n if (!config.images_upload_handler) {\n // 删除 image 图片 plugin\n if (typeof dealDefaultSetting.plugins === \"string\") {\n dealDefaultSetting.plugins = dealDefaultSetting.plugins.replace(\n \"image\",\n \"\"\n );\n } else if (Array.isArray(dealDefaultSetting.plugins)) {\n dealDefaultSetting.plugins = dealDefaultSetting.plugins.filter(\n (plugin) => plugin !== \"image\"\n );\n }\n }\n return merge(dealDefaultSetting, config);\n});\n\nonMounted(async () => {\n if (typeof window !== \"undefined\") {\n tinymce.init(initSetting.value);\n }\n});\n</script>\n\n<template>\n <div :class=\"ns.e('tiny-mce')\">\n <!-- 使用动态生成的 id -->\n <textarea :id=\"uniqueId\" v-model=\"content\" :name=\"uniqueId\" />\n </div>\n</template>\n"],"names":["emit","__emit","ns","useNamespace","content","computed","get","__props","modelValue","set","val","uniqueId","ref","Date","now","Math","random","toString","substr","basePath","assetsBasePath","undefined","DEV","defaultSetting","selector","value","promotion","license_key","elementpath","language","language_url","skin_url","content_css","min_height","max_height","plugins","toolbar","branding","autoresize","menubar","nonbreaking_force_tab","toolbar_mode","insertdatetime_formats","setup","editor","on","getContent","setContent","config","expandSetup","initSetting","dealDefaultSetting","images_upload_handler","replace","Array","isArray","filter","plugin","merge","onMounted","async","window","tinymce","init"],"mappings":"ilCA0CA,MAAMA,EAAOC,EAEPC,EAAKC,eAAa,eAIlBC,EAAUC,EAAAA,SAAS,CACvBC,IAAM,IACGC,EAAUC,WAEnB,GAAAC,CAAIC,GACFV,EAAK,oBAAqBU,EAAG,IAK3BC,EAAWC,EAAAA,IACf,qBAAqBC,KAAKC,SAASC,KAAKC,SAASC,SAAS,IAAIC,OAAO,EAAG,MAGpEC,EACJZ,EAAca,gBACd,4CACEC,GAAgBC,IACZ,8BACA,8BAEFC,EAAmC,CAEvCC,SAAU,YAAYb,EAASc,QAC/BC,WAAW,EACXC,YAAa,MACbC,aAAa,EACbC,SAAU,UAEVC,aAAc,GAAGX,4BACjBY,SAAU,GAAGZ,0BAKba,YAAa,GAAGb,iDAKhBc,WAAY,IACZC,WAAY,IACZC,QACE,8HACFC,QACE,oPACFC,UAAU,EACVC,YAAY,EACZC,SAAS,EACTC,uBAAuB,EACvBC,aAAc,UACdC,uBAAwB,CACtB,YACA,YACA,WACA,YA6BFC,MAAQC,IAECA,EAAAC,GAAG,0BAA0B,KAC1BzC,EAAAqB,MAAQmB,EAAOE,YAAW,IAI7BF,EAAAC,GAAG,QAAQ,KACTD,EAAAG,WAAW3C,EAAQqB,MAAK,IAG3BlB,EAAAyC,QAAEC,cAAcL,EAAM,GAI1BM,EAAc7C,EAAAA,UAAS,KAC3B,MAAM8C,EAAqB5B,EAcpB,OAbFhB,EAAMyC,OAACI,wBAEgC,iBAA/BD,EAAmBhB,QACTgB,EAAAhB,QAAUgB,EAAmBhB,QAAQkB,QACtD,QACA,IAEOC,MAAMC,QAAQJ,EAAmBhB,WACvBgB,EAAAhB,QAAUgB,EAAmBhB,QAAQqB,QACrDC,GAAsB,UAAXA,MAIXC,QAAMP,EAAoB5C,SAAM,WAGzCoD,EAAAA,WAAUC,UACc,oBAAXC,QACDC,EAAAC,KAAKb,EAAYzB,MAAK"}
1
+ {"version":3,"file":"tiny-mce-editor.vue.cjs","sources":["../../../../../../packages/components/src/tiny-mce-editor/src/tiny-mce-editor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor, RawEditorOptions } from \"tinymce/tinymce\";\nimport { useNamespace } from \"@qxs-bns/hooks\";\nimport { merge } from \"lodash-es\";\nimport tinymce from \"tinymce/tinymce\";\n\n// 导入核心功能\nimport \"tinymce/themes/silver/theme\";\nimport \"tinymce/icons/default/icons\";\nimport \"tinymce/models/dom\";\n\nimport \"tinymce/plugins/autolink\";\nimport \"tinymce/plugins/autoresize\";\nimport \"tinymce/plugins/fullscreen\";\nimport \"tinymce/plugins/image\";\nimport \"tinymce/plugins/insertdatetime\";\nimport \"tinymce/plugins/link\";\nimport \"tinymce/plugins/lists\";\nimport \"tinymce/plugins/media\";\nimport \"tinymce/plugins/preview\";\nimport \"tinymce/plugins/table\";\nimport \"tinymce/plugins/wordcount\";\nimport \"tinymce/plugins/code\";\nimport \"tinymce/plugins/searchreplace\";\nimport \"tinymce/plugins/nonbreaking\";\n\ndefineOptions({\n name: \"QxsTinyMceEditor\",\n});\n\nconst {\n modelValue = \"\",\n config = {},\n assetsBasePath = \"\",\n} = defineProps<{\n modelValue: string;\n config?: RawEditorOptions & {\n expandSetup?: RawEditorOptions[\"setup\"];\n };\n assetsBasePath?: string;\n}>();\n\nconst emit = defineEmits([\"update:modelValue\"]);\n\nconst ns = useNamespace(\"file-upload\");\n\nconst colorScheme = \"light\";\n\nconst content = computed({\n get() {\n return modelValue;\n },\n set(val) {\n emit(\"update:modelValue\", val);\n },\n});\n\n// 生成唯一的 id\nconst uniqueId = ref(\n `tiny-mce-textarea-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`\n);\n\nconst basePath =\n assetsBasePath ||\n `/node_modules/@qxs-bns/components/${\n import.meta.env.DEV\n ? \"src/tiny-mce-editor/public/\"\n : \"es/public/tiny-mce-editor/\"\n }`;\nconst defaultSetting: RawEditorOptions = {\n // 使用动态生成的 id\n selector: `textarea#${uniqueId.value}`,\n promotion: false, // 禁用推广信息\n license_key: \"gpl\",\n elementpath: false,\n language: \"zh-Hans\",\n\n language_url: `${basePath}tinymce/langs/zh-Hans.js`,\n skin_url: `${basePath}${\n colorScheme === \"light\"\n ? \"tinymce/skins/ui/oxide\"\n : \"tinymce/skins/ui/oxide-dark\"\n }`,\n content_css: `${basePath}${\n colorScheme === \"light\"\n ? \"tinymce/skins/content/default/content.min.css\"\n : \"tinymce/skins/content/dark/content.min.css\"\n }`,\n min_height: 250,\n max_height: 600,\n plugins:\n \"autolink autoresize fullscreen image insertdatetime link lists media preview table wordcount code searchreplace nonbreaking\",\n toolbar:\n \"undo redo | bold italic underline strikethrough | blocks | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | forecolor backcolor removeformat | link image media table insertdatetime searchreplace | preview code\",\n branding: false,\n autoresize: true,\n menubar: false,\n nonbreaking_force_tab: true,\n toolbar_mode: \"sliding\",\n insertdatetime_formats: [\n \"%Y年%m月%d日\",\n \"%H点%M分%S秒\",\n \"%Y-%m-%d\",\n \"%H:%M:%S\",\n ],\n // https://www.tiny.cloud/docs/tinymce/6/file-image-upload/#images_upload_handler\n // images_upload_handler: async (blobInfo: any, progress: any) => {\n // // blobInfo, succFun, failFun, progress\n // const files = blobInfo.blob()\n // const formData = new FormData()\n // formData.append('image', files)\n\n // const { res, error } = await useApi({\n // // ...commonUrls.uploadImage,\n // params: {\n // bucketType: classify,\n // },\n // data: formData,\n // onUploadProgress: (e: any) => {\n // progress((e.loaded / e.total) * 100)\n // },\n // })\n // if (res) {\n // const { normal } = res\n // console.log('normal: ', res)\n // return normal\n // }\n // if (error) {\n // console.log(error.message)\n // return Promise.reject(error.message)\n // }\n // },\n setup: (editor: Editor) => {\n // 监听编辑器内容变化\n editor.on(\"input change undo redo\", () => {\n content.value = editor.getContent();\n });\n\n // 编辑器初始化完成后设置内容\n editor.on(\"init\", () => {\n editor.setContent(content.value);\n });\n\n config?.expandSetup?.(editor);\n },\n};\n\nconst initSetting = computed(() => {\n const dealDefaultSetting = defaultSetting;\n if (!config.images_upload_handler) {\n // 删除 image 图片 plugin\n if (typeof dealDefaultSetting.plugins === \"string\") {\n dealDefaultSetting.plugins = dealDefaultSetting.plugins.replace(\n \"image\",\n \"\"\n );\n } else if (Array.isArray(dealDefaultSetting.plugins)) {\n dealDefaultSetting.plugins = dealDefaultSetting.plugins.filter(\n (plugin) => plugin !== \"image\"\n );\n }\n }\n return merge(dealDefaultSetting, config);\n});\n\nonMounted(async () => {\n if (typeof window !== \"undefined\") {\n tinymce.init(initSetting.value);\n }\n});\n</script>\n\n<template>\n <div :class=\"ns.e('tiny-mce')\">\n <!-- 使用动态生成的 id -->\n <textarea :id=\"uniqueId\" v-model=\"content\" :name=\"uniqueId\" />\n </div>\n</template>\n"],"names":["emit","__emit","ns","useNamespace","content","computed","get","__props","modelValue","set","val","uniqueId","ref","Date","now","Math","random","toString","substr","basePath","assetsBasePath","undefined","DEV","defaultSetting","selector","value","promotion","license_key","elementpath","language","language_url","skin_url","content_css","min_height","max_height","plugins","toolbar","branding","autoresize","menubar","nonbreaking_force_tab","toolbar_mode","insertdatetime_formats","setup","editor","on","getContent","setContent","config","expandSetup","initSetting","dealDefaultSetting","images_upload_handler","replace","Array","isArray","filter","plugin","merge","onMounted","async","window","tinymce","init"],"mappings":"ujCA0CA,MAAMA,EAAOC,EAEPC,EAAKC,eAAa,eAIlBC,EAAUC,EAAAA,SAAS,CACvBC,IAAM,IACGC,EAAUC,WAEnB,GAAAC,CAAIC,GACFV,EAAK,oBAAqBU,EAAG,IAK3BC,EAAWC,EAAAA,IACf,qBAAqBC,KAAKC,SAASC,KAAKC,SAASC,SAAS,IAAIC,OAAO,EAAG,MAGpEC,EACJZ,EAAca,gBACd,4CACEC,GAAgBC,IACZ,8BACA,8BAEFC,EAAmC,CAEvCC,SAAU,YAAYb,EAASc,QAC/BC,WAAW,EACXC,YAAa,MACbC,aAAa,EACbC,SAAU,UAEVC,aAAc,GAAGX,4BACjBY,SAAU,GAAGZ,0BAKba,YAAa,GAAGb,iDAKhBc,WAAY,IACZC,WAAY,IACZC,QACE,8HACFC,QACE,oPACFC,UAAU,EACVC,YAAY,EACZC,SAAS,EACTC,uBAAuB,EACvBC,aAAc,UACdC,uBAAwB,CACtB,YACA,YACA,WACA,YA6BFC,MAAQC,IAECA,EAAAC,GAAG,0BAA0B,KAC1BzC,EAAAqB,MAAQmB,EAAOE,YAAW,IAI7BF,EAAAC,GAAG,QAAQ,KACTD,EAAAG,WAAW3C,EAAQqB,MAAK,IAG3BlB,EAAAyC,QAAEC,cAAcL,EAAM,GAI1BM,EAAc7C,EAAAA,UAAS,KAC3B,MAAM8C,EAAqB5B,EAcpB,OAbFhB,EAAMyC,OAACI,wBAEgC,iBAA/BD,EAAmBhB,QACTgB,EAAAhB,QAAUgB,EAAmBhB,QAAQkB,QACtD,QACA,IAEOC,MAAMC,QAAQJ,EAAmBhB,WACvBgB,EAAAhB,QAAUgB,EAAmBhB,QAAQqB,QACrDC,GAAsB,UAAXA,MAIXC,QAAMP,EAAoB5C,SAAM,WAGzCoD,EAAAA,WAAUC,UACc,oBAAXC,QACDC,EAAAC,KAAKb,EAAYzB,MAAK"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qxs-bns/components",
3
3
  "type": "module",
4
- "version": "0.0.29",
4
+ "version": "0.0.30",
5
5
  "description": "Vue 3 Component Library",
6
6
  "license": "MIT",
7
7
  "homepage": "https://trry-hub.github.io/qxs-bns/",
@@ -28,12 +28,14 @@
28
28
  ],
29
29
  "peerDependencies": {
30
30
  "@element-plus/icons-vue": "^2.3.1",
31
- "@vue/composition-api": "^1.7.2",
32
31
  "element-plus": "^2.9.4",
33
- "vue": "^2.7.14 || ^3.5.12"
32
+ "vue": "^3.5.12"
34
33
  },
35
34
  "peerDependenciesMeta": {
36
- "@vue/composition-api": {
35
+ "@element-plus/icons-vue": {
36
+ "optional": true
37
+ },
38
+ "element-plus": {
37
39
  "optional": true
38
40
  }
39
41
  },
@@ -45,8 +47,8 @@
45
47
  "@vueuse/core": "^11.3.0",
46
48
  "echarts": "^5.5.1",
47
49
  "lodash-es": "^4.17.21",
48
- "tinymce": "^7.6.1",
49
- "vue-demi": "^0.14.10"
50
+ "rollup-plugin-scss": "^4.0.1",
51
+ "tinymce": "^7.6.1"
50
52
  },
51
53
  "types": "./types/index.d.ts",
52
54
  "exports": {
package/types/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import installer from './src/defaults';
2
- export * from './src/components';
3
- export declare const install: (app: any) => void;
4
- export declare const version: string;
5
- export default installer;
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAEtC,cAAc,kBAAkB,CAAA;AAEhC,eAAO,MAAM,OAAO,oBAAoB,CAAA;AACxC,eAAO,MAAM,OAAO,QAAoB,CAAA;AACxC,eAAe,SAAS,CAAA"}
@@ -1,2 +0,0 @@
1
- import '../../../../theme-chalk/base.css';
2
- //# sourceMappingURL=css.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/base/style/css.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAA"}
@@ -1,2 +0,0 @@
1
- import '../../../../theme-chalk/src/base.scss';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/base/style/index.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAA"}
@@ -1,11 +0,0 @@
1
- export * from './data-chart/index';
2
- export * from './file-upload/index';
3
- export * from './fixed-action-bar/index';
4
- export * from './image-upload/index';
5
- export * from './photo-crop-tool/index';
6
- export * from './subject-action/index';
7
- export * from './subject-layout/index';
8
- export * from './subject-list/index';
9
- export * from './subject-type/index';
10
- export * from './tiny-mce-editor/index';
11
- //# sourceMappingURL=components.d.ts.map