dialogueArticle.js 6.0 KB

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