This commit is contained in:
zyronon
2023-11-30 14:02:20 +08:00
parent 5a3f4445dc
commit c0eef7768d
8 changed files with 153 additions and 182 deletions

View File

@@ -62,7 +62,7 @@ function cancelAddDict() {
onMounted(() => {
// selectDict({dict: store.currentDict, index: 0})
console.log('router.params', route)
// console.log('router.params', route)
switch (route.query.type) {
case 'addDict':
setTimeout(() => {

View File

@@ -42,10 +42,8 @@ let showEditArticle = $ref(false)
let editArticle = $ref<Article>(cloneDeep(DefaultArticle))
watch([
() => store.current.index,
() => store.load,
() => store.currentDict.type,
() => store.currentDict.chapterIndex,
// () => store.load,
() => store.currentDict.articles,
], n => {
console.log('n', n)
getCurrentPractice()
@@ -84,7 +82,7 @@ function getCurrentPractice() {
let currentArticle = store.currentDict.articles[store.currentDict.chapterIndex]
let tempArticle = {...DefaultArticle, ...currentArticle}
console.log('article', tempArticle)
// console.log('article', tempArticle)
if (tempArticle.sections.length) {
setArticle(tempArticle)
} else {
@@ -125,6 +123,7 @@ function getCurrentPractice() {
editArticle = tempArticle
showEditArticle = true
},
() => {
renewSectionTexts(tempArticle)
tempArticle.useTranslateType = TranslateType.none
@@ -209,10 +208,11 @@ function nextWord(word: ArticleWord) {
}
}
function changePracticeArticle(val: Article) {
let rIndex = store.currentDict.articles.findIndex(v => v.id === val.id)
function changePracticeArticle(val: { item: Article, index: number }) {
let rIndex = store.currentDict.articles.findIndex(v => v.id === val.item.id)
if (rIndex > -1) {
store.currentDict.chapterIndex = rIndex
getCurrentPractice()
}
}
@@ -277,9 +277,9 @@ const {
</div>
<ArticleList4
v-if="true"
:isActive="active"
:show-translate="settingStore.translate"
@click="changePracticeArticle"
:active-id="articleData.article.id"
:list="store.currentDict.articles">
<template v-slot:suffix="{item,index}">
@@ -295,27 +295,6 @@ const {
title="取消收藏" icon="ph:star-fill"/>
</template>
</ArticleList4>
<ArticleList2
v-else
:isActive="active"
:show-translate="settingStore.translate"
@select-item="changePracticeArticle"
:active-index="store.currentDict.chapterIndex"
v-model:list="store.currentDict.articles">
<template v-slot="{source,index}">
<BaseIcon
v-if="!isArticleCollect(source)"
class-name="collect"
@click="toggleArticleCollect(source)"
title="收藏" icon="ph:star"/>
<BaseIcon
v-else
class-name="fill"
@click="toggleArticleCollect(source)"
title="取消收藏" icon="ph:star-fill"/>
</template>
</ArticleList2>
</div>
</template>
</Panel>