table.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import {
  2. displayList,
  3. serialNumberTypeList,
  4. serialNumberPositionList,
  5. switchOption,
  6. pinyinPositionList,
  7. commonComponentProperty,
  8. } from '@/views/book/courseware/data/common';
  9. import { getRandomNumber } from '@/utils';
  10. export { switchOption };
  11. export const tableTypeList = [
  12. { value: 'short', label: '精简模式' },
  13. { value: 'normal', label: '常规模式' },
  14. ];
  15. export const fontFamilyList = [
  16. { value: '楷体,微软雅黑', label: '楷体' },
  17. { value: '黑体,微软雅黑', label: '黑体' },
  18. { value: '宋体,微软雅黑', label: '宋体' },
  19. { value: 'arial,helvetica,sans-serif', label: 'Arial' },
  20. { value: 'times new roman,times,serif', label: 'Times New Roman' },
  21. { value: 'League', label: '拼音' },
  22. ];
  23. // 填空方式
  24. export const fillTypeList = [
  25. { value: 'input', label: '输入' },
  26. { value: 'select', label: '选词' },
  27. { value: 'handwriting', label: '手写' },
  28. { value: 'voice', label: '语音' },
  29. ];
  30. export function getTableProperty() {
  31. return {
  32. serial_number: 1,
  33. sn_type: serialNumberTypeList[0].value,
  34. sn_position: serialNumberPositionList[3].value,
  35. sn_display_mode: displayList[1].value,
  36. height: 400,
  37. width: 600,
  38. row_count: 2,
  39. column_count: 3,
  40. auto_wrap: switchOption[0].value, // 自动换行
  41. fill_type: fillTypeList[0].value,
  42. first_line_color: '', // 首行颜色
  43. first_column_color: '', // 首列颜色
  44. border_color: '#e6e6e6', // 边框颜色
  45. decoration_color: '#e7b576', // 装饰颜色
  46. view_pinyin: 'false', // 显示拼音
  47. pinyin_position: pinyinPositionList[0].value, // top bottom
  48. is_first_sentence_first_hz_pinyin_first_char_upper_case: 'true', // 句首大写
  49. ...commonComponentProperty,
  50. };
  51. }
  52. export function getOption() {
  53. return {
  54. content: '',
  55. mark: getRandomNumber(),
  56. model_essay: [],
  57. };
  58. }
  59. export function getAnswerOption() {
  60. return {
  61. answer: '',
  62. answer_list: [],
  63. };
  64. }
  65. export function getTableData() {
  66. return {
  67. type: 'table',
  68. title: '表格',
  69. option_list: Array.from({ length: 2 }, () => Array.from({ length: 3 }, getOption)),
  70. record_list: [],
  71. answer_list: Array.from({ length: 2 }, () => Array.from({ length: 3 }, getAnswerOption)),
  72. mode: tableTypeList[0].value,
  73. vocabulary: '', // 用于选词的词汇
  74. word_list: [], // 选词列表
  75. styles: {
  76. fontFamily: 'Arial',
  77. fontSize: '12pt',
  78. fontColor: '#1d2129',
  79. bgColor: '',
  80. isUnderline: false,
  81. isBold: false,
  82. isItalic: false,
  83. isStrikethrough: false,
  84. textAlign: '',
  85. },
  86. col_width: [
  87. {
  88. value: 100,
  89. },
  90. {
  91. value: 100,
  92. },
  93. {
  94. value: 100,
  95. },
  96. ], // 列宽
  97. property: getTableProperty(),
  98. has_identify: 'false', // 是否已识别
  99. paragraph_list: [],
  100. paragraph_list_parameter: {
  101. text: '',
  102. is_first_sentence_first_hz_pinyin_first_char_upper_case: 'true',
  103. pinyin_proofread_word_list: [],
  104. },
  105. mind_map: {
  106. node_list: [{ name: '表格' }],
  107. },
  108. multilingual: [], // 多语言
  109. parse: '', // 解析
  110. reference: '', // 参考答案
  111. };
  112. }