feat: 病例列表联调

This commit is contained in:
王天骄
2026-06-13 06:05:37 +08:00
parent 37716f200b
commit bc2e03920e
13 changed files with 1518 additions and 258 deletions
+19 -1
View File
@@ -63,6 +63,8 @@
<script setup lang="ts">
import { onMounted, onUnmounted, reactive, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import type { CaseListSource } from '../../api/cases'
import { fetchMatchingProfile, type MatchingProfile } from '../../api/matching'
type Particle = {
@@ -79,6 +81,7 @@ const profile = reactive<MatchingProfile>({
const particles = ref<Particle[]>([])
const progress = ref(0)
const source = ref<CaseListSource>('recommended')
let particleId = 0
let particleTimer: ReturnType<typeof setInterval> | null = null
@@ -137,13 +140,20 @@ function startProgress() {
if (progressTimer) clearInterval(progressTimer)
progressTimer = null
uni.redirectTo({
url: '/pages/cases/cases'
url: `/pages/cases/cases?source=${encodeURIComponent(source.value)}`
})
return
}
}, PROGRESS_INTERVAL_MS)
}
onLoad(query => {
const querySource = query?.source
if (isCaseListSource(querySource)) {
source.value = querySource
}
})
onMounted(() => {
loadMatchingProfile()
startParticles()
@@ -153,6 +163,14 @@ onUnmounted(() => {
if (particleTimer) clearInterval(particleTimer)
if (progressTimer) clearInterval(progressTimer)
})
function isCaseListSource(value: unknown): value is CaseListSource {
return value === 'recommended' ||
value === 'specialty' ||
value === 'weak' ||
value === 'teaching' ||
value === 'teacher-task'
}
</script>
<style>