feat:重构代码
This commit is contained in:
@@ -34,16 +34,8 @@ export const EnKeyboardMap: KeyboardMap = {
|
||||
//生成文章段落数据
|
||||
export function genArticleSectionData(article: Article): number {
|
||||
let text = article.text.trim()
|
||||
if (!text) {
|
||||
// text = "Last week I went to the theatre. I had a very good seat. The play was very interesting. I did not enjoy it. A young man and a young woman were sitting behind me. They were talking loudly. I got very angry. I could not hear the actors. I turned round. I looked at the man and the woman angrily. They did not pay any attention. In the end, I could not bear it. I turned round again. 'I can't hear a word!' I said angrily.\n\n 'It's none of your business,' the young man said rudely. 'This is a private conversation!'"
|
||||
// text = `While it is yet to be seen what direction the second Trump administration will take globally in its China policy, VOA traveled to the main island of Mahe in Seychelles to look at how China and the U.S. have impacted the country, and how each is fairing in that competition for influence there.`
|
||||
// text = "It was Sunday. I never get up early on Sundays. I sometimes stay in bed until lunchtime. Last Sunday I got up very late. I looked out of the window. It was dark outside. 'What a day!' I thought. 'It's raining again.' Just then, the telephone rang. It was my aunt Lucy. 'I've just arrived by train,' she said. 'I'm coming to see you.'\n\n 'But I'm still having breakfast,' I said.\n\n 'What are you doing?' she asked.\n\n 'I'm having breakfast,' I repeated.\n\n 'Dear me,' she said. 'Do you always get up so late? It's one o'clock!'"
|
||||
article.sections = []
|
||||
ElMessage.error('请填写原文!')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('genArticleSectionData',text)
|
||||
// console.log('genArticleSectionData',text)
|
||||
|
||||
let keyboardMap = EnKeyboardMap
|
||||
let sections: Sentence[][] = []
|
||||
@@ -237,7 +229,7 @@ export function genArticleSectionData(article: Article): number {
|
||||
article.sections = sections
|
||||
|
||||
let failCount = 0
|
||||
let translateList = article.textTranslate.split('\n\n')
|
||||
let translateList = article.textTranslate?.split('\n\n') || []
|
||||
for (let i = 0; i < article.sections.length; i++) {
|
||||
let v = article.sections[i]
|
||||
let sList = []
|
||||
@@ -270,7 +262,7 @@ export function genArticleSectionData(article: Article): number {
|
||||
article.textTranslate = translate
|
||||
|
||||
let count = 0
|
||||
if (article.lrcPosition.length) {
|
||||
if (article?.lrcPosition?.length) {
|
||||
article.sections.map((v, i) => {
|
||||
v.map((w, j) => {
|
||||
w.audioPosition = article.lrcPosition[count]
|
||||
|
||||
@@ -130,7 +130,7 @@ export function getCurrentStudyWord() {
|
||||
//取上一次学习的单词用于复习
|
||||
let list = getList(s, e)
|
||||
list.map(item => {
|
||||
if (!store.master.words.map(v => v.word.toLowerCase()).includes(item.word.toLowerCase())) {
|
||||
if (!store.known.words.map(v => v.word.toLowerCase()).includes(item.word.toLowerCase())) {
|
||||
data.review.push(item)
|
||||
}
|
||||
})
|
||||
@@ -148,7 +148,7 @@ export function getCurrentStudyWord() {
|
||||
if (d.length >= Math.floor(dict.perDayStudyNumber / 4)) break
|
||||
}
|
||||
let item = list[i]
|
||||
if (!store.master.words.map(v => v.word.toLowerCase()).includes(item.word.toLowerCase())) {
|
||||
if (!store.known.words.map(v => v.word.toLowerCase()).includes(item.word.toLowerCase())) {
|
||||
d.push(item)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user