choiceQuestionDetailDialog.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342
  1. <template>
  2. <div class="choiceQuestionDetailDialog">
  3. <div
  4. class="content"
  5. :style="{
  6. width: slideWidth + 'px',
  7. height: slideHeight + 'px',
  8. }"
  9. >
  10. <span class="closeIcon" @click="closeSlideIndex()">
  11. <img src="../../../assets/img/close.png" />
  12. </span>
  13. <!-- 选择题 -->
  14. <div
  15. class="c_t45"
  16. v-if="workDetail && workDetail.type === '45' && props.showData"
  17. >
  18. <div class="c_t45_title">
  19. <div v-if=" props.showData.choiceQuestionListData[props.showData.workIndex]">{{
  20. props.showData.choiceQuestionListData[props.showData.workIndex]
  21. .teststitle
  22. }}</div>
  23. <span class="c_t45_t_btn" :class="{'c_t45_t_btn_noActive': props.showData.workIndex <= 0}" @click="changeWorkIndex(0)">{{ lang.ssPrevQ }}</span>
  24. <span class="c_t45_t_btn" :class="{'c_t45_t_btn_noActive': props.showData.workIndex >= props.showData.choiceQuestionListData.length - 1}" @click="changeWorkIndex(1)">{{ lang.ssNextQ }}</span>
  25. </div>
  26. <img
  27. class="c_t45_img"
  28. :src="
  29. props.showData.choiceQuestionListData[props.showData.workIndex]
  30. .timuList[0].src
  31. "
  32. v-if=" props.showData.choiceQuestionListData[props.showData.workIndex] &&
  33. props.showData.choiceQuestionListData[props.showData.workIndex]
  34. .timuList.length > 0
  35. "
  36. />
  37. <span
  38. class="c_t45_type"
  39. v-if="
  40. props.showData.choiceQuestionListData[props.showData.workIndex]
  41. .type === '1'
  42. "
  43. >{{ lang.ssSingleSel }}</span
  44. >
  45. <span
  46. class="c_t45_type"
  47. v-if="
  48. props.showData.choiceQuestionListData[props.showData.workIndex]
  49. .type === '2'
  50. "
  51. >{{ lang.ssMultiOpt }}</span
  52. >
  53. <div
  54. class="c_t45_echarts"
  55. :style="{
  56. width: slideWidth - 40 + 'px',
  57. }"
  58. >
  59. <div id="echartsArea1" ref="echartsArea1"></div>
  60. </div>
  61. </div>
  62. <!-- 问答题 -->
  63. <div
  64. class="c_t15"
  65. v-if="workDetail && workDetail.type === '15' && props.showData"
  66. >
  67. <div class="c_t15_title">{{ workDetail.json.answerQ }}</div>
  68. <span class="c_t15_type">{{ lang.ssQATest }}</span>
  69. <div class="c_t15_content" v-show="!lookWorkData">
  70. <div
  71. class="c_t15_c_item"
  72. v-for="item in processedWorkArray"
  73. :key="item.id"
  74. @click="lookWork(item.id)"
  75. >
  76. <div class="c_t15_c_i_top">
  77. <span>S</span>
  78. <div>{{ item.name }}</div>
  79. </div>
  80. <div class="c_t15_c_i_bottom">
  81. <span v-html="item.content.answer"></span>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="c_t15_workDetail" v-if="lookWorkData">
  86. <div class="c_t15_wd_top">
  87. <img
  88. src="../../../assets/img/arrow_left.png"
  89. @click="lookWork('')"
  90. />
  91. <span>S</span>
  92. <div>{{ lookWorkData.name }}</div>
  93. </div>
  94. <div class="c_t15_wd_content">
  95. <span v-html="lookWorkData.content.answer"></span>
  96. <div
  97. class="c_t15_wd_c_imageList"
  98. v-if="lookWorkData.content.fileList.length > 0"
  99. >
  100. <img
  101. v-for="item in lookWorkData.content.fileList"
  102. :src="item.url"
  103. :key="item.uploadTime"
  104. @click="lookImage(item.url)"
  105. />
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <!-- AI应用 -->
  111. <div
  112. class="c_t72"
  113. v-if="props.showData && props.showData.toolType === 72"
  114. >
  115. <div class="c_t72_title">{{ lang.ssAiApp }}</div>
  116. <span class="c_t72_type">{{ lang.ssAiApp }}</span>
  117. <div class="c_t72_content" v-show="!lookWorkData">
  118. <div
  119. class="c_t72_c_item"
  120. v-for="item in processedWorkArray"
  121. :key="item.id"
  122. @click="lookWork(item.id)"
  123. >
  124. <div class="c_t72_c_i_top">
  125. <span>S</span>
  126. <div>{{ item.name }}</div>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="c_t72_workDetail" v-if="lookWorkData">
  131. <div class="c_t72_wd_top">
  132. <img
  133. src="../../../assets/img/arrow_left.png"
  134. @click="lookWork('')"
  135. />
  136. <span>S</span>
  137. <div>{{ lookWorkData.name }}</div>
  138. </div>
  139. <div class="c_t72_wd_content">
  140. <template
  141. v-for="(item, index) in lookWorkData.content"
  142. :key="item.id"
  143. >
  144. <div class="messageNodeArea" v-if="item.messages || item.imageUrls">
  145. <div class="messageNode">
  146. <div class="mn_title">{{ lang.ssNodeTitle.replace(/\*/g, String(index + 1)) }}</div>
  147. <div class="mn_content">
  148. <template
  149. v-for="(item2, index2) in item.messages"
  150. :key="`${index}-${index2}`"
  151. >
  152. <div>
  153. <div
  154. class="na_m_item"
  155. v-if="item2.role == 'user' && item2.content"
  156. >
  157. <div class="na_m_i_name">
  158. {{ item2.sender }}
  159. </div>
  160. <div
  161. class="na_m_i_content"
  162. v-html="item2.content"
  163. ></div>
  164. </div>
  165. <div
  166. class="na_m_item"
  167. v-if="item2.role == 'assistant' && item2.content"
  168. >
  169. <div class="na_m_i_name aiName">
  170. {{ item2.sender }}
  171. </div>
  172. <div
  173. class="na_m_i_content"
  174. v-html="item2.content"
  175. ></div>
  176. </div>
  177. </div>
  178. </template>
  179. <template v-if="item.imageUrls" v-for="(item3,index3) in item.imageUrls" :key="`${index}-${index3}`">
  180. <div class="na_m_item">
  181. <div class="na_m_i_name">
  182. {{ item.type }}
  183. </div>
  184. <div class="na_m_i_content">
  185. <img style="height: 100px;width: auto;" :src="item3" />
  186. </div>
  187. </div>
  188. </template>
  189. </div>
  190. </div>
  191. </div>
  192. </template>
  193. </div>
  194. </div>
  195. </div>
  196. <!-- H5页面 -->
  197. <div
  198. class="c_t73"
  199. v-if="props.showData && props.showData.toolType === 73"
  200. >
  201. <div class="c_t73_title">{{ lang.ssPageImage }}</div>
  202. <span class="c_t73_type">{{ lang.ssHPage }}</span>
  203. <div class="c_t73_content" v-show="!lookWorkData">
  204. <div
  205. class="c_t73_c_item"
  206. v-for="item in processedWorkArray"
  207. :key="item.id"
  208. @click="lookWork(item.id)"
  209. >
  210. <div class="c_t73_c_i_top">
  211. <span>S</span>
  212. <div>{{ item.name }}</div>
  213. </div>
  214. <div class="c_t73_c_i_bottom">
  215. <img :src="item.content" />
  216. </div>
  217. </div>
  218. </div>
  219. <div class="c_t73_workDetail" v-if="lookWorkData">
  220. <div class="c_t73_wd_top">
  221. <img
  222. src="../../../assets/img/arrow_left.png"
  223. @click="lookWork('')"
  224. />
  225. <span>S</span>
  226. <div>{{ lookWorkData.name }}</div>
  227. </div>
  228. <div class="c_t73_wd_content">
  229. <img :src="lookWorkData.content" />
  230. </div>
  231. </div>
  232. </div>
  233. </div>
  234. <previewImageTool ref="previewImageToolRef" />
  235. <selectUserDialog ref="selectUserDialogRef" />
  236. </div>
  237. </template>
  238. <script setup lang="ts">
  239. import { computed, ref, watch, onUnmounted, nextTick } from 'vue'
  240. import * as echarts from 'echarts'
  241. import previewImageTool from '../../components/tool/previewImageTool.vue'
  242. import MarkdownIt from 'markdown-it'
  243. import useImport from '@/hooks/useImport'
  244. import { lang } from '@/main'
  245. import selectUserDialog from './selectUserDialog.vue'
  246. const props = defineProps<{
  247. visible: number[];
  248. workIndex: number;
  249. slideWidth: number;
  250. slideHeight: number;
  251. slideIndex: number;
  252. showData: any;
  253. workArray: any[];
  254. }>()
  255. const emit = defineEmits<{
  256. (e: 'update:visible', v: number[]): void;
  257. (e: 'changeWorkIndex', v: number): void;
  258. }>()
  259. const visible = computed({
  260. get: () => props.visible,
  261. set: (v: number[]) => emit('update:visible', v),
  262. })
  263. const workDetail = computed(() => {
  264. if (props.showData) {
  265. return props.showData.workDetail
  266. }
  267. return null
  268. })
  269. // 预览图片组件
  270. const previewImageToolRef = ref<any>(null)
  271. // 选择用户组件
  272. const selectUserDialogRef = ref<any>(null)
  273. const md = new MarkdownIt()
  274. const { getFile } = useImport()
  275. // 判断是否是 URL 链接
  276. const isUrl = (str: string): boolean => {
  277. try {
  278. const url = new URL(str)
  279. return (url.protocol === 'http:' || url.protocol === 'https:') && str.includes('json')
  280. }
  281. catch {
  282. return false
  283. }
  284. }
  285. // 从链接获取文件内容
  286. const loadContentFromUrl = async (url: string): Promise<string> => {
  287. try {
  288. const fileData = await getFile(url)
  289. if (fileData && fileData.data) {
  290. // 将 ArrayBuffer 转为字符串
  291. const uint8Array = new Uint8Array(fileData.data)
  292. const jsonStr = new TextDecoder('utf-8').decode(uint8Array)
  293. return jsonStr
  294. }
  295. return ''
  296. }
  297. catch (error) {
  298. console.error('获取文件内容失败:', error)
  299. return ''
  300. }
  301. }
  302. // 处理单个作业内容
  303. const processWorkContent = async (content: string, toolType: number): Promise<any> => {
  304. let contentToParse = content
  305. // 如果是链接,先获取文件内容
  306. if (isUrl(content)) {
  307. contentToParse = await loadContentFromUrl(content)
  308. }
  309. if (!contentToParse) {
  310. return null
  311. }
  312. try {
  313. if ([45, 15].includes(toolType)) {
  314. return JSON.parse(decodeURIComponent(contentToParse))
  315. }
  316. else if (toolType === 72) {
  317. const parsed = JSON.parse(contentToParse)
  318. if (Array.isArray(parsed)) {
  319. parsed.forEach((item: any) => {
  320. if (item.messages && item.messages.length) {
  321. item.messages.forEach((item2: any) => {
  322. // 如果已经包含html标签则不再渲染
  323. if (
  324. !/^(\s*<[^>]+>.*<\/[^>]+>\s*|<[^>]+\/>\s*)$/s.test(
  325. item2.content.trim()
  326. )
  327. ) {
  328. item2.content = item2.content.replace(/&lt;/g, '<').replace(/&quot;/g, '"').replace(/&gt;/g, '>')
  329. item2.content = md.render(item2.content)
  330. }
  331. })
  332. }
  333. })
  334. }
  335. return parsed
  336. }
  337. return contentToParse
  338. }
  339. catch (error) {
  340. console.error('解析内容失败:', error)
  341. return null
  342. }
  343. }
  344. const processedWorkArray = ref<any[]>([])
  345. // 监听 workArray 和 showData 变化
  346. watch(
  347. () => [props.workArray, props.showData?.toolType],
  348. async () => {
  349. if (props.workArray && props.showData) {
  350. const _workArray = JSON.parse(JSON.stringify(props.workArray))
  351. // 处理每个作业内容
  352. for (const i of _workArray) {
  353. if (i.content) {
  354. const processedContent = await processWorkContent(i.content, props.showData.toolType)
  355. if (processedContent !== null) {
  356. i.content = processedContent
  357. }
  358. }
  359. }
  360. processedWorkArray.value = _workArray
  361. }
  362. else {
  363. processedWorkArray.value = []
  364. }
  365. },
  366. { immediate: true, deep: true }
  367. )
  368. // 关闭对应的作业详细页面
  369. const closeSlideIndex = () => {
  370. visible.value = visible.value.filter((v) => v !== props.slideIndex)
  371. }
  372. // 切换题目
  373. const changeWorkIndex = (type:number) => {
  374. emit('changeWorkIndex', type)
  375. // console.log(props.workIndex, props.showData.choiceQuestionListData.length)
  376. // if (type === 0 && props.workIndex > 0) {
  377. // emit('changeWorkIndex', 0)
  378. // }
  379. // else if (type === 1 && props.workIndex < props.showData.choiceQuestionListData.length) {
  380. // emit('changeWorkIndex', props.workIndex + 1)
  381. // }
  382. }
  383. // 选择题图表div
  384. const echartsArea1 = ref<any>(null)
  385. // 查看的作业详细id
  386. const lookWorkDetail = ref<string>('')
  387. // 查看作业详细的数据
  388. const lookWorkData = computed(() => {
  389. let _result = null
  390. if (lookWorkDetail.value && processedWorkArray.value.length > 0) {
  391. const _workFind = processedWorkArray.value.find(
  392. (i: any) => i.id === lookWorkDetail.value
  393. )
  394. if (_workFind) {
  395. _result = _workFind
  396. }
  397. }
  398. return _result
  399. })
  400. // 查看图片
  401. const lookImage = (url: string) => {
  402. if (previewImageToolRef.value) {
  403. previewImageToolRef.value.previewImage(url)
  404. }
  405. }
  406. // 查看作业
  407. const lookWork = (id: string) => {
  408. lookWorkDetail.value = id
  409. }
  410. // 选择题图表实例
  411. const myChart = ref<any>(null)
  412. // resize防抖定时器
  413. let resizeTimer: ReturnType<typeof setTimeout> | null = null
  414. // 处理ECharts resize
  415. const handleChartResize = () => {
  416. // 清除之前的定时器
  417. if (resizeTimer) {
  418. clearTimeout(resizeTimer)
  419. }
  420. resizeTimer = setTimeout(() => {
  421. nextTick(() => {
  422. if (
  423. myChart.value &&
  424. typeof myChart.value.resize === 'function' &&
  425. !myChart.value.isDisposed()
  426. ) {
  427. try {
  428. myChart.value.resize()
  429. }
  430. catch (e) {
  431. // console.error('myChart resize error:', e)
  432. // 如果resize失败,重新初始化图表
  433. if (
  434. props.showData &&
  435. props.showData.workDetail &&
  436. props.showData.workDetail.type === '45'
  437. ) {
  438. setEchartsArea1()
  439. }
  440. }
  441. }
  442. })
  443. }, 200) // 防抖延迟200ms
  444. }
  445. // 设置选择题图表
  446. const setEchartsArea1 = () => {
  447. // 如果已有实例且未销毁,先销毁
  448. if (myChart.value && !myChart.value.isDisposed()) {
  449. myChart.value.dispose()
  450. }
  451. if (echartsArea1.value) {
  452. myChart.value = echarts.init(echartsArea1.value)
  453. }
  454. else {
  455. myChart.value = null
  456. }
  457. if (myChart.value) {
  458. const _work =
  459. props.showData.choiceQuestionListData[props.showData.workIndex]
  460. // 修正版,处理xAxis.data内为图片对象的case,formatter始终只拿到src或自定义label,保证无[object Object]问题
  461. const option = {
  462. tooltip: {
  463. show: false, // 禁用鼠标移动到柱体时的内容显示
  464. },
  465. yAxis: {
  466. show: false, // 不显示最左边的y轴
  467. },
  468. xAxis: {
  469. data: [],
  470. axisLabel: {
  471. color: 'rgba(0, 0, 0, 0.9)',
  472. fontWeight: 600,
  473. fontSize: 17,
  474. lineHeight: 20,
  475. interval: 0,
  476. formatter: function(value: any, idx: number) {
  477. // 如果是字符串且格式为JSON(图片),则解析处理
  478. if (typeof value === 'string') {
  479. try {
  480. const obj = JSON.parse(value)
  481. if (obj && typeof obj === 'object' && obj.imgType && obj.src) {
  482. return '{img' + idx + '|}'
  483. }
  484. }
  485. catch (e) {
  486. // 非JSON字符串,直接返回
  487. // 如果文本文字超过8个字,换行
  488. if (typeof value === 'string') {
  489. let displayValue = value
  490. if (value.length > 20) {
  491. displayValue = value.substr(0, 20) + '...'
  492. }
  493. // 8个字换行
  494. let output = ''
  495. for (let i = 0; i < displayValue.length; i += 8) {
  496. output += displayValue.substr(i, 8)
  497. if (i + 8 < displayValue.length) {
  498. output += '\n'
  499. }
  500. }
  501. return output
  502. }
  503. return value
  504. }
  505. return value
  506. }
  507. // 兼容老格式(容错):value本身是对象,并有图片信息
  508. if (
  509. value &&
  510. typeof value === 'object' &&
  511. value.imgType &&
  512. value.src
  513. ) {
  514. return '{img' + idx + '|}'
  515. }
  516. // 其他类型直接空
  517. return ''
  518. },
  519. rich: (() => {
  520. // 动态生成所有图片的 rich 格式
  521. const richObj: any = {}
  522. _work.choiceUser.forEach((op: any, idx: number) => {
  523. if (
  524. op.option &&
  525. typeof op.option === 'object' &&
  526. op.option.imgType &&
  527. op.option.src
  528. ) {
  529. richObj['img' + idx] = {
  530. height: 40,
  531. width: 40,
  532. align: 'center',
  533. backgroundColor: {
  534. image: op.option.src,
  535. },
  536. }
  537. }
  538. })
  539. return richObj
  540. })(),
  541. },
  542. },
  543. series: [
  544. {
  545. name: '',
  546. type: 'bar',
  547. data: [],
  548. barWidth: '50%', // 柱体宽度缩小40%
  549. itemStyle: {
  550. color: 'rgba(252, 207, 0, 1)',
  551. },
  552. label: {
  553. show: true,
  554. position: 'top',
  555. color: 'rgba(116, 139, 115, 1)',
  556. fontSize: 22,
  557. fontWeight: 500,
  558. lineHeight: 24,
  559. },
  560. },
  561. ],
  562. }
  563. _work.choiceUser.forEach((i: any, idx: number) => {
  564. // 如果是图片,存src对象,否则为字符串
  565. if (
  566. i.option &&
  567. typeof i.option === 'object' &&
  568. i.option.imgType &&
  569. i.option.src
  570. ) {
  571. (option.xAxis.data as any[]).push(
  572. JSON.stringify({ imgType: i.option.imgType, src: i.option.src })
  573. ) // 仅保留相关字段
  574. }
  575. else if (typeof i.option === 'string') {
  576. (option.xAxis.data as any[]).push(i.option)
  577. }
  578. else {
  579. (option.xAxis.data as any[]).push('')
  580. }
  581. (option.series[0].data as any[]).push(i.user.length)
  582. })
  583. console.log(option)
  584. // {
  585. // title: {
  586. // text: 'ECharts 入门示例'
  587. // },
  588. // tooltip: {},
  589. // xAxis: {
  590. // data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
  591. // },
  592. // yAxis: {},
  593. // series: [
  594. // {
  595. // name: '销量',
  596. // type: 'bar',
  597. // data: [5, 20, 36, 10, 10, 20]
  598. // }
  599. // ]
  600. // }
  601. myChart.value.setOption(option)
  602. myChart.value.off('click')
  603. myChart.value.on('click', (params: any) => {
  604. const idx = params.dataIndex
  605. const selectedOption = _work.choiceUser[idx]
  606. if (selectedOption && selectUserDialogRef.value) {
  607. // console.log(selectedOption)
  608. selectUserDialogRef.value.open(selectedOption)
  609. }
  610. })
  611. }
  612. }
  613. // 监听选择题数据变化
  614. watch(
  615. () => props.showData,
  616. (newVal, oldVal) => {
  617. console.log('发生变化,showData')
  618. if (
  619. newVal &&
  620. newVal.choiceQuestionListData[newVal.workIndex] &&
  621. props.showData.workDetail.type === '45'
  622. ) {
  623. if (
  624. oldVal &&
  625. newVal.choiceQuestionListData[newVal.workIndex] &&
  626. oldVal.choiceQuestionListData[oldVal.workIndex]
  627. ) {
  628. if (
  629. JSON.stringify(newVal.choiceQuestionListData[newVal.workIndex]) !==
  630. JSON.stringify(oldVal.choiceQuestionListData[oldVal.workIndex])
  631. ) {
  632. setEchartsArea1()
  633. }
  634. }
  635. }
  636. else {
  637. myChart.value = null
  638. }
  639. },
  640. { immediate: true, deep: true }
  641. )
  642. // 监听作业变化
  643. watch(
  644. () => props.showData?.choiceQuestionListData,
  645. (newVal, oldVal) => {
  646. console.log('choiceQuestionListData变化了')
  647. if (
  648. (newVal || newVal === 0) &&
  649. props.showData.workDetail &&
  650. props.showData.workDetail.type === '45'
  651. ) {
  652. if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
  653. setEchartsArea1()
  654. }
  655. else {
  656. console.log('choiceQuestionListData没有变化')
  657. }
  658. }
  659. else {
  660. myChart.value = null
  661. }
  662. },
  663. { deep: true }
  664. )
  665. // 监听作业变化
  666. watch(
  667. () => props.showData?.workIndex,
  668. (newVal) => {
  669. if (
  670. (newVal || newVal === 0) &&
  671. props.showData.workDetail &&
  672. props.showData.workDetail.type === '45'
  673. ) {
  674. setEchartsArea1()
  675. }
  676. else {
  677. myChart.value = null
  678. }
  679. }
  680. )
  681. // 监听echartsArea1变化
  682. watch(
  683. () => echartsArea1.value,
  684. (newVal) => {
  685. if (
  686. newVal &&
  687. props.showData &&
  688. props.showData.workDetail &&
  689. props.showData.workDetail.type === '45'
  690. ) {
  691. setEchartsArea1()
  692. }
  693. else {
  694. myChart.value = null
  695. }
  696. }
  697. )
  698. // 监听页面宽度变化
  699. watch(
  700. () => props.slideWidth,
  701. (newVal) => {
  702. if (
  703. newVal &&
  704. props.showData &&
  705. props.showData.workDetail &&
  706. props.showData.workDetail.type === '45'
  707. ) {
  708. handleChartResize()
  709. }
  710. }
  711. )
  712. // 组件卸载时清理ECharts实例
  713. onUnmounted(() => {
  714. // 清除定时器
  715. if (resizeTimer) {
  716. clearTimeout(resizeTimer)
  717. resizeTimer = null
  718. }
  719. // 销毁ECharts实例
  720. if (myChart.value && !myChart.value.isDisposed()) {
  721. myChart.value.dispose()
  722. myChart.value = null
  723. }
  724. })
  725. </script>
  726. <style lang="scss" scoped>
  727. .choiceQuestionDetailDialog {
  728. background: none;
  729. position: relative;
  730. width: 100%;
  731. height: 100%;
  732. z-index: 1;
  733. .content {
  734. width: 100%;
  735. height: 100%;
  736. position: relative;
  737. background: #fff;
  738. box-sizing: border-box;
  739. padding: 40px;
  740. overflow: auto;
  741. .closeIcon {
  742. position: absolute;
  743. right: 20px;
  744. top: 20px;
  745. cursor: pointer;
  746. width: 20px;
  747. height: 20px;
  748. img {
  749. width: 100%;
  750. height: 100%;
  751. }
  752. }
  753. .c_t45 {
  754. width: 100%;
  755. min-height: 100%;
  756. display: flex;
  757. align-items: center;
  758. flex-direction: column;
  759. height: auto;
  760. .c_t45_title {
  761. color: rgba(0, 0, 0, 0.9);
  762. font-weight: 600;
  763. font-size: 24px;
  764. line-height: 24px;
  765. position: relative;
  766. width: 100%;
  767. display: flex;
  768. align-items: center;
  769. justify-content: center;
  770. user-select: none;
  771. &>div{
  772. max-width: calc(100% - 200px);
  773. }
  774. &>span{
  775. position: absolute;
  776. top: 20px;
  777. cursor: pointer;
  778. &:nth-of-type(1){
  779. left: 0;
  780. }
  781. &:nth-of-type(2){
  782. right: 0;
  783. }
  784. }
  785. .c_t45_t_btn_noActive{
  786. color: #CCCCCC;
  787. }
  788. }
  789. .c_t45_img {
  790. max-width: 200px;
  791. object-fit: cover;
  792. margin-top: 20px;
  793. }
  794. .c_t45_type {
  795. font-weight: 400;
  796. font-size: 15px;
  797. line-height: 21px;
  798. letter-spacing: 0.5px;
  799. color: rgba(0, 0, 0, 1);
  800. opacity: 0.5;
  801. margin-top: 20px;
  802. }
  803. .c_t45_echarts {
  804. width: 100%;
  805. flex: 1;
  806. min-height: 400px;
  807. display: flex;
  808. align-items: center;
  809. box-sizing: border-box;
  810. & > div {
  811. width: 100%;
  812. height: 400px;
  813. }
  814. }
  815. }
  816. .c_t15 {
  817. width: 100%;
  818. min-height: 100%;
  819. display: flex;
  820. align-items: center;
  821. flex-direction: column;
  822. height: auto;
  823. padding: 40px;
  824. .c_t15_title {
  825. color: rgba(0, 0, 0, 0.9);
  826. font-weight: 600;
  827. font-size: 24px;
  828. line-height: 24px;
  829. }
  830. .c_t15_type {
  831. font-weight: 400;
  832. font-size: 15px;
  833. line-height: 21px;
  834. letter-spacing: 0.5px;
  835. color: rgba(0, 0, 0, 1);
  836. opacity: 0.5;
  837. margin-top: 20px;
  838. }
  839. .c_t15_content {
  840. width: 100%;
  841. height: auto;
  842. display: grid;
  843. grid-template-columns: repeat(3, 1fr);
  844. gap: 20px;
  845. margin-top: 40px;
  846. .c_t15_c_item {
  847. width: 100%;
  848. height: auto;
  849. box-shadow: 2px 4px 20px 0px rgba(0, 0, 0, 0.2);
  850. box-sizing: border-box;
  851. border-radius: 12px;
  852. padding: 16px;
  853. background: rgba(255, 255, 255, 0.6);
  854. transition: 0.3s;
  855. cursor: pointer;
  856. &:hover {
  857. box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
  858. background: rgba(255, 255, 255, 0.6);
  859. }
  860. .c_t15_c_i_top {
  861. display: flex;
  862. align-items: center;
  863. gap: 10px;
  864. & > span {
  865. display: block;
  866. width: 25px;
  867. height: 25px;
  868. display: flex;
  869. align-items: center;
  870. justify-content: center;
  871. background: rgba(252, 207, 0, 1);
  872. border-radius: 4px;
  873. color: rgba(255, 255, 255, 1);
  874. font-weight: bold;
  875. font-size: 14px;
  876. }
  877. & > div {
  878. color: rgba(0, 0, 0, 0.7);
  879. font-weight: 800;
  880. }
  881. }
  882. .c_t15_c_i_bottom {
  883. margin-top: 15px;
  884. font-weight: 300;
  885. font-size: 14px;
  886. height: 40px;
  887. max-width: 100%;
  888. overflow: hidden;
  889. text-overflow: ellipsis;
  890. display: -webkit-box;
  891. -webkit-line-clamp: 2;
  892. -webkit-box-orient: vertical;
  893. }
  894. }
  895. }
  896. .c_t15_workDetail {
  897. width: 100%;
  898. height: auto;
  899. margin-top: 40px;
  900. box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
  901. box-sizing: border-box;
  902. padding: 16px;
  903. border-radius: 12px;
  904. display: flex;
  905. flex-direction: column;
  906. .c_t15_wd_top {
  907. width: 100%;
  908. display: flex;
  909. align-items: center;
  910. gap: 15px;
  911. & > img {
  912. width: 25px;
  913. height: 25px;
  914. cursor: pointer;
  915. }
  916. & > span {
  917. display: block;
  918. width: 30px;
  919. height: 30px;
  920. display: flex;
  921. align-items: center;
  922. justify-content: center;
  923. background: rgba(252, 207, 0, 1);
  924. border-radius: 4px;
  925. color: rgba(255, 255, 255, 1);
  926. font-weight: bold;
  927. font-size: 16px;
  928. }
  929. & > div {
  930. color: rgba(0, 0, 0, 0.7);
  931. font-weight: 800;
  932. font-size: 18px;
  933. }
  934. }
  935. .c_t15_wd_content {
  936. width: 100%;
  937. margin-top: 20px;
  938. max-height: 100%;
  939. overflow: auto;
  940. flex-wrap: wrap;
  941. .c_t15_wd_c_imageList {
  942. width: 100%;
  943. gap: 20px;
  944. margin-top: 20px;
  945. & > img {
  946. width: 100px;
  947. height: auto;
  948. cursor: pointer;
  949. margin-right: 20px;
  950. object-fit: cover;
  951. }
  952. }
  953. }
  954. }
  955. }
  956. .c_t72 {
  957. width: 100%;
  958. min-height: 100%;
  959. display: flex;
  960. align-items: center;
  961. flex-direction: column;
  962. height: auto;
  963. padding: 40px;
  964. .c_t72_title {
  965. color: rgba(0, 0, 0, 0.9);
  966. font-weight: 600;
  967. font-size: 24px;
  968. line-height: 24px;
  969. }
  970. .c_t72_type {
  971. font-weight: 400;
  972. font-size: 15px;
  973. line-height: 21px;
  974. letter-spacing: 0.5px;
  975. color: rgba(0, 0, 0, 1);
  976. opacity: 0.5;
  977. margin-top: 20px;
  978. }
  979. .c_t72_content {
  980. width: 100%;
  981. height: auto;
  982. display: grid;
  983. grid-template-columns: repeat(4, 1fr);
  984. gap: 20px;
  985. margin-top: 40px;
  986. .c_t72_c_item {
  987. width: 100%;
  988. height: auto;
  989. box-shadow: 2px 4px 20px 0px rgba(0, 0, 0, 0.2);
  990. box-sizing: border-box;
  991. border-radius: 12px;
  992. padding: 16px;
  993. background: rgba(255, 255, 255, 0.6);
  994. transition: 0.3s;
  995. cursor: pointer;
  996. &:hover {
  997. box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
  998. background: rgba(255, 255, 255, 0.6);
  999. }
  1000. .c_t72_c_i_top {
  1001. display: flex;
  1002. align-items: center;
  1003. gap: 10px;
  1004. & > span {
  1005. display: block;
  1006. width: 25px;
  1007. height: 25px;
  1008. display: flex;
  1009. align-items: center;
  1010. justify-content: center;
  1011. background: rgba(252, 207, 0, 1);
  1012. border-radius: 4px;
  1013. color: rgba(255, 255, 255, 1);
  1014. font-weight: bold;
  1015. font-size: 14px;
  1016. }
  1017. & > div {
  1018. color: rgba(0, 0, 0, 0.7);
  1019. font-weight: 800;
  1020. }
  1021. }
  1022. .c_t72_c_i_bottom {
  1023. margin-top: 15px;
  1024. font-weight: 300;
  1025. font-size: 14px;
  1026. // height: 40px;
  1027. max-width: 100%;
  1028. overflow: hidden;
  1029. text-overflow: ellipsis;
  1030. display: -webkit-box;
  1031. -webkit-line-clamp: 2;
  1032. -webkit-box-orient: vertical;
  1033. img {
  1034. width: 100%;
  1035. max-height: 200px;
  1036. object-fit: cover;
  1037. }
  1038. }
  1039. }
  1040. }
  1041. .c_t72_workDetail {
  1042. width: 100%;
  1043. height: auto;
  1044. margin-top: 40px;
  1045. box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
  1046. box-sizing: border-box;
  1047. padding: 16px;
  1048. border-radius: 12px;
  1049. display: flex;
  1050. flex-direction: column;
  1051. .c_t72_wd_top {
  1052. width: 100%;
  1053. display: flex;
  1054. align-items: center;
  1055. gap: 15px;
  1056. & > img {
  1057. width: 25px;
  1058. height: 25px;
  1059. cursor: pointer;
  1060. }
  1061. & > span {
  1062. display: block;
  1063. width: 30px;
  1064. height: 30px;
  1065. display: flex;
  1066. align-items: center;
  1067. justify-content: center;
  1068. background: rgba(252, 207, 0, 1);
  1069. border-radius: 4px;
  1070. color: rgba(255, 255, 255, 1);
  1071. font-weight: bold;
  1072. font-size: 16px;
  1073. }
  1074. & > div {
  1075. color: rgba(0, 0, 0, 0.7);
  1076. font-weight: 800;
  1077. font-size: 18px;
  1078. }
  1079. }
  1080. .c_t72_wd_content {
  1081. width: 100%;
  1082. margin-top: 20px;
  1083. max-height: 100%;
  1084. overflow: auto;
  1085. flex-wrap: wrap;
  1086. display: flex;
  1087. align-items: center;
  1088. justify-content: center;
  1089. .na_m_item {
  1090. width: 100%;
  1091. height: auto;
  1092. margin: 10px 0;
  1093. }
  1094. .na_m_i_name {
  1095. width: fit-content;
  1096. max-width: 100%;
  1097. height: auto;
  1098. box-sizing: border-box;
  1099. padding: 10px 10px;
  1100. display: flex;
  1101. align-items: center;
  1102. border-radius: 10px 10px 0 0;
  1103. background-color: #9747ff;
  1104. color: #fff;
  1105. text-overflow: ellipsis;
  1106. overflow: hidden;
  1107. white-space: nowrap;
  1108. }
  1109. .aiName {
  1110. background-color: #0560fc;
  1111. }
  1112. .na_m_i_content {
  1113. padding: 10px;
  1114. border: solid 1px #e7e7e7;
  1115. box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.1);
  1116. border-radius: 0 0 12px 12px;
  1117. background-color: #fff;
  1118. :deep(img){
  1119. max-width: 100%;
  1120. }
  1121. }
  1122. .messageNode {
  1123. width: 100%;
  1124. height: auto;
  1125. box-sizing: border-box;
  1126. padding: 10px 10px;
  1127. border: 0.5px solid #e7e7e7;
  1128. border-radius: 12px;
  1129. gap: 10px;
  1130. margin-top: 20px;
  1131. }
  1132. .messageNodeArea{
  1133. width: 100%;
  1134. height: auto;
  1135. }
  1136. }
  1137. }
  1138. }
  1139. .c_t73 {
  1140. width: 100%;
  1141. min-height: 100%;
  1142. display: flex;
  1143. align-items: center;
  1144. flex-direction: column;
  1145. height: auto;
  1146. padding: 40px;
  1147. .c_t73_title {
  1148. color: rgba(0, 0, 0, 0.9);
  1149. font-weight: 600;
  1150. font-size: 24px;
  1151. line-height: 24px;
  1152. }
  1153. .c_t73_type {
  1154. font-weight: 400;
  1155. font-size: 15px;
  1156. line-height: 21px;
  1157. letter-spacing: 0.5px;
  1158. color: rgba(0, 0, 0, 1);
  1159. opacity: 0.5;
  1160. margin-top: 20px;
  1161. }
  1162. .c_t73_content {
  1163. width: 100%;
  1164. height: auto;
  1165. display: grid;
  1166. grid-template-columns: repeat(4, 1fr);
  1167. gap: 20px;
  1168. margin-top: 40px;
  1169. .c_t73_c_item {
  1170. width: 100%;
  1171. height: auto;
  1172. box-shadow: 2px 4px 20px 0px rgba(0, 0, 0, 0.2);
  1173. box-sizing: border-box;
  1174. border-radius: 12px;
  1175. padding: 16px;
  1176. background: rgba(255, 255, 255, 0.6);
  1177. transition: 0.3s;
  1178. cursor: pointer;
  1179. &:hover {
  1180. box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
  1181. background: rgba(255, 255, 255, 0.6);
  1182. }
  1183. .c_t73_c_i_top {
  1184. display: flex;
  1185. width: 100%;
  1186. align-items: center;
  1187. gap: 10px;
  1188. & > span {
  1189. display: block;
  1190. width: 25px;
  1191. height: 25px;
  1192. display: flex;
  1193. align-items: center;
  1194. justify-content: center;
  1195. background: rgba(252, 207, 0, 1);
  1196. border-radius: 4px;
  1197. color: rgba(255, 255, 255, 1);
  1198. font-weight: bold;
  1199. font-size: 14px;
  1200. }
  1201. & > div {
  1202. color: rgba(0, 0, 0, 0.7);
  1203. font-weight: 800;
  1204. }
  1205. }
  1206. .c_t73_c_i_bottom {
  1207. margin-top: 15px;
  1208. font-weight: 300;
  1209. font-size: 14px;
  1210. // height: 40px;
  1211. max-width: 100%;
  1212. overflow: hidden;
  1213. text-overflow: ellipsis;
  1214. display: -webkit-box;
  1215. -webkit-line-clamp: 2;
  1216. -webkit-box-orient: vertical;
  1217. img {
  1218. width: 100%;
  1219. max-height: 200px;
  1220. object-fit: cover;
  1221. }
  1222. }
  1223. }
  1224. }
  1225. .c_t73_workDetail {
  1226. width: 100%;
  1227. height: auto;
  1228. margin-top: 40px;
  1229. box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
  1230. box-sizing: border-box;
  1231. padding: 16px;
  1232. border-radius: 12px;
  1233. display: flex;
  1234. flex-direction: column;
  1235. .c_t73_wd_top {
  1236. width: 100%;
  1237. display: flex;
  1238. align-items: center;
  1239. gap: 15px;
  1240. & > img {
  1241. width: 25px;
  1242. height: 25px;
  1243. cursor: pointer;
  1244. }
  1245. & > span {
  1246. display: block;
  1247. width: 30px;
  1248. height: 30px;
  1249. display: flex;
  1250. align-items: center;
  1251. justify-content: center;
  1252. background: rgba(252, 207, 0, 1);
  1253. border-radius: 4px;
  1254. color: rgba(255, 255, 255, 1);
  1255. font-weight: bold;
  1256. font-size: 16px;
  1257. }
  1258. & > div {
  1259. color: rgba(0, 0, 0, 0.7);
  1260. font-weight: 800;
  1261. font-size: 18px;
  1262. }
  1263. }
  1264. .c_t73_wd_content {
  1265. width: 100%;
  1266. margin-top: 20px;
  1267. max-height: 100%;
  1268. overflow: auto;
  1269. flex-wrap: wrap;
  1270. display: flex;
  1271. align-items: center;
  1272. justify-content: center;
  1273. & > img {
  1274. max-width: 100%;
  1275. object-fit: cover;
  1276. }
  1277. }
  1278. }
  1279. }
  1280. }
  1281. }
  1282. </style>