From 429d8d7e8652aed2d62734286dad16486f528f4a Mon Sep 17 00:00:00 2001 From: fuenmao <980740792@qq.com> Date: Thu, 24 Sep 2026 16:12:54 +0800 Subject: [PATCH] 111 --- src/services/health.ts | 12 ------ src/views/DashboardView.vue | 2 +- src/views/DeviceControlView.vue | 68 +-------------------------------- 3 files changed, 2 insertions(+), 80 deletions(-) diff --git a/src/services/health.ts b/src/services/health.ts index e23fd33..ab3aecb 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -219,14 +219,6 @@ export type HomeAssistantLightTransition = { message: string } -export type HomeAssistantSpeakerDemo = { - audioUrl: string - speakerOnline: boolean - directPlaybackSupported: boolean - commandAccepted: boolean - message: string -} - export type HomeAssistantStatus = { connected: boolean message: string @@ -299,10 +291,6 @@ export const healthApi = { http.post('/api/health/home-assistant/lights/wake'), stopLightTransition: () => http.post('/api/health/home-assistant/lights/stop'), - speakerDemoStatus: () => - http.get('/api/health/home-assistant/speaker/demo'), - playSpeakerDemo: () => - http.post('/api/health/home-assistant/speaker/play-demo'), executeSleepScene: () => http.post('/api/health/home-assistant/scenes/sleep', undefined, { timeout: 90000 }), executeAllOffScene: () => diff --git a/src/views/DashboardView.vue b/src/views/DashboardView.vue index dba8252..decac7f 100644 --- a/src/views/DashboardView.vue +++ b/src/views/DashboardView.vue @@ -138,7 +138,7 @@ onMounted(load)
8H 床垫 - 左右加热 {{ dashboard?.mattressComfort?.heatingLevel ?? 0 }} 档 · 软硬度{{ dashboard?.mattressComfort?.firmness || '待填写 BMI' }} + 左右加热 {{ dashboard?.mattressComfort?.heatingLevel ?? 0 }} 档 · 软硬度{{ dashboard?.mattressComfort?.firmness || '待填写 BMI' }} · 右侧全身轻柔按摩
除湿消杀 diff --git a/src/views/DeviceControlView.vue b/src/views/DeviceControlView.vue index 31dbe23..35fa0e2 100644 --- a/src/views/DeviceControlView.vue +++ b/src/views/DeviceControlView.vue @@ -13,7 +13,6 @@ import { healthApi, type HomeAssistantDiscoveredDevice, type HomeAssistantLightTransition, - type HomeAssistantSpeakerDemo, type HomeAssistantStatus, type MattressComfort, type TcmAssessmentResult @@ -31,8 +30,6 @@ const lastUpdatedAt = ref('') const actionFeedback = ref<{ type: 'success' | 'fail'; message: string }>() const lightTransition = ref() const lightActionBusy = ref(false) -const speakerDemo = ref() -const speakerDemoBusy = ref(false) let lightProgressTimer: ReturnType | undefined let lightPolling = false @@ -73,11 +70,10 @@ function setFeedback(type: 'success' | 'fail', message: string) { } const operationBusy = computed(() => - loading.value || lightActionBusy.value || speakerDemoBusy.value || Boolean(sceneRunning.value) || Boolean(settingParam.value) || Boolean(switchingDeviceId.value) + loading.value || lightActionBusy.value || Boolean(sceneRunning.value) || Boolean(settingParam.value) || Boolean(switchingDeviceId.value) ) const currentOperationText = computed(() => { - if (speakerDemoBusy.value) return '正在尝试播放示例音频…' if (lightActionBusy.value) return '正在切换灯光渐变模式…' if (sceneRunning.value === 'sleep') return '正在启动全屋舒睡模式…' if (sceneRunning.value === 'all-off') return '正在关闭场景设备…' @@ -188,14 +184,6 @@ async function loadStatus(notify = false) { if (controls.mattress_massage_right_part?.state) localParams.mattressMassageRightPart = controls.mattress_massage_right_part.state if (controls.mattress_massage_level?.state) localParams.mattressMassageLevel = controls.mattress_massage_level.state await syncLightTransitionStatus() - try { - speakerDemo.value = await healthApi.speakerDemoStatus() - } catch (err) { - speakerDemo.value = { - audioUrl: '', speakerOnline: false, directPlaybackSupported: false, commandAccepted: false, - message: err instanceof Error ? err.message : '音箱能力检测失败' - } - } lastUpdatedAt.value = new Intl.DateTimeFormat('zh-CN', { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false }).format(new Date()) @@ -271,26 +259,6 @@ async function controlLightTransition(action: 'sleep' | 'wake' | 'stop') { } } -async function tryPlaySpeakerDemo() { - if (!speakerDemo.value?.directPlaybackSupported || operationBusy.value) return - speakerDemoBusy.value = true - const loadingToast = showLoadingToast({ message: '正在尝试投放到音箱…', forbidClick: true, duration: 0 }) - try { - const result = await healthApi.playSpeakerDemo() - speakerDemo.value = result - if (!result.commandAccepted) throw new Error(result.message) - setFeedback('success', result.message) - showSuccessToast('指令已发送,请确认音箱实际出声') - } catch (err) { - const message = err instanceof Error ? err.message : '投放失败' - setFeedback('fail', message) - showFailToast(message) - } finally { - loadingToast.close() - speakerDemoBusy.value = false - } -} - // 查找具体设备 const dehumidifierDevice = computed(() => haStatus.value?.devices.find(d => d.category === 'EnvironmentControl') @@ -777,17 +745,6 @@ onUnmounted(() => {
-
- OSS 音频播放 Demo - 先在手机试听,再检测能否投放到 Sound Pro。 - -

{{ speakerDemo?.message || '正在检测音箱播放能力…' }}

- -
@@ -1544,29 +1501,6 @@ onUnmounted(() => { cursor: not-allowed; } -.speaker-demo-panel { - padding: 13px; - border-radius: 12px; - background: #f3f8f7; - border: 1px solid #d9e9e5; -} - -.speaker-demo-panel strong, -.speaker-demo-panel small, -.speaker-demo-panel audio { - display: block; -} - -.speaker-demo-panel strong { font-size: 13px; color: #174d44; } -.speaker-demo-panel small { margin-top: 4px; color: #647b75; font-size: 11px; } -.speaker-demo-panel audio { width: 100%; margin-top: 10px; height: 38px; } -.speaker-demo-panel p { margin: 10px 0; color: #526a64; font-size: 11px; line-height: 1.5; } -.speaker-demo-panel button { - width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; - background: #0c5045; color: #fff; font-size: 12px; font-weight: 600; -} -.speaker-demo-panel button:disabled { background: #b8c5c1; } - /* 滑块样式:左右各预留 10px 间距,使滑块在 0% 和 100% 端点时,外凸的圆形按钮完整居中且不被裁剪 */ .param-row :deep(.van-slider) { margin: 10px 10px 14px 10px;