dialogueArticle.js 6.1 KB

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