feat: 更改加载时间

This commit is contained in:
王天骄
2026-06-15 17:55:07 +08:00
parent 9b95789595
commit 4c130cee9d
3 changed files with 148 additions and 16 deletions
+11 -2
View File
@@ -141,7 +141,13 @@
<script setup lang="ts">
import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { fetchCaseListPage, type CaseListSource, type CaseMode, type ClinicalCase } from '../../api/cases'
import {
fetchCaseListPage,
takePrefetchedCaseList,
type CaseListSource,
type CaseMode,
type ClinicalCase
} from '../../api/cases'
import { createHomeNavigator, createProfileOpener, createSettingsOpener } from '../../api/navigation'
const emit = defineEmits<{
@@ -284,9 +290,12 @@ async function loadCases(page = 1) {
loadingMore.value = !isFirstPage
loadFailed.value = false
errorMessage.value = ''
const query = buildQuery(page)
try {
const result = await fetchCaseListPage(source.value, buildQuery(page))
const result = isFirstPage
? takePrefetchedCaseList(source.value, query) || await fetchCaseListPage(source.value, query)
: await fetchCaseListPage(source.value, query)
if (seq !== requestSeq) return
cases.value = isFirstPage ? result.results : [...cases.value, ...result.results]