dialogueArticle.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. import {
  2. displayList,
  3. serialNumberTypeList,
  4. serialNumberPositionList,
  5. arrangeTypeList,
  6. switchOption,
  7. isEnable,
  8. pinyinPositionList,
  9. serialNumberStyleList,
  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_style: serialNumberStyleList[0].value,
  98. sn_background_color: '#ea3232', // 序号背景色
  99. sn_display_mode: displayList[1].value,
  100. mp3_position: positionList[0].value,
  101. is_enable_new_word: switchOption[0].value,
  102. is_enable_read: switchOption[0].value,
  103. is_enable_word: switchOption[0].value,
  104. view_pinyin: 'true',
  105. pinyin_position: pinyinPositionList[0].value,
  106. is_first_sentence_first_hz_pinyin_first_char_upper_case: 'true', // 句首大写
  107. role_img_type: 'word',
  108. role_list: [getRole(0), getRole(1)],
  109. multilingual_position: multilingualList[0].value,
  110. content_height: '', // 内容高度
  111. voice_type: '', // 音色
  112. emotion: '', // 风格,情感
  113. speed_ratio: '', // 语速
  114. notice_size: '14',
  115. notice_color: '#000',
  116. noitce_family: '',
  117. remarkWidth: '30', // 气泡预览宽度%
  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. is_show: 'false',
  140. },
  141. new_word_list: [],
  142. lrc_arr: [], // lrc 文件解析后的数据
  143. // lrc 文件数据
  144. lrc_data: {
  145. name: '',
  146. url: '',
  147. id: '',
  148. file_id: '',
  149. },
  150. // 音频文件数据
  151. audio_data: {
  152. name: '',
  153. media_duration: 0,
  154. temporary_url: '',
  155. url: '',
  156. file_id: '',
  157. },
  158. wordTime: [], // 字幕时间节点
  159. taskId: '',
  160. file_id_list: [], // 文件 id
  161. col_width: [
  162. {
  163. value: 100, // 生词
  164. },
  165. {
  166. value: 110, // 拼音
  167. },
  168. {
  169. value: 50, // 词性
  170. },
  171. {
  172. value: 180, // 释义
  173. },
  174. {
  175. value: 180, // 搭配
  176. },
  177. {
  178. value: 200, // 例句
  179. },
  180. ], // 列宽
  181. multilingual: [], // 多语言
  182. addCol: [], // 自定义增加的列
  183. }, // 生词列表
  184. other_word_list: {
  185. title_con: '',
  186. property: {
  187. audio_generation_method: audioGenerationMethodList[0].value,
  188. pinyin_position: pinyinPositionLists[0].value,
  189. auto_wrap: switchOption[0].value, // 自动换行
  190. is_has_infor: inforList[0].value,
  191. voice_type: '', // 音色
  192. emotion: '', // 风格,情感
  193. speed_ratio: '', // 语速
  194. is_show: 'false',
  195. },
  196. new_word_list: [],
  197. lrc_arr: [], // lrc 文件解析后的数据
  198. // lrc 文件数据
  199. lrc_data: {
  200. name: '',
  201. url: '',
  202. id: '',
  203. file_id: '',
  204. },
  205. // 音频文件数据
  206. audio_data: {
  207. name: '',
  208. media_duration: 0,
  209. temporary_url: '',
  210. url: '',
  211. file_id: '',
  212. },
  213. wordTime: [], // 字幕时间节点
  214. taskId: '',
  215. file_id_list: [], // 文件 id
  216. col_width: [
  217. {
  218. value: 125, // 生词
  219. },
  220. {
  221. value: 125, // 拼音
  222. },
  223. {
  224. value: 125, // 词性
  225. },
  226. {
  227. value: 125, // 释义
  228. },
  229. {
  230. value: 150, // 搭配
  231. },
  232. {
  233. value: 300, // 例句
  234. },
  235. ], // 列宽
  236. multilingual: [], // 多语言
  237. addCol: [], // 自定义增加的列
  238. },
  239. notes_list: {
  240. title_con: '',
  241. option: [],
  242. multilingual: [], // 多语言
  243. file_id_list: [], // 文件 id
  244. property: {
  245. view_pinyin: 'false', // 显示拼音
  246. pinyin_position: pinyinPositionLists[1].value, // top bottom
  247. is_first_sentence_first_hz_pinyin_first_char_upper_case: 'true', // 句首大写
  248. is_show: 'false',
  249. },
  250. },
  251. sentence_list_mp: [], // 句子+分词数组
  252. pinyin_type: 'pinyin', // 拼音类型
  253. multilingual: [], // 多语言
  254. other_attrib: {
  255. isUnderline: '',
  256. isBold: '',
  257. isItalic: '',
  258. isStrikethrough: '',
  259. border: '',
  260. oldFont: '',
  261. oldColor: '',
  262. oldUnderline: '',
  263. oldBold: '',
  264. oldBorder: '',
  265. oldAlign: '',
  266. }, // 文章其他一些整体样式设置
  267. isFenci: false, // 是否点过分词按钮
  268. };
  269. }