feat: 联调对话功能
This commit is contained in:
+10
-34
@@ -1,27 +1,8 @@
|
||||
<template>
|
||||
<MatchingPage
|
||||
v-if="showMatchingPage"
|
||||
@open-settings="emit('open-settings')"
|
||||
@open-profile="openProfile"
|
||||
@go-home="showMatchingPage = false"
|
||||
/>
|
||||
<LearningAssistantPage
|
||||
v-else-if="showLearningAssistantPage"
|
||||
@open-settings="emit('open-settings')"
|
||||
@open-profile="openProfile"
|
||||
@go-home="showLearningAssistantPage = false"
|
||||
/>
|
||||
<ChatPage
|
||||
v-else-if="showChatPage"
|
||||
:case-item="null"
|
||||
@open-settings="emit('open-settings')"
|
||||
@open-profile="openProfile"
|
||||
@go-home="showChatPage = false"
|
||||
/>
|
||||
<view v-else class="home-page">
|
||||
<view class="home-page">
|
||||
<view class="home-shell">
|
||||
<view class="top-bar">
|
||||
<button class="icon-button" aria-label="配置" @click="emit('open-settings')">
|
||||
<button class="icon-button" aria-label="配置" @click="openSettings">
|
||||
<view class="settings-icon"></view>
|
||||
</button>
|
||||
<view class="top-spacer"></view>
|
||||
@@ -86,10 +67,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, reactive, ref } from 'vue'
|
||||
import { fetchHomeSummary, startTrainingSession, type HomeSummary } from '../../api/home'
|
||||
import { createProfileOpener } from '../../api/navigation'
|
||||
import ChatPage from '../chat/chat.vue'
|
||||
import LearningAssistantPage from '../learning-assistant/learning-assistant.vue'
|
||||
import MatchingPage from '../matching/matching.vue'
|
||||
import { createProfileOpener, createSettingsOpener } from '../../api/navigation'
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'open-settings'): void
|
||||
@@ -97,6 +75,7 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const openProfile = createProfileOpener(emit)
|
||||
const openSettings = createSettingsOpener(emit)
|
||||
|
||||
const summary = reactive<HomeSummary>({
|
||||
greeting: '下午好,医生。',
|
||||
@@ -115,9 +94,6 @@ const trainingModules = [
|
||||
const starting = ref(false)
|
||||
const toastMessage = ref('')
|
||||
const toastVisible = ref(false)
|
||||
const showMatchingPage = ref(false)
|
||||
const showLearningAssistantPage = ref(false)
|
||||
const showChatPage = ref(false)
|
||||
|
||||
let toastTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
@@ -132,7 +108,9 @@ function handleStartTraining() {
|
||||
starting.value = true
|
||||
startTrainingSession().then(result => {
|
||||
uni.setStorageSync('clinical-thinking-session', result)
|
||||
showMatchingPage.value = true
|
||||
uni.navigateTo({
|
||||
url: '/pages/matching/matching'
|
||||
})
|
||||
}).catch(error => {
|
||||
showToast(error instanceof Error ? error.message : '进入训练失败')
|
||||
}).finally(() => {
|
||||
@@ -143,17 +121,15 @@ function handleStartTraining() {
|
||||
}
|
||||
|
||||
function openLearningAssistant() {
|
||||
showLearningAssistantPage.value = true
|
||||
uni.navigateTo({
|
||||
url: '/pages/learning-assistant/learning-assistant'
|
||||
})
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user