dialogueArticle.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. import {
  2. displayList,
  3. serialNumberTypeList,
  4. serialNumberPositionList,
  5. arrangeTypeList,
  6. switchOption,
  7. isEnable,
  8. pinyinPositionList,
  9. } from '@/views/book/courseware/data/common';
  10. import { getRandomNumber } from '@/utils';
  11. export { arrangeTypeList, switchOption, isEnable, pinyinPositionList };
  12. export const roleDefaultColorList = ['#306EFF', '#3ABD38', '#FC8E3D', '#FC493D', '#BF3DFC']; // 角色默认颜色
  13. // 显示
  14. export const positionList = [
  15. {
  16. value: 'top',
  17. label: '上',
  18. },
  19. {
  20. value: 'bottom',
  21. label: '下',
  22. },
  23. ];
  24. export const wordShowList = [
  25. { value: 'true', label: '是' },
  26. { value: 'false', label: '否' },
  27. ];
  28. export const inforList = [
  29. { value: 'true', label: '有' },
  30. { value: 'false', label: '没有' },
  31. ];
  32. // 拼音位置
  33. export const pinyinPositionLists = [
  34. { value: 'front', label: '前面' },
  35. { value: 'back', label: '后面' },
  36. { value: 'top', label: '上面' },
  37. { value: 'bottom', label: '下面' },
  38. ];
  39. // 读音生成方式
  40. export const audioGenerationMethodList = [
  41. {
  42. value: 'upload',
  43. label: '上传',
  44. },
  45. {
  46. value: 'auto',
  47. label: '自动生成',
  48. },
  49. {
  50. value: 'record',
  51. label: '录音',
  52. },
  53. ];
  54. // 头像类型
  55. export const roleTypeList = [
  56. {
  57. value: 'word',
  58. label: '文字+背景色',
  59. },
  60. {
  61. value: 'upload',
  62. label: '上传头像',
  63. },
  64. {
  65. value: 'simple',
  66. label: '简易头像',
  67. },
  68. ];
  69. // 多语言显示方式
  70. export const multilingualList = [
  71. { value: 'para', label: '句/段落' },
  72. { value: 'all', label: '整篇' },
  73. ];
  74. export function getArticleProperty() {
  75. return {
  76. serial_number: 1,
  77. sn_type: serialNumberTypeList[0].value,
  78. sn_position: serialNumberPositionList[0].value,
  79. sn_display_mode: displayList[0].value,
  80. mp3_position: positionList[0].value,
  81. is_enable_new_word: switchOption[0].value,
  82. is_enable_read: switchOption[0].value,
  83. is_enable_word: switchOption[0].value,
  84. view_pinyin: 'true',
  85. pinyin_position: pinyinPositionList[0].value,
  86. is_first_sentence_first_hz_pinyin_first_char_upper_case: 'true', // 句首大写
  87. role_img_type: 'word',
  88. role_list: [getRole(0), getRole(1)],
  89. multilingual_position: multilingualList[0].value,
  90. };
  91. }
  92. /**
  93. * 获取角色对象
  94. * @param {number} index 序号
  95. * @param {string} name 名称
  96. */
  97. export function getRole(index, name = '') {
  98. return {
  99. name: name || `角色${index + 1}`,
  100. mark: getRandomNumber(),
  101. color: roleDefaultColorList[index % 5],
  102. simpleHead: '',
  103. img_list: [],
  104. fullName: '',
  105. fullPinyin: '',
  106. id: Math.random().toString(36).substr(2),
  107. };
  108. }
  109. export function getArticleData() {
  110. return {
  111. type: 'dialogue_article',
  112. title: '对话课文',
  113. property: getArticleProperty(),
  114. content: '', // 课文内容
  115. mp3_list: [], // 音频列表
  116. detail: [], // 分段分句分词详情
  117. wordTime: [], // 字幕时间
  118. new_word_list: {
  119. title_con: '',
  120. property: {
  121. audio_generation_method: audioGenerationMethodList[0].value,
  122. pinyin_position: pinyinPositionLists[0].value,
  123. auto_wrap: switchOption[0].value, // 自动换行
  124. is_has_infor: inforList[0].value,
  125. },
  126. new_word_list: [],
  127. lrc_arr: [], // lrc 文件解析后的数据
  128. // lrc 文件数据
  129. lrc_data: {
  130. name: '',
  131. url: '',
  132. id: '',
  133. file_id: '',
  134. },
  135. // 音频文件数据
  136. audio_data: {
  137. name: '',
  138. media_duration: 0,
  139. temporary_url: '',
  140. url: '',
  141. file_id: '',
  142. },
  143. wordTime: [], // 字幕时间节点
  144. taskId: '',
  145. file_id_list: [], // 文件 id
  146. col_width: [
  147. {
  148. value: 100, // 生词
  149. },
  150. {
  151. value: 110, // 拼音
  152. },
  153. {
  154. value: 50, // 词性
  155. },
  156. {
  157. value: 180, // 释义
  158. },
  159. {
  160. value: 180, // 搭配
  161. },
  162. {
  163. value: 200, // 例句
  164. },
  165. ], // 列宽
  166. }, // 生词列表
  167. other_word_list: {
  168. title_con: '',
  169. property: {
  170. audio_generation_method: audioGenerationMethodList[0].value,
  171. pinyin_position: pinyinPositionLists[0].value,
  172. auto_wrap: switchOption[0].value, // 自动换行
  173. is_has_infor: inforList[0].value,
  174. },
  175. new_word_list: [],
  176. lrc_arr: [], // lrc 文件解析后的数据
  177. // lrc 文件数据
  178. lrc_data: {
  179. name: '',
  180. url: '',
  181. id: '',
  182. file_id: '',
  183. },
  184. // 音频文件数据
  185. audio_data: {
  186. name: '',
  187. media_duration: 0,
  188. temporary_url: '',
  189. url: '',
  190. file_id: '',
  191. },
  192. wordTime: [], // 字幕时间节点
  193. taskId: '',
  194. file_id_list: [], // 文件 id
  195. col_width: [
  196. {
  197. value: 125, // 生词
  198. },
  199. {
  200. value: 125, // 拼音
  201. },
  202. {
  203. value: 125, // 词性
  204. },
  205. {
  206. value: 125, // 释义
  207. },
  208. {
  209. value: 150, // 搭配
  210. },
  211. {
  212. value: 300, // 例句
  213. },
  214. ], // 列宽
  215. },
  216. notes_list: {
  217. title_con: '',
  218. option: [],
  219. property: {},
  220. },
  221. sentence_list_mp: [], // 句子+分词数组
  222. pinyin_type: 'pinyin', // 拼音类型
  223. multilingual: [], // 多语言
  224. };
  225. }