dialogueArticle.js 5.1 KB

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