import { displayList, serialNumberTypeList, serialNumberPositionList, arrangeTypeList, switchOption, isEnable, pinyinPositionList, } from '@/views/book/courseware/data/common'; import { getRandomNumber } from '@/utils'; export { arrangeTypeList, switchOption, isEnable, pinyinPositionList }; export const roleDefaultColorList = ['#306EFF', '#3ABD38', '#FC8E3D', '#FC493D', '#BF3DFC']; // 角色默认颜色 // 显示 export const positionList = [ { value: 'top', label: '上', }, { value: 'bottom', label: '下', }, ]; export const wordShowList = [ { value: 'true', label: '是' }, { value: 'false', label: '否' }, ]; export const inforList = [ { value: 'true', label: '有' }, { value: 'false', label: '没有' }, ]; // 拼音位置 export const pinyinPositionLists = [ { value: 'front', label: '前面' }, { value: 'back', label: '后面' }, { value: 'top', label: '上面' }, { value: 'bottom', label: '下面' }, ]; // 读音生成方式 export const audioGenerationMethodList = [ { value: 'upload', label: '上传', }, { value: 'auto', label: '自动生成', }, { value: 'record', label: '录音', }, ]; // 头像类型 export const roleTypeList = [ { value: 'word', label: '文字+背景色', }, { value: 'upload', label: '上传头像', }, { value: 'simple', label: '简易头像', }, ]; // 多语言显示方式 export const multilingualList = [ { value: 'para', label: '句/段落' }, { value: 'all', label: '整篇' }, ]; export function getArticleProperty() { return { serial_number: 1, sn_type: serialNumberTypeList[0].value, sn_position: serialNumberPositionList[0].value, sn_display_mode: displayList[0].value, mp3_position: positionList[0].value, is_enable_new_word: switchOption[0].value, is_enable_read: switchOption[0].value, is_enable_word: switchOption[0].value, view_pinyin: 'true', pinyin_position: pinyinPositionList[0].value, is_first_sentence_first_hz_pinyin_first_char_upper_case: 'true', // 句首大写 role_img_type: 'word', role_list: [getRole(0), getRole(1)], multilingual_position: multilingualList[0].value, }; } /** * 获取角色对象 * @param {number} index 序号 * @param {string} name 名称 */ export function getRole(index, name = '') { return { name: name || `角色${index + 1}`, mark: getRandomNumber(), color: roleDefaultColorList[index % 5], simpleHead: '', img_list: [], fullName: '', fullPinyin: '', id: Math.random().toString(36).substr(2), }; } export function getArticleData() { return { type: 'dialogue_article', title: '对话课文', property: getArticleProperty(), content: '', // 课文内容 mp3_list: [], // 音频列表 detail: [], // 分段分句分词详情 wordTime: [], // 字幕时间 new_word_list: { title_con: '', property: { audio_generation_method: audioGenerationMethodList[0].value, pinyin_position: pinyinPositionLists[0].value, auto_wrap: switchOption[0].value, // 自动换行 is_has_infor: inforList[0].value, }, new_word_list: [], lrc_arr: [], // lrc 文件解析后的数据 // lrc 文件数据 lrc_data: { name: '', url: '', id: '', file_id: '', }, // 音频文件数据 audio_data: { name: '', media_duration: 0, temporary_url: '', url: '', file_id: '', }, wordTime: [], // 字幕时间节点 taskId: '', file_id_list: [], // 文件 id col_width: [ { value: 100, // 生词 }, { value: 110, // 拼音 }, { value: 50, // 词性 }, { value: 180, // 释义 }, { value: 180, // 搭配 }, { value: 200, // 例句 }, ], // 列宽 }, // 生词列表 other_word_list: { title_con: '', property: { audio_generation_method: audioGenerationMethodList[0].value, pinyin_position: pinyinPositionLists[0].value, auto_wrap: switchOption[0].value, // 自动换行 is_has_infor: inforList[0].value, }, new_word_list: [], lrc_arr: [], // lrc 文件解析后的数据 // lrc 文件数据 lrc_data: { name: '', url: '', id: '', file_id: '', }, // 音频文件数据 audio_data: { name: '', media_duration: 0, temporary_url: '', url: '', file_id: '', }, wordTime: [], // 字幕时间节点 taskId: '', file_id_list: [], // 文件 id col_width: [ { value: 125, // 生词 }, { value: 125, // 拼音 }, { value: 125, // 词性 }, { value: 125, // 释义 }, { value: 150, // 搭配 }, { value: 300, // 例句 }, ], // 列宽 }, notes_list: { title_con: '', option: [], property: {}, }, sentence_list_mp: [], // 句子+分词数组 pinyin_type: 'pinyin', // 拼音类型 multilingual: [], // 多语言 }; }