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
+26
View File
@@ -154,6 +154,7 @@
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from 'vue'
import {
downloadEvaluationPdf,
@@ -162,6 +163,7 @@ import {
type EvaluationDetail,
type EvaluationResult
} from '../../api/assessment'
import { fetchServerEvaluationDetail } from '../../api/profile'
import { readActiveSessionId } from '../../api/session'
type BreakdownItem = {
@@ -200,6 +202,7 @@ const activeEvaluationId = ref<number | null>(null)
const exportingPdf = ref(false)
const evaluationLoaded = ref(false)
const evaluationFailed = ref(false)
const routeEvaluationId = ref<number | null>(null)
const scoreDashOffset = computed(() => {
return 264 - (264 * report.score) / 100
@@ -436,6 +439,11 @@ async function loadEvaluation() {
evaluationLoaded.value = false
evaluationFailed.value = false
try {
if (routeEvaluationId.value) {
await loadRouteEvaluation(routeEvaluationId.value)
return
}
if (isTeachingAssessment()) {
await loadTeachingEvaluation()
return
@@ -459,6 +467,14 @@ async function loadEvaluation() {
}
}
async function loadRouteEvaluation(evaluationId: number) {
const detail = await fetchServerEvaluationDetail(evaluationId)
uni.setStorageSync('clinical-thinking-evaluation-detail', detail)
applyEvaluationDetail(detail)
evaluation.value = null
evaluationLoaded.value = true
}
async function loadTeachingEvaluation() {
const evaluationId = readTeachingEvaluationId()
const storedEvaluation = readStoredTeachingEvaluation()
@@ -574,6 +590,16 @@ function startBrowserDownload(url: string, fileName: string) {
document.body.removeChild(link)
}
function readEvaluationId(value: unknown) {
const evaluationId = Number(value)
if (Number.isInteger(evaluationId) && evaluationId > 0) return evaluationId
return null
}
onLoad(query => {
routeEvaluationId.value = readEvaluationId(query?.evaluation_id || query?.id)
})
onMounted(() => {
void loadEvaluation()
})