ModuleMixin.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. // 组件混入
  2. import Vue from 'vue';
  3. import ModuleBase from './ModuleBase.vue';
  4. import RichText from '@/components/RichText.vue';
  5. import MultilingualFill from '@/views/book/components/MultilingualFill.vue';
  6. import AnswerAnalysisList from '@/views/book/courseware/create/components/common/AnswerAnalysisList.vue';
  7. import { displayList, viewMethodList, isEnable, analysisData, answerData } from '@/views/book/courseware/data/common';
  8. import {
  9. ContentSaveCoursewareComponentContent,
  10. ContentGetCoursewareComponentContent,
  11. GetCoursewareComponentBackground,
  12. SaveCoursewareComponentBackground,
  13. PinyinBuild_OldFormat,
  14. } from '@/api/book';
  15. const isPlainObject = (value) => Object.prototype.toString.call(value) === '[object Object]';
  16. /**
  17. * 将已保存的组件内容合并到组件默认内容上
  18. * 组件内容可能是空对象(如 "{}")、旧版本结构或部分字段缺失,直接覆盖会让模板读取 undefined 报错,
  19. * 表现为整个组件渲染失败、变成空白,因此缺失(或为 null)的字段都回退到默认值
  20. * @param {object} defaults 组件默认内容
  21. * @param {object} data 已保存的组件内容
  22. * @returns {object} 合并后的内容
  23. */
  24. function mergeComponentData(defaults, data) {
  25. if (!isPlainObject(defaults)) return data;
  26. if (!isPlainObject(data)) return defaults;
  27. const result = { ...defaults };
  28. Object.keys(data).forEach((key) => {
  29. const defaultValue = defaults[key];
  30. const value = data[key];
  31. // 空值回退到默认值,避免覆盖掉模板依赖的字段
  32. if (value === undefined || value === null) return;
  33. if (Array.isArray(defaultValue)) {
  34. result[key] = Array.isArray(value) ? value : defaultValue;
  35. return;
  36. }
  37. const isObjectValue = isPlainObject(defaultValue) && isPlainObject(value);
  38. result[key] = isObjectValue ? mergeComponentData(defaultValue, value) : value;
  39. });
  40. return result;
  41. }
  42. const mixin = {
  43. data() {
  44. return {
  45. displayList,
  46. viewMethodList,
  47. typeList: ['interaction'],
  48. isEnable,
  49. property: {
  50. isGetContent: false, // 是否已获取内容
  51. isSilentPropertyWatch: false, // 初始化组件内容时,临时静默 property 监听
  52. isDataPreset: false, // 组件内容是否已由外部预设(粘贴组件),预设后不再用初始化数据覆盖
  53. },
  54. borderColorObj: Vue.observable({ value: this.borderColor }), // 边框颜色
  55. multilingualVisible: false, // 多语言弹窗
  56. idNameOrder: [
  57. 'answer_audio_id_list',
  58. 'answer_image_id_list',
  59. 'answer_video_id_list',
  60. 'analysis_audio_id_list',
  61. 'analysis_image_id_list',
  62. 'analysis_video_id_list',
  63. ],
  64. fileNameOrder: [
  65. 'answer_audio_list',
  66. 'answer_image_list',
  67. 'answer_video_list',
  68. 'analysis_audio_list',
  69. 'analysis_image_list',
  70. 'analysis_video_list',
  71. ],
  72. background: '', // 组件背景
  73. };
  74. },
  75. props: {
  76. id: {
  77. type: String,
  78. required: true,
  79. },
  80. oldId: {
  81. type: String,
  82. default: '',
  83. },
  84. componentMove: {
  85. type: Function,
  86. required: true,
  87. },
  88. borderColor: {
  89. type: String,
  90. required: true,
  91. },
  92. content: {
  93. type: String,
  94. default: '{}',
  95. },
  96. type: {
  97. type: String,
  98. default: '',
  99. },
  100. },
  101. components: {
  102. ModuleBase,
  103. RichText,
  104. MultilingualFill,
  105. AnswerAnalysisList,
  106. },
  107. provide() {
  108. return {
  109. showSetting: this.showSetting,
  110. copyComponent: this.copyComponent,
  111. id: this.id,
  112. deleteComponent: this.deleteComponent,
  113. handleComponentMove: this.handleComponentMove,
  114. property: this.property,
  115. borderColor: this.borderColorObj,
  116. };
  117. },
  118. watch: {
  119. borderColor(newVal) {
  120. this.borderColorObj.value = newVal;
  121. },
  122. content: {
  123. handler(newVal) {
  124. if (this.type !== 'interaction') return;
  125. if (newVal) this.data = JSON.parse(newVal);
  126. },
  127. immediate: true,
  128. },
  129. },
  130. inject: ['courseware_id', 'project_id', 'getBookUnifiedAttr', 'getTemporaryCoursewareID'],
  131. created() {
  132. if (this.type === 'interaction') {
  133. this.$emit('contentLoading', !this.property.isGetContent);
  134. } else {
  135. this.GetCoursewareComponentContent();
  136. }
  137. // 初始化 mind_map.node_list[0].id
  138. if (!this.data?.mind_map?.node_list?.[0]?.id) {
  139. this.data.mind_map = this.data.mind_map ?? {};
  140. this.data.mind_map.node_list = this.data.mind_map.node_list ?? [{}];
  141. if (this.data.mind_map.node_list.length > 0) {
  142. this.data.mind_map.node_list[0].id = this.id;
  143. }
  144. }
  145. },
  146. methods: {
  147. GetCoursewareComponentContent() {
  148. if (this.courseware_id === '' || this.id === '') return;
  149. this.$emit('contentLoading', true);
  150. this.property.isSilentPropertyWatch = true;
  151. let temporaryCoursewareID = this.getTemporaryCoursewareID();
  152. let coursewareID = temporaryCoursewareID || this.courseware_id;
  153. let component_id = temporaryCoursewareID.length > 0 ? this.oldId || this.id : this.id;
  154. ContentGetCoursewareComponentContent({ courseware_id: coursewareID, component_id })
  155. .then(({ content }) => {
  156. // 粘贴组件时内容已由源组件预设,接口返回的初始内容(通常为空)不能覆盖粘贴过来的设置
  157. if (!this.property.isDataPreset) {
  158. if (content) {
  159. let oldData = {};
  160. try {
  161. oldData = JSON.parse(content) ?? {};
  162. } catch (error) {
  163. // 内容不是合法 JSON 时不能让组件停留在空数据上
  164. console.error('组件内容解析失败,已使用默认内容', error);
  165. }
  166. if (oldData.type === 'audio') {
  167. let p = oldData.property || {};
  168. if (!p.file_name_display_mode) p.file_name_display_mode = 'true';
  169. if (p.view_method === 'independent' && !p.style_mode) {
  170. p.style_mode = 'middle';
  171. }
  172. if (!p.style_mode) p.style_mode = 'big';
  173. if (p.view_method === 'icon') {
  174. p.file_name_display_mode = 'false';
  175. p.view_method = 'independent';
  176. p.style_mode = 'small';
  177. }
  178. }
  179. this.data = mergeComponentData(this.data, oldData);
  180. } else {
  181. const bookUnifiedAttr = this.getBookUnifiedAttr();
  182. this.$set(this.data, 'unified_attrib', bookUnifiedAttr);
  183. // 初始化时,如果有 view_pinyin 则根据全教材设置配置设 view_pinyin 和 pinyin_position
  184. if ('view_pinyin' in this.data.property) {
  185. this.data.property.view_pinyin = bookUnifiedAttr?.view_pinyin ?? 'false';
  186. this.data.property.pinyin_position = bookUnifiedAttr?.pinyin_position ?? 'top';
  187. }
  188. if ('frame_color' in this.data.property) {
  189. // 框颜色初始化为主题色
  190. this.data.property.frame_color = bookUnifiedAttr?.topic_color ?? '#F13232';
  191. }
  192. if ('sn_background_color' in this.data.property) {
  193. // 序号背景色
  194. this.data.property.sn_background_color = bookUnifiedAttr?.topic_color ?? '#EA3232';
  195. }
  196. }
  197. }
  198. this.property.isGetContent = true;
  199. this.$emit('contentLoading', false);
  200. this.$watch(
  201. 'data',
  202. () => {
  203. this.$emit('changeData');
  204. },
  205. { deep: true },
  206. );
  207. })
  208. .catch((error) => {
  209. // 请求失败时保持未加载状态(避免用空内容覆盖已保存内容),但把错误暴露出来便于排查
  210. console.error('组件内容获取失败', component_id, error);
  211. })
  212. .finally(() => {
  213. this.$nextTick(() => {
  214. this.property.isSilentPropertyWatch = false;
  215. });
  216. });
  217. },
  218. /**
  219. * @description 复制组件(组件数据 + 组件背景)
  220. */
  221. async copyComponent() {
  222. // 编辑器内容可能还未同步到 data,先同步再复制,避免复制到旧内容
  223. this.syncRichTextContent();
  224. const background = await this.getComponentBackground();
  225. this.$emit('copyComponent', {
  226. data: JSON.parse(JSON.stringify(this.data)),
  227. background,
  228. });
  229. },
  230. /**
  231. * @description 获取组件背景(已加载过则直接复用,否则从服务端获取)
  232. * @returns {Promise<String>} 组件背景 JSON 字符串
  233. */
  234. async getComponentBackground() {
  235. const normalize = (background) =>
  236. background ? (typeof background === 'string' ? background : JSON.stringify(background)) : '';
  237. if (this.background) return normalize(this.background);
  238. if (this.courseware_id === '' || this.id === '') return '';
  239. // 与组件内容保持一致:从模板课件取内容时,背景也按模板组件的 id 取
  240. const temporaryCoursewareID = this.getTemporaryCoursewareID();
  241. const courseware_id = temporaryCoursewareID || this.courseware_id;
  242. const component_id = temporaryCoursewareID.length > 0 ? this.oldId || this.id : this.id;
  243. try {
  244. const { background } = await GetCoursewareComponentBackground({ courseware_id, component_id });
  245. return normalize(background);
  246. } catch (error) {
  247. console.error('组件背景获取失败', component_id, error);
  248. return '';
  249. }
  250. },
  251. /**
  252. * @description 设置组件数据(用于粘贴组件)
  253. * @param {Object} data 组件数据
  254. * @param {String} background 组件背景 JSON 字符串
  255. */
  256. setData(data, background = '') {
  257. // 标记内容已预设,避免初始化接口返回后再把粘贴过来的设置重置为默认值
  258. this.property.isDataPreset = true;
  259. this.property.isSilentPropertyWatch = true;
  260. // 先卸载内容区,让依赖 isGetContent 渲染的编辑器(如富文本)用新内容重新初始化
  261. this.property.isGetContent = false;
  262. this.$emit('contentLoading', true);
  263. this.data = data;
  264. this.background = background;
  265. this.$nextTick(() => {
  266. this.property.isGetContent = true;
  267. this.$emit('contentLoading', false);
  268. this.$nextTick(() => {
  269. this.property.isSilentPropertyWatch = false;
  270. });
  271. });
  272. // 背景由独立接口保存,粘贴后立即把源组件的背景写到新组件上
  273. this.saveCoursewareComponentBackground();
  274. },
  275. /**
  276. * @description 显示设置
  277. */
  278. showSetting() {
  279. this.$emit('showSetting', this.data.property, this.data.type, this.id);
  280. },
  281. /**
  282. * @description 删除组件
  283. */
  284. deleteComponent() {
  285. this.$emit('deleteComponent', this.id);
  286. },
  287. /**
  288. * @description 更新property属性
  289. * @param {String} type 类型
  290. * @param {Object} attr 属性
  291. */
  292. updateProperty(type, attr) {
  293. this.$set(this.data.property, type, attr);
  294. },
  295. /**
  296. * 批量设置富文本样式
  297. * @param {string} type 类型
  298. * @param {Object} attr 属性
  299. */
  300. updateRichTextProperty(type, attr) {
  301. let richTextRefs = this.$refs.richText;
  302. if (!richTextRefs) return;
  303. if (!Array.isArray(richTextRefs)) {
  304. richTextRefs = [richTextRefs];
  305. }
  306. richTextRefs?.forEach((richText) => {
  307. richText.setRichFormat(type, attr);
  308. });
  309. },
  310. /**
  311. * 批量设置整体富文本格式
  312. * @param {Array<{type: string, val: string}>} formats 格式数组,每个元素是一个对象,包含 type 和 val
  313. */
  314. patchSetRichFormat(formats) {
  315. let richTextRefs = this.$refs.richText;
  316. if (!richTextRefs) return;
  317. if (!Array.isArray(richTextRefs)) {
  318. richTextRefs = [richTextRefs];
  319. }
  320. richTextRefs?.forEach((richText) => {
  321. richText.patchSetRichFormat(formats);
  322. });
  323. },
  324. /**
  325. * @description 设置 unified_attrib 属性
  326. * @param {object} data unified_attrib数据
  327. */
  328. setUnifiedAttr(data) {
  329. if (!data) return;
  330. this.data.unified_attrib = data;
  331. },
  332. /**
  333. * @description 设置单个教材属性
  334. * @param {string} attr 字段名
  335. * @param {any} value 属性值
  336. */
  337. setSingleUnifiedAttr(attr, value) {
  338. if (!attr) return;
  339. this.$set(this.data.unified_attrib, attr, value);
  340. },
  341. handleComponentMove(data) {
  342. this.componentMove({ ...data, id: this.id });
  343. },
  344. /**
  345. * 保存课件组件内容
  346. * @returns {Promise} 返回 Promise,便于父组件 await
  347. */
  348. saveCoursewareComponentContent() {
  349. this.syncRichTextContent();
  350. return ContentSaveCoursewareComponentContent({
  351. courseware_id: this.courseware_id,
  352. component_id: this.id,
  353. component_type: this.data.type,
  354. content: JSON.stringify(this.data),
  355. background: this.background,
  356. });
  357. },
  358. /**
  359. * @description 保存组件背景
  360. * @param {String} background 组件背景 JSON 字符串
  361. * @returns {Promise} 返回 Promise,便于父组件 await
  362. */
  363. saveCoursewareComponentBackground(background = this.background) {
  364. if (!background || this.courseware_id === '' || this.id === '') return Promise.resolve();
  365. return SaveCoursewareComponentBackground({
  366. courseware_id: this.courseware_id,
  367. component_id: this.id,
  368. background: typeof background === 'string' ? background : JSON.stringify(background),
  369. }).catch((error) => {
  370. console.error('组件背景保存失败', this.id, error);
  371. });
  372. },
  373. syncRichTextContent() {
  374. const syncEditors = (children) => {
  375. children.forEach((child) => {
  376. if (child.$options.name === 'RichText' && typeof child.syncContent === 'function') {
  377. child.syncContent();
  378. }
  379. syncEditors(child.$children || []);
  380. });
  381. };
  382. syncEditors(this.$children || []);
  383. },
  384. /**
  385. * @description 获取组件请求内容
  386. @returns {Object} 组件请求内容
  387. */
  388. getComponentRequestContent() {
  389. this.syncRichTextContent();
  390. return {
  391. courseware_id: this.courseware_id,
  392. component_id: this.id,
  393. component_type: this.data.type,
  394. content: JSON.stringify(this.data),
  395. background: this.background,
  396. };
  397. },
  398. findComponentWithRefAndMethod(children, refName, methodName) {
  399. for (const child of children) {
  400. // 检查当前组件是否符合条件
  401. if (child.$refs[refName] && typeof child[methodName] === 'function') {
  402. return child;
  403. }
  404. // 递归检查子组件
  405. if (child.$children?.length) {
  406. const found = this.findComponentWithRefAndMethod(child.$children, refName, methodName);
  407. if (found) return found;
  408. }
  409. }
  410. return null;
  411. },
  412. openMultilingual() {
  413. this.multilingualVisible = true;
  414. },
  415. /**
  416. * @description 提交多语言翻译
  417. * @param {Array} multilingual
  418. */
  419. handleMultilingualTranslation(multilingual) {
  420. this.$set(this.data, 'multilingual', multilingual);
  421. },
  422. /**
  423. * 获取并设置拼音解析文本
  424. * @param {String} text 文本
  425. * @param {Number} i 行索引
  426. * @param {Number} j 列索引
  427. * @param {String} attr 属性名
  428. */
  429. createParsedTextInfoPinyin(text, i = -1, j = -1, attr = 'option_list', fc_list = []) {
  430. let data = null;
  431. if (i === -1) {
  432. data = this.data;
  433. } else if (i >= 0 && j === -1) {
  434. data = this.data[attr][i];
  435. } else if (i >= 0 && j >= 0) {
  436. data = this.data[attr][i][j];
  437. }
  438. if (text === '') {
  439. data.pinyin_proofread_word_list = [];
  440. return Promise.resolve({ parsed_text: null, rich_text: null });
  441. }
  442. data.paragraph_list_parameter.text = text;
  443. return PinyinBuild_OldFormat({
  444. ...data.paragraph_list_parameter,
  445. is_first_sentence_first_hz_pinyin_first_char_upper_case:
  446. this.data.property.is_first_sentence_first_hz_pinyin_first_char_upper_case,
  447. is_fill_space: 'true',
  448. is_rich_text: 'true',
  449. is_custom_fc: fc_list.length > 0,
  450. fc_paragraph_list: fc_list,
  451. }).then(({ parsed_text, rich_text }) => {
  452. if (parsed_text) {
  453. // 合并 activeTextStyle
  454. const mergedData = parsed_text.paragraph_list.map((outerArr, i) =>
  455. outerArr.map((innerArr, j) =>
  456. innerArr.map((newItem, k) => {
  457. if (!newItem.pinyin) newItem.pinyin = newItem.text;
  458. return {
  459. ...newItem,
  460. // 如果 originalItem 有 activeTextStyle,就合并到 newItem
  461. ...(data.paragraph_list?.[i]?.[j]?.[k]?.activeTextStyle && {
  462. activeTextStyle: data.paragraph_list[i][j][k].activeTextStyle,
  463. }),
  464. };
  465. }),
  466. ),
  467. );
  468. data.paragraph_list = mergedData;
  469. }
  470. if (rich_text) {
  471. data.rich_text_list = rich_text.text_list;
  472. }
  473. return { parsed_text, rich_text };
  474. });
  475. },
  476. /**
  477. * 填充校对后的拼音
  478. * @param {Object} param0 拼音参数
  479. * @param {Number} row 行索引
  480. * @param {Number} col 列索引
  481. * @param {String} attr 属性名
  482. */
  483. fillCorrectPinyin(
  484. { selectContent: { text, pinyin, activeTextStyle, note, showPinyin }, i, j, k, newVersion },
  485. row = -1,
  486. col = -1,
  487. attr = 'option_list',
  488. ) {
  489. if (newVersion) {
  490. let richTextList = null;
  491. if (row === -1) {
  492. richTextList = this.data.rich_text_list;
  493. } else if (row >= 0 && col === -1) {
  494. richTextList = this.data[attr]?.[row]?.rich_text_list;
  495. } else if (row >= 0 && col >= 0) {
  496. richTextList = this.data[attr]?.[row]?.[col]?.rich_text_list;
  497. }
  498. if (!richTextList) return;
  499. const targetBlock = richTextList[j];
  500. if (!targetBlock || !targetBlock.word_list) {
  501. return;
  502. }
  503. const targetWord = targetBlock.word_list[k];
  504. if (!targetWord) {
  505. return;
  506. }
  507. if (pinyin) {
  508. targetWord.pinyin = pinyin;
  509. targetWord.pinyin_list = pinyin.split(/\s+/);
  510. }
  511. if (showPinyin !== undefined && showPinyin !== null) {
  512. targetWord.showPinyin = showPinyin;
  513. }
  514. if (note !== null && note !== undefined) {
  515. targetWord.note = note;
  516. }
  517. if (activeTextStyle && Object.keys(activeTextStyle).length > 0) {
  518. targetWord.activeTextStyle = { ...targetWord.activeTextStyle, ...activeTextStyle };
  519. }
  520. return;
  521. }
  522. // 兼容旧版逻辑
  523. let data = null;
  524. if (row === -1) {
  525. data = this.data.paragraph_list_parameter;
  526. } else if (row >= 0 && col === -1) {
  527. data = this.data[attr][row].paragraph_list_parameter;
  528. } else if (row >= 0 && col >= 0) {
  529. data = this.data[attr][row][col].paragraph_list_parameter;
  530. }
  531. if (!Array.isArray(data.pinyin_proofread_word_list)) {
  532. data.pinyin_proofread_word_list = [];
  533. }
  534. data.pinyin_proofread_word_list.push({
  535. paragraph_index: i,
  536. sentence_index: j,
  537. word_index: k,
  538. word: text,
  539. pinyin,
  540. showPinyin,
  541. });
  542. let listItem = null;
  543. if (row === -1) {
  544. listItem = this.data.paragraph_list?.[i]?.[j]?.[k];
  545. } else if (row >= 0 && col === -1) {
  546. listItem = this.data[attr]?.[row]?.paragraph_list?.[i]?.[j]?.[k];
  547. } else if (row >= 0 && col >= 0) {
  548. listItem = this.data[attr]?.[row]?.[col]?.paragraph_list?.[i]?.[j]?.[k];
  549. }
  550. if (listItem) {
  551. if (pinyin) listItem.pinyin = pinyin;
  552. if (activeTextStyle) listItem.activeTextStyle = activeTextStyle;
  553. if (note !== null) listItem.note = note;
  554. listItem.showPinyin = showPinyin;
  555. }
  556. },
  557. /**
  558. * 组件中添加答案与解析
  559. * @param {'answer'|'analysis'} type 类型 answer 答案 analysis 解析
  560. */
  561. addAnswerAndAnalysis(type) {
  562. // 确保 answer_list 和 analysis_list 已初始化
  563. ['answer_list', 'analysis_list'].forEach((key) => {
  564. if (!this.data[key]) {
  565. this.$set(this.data, key, []);
  566. }
  567. });
  568. if (type === 'answer') {
  569. this.data.answer_list.push(structuredClone(answerData));
  570. } else if (type === 'analysis') {
  571. this.data.analysis_list.push(structuredClone(analysisData));
  572. }
  573. },
  574. /**
  575. * 更新答案或解析的文件列表
  576. * @param {Array} file_list 文件列表
  577. * @param {Array} file_id_list 文件ID列表
  578. * @param {Number} index 答案解析索引
  579. * @param {Number} indexs 文件类型索引 0-答案音频 1-答案图片 2-答案视频 3-解析音频 4-解析图片 5-解析视频
  580. * @param {String} type 类型 answer 答案 analysis 解析
  581. */
  582. updateAnswerAnalysisFileList({ file_list, file_id_list, index, indexs, type }) {
  583. if (type === 'answer') {
  584. this.data.answer_list[index][this.idNameOrder[indexs]] = file_id_list;
  585. this.data.answer_list[index][this.fileNameOrder[indexs]] = file_list;
  586. } else if (type === 'analysis') {
  587. this.data.analysis_list[index][this.idNameOrder[indexs]] = file_id_list;
  588. this.data.analysis_list[index][this.fileNameOrder[indexs]] = file_list;
  589. }
  590. },
  591. /**
  592. * 删除答案或解析项
  593. * @param {Object} param 参数对象
  594. * @param {number} param.index 索引
  595. * @param {'answer'|'analysis'} param.type 类型
  596. */
  597. deleteAnswerAnalysis({ index, type }) {
  598. if (type === 'answer') {
  599. this.data.answer_list.splice(index, 1);
  600. } else if (type === 'analysis') {
  601. this.data.analysis_list.splice(index, 1);
  602. }
  603. },
  604. },
  605. };
  606. export default mixin;