feat: 联调对话功能

This commit is contained in:
王天骄
2026-06-09 17:00:23 +08:00
parent 3414d0662c
commit 2192b855a1
77 changed files with 1082 additions and 487 deletions
+9 -33
View File
@@ -1,25 +1,11 @@
<template>
<ScenarioPage
v-if="showScenarioPage"
:case-item="selectedCase"
@open-settings="emit('open-settings')"
@open-profile="openProfile"
@go-home="emit('go-home')"
/>
<TeachingPage
v-else-if="showTeachingPage"
:case-item="selectedCase"
@open-settings="emit('open-settings')"
@open-profile="openProfile"
@go-home="emit('go-home')"
/>
<view v-else class="cases-page">
<view class="cases-page">
<view class="case-shell">
<view class="case-header">
<button class="icon-button" aria-label="设置" @click="emit('open-settings')">
<button class="icon-button" aria-label="设置" @click="openSettings">
<view class="settings-icon"></view>
</button>
<button class="icon-button home-button" aria-label="首页" @click="emit('go-home')">
<button class="icon-button home-button" aria-label="首页" @click="goHome">
<view class="home-icon"></view>
</button>
<view class="header-spacer"></view>
@@ -85,9 +71,7 @@
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { fetchCaseList, type CaseMode, type ClinicalCase } from '../../api/cases'
import { createProfileOpener } from '../../api/navigation'
import ScenarioPage from '../scenario/scenario.vue'
import TeachingPage from '../teaching/teaching.vue'
import { createHomeNavigator, createProfileOpener, createSettingsOpener } from '../../api/navigation'
const emit = defineEmits<{
(event: 'open-settings'): void
@@ -96,14 +80,13 @@ const emit = defineEmits<{
}>()
const openProfile = createProfileOpener(emit)
const openSettings = createSettingsOpener(emit)
const goHome = createHomeNavigator(emit)
const cases = ref<ClinicalCase[]>([])
const keyword = ref('')
const toastMessage = ref('')
const toastVisible = ref(false)
const selectedCase = ref<ClinicalCase | null>(null)
const showScenarioPage = ref(false)
const showTeachingPage = ref(false)
const modeFilter = ref<CaseMode | ''>('')
let toastTimer: ReturnType<typeof setTimeout> | null = null
@@ -139,22 +122,15 @@ function loadCases() {
function selectCase(item: ClinicalCase) {
uni.setStorageSync('clinical-thinking-selected-case', item)
uni.setStorageSync('clinical-thinking-case-mode', item.mode)
selectedCase.value = item
if (item.mode === 'teaching') {
showTeachingPage.value = true
return
}
showScenarioPage.value = true
uni.navigateTo({
url: item.mode === 'teaching' ? '/pages/teaching/teaching' : '/pages/scenario/scenario'
})
}
function showToast(message: string) {
if (toastTimer) clearTimeout(toastTimer)
toastMessage.value = message
toastVisible.value = true
uni.showToast({
title: message,
icon: 'none'
})
toastTimer = setTimeout(() => {
toastVisible.value = false
}, 2200)