feat: 优化账户切换时的页面状态一致性,增加登录回跳校验和课程阅读新逻辑
- 增加账户状态监听定时器,页面切换时自动校验账户归属,避免跨账户操作 - 新增登录回跳路径校验函数,限制仅允许指定页面回跳,防止非法跳转 - 课程页改为整篇连续阅读,底部仅一次标记已读,兼容历史记录 - 完善助手、对比页、资料填写页等多处的账户状态校验逻辑,防止错版数据提交 - 优化账户资料请求逻辑,增加版本校验,避免旧请求覆盖新数据
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
<script setup lang="uts">
|
||||
import { usePageLayout } from '@/services/layout.uts'
|
||||
import { fetchLessons, FinanceLesson } from '@/services/content.uts'
|
||||
import { fetchLessons, FinanceLesson, validateContentAppend } from '@/services/content.uts'
|
||||
import AppHeader from '@/components/AppHeader.uvue'
|
||||
import AppIcon from '@/components/AppIcon.uvue'
|
||||
const { contentStyle, pageStyle } = usePageLayout()
|
||||
@@ -51,10 +51,11 @@ async function load(append: boolean) {
|
||||
if (!visible || loading.value || loadingMore.value || (append && !hasMore.value)) return
|
||||
const request = append ? generation : ++generation
|
||||
if (append) { loadingMore.value = true; moreError.value = '' }
|
||||
else { loading.value = true; error.value = ''; lessons.value = []; total.value = 0; hasMore.value = false; page = 1 }
|
||||
else { loading.value = true; error.value = ''; moreError.value = ''; lessons.value = []; total.value = 0; hasMore.value = false; page = 1 }
|
||||
try {
|
||||
const result = await fetchLessons(activeTopic.value, append ? page + 1 : 1)
|
||||
if (!visible || request != generation) return
|
||||
if (append) validateContentAppend(lessons.value.map((item: FinanceLesson): string => item.id), result.items.map((item: FinanceLesson): string => item.id))
|
||||
lessons.value = append ? lessons.value.concat(result.items) : result.items
|
||||
total.value = result.total; hasMore.value = result.hasMore
|
||||
if (append) page++
|
||||
|
||||
Reference in New Issue
Block a user