diff --git a/apps/nuxt/app/pages/(articles)/articles.vue b/apps/nuxt/app/pages/(articles)/articles.vue
index e4d3d889..03a8d7b6 100644
--- a/apps/nuxt/app/pages/(articles)/articles.vue
+++ b/apps/nuxt/app/pages/(articles)/articles.vue
@@ -34,7 +34,7 @@ useHead({
title: APP_NAME + ' 文章',
})
-const { nav } = useNav()
+const {nav} = useNav()
const base = useBaseStore()
const store = useBaseStore()
const settingStore = useSettingStore()
@@ -50,7 +50,7 @@ watch(
init()
}
},
- { immediate: true }
+ {immediate: true}
)
async function onvisibilitychange() {
@@ -72,14 +72,38 @@ async function init() {
document.addEventListener('visibilitychange', onvisibilitychange)
if (AppEnv.CAN_REQUEST) {
- let res = await myDictList({ type: 'article' })
+ let res = await myDictList({type: 'article'})
if (res.success) {
store.setState(Object.assign(store.$state, res.data))
}
}
- if (store.article.studyIndex >= 1) {
+ let studyIndex = store.article.studyIndex
+ if (studyIndex >= 1) {
if (!store.sbook.custom && !store.sbook.articles.length) {
- store.article.bookList[store.article.studyIndex] = await _getDictDataByUrl(store.sbook, DictType.article)
+ let dictList = await fetch(resourceWrap(DICT_LIST.ARTICLE.ALL)).then(r => r.json())
+ let dict = await _getDictDataByUrl(store.sbook, DictType.article)
+ let r = dictList.find(v => [v.enName, v.id].includes(store.sbook.id))
+ if (r) {
+ store.article.bookList[studyIndex].articles = dict.articles
+ store.article.bookList[studyIndex].id = r.id
+ store.article.bookList[studyIndex].enName = r.enName
+ store.article.bookList[studyIndex].cover = r.cover
+ store.article.bookList[studyIndex].category = r.category
+ store.article.bookList[studyIndex].tags = r.tags
+ store.article.bookList[studyIndex].url = r.url
+ store.article.bookList[studyIndex].description = r.description
+ store.article.bookList[studyIndex].name = r.name
+ } else {
+ store.article.bookList[studyIndex] = dict
+ }
+ store.article.bookList[studyIndex].length = dict.articles.length
+ let s = store.article.bookList[studyIndex]
+ if (s.lastLearnIndex > s.length) {
+ store.article.bookList[studyIndex].lastLearnIndex = s.length
+ store.article.bookList[studyIndex].complete = true
+ //todo 后续加上
+ // await resetCacheData()
+ }
}
}
const d = await articlePersistence.load()
@@ -110,7 +134,7 @@ watch(
text: `下一步(7/${TourConfig.total})`,
action() {
tour.next()
- nav('/practice-articles/article_nce2', { guide: 1 })
+ nav('/practice-articles/article_nce2', {guide: 1})
},
},
],
@@ -123,7 +147,7 @@ watch(
}, 500)
}
},
- { immediate: true }
+ {immediate: true}
)
function startStudy() {
@@ -231,7 +255,7 @@ const weekList = $computed(() => {
return list
})
-const { data: recommendBookList, isFetching } = useFetch(resourceWrap(DICT_LIST.ARTICLE.RECOMMENDED)).json()
+const {data: recommendBookList, isFetching} = useFetch(resourceWrap(DICT_LIST.ARTICLE.RECOMMENDED)).json()
let isOldHost = $ref(false)
onMounted(() => {
@@ -257,7 +281,7 @@ onMounted(() => {
:show-progress="false"
@click="goBookDetail(base.sbook)"
/>
-