choiceQuestionDetailDialog.vue 35 KB

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