Compare commits
2
Commits
20467ca479
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09e8bded7e | ||
|
|
db0c578890 |
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
||||||
<meta name="theme-color" content="#0c5045" />
|
<meta name="theme-color" content="#1677ff" />
|
||||||
<title>常青树健康管理</title>
|
<title>常青树健康管理</title>
|
||||||
<script>
|
<script>
|
||||||
function hideWxToolbar() {
|
function hideWxToolbar() {
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 496 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 329 KiB |
+126
-6
@@ -23,7 +23,7 @@ const dashboardRecord = (name = '演示用户') => ({ user: { id: 1, displayName
|
|||||||
profile: {}, hasCompletedAssessment: false, tcmResult: { hasCompleted: true, constitutionName: '平和质' } })
|
profile: {}, hasCompletedAssessment: false, tcmResult: { hasCompleted: true, constitutionName: '平和质' } })
|
||||||
const deviceStatus = () => ({ connected: true, sceneDevices: { available: 3 } })
|
const deviceStatus = () => ({ connected: true, sceneDevices: { available: 3 } })
|
||||||
|
|
||||||
function environment(overrides = {}) {
|
function environment(overrides = {}, ib43Get) {
|
||||||
const disposed = [], toasts = [], navigations = [], tokenWrites = [], mounted = []
|
const disposed = [], toasts = [], navigations = [], tokenWrites = [], mounted = []
|
||||||
const router = { replace: location => navigations.push(location), push: location => navigations.push(location) }
|
const router = { replace: location => navigations.push(location), push: location => navigations.push(location) }
|
||||||
const vue = { defineComponent: options => options, ref: value => ({ value }), reactive: value => value,
|
const vue = { defineComponent: options => options, ref: value => ({ value }), reactive: value => value,
|
||||||
@@ -43,6 +43,7 @@ function environment(overrides = {}) {
|
|||||||
const file = path.resolve(root, /\.(vue|ts)$/.test(relative) ? relative : relative + '.ts')
|
const file = path.resolve(root, /\.(vue|ts)$/.test(relative) ? relative : relative + '.ts')
|
||||||
const normalized = file.replaceAll('\\', '/')
|
const normalized = file.replaceAll('\\', '/')
|
||||||
if (normalized.endsWith('services/health.ts')) return { healthApi }
|
if (normalized.endsWith('services/health.ts')) return { healthApi }
|
||||||
|
if (normalized.endsWith('services/http.ts') && ib43Get) return { default: { get: ib43Get } }
|
||||||
if (normalized.endsWith('services/auth.ts')) return { saveTokens: (...args) => tokenWrites.push(args), clearTokens: () => tokenWrites.push('clear') }
|
if (normalized.endsWith('services/auth.ts')) return { saveTokens: (...args) => tokenWrites.push(args), clearTokens: () => tokenWrites.push('clear') }
|
||||||
if (file.endsWith('AppTabBar.vue')) return { default: {} }
|
if (file.endsWith('AppTabBar.vue')) return { default: {} }
|
||||||
if (file.endsWith('useDeviceScenes.ts')) return { useDeviceScenes: options => {
|
if (file.endsWith('useDeviceScenes.ts')) return { useDeviceScenes: options => {
|
||||||
@@ -143,8 +144,9 @@ test('late login response cannot write a token or navigate after leaving the aut
|
|||||||
const server = await createServer({ configFile: false, root: path.dirname(root), plugins: [vuePlugin()], appType: 'custom',
|
const server = await createServer({ configFile: false, root: path.dirname(root), plugins: [vuePlugin()], appType: 'custom',
|
||||||
server: { middlewareMode: true, hmr: false }, optimizeDeps: { noDiscovery: true, include: [] } })
|
server: { middlewareMode: true, hmr: false }, optimizeDeps: { noDiscovery: true, include: [] } })
|
||||||
after(() => server.close())
|
after(() => server.close())
|
||||||
async function render(name, values = {}, routePath = '/dashboard') {
|
async function render(name, values = {}, routePath = '/dashboard', props = {}) {
|
||||||
const { default: view } = await server.ssrLoadModule(`/src/views/${name}.vue`)
|
const componentPath = name.includes('/') ? name : `views/${name}`
|
||||||
|
const { default: view } = await server.ssrLoadModule(`/src/${componentPath}.vue`)
|
||||||
const component = { ...view, setup(props, context) {
|
const component = { ...view, setup(props, context) {
|
||||||
const state = view.setup(props, context)
|
const state = view.setup(props, context)
|
||||||
for (const [key, value] of Object.entries(values)) { assert.ok(isRef(state[key]), key); state[key].value = value }
|
for (const [key, value] of Object.entries(values)) { assert.ok(isRef(state[key]), key); state[key].value = value }
|
||||||
@@ -152,20 +154,138 @@ async function render(name, values = {}, routePath = '/dashboard') {
|
|||||||
} }
|
} }
|
||||||
const router = createRouter({ history: createMemoryHistory(), routes: [{ path: '/:pathMatch(.*)*', component }] })
|
const router = createRouter({ history: createMemoryHistory(), routes: [{ path: '/:pathMatch(.*)*', component }] })
|
||||||
await router.push(routePath); await router.isReady()
|
await router.push(routePath); await router.isReady()
|
||||||
const app = createSSRApp({ render: () => h(component) }); app.use(router)
|
const app = createSSRApp({ render: () => h(component, props) }); app.use(router)
|
||||||
return renderToString(app)
|
return renderToString(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
test('home renders a prominent scene, collapsed presets, a real profile entry and the required navigation order', async () => {
|
test('home renders a prominent scene, collapsed presets, a real profile entry and the required navigation order', async () => {
|
||||||
const record = { ...dashboardRecord(), bmi: 31.1, sceneConfig: { targetHumidity: 55, fanLevel: '1挡', lightBrightnessPercent: 50, lightColorTemperatureKelvin: 2700 } }
|
const record = { ...dashboardRecord(), bmi: 31.1, sceneConfig: { targetHumidity: 55, fanLevel: '1挡', lightBrightnessPercent: 50, lightColorTemperatureKelvin: 2700 } }
|
||||||
const html = await render('DashboardView', { loading: false, dashboard: record, homeAssistant: deviceStatus() })
|
const html = await render('DashboardView', { loading: false, dashboard: record, homeAssistant: {
|
||||||
for (const value of ['我的舒睡空间', '一键开启舒睡', '查看舒睡设备', '查看体质启动预设', '打开我的健康档案']) assert.ok(html.includes(value), value)
|
...deviceStatus(), scenePresets: [{ deviceName: '米家除湿机', entityId: 'humidifier.keep', action: '恒湿', detail: '目标 55%', available: true }],
|
||||||
|
} })
|
||||||
|
for (const value of ['我的舒睡空间', '一键开启舒睡', '查看舒睡设备', '睡眠数据', '查看体质启动预设', '打开我的健康档案']) assert.ok(html.includes(value), value)
|
||||||
assert.match(html, /<details class="startup-preset-details">/)
|
assert.match(html, /<details class="startup-preset-details">/)
|
||||||
|
assert.match(html, /米家除湿机/)
|
||||||
|
assert.doesNotMatch(html, /助眠灯光|2700K/)
|
||||||
assert.ok(html.indexOf('首页</span>') < html.indexOf('中医四诊</span>'))
|
assert.ok(html.indexOf('首页</span>') < html.indexOf('中医四诊</span>'))
|
||||||
assert.ok(html.indexOf('中医四诊</span>') < html.indexOf('健康评估</span>'))
|
assert.ok(html.indexOf('中医四诊</span>') < html.indexOf('健康评估</span>'))
|
||||||
assert.ok(html.indexOf('健康评估</span>') < html.indexOf('我的</span>'))
|
assert.ok(html.indexOf('健康评估</span>') < html.indexOf('我的</span>'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('automation card separates the rule switch from physical readback and preserves previous results while stopped', async () => {
|
||||||
|
const state = { available: true, enabled: false, actionLabel: '关闭窗帘', targetLabel: '美百帘窗帘', records: [
|
||||||
|
{ id: 'one', actionKey: 'curtain-close', targetLabel: '美百帘窗帘', triggeredAtMs: 1794380000000, result: 'readback-confirmed' },
|
||||||
|
{ id: 'two', actionKey: 'curtain-close', targetLabel: '美百帘窗帘', triggeredAtMs: 1794381000000, result: 'sent-readback-unconfirmed' },
|
||||||
|
] }
|
||||||
|
const props = { bindingId: 'simulation-left' }
|
||||||
|
const stopped = await render('components/Ib43AutomationCard', { status: state }, '/sleep-data', props)
|
||||||
|
assert.match(stopped, /已停止/)
|
||||||
|
assert.match(stopped, /开启联动/)
|
||||||
|
assert.match(stopped, /美百帘窗帘 · 已确认关闭/)
|
||||||
|
assert.match(stopped, /已发出关帘指令,未确认关闭/)
|
||||||
|
const started = await render('components/Ib43AutomationCard', { status: { ...state, enabled: true } }, '/sleep-data', props)
|
||||||
|
assert.match(started, /停止联动/)
|
||||||
|
assert.doesNotMatch(started, /开启联动/)
|
||||||
|
|
||||||
|
const both = await render('components/Ib43AutomationCard', { status: {
|
||||||
|
...state,
|
||||||
|
rules: [
|
||||||
|
{ actionKey: 'curtain-close', actionLabel: '关闭窗帘', enabled: false, targetLabel: '美百帘窗帘' },
|
||||||
|
{ actionKey: 'dehumidifier-humidity-preview', actionLabel: '湿度偏高时开启除湿机', enabled: true,
|
||||||
|
targetLabel: '除湿机', previewOnly: true, conditionLabel: '室内相对湿度超过 55% 时记录开机计划。' },
|
||||||
|
{ actionKey: 'dehumidifier-humidity-start', actionLabel: '湿度偏高时开启除湿机', enabled: false,
|
||||||
|
targetLabel: '除湿机', previewOnly: false, conditionLabel: '室内相对湿度超过 55% 且除湿机关机时,发送开机指令。' },
|
||||||
|
{ actionKey: 'climate-temperature-preview', actionLabel: '按室温判断空调模式', enabled: false,
|
||||||
|
targetLabel: '空调温控器2', previewOnly: true, conditionLabel: '室温高于 25℃ 时计划制冷,低于 22℃ 时计划制热。' },
|
||||||
|
{ actionKey: 'climate-heat-start', actionLabel: '室温偏低时开启空调制热', enabled: false,
|
||||||
|
targetLabel: '空调温控器2', previewOnly: false, conditionLabel: '室温低于 22℃ 且空调关机时,开启制热并设为 22℃。' },
|
||||||
|
{ actionKey: 'wake-fragrance-quick-release', actionLabel: '让香氛机「唤醒」出香一次', enabled: false,
|
||||||
|
targetLabel: '香氛机 唤醒', previewOnly: false },
|
||||||
|
{ actionKey: 'speaker-sleep-music', actionLabel: '用 Xiaomi Sound Pro 播放舒睡音乐', enabled: false,
|
||||||
|
targetLabel: 'Xiaomi Sound Pro', previewOnly: false },
|
||||||
|
],
|
||||||
|
records: [...state.records,
|
||||||
|
{ id: 'three', actionKey: 'dehumidifier-humidity-preview', targetLabel: '除湿机',
|
||||||
|
triggeredAtMs: 1794382000000, result: 'preview-would-start' },
|
||||||
|
{ id: 'four', actionKey: 'dehumidifier-humidity-start', targetLabel: '除湿机',
|
||||||
|
triggeredAtMs: 1794383000000, result: 'readback-confirmed' },
|
||||||
|
{ id: 'five', actionKey: 'climate-temperature-preview', targetLabel: '空调温控器2',
|
||||||
|
triggeredAtMs: 1794384000000, result: 'preview-climate-cool' },
|
||||||
|
{ id: 'six', actionKey: 'climate-heat-start', targetLabel: '空调温控器2',
|
||||||
|
triggeredAtMs: 1794385000000, result: 'readback-confirmed' },
|
||||||
|
{ id: 'seven', actionKey: 'wake-fragrance-quick-release', targetLabel: '香氛机 唤醒',
|
||||||
|
triggeredAtMs: 1794386000000, result: 'fragrance-release-sent' },
|
||||||
|
{ id: 'eight', actionKey: 'speaker-sleep-music', targetLabel: 'Xiaomi Sound Pro',
|
||||||
|
triggeredAtMs: 1794387000000, result: 'speaker-playback-sent' }],
|
||||||
|
} }, '/sleep-data', props)
|
||||||
|
for (const text of ['开启联动', '停止预演', '超过 55% 且除湿机关机时', '除湿机 · 已确认开启', '除湿机 · 预演通过,计划开启除湿机',
|
||||||
|
'按室温判断空调模式(预演)', '高于 25℃ 时计划制冷', '空调温控器2 · 预演通过,计划制冷',
|
||||||
|
'室温偏低时开启空调制热', '低于 22℃ 且空调关机时', '空调温控器2 · 已确认制热至 22℃',
|
||||||
|
'香氛机 唤醒 · 已发送一次快速出香指令', 'Xiaomi Sound Pro · 已发送舒睡音乐播放指令'])
|
||||||
|
assert.ok(both.includes(text), text)
|
||||||
|
})
|
||||||
|
|
||||||
|
const sleepBed = { id: 'left-bed', bedName: '卧室左侧', side: 'left', simulation: true, endedAtMs: null }
|
||||||
|
const rightBed = { id: 'right-bed', bedName: '卧室右侧', side: 'right', simulation: false, endedAtMs: null }
|
||||||
|
|
||||||
|
test('sleep data renders stale readings and missing fields separately, with the same time for UTC strings and history milliseconds', async () => {
|
||||||
|
const instant = Date.parse('2026-11-11T01:55:21Z')
|
||||||
|
const readings = {
|
||||||
|
heartRate: { value: 72, receivedAt: '2026-11-11 01:55:21', freshness: 'stale' },
|
||||||
|
respiration: { value: null, receivedAt: '2026-11-11 01:55:21', freshness: 'recent' },
|
||||||
|
snoring: { value: 0, receivedAt: '2026-11-11 01:55:21', freshness: 'stale' },
|
||||||
|
}
|
||||||
|
const html = await render('SleepDataView', {
|
||||||
|
bindingsLoading: false, beds: [sleepBed], bedId: sleepBed.id,
|
||||||
|
current: { bed: sleepBed, active: true, transport: 'connected', readings },
|
||||||
|
history: [{ id: '1', receivedAtMs: String(instant), readings }],
|
||||||
|
}, '/sleep-data')
|
||||||
|
assert.match(html, /模拟设备/)
|
||||||
|
assert.match(html, /数据服务已连接/)
|
||||||
|
assert.match(html, /数据已过期/)
|
||||||
|
assert.match(html, /暂无有效读数/)
|
||||||
|
assert.match(html, /暂无上报/)
|
||||||
|
assert.match(html, /未打鼾/)
|
||||||
|
assert.doesNotMatch(html, /离床/)
|
||||||
|
const { formatIb43Time } = await server.ssrLoadModule('/src/services/ib43.ts')
|
||||||
|
assert.equal(formatIb43Time(readings.heartRate.receivedAt), formatIb43Time(String(instant)))
|
||||||
|
const empty = await render('SleepDataView', { bindingsLoading: false }, '/sleep-data')
|
||||||
|
assert.match(empty, /暂无绑定床位/)
|
||||||
|
assert.doesNotMatch(empty, /最近读数|历史记录/)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('sleep data discards late results from a previous bed and keeps the time range and cursor when paging', async () => {
|
||||||
|
const oldCurrent = deferred(), oldHistory = deferred(), historyRequests = []
|
||||||
|
const cursor = '9007199254740993'
|
||||||
|
const env = environment({}, async (url, options) => {
|
||||||
|
if (url.endsWith('/bindings')) return [sleepBed, rightBed]
|
||||||
|
if (url.includes('/left-bed/')) return url.endsWith('/current') ? oldCurrent.promise : oldHistory.promise
|
||||||
|
if (url.endsWith('/right-bed/current')) return { bed: rightBed, readings: {} }
|
||||||
|
if (url.endsWith('/right-bed/history')) {
|
||||||
|
historyRequests.push(options.params)
|
||||||
|
return options.params.beforeId == null ? { items: [{ id: 'right-1' }], nextBeforeId: cursor } :
|
||||||
|
{ items: [{ id: 'right-2' }], nextBeforeId: null }
|
||||||
|
}
|
||||||
|
throw new Error(`Unexpected request: ${url}`)
|
||||||
|
})
|
||||||
|
const page = env.page('SleepDataView')
|
||||||
|
await page.loadBindings()
|
||||||
|
assert.equal(page.bedId.value, 'left-bed')
|
||||||
|
page.bedId.value = 'right-bed'
|
||||||
|
page.loadBed()
|
||||||
|
await new Promise(resolve => setImmediate(resolve))
|
||||||
|
oldCurrent.resolve({ bed: sleepBed }); oldHistory.resolve({ items: [{ id: 'left-1' }] })
|
||||||
|
await new Promise(resolve => setImmediate(resolve))
|
||||||
|
assert.equal(page.current.value.bed.id, 'right-bed')
|
||||||
|
assert.equal(page.history.value[0].id, 'right-1')
|
||||||
|
await page.loadHistory(true)
|
||||||
|
assert.equal(historyRequests[1].beforeId, cursor)
|
||||||
|
assert.equal(historyRequests[1].fromMs, historyRequests[0].fromMs)
|
||||||
|
assert.equal(historyRequests[1].toMs, historyRequests[0].toMs)
|
||||||
|
assert.equal(page.history.value[1].id, 'right-2')
|
||||||
|
assert.equal(page.nextBeforeId.value, undefined)
|
||||||
|
})
|
||||||
|
|
||||||
test('error pages render retry controls without mistaken missing-assessment or device actions', async () => {
|
test('error pages render retry controls without mistaken missing-assessment or device actions', async () => {
|
||||||
for (const [name, path] of [['DashboardView', '/dashboard'], ['ProfileView', '/profile']]) {
|
for (const [name, path] of [['DashboardView', '/dashboard'], ['ProfileView', '/profile']]) {
|
||||||
const html = await render(name, { loading: false, loadError: '测试连接失败' }, path)
|
const html = await render(name, { loading: false, loadError: '测试连接失败' }, path)
|
||||||
|
|||||||
@@ -81,12 +81,12 @@ test('parameter conversion rejects junk and unavailable data; light zero and har
|
|||||||
const { createDeviceParameterState, syncDeviceParameters } = env.load('devices/parameterRegistry')
|
const { createDeviceParameterState, syncDeviceParameters } = env.load('devices/parameterRegistry')
|
||||||
const params = createDeviceParameterState()
|
const params = createDeviceParameterState()
|
||||||
syncDeviceParameters(params, { brightness: control('off'), color_temp: control('on', { color_temp_kelvin: 6500 }),
|
syncDeviceParameters(params, { brightness: control('off'), color_temp: control('on', { color_temp_kelvin: 6500 }),
|
||||||
mattress_left_heating: control('4'), volume: control('on', { volume_level: .56 }), fragrance_auto_light: control('on') })
|
volume: control('on', { volume_level: .56 }), uv: control('on') })
|
||||||
assert.equal(params.lightBrightness, 0); assert.equal(params.lightColorTemp, 5000)
|
assert.equal(params.lightBrightness, 0); assert.equal(params.lightColorTemp, 5000)
|
||||||
assert.equal(params.mattressLeftHeating, 4); assert.equal(params.speakerVolume, 56)
|
assert.equal(params.speakerVolume, 56)
|
||||||
assert.equal(params.fragranceAutoLight, true)
|
assert.equal(params.dehumidifierUv, true)
|
||||||
syncDeviceParameters(params, { fragrance_auto_light: control('unavailable', {}, false), volume: control('on', { volume_level: 'NaN' }) })
|
syncDeviceParameters(params, { uv: control('unavailable', {}, false), volume: control('on', { volume_level: 'NaN' }) })
|
||||||
assert.equal(params.fragranceAutoLight, true); assert.equal(params.speakerVolume, 56)
|
assert.equal(params.dehumidifierUv, true); assert.equal(params.speakerVolume, 56)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('parameter availability is scoped to the actual device; missing numeric attributes are not default readings', () => {
|
test('parameter availability is scoped to the actual device; missing numeric attributes are not default readings', () => {
|
||||||
@@ -105,20 +105,6 @@ test('parameter availability is scoped to the actual device; missing numeric att
|
|||||||
assert.equal(parameterIsAvailable(controls, 'brightness', lamp), false)
|
assert.equal(parameterIsAvailable(controls, 'brightness', lamp), false)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('mattress per-user preferences remain separate from the one physically running side', () => {
|
|
||||||
const env = environment(), params = env.load('devices/parameterRegistry').createDeviceParameterState()
|
|
||||||
const user = env.vue.ref(1), hook = env.load('devices/mattress/useMattressPreferences').useMattressPreferences(params, user, () => 'mattress')
|
|
||||||
hook.syncModes({ mattress_left_mode: control('智能适配'), mattress_right_mode: control('无') })
|
|
||||||
assert.equal(params.mattressLeftMode, '智能适配'); assert.equal(params.mattressRightMode, '智能适配')
|
|
||||||
assert.equal(hook.mattressActiveSide.value, 'left')
|
|
||||||
hook.commitMode('left', '瑜伽助眠'); hook.commitMode('right', '智能腰托')
|
|
||||||
hook.syncModes({ mattress_left_mode: control('无'), mattress_right_mode: control('智能腰托') })
|
|
||||||
assert.equal(params.mattressLeftMode, '瑜伽助眠'); assert.equal(hook.mattressActiveSide.value, 'right')
|
|
||||||
hook.syncModes({ mattress_left_mode: control('智能适配'), mattress_right_mode: control('智能腰托') })
|
|
||||||
assert.equal(hook.mattressActiveSide.value, 'right')
|
|
||||||
user.value = 2; hook.syncModes({})
|
|
||||||
assert.equal(params.mattressLeftMode, '智能适配')
|
|
||||||
})
|
|
||||||
|
|
||||||
test('older transition response cannot replace newer volume; disposal cannot create a late timer', async () => {
|
test('older transition response cannot replace newer volume; disposal cannot create a late timer', async () => {
|
||||||
const first = deferred(), second = deferred(); let reads = 0
|
const first = deferred(), second = deferred(); let reads = 0
|
||||||
@@ -164,13 +150,13 @@ test('all-off can interrupt start; a late start result cannot overwrite off feed
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('failed parameter command restores last known reading even if refresh itself fails', async () => {
|
test('failed parameter command restores last known reading even if refresh itself fails', async () => {
|
||||||
const env = environment({ homeAssistantStatus: async () => status({ fragrance_auto_light: control('off') }),
|
const env = environment({ homeAssistantStatus: async () => status({ uv: control('off') }),
|
||||||
setParameter: async () => ({ success: false, message: '失败' }) })
|
setParameter: async () => ({ success: false, message: '失败' }) })
|
||||||
const hook = env.load('composables/useDeviceControl').useDeviceControl()
|
const hook = env.load('composables/useDeviceControl').useDeviceControl()
|
||||||
await hook.loadStatus(); hook.localParams.fragranceAutoLight = true
|
await hook.loadStatus(); hook.localParams.dehumidifierUv = true
|
||||||
env.healthApi.homeAssistantStatus = async () => { throw new Error('离线') }
|
env.healthApi.homeAssistantStatus = async () => { throw new Error('离线') }
|
||||||
assert.equal(await hook.applyParam('fragrance', 'fragrance_auto_light', true), false)
|
assert.equal(await hook.applyParam('dehumidifier', 'uv', true), false)
|
||||||
assert.equal(hook.localParams.fragranceAutoLight, false)
|
assert.equal(hook.localParams.dehumidifierUv, false)
|
||||||
assert.equal(hook.actionFeedback.value.message, '失败')
|
assert.equal(hook.actionFeedback.value.message, '失败')
|
||||||
env.dispose(); assert.equal(env.timeouts.size, 0)
|
env.dispose(); assert.equal(env.timeouts.size, 0)
|
||||||
})
|
})
|
||||||
@@ -223,20 +209,6 @@ test('navigation closes a pending parameter toast and prevents a late result fro
|
|||||||
assert.equal(env.timeouts.size, 0)
|
assert.equal(env.timeouts.size, 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('mattress confirmation cannot act after leaving the page or switching to another mattress', async () => {
|
|
||||||
const confirmation = deferred(), env = environment({ confirmDialog: () => confirmation.promise })
|
|
||||||
const selected = env.vue.ref(device('mattress', 'Sleep', [], { deviceId: 'first' }))
|
|
||||||
let writes = 0
|
|
||||||
const hook = env.load('devices/mattress/useMattressControls').useMattressControls(selected,
|
|
||||||
async () => { writes++; return true }, async () => {}, () => {})
|
|
||||||
const request = hook.setMattressSelect('mattress_massage_right_part', { target: { value: '全身' } })
|
|
||||||
selected.value = undefined; confirmation.resolve(); await request
|
|
||||||
assert.equal(writes, 0)
|
|
||||||
selected.value = device('mattress', 'Sleep', [], { deviceId: 'first' })
|
|
||||||
env.dispose()
|
|
||||||
await hook.setMattressSelect('mattress_massage_right_part', { target: { value: '全身' } })
|
|
||||||
assert.equal(writes, 0)
|
|
||||||
})
|
|
||||||
|
|
||||||
const device = (moduleKey, category, entities = [], extra = {}) => ({
|
const device = (moduleKey, category, entities = [], extra = {}) => ({
|
||||||
deviceId: 'device', name: '测试设备', manufacturer: '', model: '', moduleKey, category,
|
deviceId: 'device', name: '测试设备', manufacturer: '', model: '', moduleKey, category,
|
||||||
@@ -303,7 +275,10 @@ test('a failed new-light fade is not reported as success merely because the orig
|
|||||||
{ entityId: 'light.primary', running: true, success: true, brightnessPercent: 1, mode: 'sleep' },
|
{ entityId: 'light.primary', running: true, success: true, brightnessPercent: 1, mode: 'sleep' },
|
||||||
{ entityId: 'light.strip', running: true, success: true, brightnessPercent: 2, mode: 'sleep' },
|
{ entityId: 'light.strip', running: true, success: true, brightnessPercent: 2, mode: 'sleep' },
|
||||||
] }
|
] }
|
||||||
const env = environment({ lightTransitionStatus: async () => current })
|
const primary = standardLight('light.primary'); primary.moduleKey = 'lighting'
|
||||||
|
const strip = standardLight('light.strip'); strip.moduleKey = 'sleep-light-strip'
|
||||||
|
const env = environment({ lightTransitionStatus: async () => current,
|
||||||
|
homeAssistantStatus: async () => ({ connected: true, devices: [primary, strip] }) })
|
||||||
const hook = env.load('composables/useDeviceControl').useDeviceControl(); await hook.loadStatus()
|
const hook = env.load('composables/useDeviceControl').useDeviceControl(); await hook.loadStatus()
|
||||||
current = { ...current, running: false, message: '原灯渐暗完成', lights: [
|
current = { ...current, running: false, message: '原灯渐暗完成', lights: [
|
||||||
{ entityId: 'light.primary', running: false, success: true, mode: 'sleep', message: '原灯渐暗完成' },
|
{ entityId: 'light.primary', running: false, success: true, mode: 'sleep', message: '原灯渐暗完成' },
|
||||||
@@ -316,6 +291,25 @@ test('a failed new-light fade is not reported as success merely because the orig
|
|||||||
env.dispose()
|
env.dispose()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('an inventory without configured scene lights clears the previous fade and stops light requests', async () => {
|
||||||
|
const primary = standardLight('light.primary'); primary.moduleKey = 'lighting'
|
||||||
|
let devices = [primary], lightReads = 0
|
||||||
|
const env = environment({
|
||||||
|
homeAssistantStatus: async () => ({ connected: true, devices }),
|
||||||
|
lightTransitionStatus: async () => { lightReads++; return { running: true, brightnessPercent: 50, mode: 'sleep' } },
|
||||||
|
})
|
||||||
|
const hook = env.load('composables/useDeviceControl').useDeviceControl()
|
||||||
|
await hook.loadStatus()
|
||||||
|
assert.equal(lightReads, 1)
|
||||||
|
assert.equal(env.intervals.size, 1)
|
||||||
|
devices = []
|
||||||
|
await hook.loadStatus()
|
||||||
|
assert.equal(lightReads, 1)
|
||||||
|
assert.equal(hook.lightTransition.value, undefined)
|
||||||
|
assert.equal(env.intervals.size, 0)
|
||||||
|
env.dispose()
|
||||||
|
})
|
||||||
|
|
||||||
test('standard light capabilities are per entity, not per category or another lamps configured parameters', () => {
|
test('standard light capabilities are per entity, not per category or another lamps configured parameters', () => {
|
||||||
const { lightCapabilities } = environment().load('devices/lighting/capabilities')
|
const { lightCapabilities } = environment().load('devices/lighting/capabilities')
|
||||||
const item = standardLight(), capability = lightCapabilities(item)
|
const item = standardLight(), capability = lightCapabilities(item)
|
||||||
@@ -479,7 +473,7 @@ test('overview distinguishes a known off state from unavailable data and never a
|
|||||||
assert.equal(deviceSummary(climate).canToggle, false)
|
assert.equal(deviceSummary(climate).canToggle, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('overview separates fragrance from its nightlight and only uses mattress readings belonging to that device', () => {
|
test('overview separates fragrance from its nightlight and does not infer retired mattress controls', () => {
|
||||||
const { deviceSummary } = environment().load('devices/deviceSummary')
|
const { deviceSummary } = environment().load('devices/deviceSummary')
|
||||||
const fragrance = device('fragrance', 'Fragrance', [entity('switch.fragrance', 'switch', 'off'), entity('light.night', 'light', 'on')],
|
const fragrance = device('fragrance', 'Fragrance', [entity('switch.fragrance', 'switch', 'off'), entity('light.night', 'light', 'on')],
|
||||||
{ primaryControlEntityId: 'switch.fragrance' })
|
{ primaryControlEntityId: 'switch.fragrance' })
|
||||||
@@ -488,7 +482,7 @@ test('overview separates fragrance from its nightlight and only uses mattress re
|
|||||||
const mattress = device('mattress', 'Sleep', [entity('select.massage', 'select', '全身')])
|
const mattress = device('mattress', 'Sleep', [entity('select.massage', 'select', '全身')])
|
||||||
assert.equal(deviceSummary(mattress).canToggle, false)
|
assert.equal(deviceSummary(mattress).canToggle, false)
|
||||||
assert.equal(deviceSummary(mattress, { controls: { mattress_massage_right_part: { ...control('全身'), entityId: 'foreign' } } }).statusText, '已连接')
|
assert.equal(deviceSummary(mattress, { controls: { mattress_massage_right_part: { ...control('全身'), entityId: 'foreign' } } }).statusText, '已连接')
|
||||||
assert.equal(deviceSummary(mattress, { controls: { mattress_massage_right_part: { ...control('全身'), entityId: 'select.massage' } } }).statusText, '右侧按摩中')
|
assert.equal(deviceSummary(mattress, { controls: { mattress_massage_right_part: { ...control('全身'), entityId: 'select.massage' } } }).statusText, '已连接')
|
||||||
assert.equal(deviceSummary(mattress, { controls: { mattress_massage_right_part: { ...control('unknown'), entityId: 'select.massage' } } }).statusText, '已连接')
|
assert.equal(deviceSummary(mattress, { controls: { mattress_massage_right_part: { ...control('unknown'), entityId: 'select.massage' } } }).statusText, '已连接')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ const { default: Overview } = await server.ssrLoadModule('/src/views/DeviceContr
|
|||||||
const { default: Detail } = await server.ssrLoadModule('/src/views/DeviceDetailView.vue')
|
const { default: Detail } = await server.ssrLoadModule('/src/views/DeviceDetailView.vue')
|
||||||
const { deviceControlKey } = await server.ssrLoadModule('/src/devices/controlContext.ts')
|
const { deviceControlKey } = await server.ssrLoadModule('/src/devices/controlContext.ts')
|
||||||
const { createDeviceParameterState, syncDeviceParameters } = await server.ssrLoadModule('/src/devices/parameterRegistry.ts')
|
const { createDeviceParameterState, syncDeviceParameters } = await server.ssrLoadModule('/src/devices/parameterRegistry.ts')
|
||||||
const mattressParams = await server.ssrLoadModule('/src/devices/mattress/parameters.ts')
|
|
||||||
const { deviceDetailLocation } = await server.ssrLoadModule('/src/devices/deviceKinds.ts')
|
const { deviceDetailLocation } = await server.ssrLoadModule('/src/devices/deviceKinds.ts')
|
||||||
const { parameterIsAvailable, parameterHasReading } = await server.ssrLoadModule('/src/devices/parameterState.ts')
|
const { parameterIsAvailable, parameterHasReading } = await server.ssrLoadModule('/src/devices/parameterState.ts')
|
||||||
const { primaryDeviceEntity, reportedPower } = await server.ssrLoadModule('/src/devices/deviceSummary.ts')
|
const { primaryDeviceEntity, reportedPower } = await server.ssrLoadModule('/src/devices/deviceSummary.ts')
|
||||||
@@ -31,7 +30,7 @@ const devices = [
|
|||||||
device('lamp', '演示卧室灯', 'lighting', 'Lighting', [reading('light.room', 'light', 'on', { brightness: 128,
|
device('lamp', '演示卧室灯', 'lighting', 'Lighting', [reading('light.room', 'light', 'on', { brightness: 128,
|
||||||
supported_color_modes: ['color_temp'], min_color_temp_kelvin: 2700, max_color_temp_kelvin: 6500,
|
supported_color_modes: ['color_temp'], min_color_temp_kelvin: 2700, max_color_temp_kelvin: 6500,
|
||||||
color_temp_kelvin: 3000, supported_features: 4, effect_list: ['阅读', '助眠'], effect: '阅读' })], { primaryControlEntityId: 'light.room' }),
|
color_temp_kelvin: 3000, supported_features: 4, effect_list: ['阅读', '助眠'], effect: '阅读' })], { primaryControlEntityId: 'light.room' }),
|
||||||
device('mattress', '演示智能床垫', 'mattress', 'Sleep'),
|
device('environment', '演示环境检测仪', 'environment', 'EnvironmentSensor'),
|
||||||
device('fragrance', '演示香氛机', 'fragrance', 'Fragrance', [reading('switch.fragrance', 'switch', 'off')], { primaryControlEntityId: 'switch.fragrance' }),
|
device('fragrance', '演示香氛机', 'fragrance', 'Fragrance', [reading('switch.fragrance', 'switch', 'off')], { primaryControlEntityId: 'switch.fragrance' }),
|
||||||
device('speaker', '演示音箱', 'audio', 'Media', [reading('media_player.room', 'media_player', 'idle', { volume_level: .7 })], { primaryControlEntityId: 'media_player.room' }),
|
device('speaker', '演示音箱', 'audio', 'Media', [reading('media_player.room', 'media_player', 'idle', { volume_level: .7 })], { primaryControlEntityId: 'media_player.room' }),
|
||||||
]
|
]
|
||||||
@@ -50,8 +49,7 @@ async function render(location = '/device-control', overrides = {}) {
|
|||||||
environment: { temperature: 25.6, humidity: 58.8 }, controlParameters: {} }),
|
environment: { temperature: 25.6, humidity: 58.8 }, controlParameters: {} }),
|
||||||
musicTransition: ref({ running: true, hasVolume: true, volumePercent: 46 }), lightTransition: ref(),
|
musicTransition: ref({ running: true, hasVolume: true, volumePercent: 46 }), lightTransition: ref(),
|
||||||
sceneRunning: ref(), switchingDeviceId: ref(), settingParam: ref(), actionFeedback: ref(), currentOperationText: ref(''), lastUpdatedAt: ref(''),
|
sceneRunning: ref(), switchingDeviceId: ref(), settingParam: ref(), actionFeedback: ref(), currentOperationText: ref(''), lastUpdatedAt: ref(''),
|
||||||
localParams: createDeviceParameterState(), mattressComfort: ref(), mattressActiveSide: ref('left'),
|
localParams: createDeviceParameterState(),
|
||||||
...mattressParams,
|
|
||||||
isDeviceTurnedOn: value => Boolean(reportedPower(primaryDeviceEntity(value))),
|
isDeviceTurnedOn: value => Boolean(reportedPower(primaryDeviceEntity(value))),
|
||||||
isDeviceControlAvailable: value => primaryDeviceEntity(value)?.domain === 'climate' ? climateCapabilities(value).canToggle
|
isDeviceControlAvailable: value => primaryDeviceEntity(value)?.domain === 'climate' ? climateCapabilities(value).canToggle
|
||||||
: Boolean(value?.online && reportedPower(primaryDeviceEntity(value)) !== null &&
|
: Boolean(value?.online && reportedPower(primaryDeviceEntity(value)) !== null &&
|
||||||
@@ -60,7 +58,7 @@ async function render(location = '/device-control', overrides = {}) {
|
|||||||
hasParameterReading: (parameter, value) => parameterHasReading(context.haStatus.value?.controlParameters, parameter, value),
|
hasParameterReading: (parameter, value) => parameterHasReading(context.haStatus.value?.controlParameters, parameter, value),
|
||||||
toggleDevice: unexpectedCommand, controlSpeaker: unexpectedCommand, applyParam: unexpectedCommand,
|
toggleDevice: unexpectedCommand, controlSpeaker: unexpectedCommand, applyParam: unexpectedCommand,
|
||||||
executeScene: unexpectedCommand, loadStatus: unexpectedCommand, controlLightTransition: unexpectedCommand,
|
executeScene: unexpectedCommand, loadStatus: unexpectedCommand, controlLightTransition: unexpectedCommand,
|
||||||
setMattressMode: unexpectedCommand, setMattressSelect: unexpectedCommand, ...overrides,
|
...overrides,
|
||||||
}
|
}
|
||||||
await router.push(location); await router.isReady()
|
await router.push(location); await router.isReady()
|
||||||
const app = createSSRApp({ render: () => h(RouterView) })
|
const app = createSSRApp({ render: () => h(RouterView) })
|
||||||
@@ -171,7 +169,7 @@ test('unbound devices in new categories remain generic and cannot borrow bound c
|
|||||||
test('overview has compact tiles and room tabs without detailed sliders or mattress controls', async () => {
|
test('overview has compact tiles and room tabs without detailed sliders or mattress controls', async () => {
|
||||||
const { html } = await render()
|
const { html } = await render()
|
||||||
assert.equal((html.match(/<article class="device-overview-tile/g) ?? []).length, 4)
|
assert.equal((html.match(/<article class="device-overview-tile/g) ?? []).length, 4)
|
||||||
for (const value of ['一键启动全屋舒睡模式', '一键关闭设备', '全屋', '睡眠空间', '音量 46%', '演示智能床垫']) assert.ok(html.includes(value), value)
|
for (const value of ['一键启动全屋舒睡模式', '一键关闭设备', '全屋', '睡眠空间', '音量 46%', '演示环境检测仪']) assert.ok(html.includes(value), value)
|
||||||
for (const value of ['左侧加热档位', '按摩力度', '灯光色温调节', 'van-slider']) assert.ok(!html.includes(value), value)
|
for (const value of ['左侧加热档位', '按摩力度', '灯光色温调节', 'van-slider']) assert.ok(!html.includes(value), value)
|
||||||
// 快捷开关与进入详情按钮是同级元素,不会发生嵌套按钮或点击开关误进详情。
|
// 快捷开关与进入详情按钮是同级元素,不会发生嵌套按钮或点击开关误进详情。
|
||||||
for (const tile of html.match(/<article class="device-overview-tile[\s\S]*?<\/article>/g) ?? []) {
|
for (const tile of html.match(/<article class="device-overview-tile[\s\S]*?<\/article>/g) ?? []) {
|
||||||
@@ -288,16 +286,15 @@ test('offline main light disables standard controls even when an auxiliary entit
|
|||||||
|
|
||||||
test('configured scene light composes shared controls with its own fade and wake extensions', async () => {
|
test('configured scene light composes shared controls with its own fade and wake extensions', async () => {
|
||||||
const { html } = await render('/device-control/lamp')
|
const { html } = await render('/device-control/lamp')
|
||||||
for (const text of ['灯光亮度', '灯光色温调节', '灯光模式', '开始助眠渐暗', '晨起唤醒', '灯灭停止按摩']) assert.ok(html.includes(text), text)
|
for (const text of ['灯光亮度', '灯光色温调节', '灯光模式', '开始助眠渐暗', '晨起唤醒']) assert.ok(html.includes(text), text)
|
||||||
assert.equal((html.match(/<section class="device-card"/g) ?? []).length, 1)
|
assert.equal((html.match(/<section class="device-card"/g) ?? []).length, 1)
|
||||||
assert.ok(!html.includes('不自动加入舒睡或唤醒场景'))
|
assert.ok(!html.includes('不自动加入舒睡或唤醒场景'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('mattress detail retains full controls and never renders other devices or scene-wide actions', async () => {
|
test('retired mattress detail link has no controls', async () => {
|
||||||
const { html } = await render('/device-control/mattress')
|
const { html } = await render('/device-control/mattress')
|
||||||
assert.equal((html.match(/<section class="device-card"/g) ?? []).length, 1)
|
assert.ok(html.includes('未找到这个设备'))
|
||||||
for (const value of ['演示智能床垫', '全部设备', '左侧加热档位', '右侧加热档位', '左侧承托模式', '右侧承托模式', '左肩软硬度', '右腿软硬度', '左侧按摩部位', '右侧按摩部位', '按摩力度']) assert.ok(html.includes(value), value)
|
for (const value of ['左侧加热档位', '按摩力度', '左肩软硬度']) assert.ok(!html.includes(value), value)
|
||||||
for (const value of ['演示卧室灯', '演示香氛机', '一键启动全屋舒睡模式', 'device-overview-tile']) assert.ok(!html.includes(value), value)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('fragrance detail retains separate nightlight and unavailable quick-release feedback', async () => {
|
test('fragrance detail retains separate nightlight and unavailable quick-release feedback', async () => {
|
||||||
@@ -306,6 +303,30 @@ test('fragrance detail retains separate nightlight and unavailable quick-release
|
|||||||
assert.ok(!html.includes('演示智能床垫'))
|
assert.ok(!html.includes('演示智能床垫'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('wake and sleep fragrance details share controls and show their own readings', async () => {
|
||||||
|
const sleepDuration = reading('number.sleep_duration', 'number', '3')
|
||||||
|
const wakeDuration = reading('number.wake_duration', 'number', '5')
|
||||||
|
const wakeButton = reading('button.wake_release', 'button', 'unknown')
|
||||||
|
const sleep = { ...devices[2], entities: [...devices[2].entities, sleepDuration] }
|
||||||
|
const wake = device('wake', '香氛机 唤醒', 'wake-fragrance', 'Fragrance',
|
||||||
|
[reading('switch.wake', 'switch', 'on'), wakeDuration, wakeButton], { primaryControlEntityId: 'switch.wake' })
|
||||||
|
const haStatus = ref({ connected: true, devices: [sleep, wake], controlParameters: {
|
||||||
|
fragrance_duration: sleepDuration, wake_fragrance_duration: wakeDuration, wake_fragrance_quick_release: wakeButton,
|
||||||
|
} })
|
||||||
|
const sleepHtml = (await render('/device-control/fragrance', { haStatus })).html
|
||||||
|
const wakeHtml = (await render('/device-control/wake', { haStatus })).html
|
||||||
|
for (const label of ['单次出香时长', '自动出香间隔', '香薰氛围灯', '人来增香', '感应夜灯', '无人时自动关灯', '立即出香']) {
|
||||||
|
assert.ok(sleepHtml.includes(label), label)
|
||||||
|
assert.ok(wakeHtml.includes(label), label)
|
||||||
|
}
|
||||||
|
assert.match(sleepHtml, />3 秒</)
|
||||||
|
assert.doesNotMatch(sleepHtml, />5 秒</)
|
||||||
|
assert.match(wakeHtml, />5 秒</)
|
||||||
|
assert.doesNotMatch(wakeHtml, />3 秒</)
|
||||||
|
assert.match(wakeHtml, /快速出香/)
|
||||||
|
assert.doesNotMatch(wakeHtml, /查看全部能力/)
|
||||||
|
})
|
||||||
|
|
||||||
test('each registered device detail renders its own parameters without requesting the network', async () => {
|
test('each registered device detail renders its own parameters without requesting the network', async () => {
|
||||||
const cases = [
|
const cases = [
|
||||||
[devices[0], ['灯光亮度', '灯光色温调节']],
|
[devices[0], ['灯光亮度', '灯光色温调节']],
|
||||||
@@ -330,13 +351,13 @@ test('missing, offline and disconnected devices display honest explanatory state
|
|||||||
assert.ok((await render('/device-control/removed')).html.includes('未找到这个设备'))
|
assert.ok((await render('/device-control/removed')).html.includes('未找到这个设备'))
|
||||||
const offline = { ...devices[1], online: false }
|
const offline = { ...devices[1], online: false }
|
||||||
const snapshot = { connected: true, devices: [offline], summary: { totalDevices: 1, onlineDevices: 0 } }
|
const snapshot = { connected: true, devices: [offline], summary: { totalDevices: 1, onlineDevices: 0 } }
|
||||||
const { html } = await render('/device-control/mattress', { haStatus: ref(snapshot) })
|
const { html } = await render('/device-control/environment', { haStatus: ref(snapshot) })
|
||||||
assert.ok(html.includes('设备回读显示离线'))
|
assert.ok(html.includes('设备回读显示离线'))
|
||||||
assert.ok(html.includes('右侧按摩部位'))
|
assert.ok(html.includes('温度'))
|
||||||
const disconnected = await render('/device-control/mattress', { haStatus: ref({ ...snapshot, connected: false, message: '连接失败' }) })
|
const disconnected = await render('/device-control/environment', { haStatus: ref({ ...snapshot, connected: false, message: '连接失败' }) })
|
||||||
assert.ok(disconnected.html.includes('暂时无法读取设备'))
|
assert.ok(disconnected.html.includes('暂时无法读取设备'))
|
||||||
assert.ok(!disconnected.html.includes('未找到这个设备'))
|
assert.ok(!disconnected.html.includes('未找到这个设备'))
|
||||||
const loading = await render('/device-control/mattress', { haStatus: ref(), loading: ref(true) })
|
const loading = await render('/device-control/environment', { haStatus: ref(), loading: ref(true) })
|
||||||
assert.ok(loading.html.includes('正在读取设备详情'))
|
assert.ok(loading.html.includes('正在读取设备详情'))
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -350,7 +371,7 @@ test('detail route safely round-trips unusual device IDs; unfinished constitutio
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('offline parameter details disable controls and do not present default values as current readings', async () => {
|
test('offline parameter details disable controls and do not present default values as current readings', async () => {
|
||||||
for (const item of [devices[0], devices[1], devices[2]]) {
|
for (const item of [devices[0], devices[2]]) {
|
||||||
const snapshot = { connected: true, devices: [{ ...item, online: false }], controlParameters: {} }
|
const snapshot = { connected: true, devices: [{ ...item, online: false }], controlParameters: {} }
|
||||||
const { html } = await render(deviceDetailLocation(item.deviceId), { haStatus: ref(snapshot) })
|
const { html } = await render(deviceDetailLocation(item.deviceId), { haStatus: ref(snapshot) })
|
||||||
const card = html.match(/<section class="device-card"[\s\S]*?<\/section>/)?.[0]
|
const card = html.match(/<section class="device-card"[\s\S]*?<\/section>/)?.[0]
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 496 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 329 KiB |
@@ -109,14 +109,14 @@ function navigate(target: string) {
|
|||||||
background: rgba(255, 255, 255, 0.98);
|
background: rgba(255, 255, 255, 0.98);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
-webkit-backdrop-filter: blur(12px);
|
-webkit-backdrop-filter: blur(12px);
|
||||||
border-top: 1px solid rgba(18, 63, 55, 0.08);
|
border-top: 1px solid #eef2f6;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
padding-bottom: env(safe-area-inset-bottom, 0px);
|
padding-bottom: env(safe-area-inset-bottom, 0px);
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
box-shadow: 0 -4px 16px rgba(18, 63, 55, 0.04);
|
box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-item {
|
.tab-item {
|
||||||
@@ -129,7 +129,7 @@ function navigate(target: string) {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 44px;
|
height: 44px;
|
||||||
color: #7d8e87;
|
color: #94a3b8;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: color 0.2s ease;
|
transition: color 0.2s ease;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
@@ -152,7 +152,7 @@ function navigate(target: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tab-item.active {
|
.tab-item.active {
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-item.active .tab-label {
|
.tab-item.active .tab-label {
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
|
import { usePageRequest } from '../composables/usePageRequest'
|
||||||
|
import { formatIb43Time, ib43Api, type Ib43Automation, type Ib43AutomationRecord, type Ib43AutomationRule } from '../services/ib43'
|
||||||
|
|
||||||
|
const props = defineProps<{ bindingId: string }>()
|
||||||
|
const status = ref<Ib43Automation>()
|
||||||
|
const loading = ref(false)
|
||||||
|
const updatingKey = ref<string | null>(null)
|
||||||
|
const updating = computed(() => updatingKey.value !== null)
|
||||||
|
const loadError = ref('')
|
||||||
|
const actionError = ref('')
|
||||||
|
const requests = usePageRequest()
|
||||||
|
let timer: ReturnType<typeof setInterval>
|
||||||
|
|
||||||
|
const rules = computed<Ib43AutomationRule[]>(() => {
|
||||||
|
if (!status.value) return []
|
||||||
|
if (status.value.rules) return status.value.rules
|
||||||
|
const { available, enabled, actionLabel, targetLabel } = status.value
|
||||||
|
return available ? [{ actionKey: '', enabled, actionLabel, targetLabel, previewOnly: false }] : []
|
||||||
|
})
|
||||||
|
|
||||||
|
const resultLabels: Record<string, string> = {
|
||||||
|
pending: '尚未记录结果',
|
||||||
|
'readback-confirmed': '已回读确认',
|
||||||
|
'already-closed': '窗帘已关闭,跳过',
|
||||||
|
'already-closing': '窗帘正在关闭,跳过',
|
||||||
|
'already-running': '动作已在运行,跳过',
|
||||||
|
'state-not-open': '当前状态不适合关帘,跳过',
|
||||||
|
'sent-readback-unconfirmed': '已发出指令,回读未确认',
|
||||||
|
'target-not-configured': '目标设备未配置',
|
||||||
|
'cancelled-unconfirmed': '已取消或超时,结果未确认',
|
||||||
|
'failed-unconfirmed': '动作未确认',
|
||||||
|
expired: '事件已过期,跳过',
|
||||||
|
'preview-would-start': '预演通过,计划开启除湿机',
|
||||||
|
'preview-humidity-normal': '预演跳过,湿度未超过阈值',
|
||||||
|
'preview-humidity-unavailable': '预演跳过,湿度读数缺失或不可用',
|
||||||
|
'preview-humidity-stale': '预演跳过,湿度读数过期或时间无效',
|
||||||
|
'preview-humidity-invalid': '预演跳过,湿度读数或单位无效',
|
||||||
|
'humidity-normal': '湿度未超过阈值,跳过',
|
||||||
|
'humidity-unavailable': '湿度读数缺失或不可用,跳过',
|
||||||
|
'humidity-stale': '湿度读数过期或时间无效,跳过',
|
||||||
|
'humidity-invalid': '湿度读数或单位无效,跳过',
|
||||||
|
'dehumidifier-unavailable': '除湿机不可用,跳过',
|
||||||
|
'dehumidifier-already-on': '除湿机已开启,跳过',
|
||||||
|
'dehumidifier-state-not-off': '无法确认除湿机已关机,跳过',
|
||||||
|
'preview-climate-cool': '预演通过,计划制冷',
|
||||||
|
'preview-climate-heat': '预演通过,计划制热',
|
||||||
|
'preview-temperature-within-range': '预演跳过,室温在设定区间内',
|
||||||
|
'preview-temperature-unavailable': '预演跳过,室温读数缺失或不可用',
|
||||||
|
'preview-temperature-stale': '预演跳过,室温读数过期或时间无效',
|
||||||
|
'preview-temperature-invalid': '预演跳过,室温读数或单位无效',
|
||||||
|
'temperature-not-low': '室温未低于 22℃,跳过',
|
||||||
|
'temperature-unavailable': '室温读数缺失或不可用,跳过',
|
||||||
|
'temperature-stale': '室温读数过期或时间无效,跳过',
|
||||||
|
'temperature-invalid': '室温读数或单位无效,跳过',
|
||||||
|
'climate-unavailable': '空调不可用,跳过',
|
||||||
|
'climate-not-off': '空调当前未关机,跳过',
|
||||||
|
'climate-heat-unsupported': '空调不支持制热或 22℃ 目标温度,跳过',
|
||||||
|
'climate-heat-mode-unconfirmed': '已发出制热指令,未确认制热模式',
|
||||||
|
'climate-heat-state-changed': '制热状态已改变或不可用,跳过设温',
|
||||||
|
'climate-heat-target-unconfirmed': '已确认制热,未确认维持制热并设为 22℃',
|
||||||
|
'fragrance-release-sent': '已发送一次快速出香指令',
|
||||||
|
'fragrance-release-unavailable': '快速出香按钮不可用,跳过',
|
||||||
|
'speaker-music-not-configured': '舒睡曲目或音箱网关未配置,跳过',
|
||||||
|
'speaker-state-unavailable': '音箱状态不可用,跳过',
|
||||||
|
'speaker-not-idle': '音箱当前非空闲,跳过',
|
||||||
|
'speaker-playback-sent': '已发送舒睡音乐播放指令',
|
||||||
|
}
|
||||||
|
|
||||||
|
function resultLabel(row: Ib43AutomationRecord) {
|
||||||
|
if (row.actionKey === 'curtain-close' && row.result === 'readback-confirmed') return '已确认关闭'
|
||||||
|
if (row.actionKey === 'curtain-close' && row.result === 'sent-readback-unconfirmed') return '已发出关帘指令,未确认关闭'
|
||||||
|
if (row.actionKey === 'dehumidifier-humidity-start' && row.result === 'readback-confirmed') return '已确认开启'
|
||||||
|
if (row.actionKey === 'dehumidifier-humidity-start' && row.result === 'sent-readback-unconfirmed') return '已发出开机指令,未确认开启'
|
||||||
|
if (row.actionKey === 'climate-heat-start' && row.result === 'readback-confirmed') return '已确认制热至 22℃'
|
||||||
|
return resultLabels[row.result] || '结果未知'
|
||||||
|
}
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
if (updating.value || loading.value) return
|
||||||
|
const request = requests.begin()
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const result = await ib43Api.automation(props.bindingId)
|
||||||
|
if (!requests.isCurrent(request)) return
|
||||||
|
status.value = result
|
||||||
|
loadError.value = ''
|
||||||
|
} catch (error) {
|
||||||
|
if (requests.isCurrent(request)) loadError.value = error instanceof Error ? error.message : '暂时无法读取联动状态'
|
||||||
|
} finally {
|
||||||
|
if (requests.isCurrent(request)) loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggle(rule: Ib43AutomationRule) {
|
||||||
|
const enabled = !rule.enabled
|
||||||
|
if (!status.value || updating.value || (enabled && loadError.value)) return
|
||||||
|
const request = requests.begin()
|
||||||
|
updatingKey.value = rule.actionKey
|
||||||
|
loading.value = false
|
||||||
|
actionError.value = ''
|
||||||
|
try {
|
||||||
|
if (enabled) await ib43Api.startAutomation(props.bindingId, rule.actionKey || undefined)
|
||||||
|
else await ib43Api.stopAutomation(props.bindingId, rule.actionKey || undefined)
|
||||||
|
if (!requests.isCurrent(request)) return
|
||||||
|
const previous = status.value
|
||||||
|
status.value = previous.rules
|
||||||
|
? { ...previous, rules: previous.rules.map(item => item.actionKey === rule.actionKey ? { ...item, enabled } : item) }
|
||||||
|
: { ...previous, enabled }
|
||||||
|
} catch (error) {
|
||||||
|
if (requests.isCurrent(request)) actionError.value = error instanceof Error ? error.message : '更新联动状态失败'
|
||||||
|
} finally {
|
||||||
|
if (requests.isCurrent(request)) {
|
||||||
|
updatingKey.value = null
|
||||||
|
void load()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void load()
|
||||||
|
timer = setInterval(() => {
|
||||||
|
if (!document.hidden && (rules.value.some(rule => rule.enabled) || status.value?.records.some(row =>
|
||||||
|
row.result === 'pending' && Date.now() - Number(row.triggeredAtMs) < 90000))) void load()
|
||||||
|
}, 5000)
|
||||||
|
})
|
||||||
|
onUnmounted(() => clearInterval(timer))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="section-card automation-card" aria-labelledby="ib43-automation-title">
|
||||||
|
<div class="automation-heading">
|
||||||
|
<h2 id="ib43-automation-title">家具联动</h2>
|
||||||
|
<button class="automation-button" type="button" :disabled="loading || updating" @click="load">刷新记录</button>
|
||||||
|
</div>
|
||||||
|
<p v-if="!status && loading" class="automation-muted" role="status">正在读取联动状态…</p>
|
||||||
|
<p v-if="loadError" class="automation-error" role="alert">{{ loadError }}</p>
|
||||||
|
<template v-if="status">
|
||||||
|
<p v-if="!rules.length" class="automation-muted">该床位当前未启用可管理的家具规则。</p>
|
||||||
|
<div v-for="rule in rules" :key="rule.actionKey" class="automation-rule">
|
||||||
|
<div class="automation-heading">
|
||||||
|
<strong>上床后{{ rule.actionLabel }}{{ rule.previewOnly ? '(预演)' : '' }}</strong>
|
||||||
|
<span class="automation-state" :class="{ enabled: rule.enabled }">{{ rule.enabled ? '已开启' : '已停止' }}</span>
|
||||||
|
</div>
|
||||||
|
<p v-if="rule.previewOnly">预演只读取数据并记录结果。{{ rule.conditionLabel }}</p>
|
||||||
|
<p v-else-if="rule.conditionLabel">{{ rule.conditionLabel }}</p>
|
||||||
|
<p v-else>模拟床位从离床变为在床时,对{{ rule.targetLabel }}执行此动作。</p>
|
||||||
|
<button class="automation-button" :class="{ primary: !rule.enabled }" type="button"
|
||||||
|
:disabled="updating || (!rule.enabled && !!loadError)" @click="toggle(rule)">
|
||||||
|
{{ updatingKey === rule.actionKey ? '正在更新…' : rule.previewOnly
|
||||||
|
? (rule.enabled ? '停止预演' : '开启预演') : (rule.enabled ? '停止联动' : '开启联动') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p v-if="actionError" class="automation-error" role="alert">{{ actionError }}</p>
|
||||||
|
<h3>最近执行记录</h3>
|
||||||
|
<p v-if="status.records.length === 0" class="automation-muted">暂无执行记录。</p>
|
||||||
|
<ol v-else class="automation-records">
|
||||||
|
<li v-for="row in status.records" :key="row.id">
|
||||||
|
<span>{{ row.targetLabel }} · {{ resultLabel(row) }}</span>
|
||||||
|
<time>{{ formatIb43Time(row.triggeredAtMs) }}</time>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</template>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.automation-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
|
||||||
|
h2 { margin: 0; font-size: 17px; }
|
||||||
|
h3 { margin: 16px 0 8px; font-size: 14px; }
|
||||||
|
.automation-button { min-height: 44px; border: 1px solid #bae6fd; border-radius: 12px; background: #f0f9ff; color: #0284c7; padding: 8px 12px; font: inherit; font-size: 13px; }
|
||||||
|
.automation-button.primary { color: #fff; background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%); border-color: transparent; box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25); }
|
||||||
|
.automation-button:disabled { opacity: .55; }
|
||||||
|
.automation-rule { margin-top: 12px; padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 13px; }
|
||||||
|
.automation-rule p, .automation-muted, .automation-records time { color: var(--muted-text); font-size: 13px; }
|
||||||
|
.automation-state { flex-shrink: 0; border-radius: 8px; padding: 4px 8px; background: #f1f5f9; color: #64748b; font-size: 12px; }
|
||||||
|
.automation-state.enabled { background: #f0f9ff; color: #0284c7; }
|
||||||
|
.automation-error { color: #8b432f; font-size: 13px; overflow-wrap: anywhere; }
|
||||||
|
.automation-records { list-style: none; padding: 0; margin: 0; }
|
||||||
|
.automation-records li { display: grid; gap: 5px; border-top: 1px solid #e2e8f0; padding: 10px 0; font-size: 14px; overflow-wrap: anywhere; }
|
||||||
|
</style>
|
||||||
@@ -1,20 +1,47 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { toRefs } from 'vue'
|
import { reactive, toRefs, watchEffect } from 'vue'
|
||||||
import { Button as VanButton, Slider as VanSlider } from 'vant'
|
import { Button as VanButton, Slider as VanSlider } from 'vant'
|
||||||
import type { HomeAssistantDiscoveredDevice } from '../../services/health'
|
import type { HomeAssistantDiscoveredDevice } from '../../services/health'
|
||||||
import { useDeviceControlContext } from '../../devices/controlContext'
|
import { useDeviceControlContext } from '../../devices/controlContext'
|
||||||
import { useDeviceCardState } from '../../devices/useDeviceCardState'
|
import { useDeviceCardState } from '../../devices/useDeviceCardState'
|
||||||
|
import { defaults, labels, sync } from '../../devices/fragrance/parameters'
|
||||||
|
import type { ParameterSnapshot } from '../../devices/parameterState'
|
||||||
const props = defineProps<{ device: HomeAssistantDiscoveredDevice }>()
|
const props = defineProps<{ device: HomeAssistantDiscoveredDevice }>()
|
||||||
const { device: fragranceDevice } = toRefs(props)
|
const { device: fragranceDevice } = toRefs(props)
|
||||||
const { localParams, operationBusy, switchingDeviceId, isDeviceTurnedOn, toggleDevice, applyParam, settingParam } = useDeviceControlContext()
|
const { haStatus, operationBusy, switchingDeviceId, isDeviceTurnedOn, toggleDevice,
|
||||||
const state = useDeviceCardState(() => props.device)
|
applyParam: setParameter, settingParam } = useDeviceControlContext()
|
||||||
|
const localParams = reactive({ ...defaults })
|
||||||
|
const parameterKey = (key: string) => props.device.moduleKey === 'wake-fragrance' ? `wake_${key}` : key
|
||||||
|
const card = useDeviceCardState(() => props.device)
|
||||||
|
const state = {
|
||||||
|
...card,
|
||||||
|
available: (key: string) => card.available(parameterKey(key)),
|
||||||
|
readable: (key: string) => card.readable(parameterKey(key)),
|
||||||
|
display: (key: string, value: unknown, suffix = '') => card.display(parameterKey(key), value, suffix),
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncReadings() {
|
||||||
|
const controls: ParameterSnapshot = {}
|
||||||
|
for (const key of Object.keys(labels)) {
|
||||||
|
const reading = haStatus.value?.controlParameters?.[parameterKey(key)]
|
||||||
|
if (reading && state.available(key)) controls[key] = reading
|
||||||
|
}
|
||||||
|
Object.assign(localParams, defaults)
|
||||||
|
sync(localParams, controls)
|
||||||
|
}
|
||||||
|
watchEffect(syncReadings)
|
||||||
|
|
||||||
|
async function applyParam(key: string, value: unknown) {
|
||||||
|
await setParameter(props.device.deviceId, parameterKey(key), value)
|
||||||
|
syncReadings()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="device-card" v-if="fragranceDevice">
|
<section class="device-card" v-if="fragranceDevice">
|
||||||
<div class="device-head">
|
<div class="device-head">
|
||||||
<div class="dev-info">
|
<div class="dev-info">
|
||||||
<span class="category-tag">香氛助眠</span>
|
<span class="category-tag">香氛控制</span>
|
||||||
<h3>{{ fragranceDevice.name }}</h3>
|
<h3>{{ fragranceDevice.name }}</h3>
|
||||||
<span class="status-dot" :class="{ online: fragranceDevice.online }">
|
<span class="status-dot" :class="{ online: fragranceDevice.online }">
|
||||||
{{ fragranceDevice.online ? '设备在线' : '设备离线' }}
|
{{ fragranceDevice.online ? '设备在线' : '设备离线' }}
|
||||||
@@ -47,7 +74,7 @@ const state = useDeviceCardState(() => props.device)
|
|||||||
:max="6"
|
:max="6"
|
||||||
:step="1"
|
:step="1"
|
||||||
:disabled="operationBusy || !state.available('fragrance_duration')"
|
:disabled="operationBusy || !state.available('fragrance_duration')"
|
||||||
@change="applyParam(fragranceDevice.deviceId, 'fragrance_duration', localParams.fragranceDuration)"
|
@change="applyParam('fragrance_duration', localParams.fragranceDuration)"
|
||||||
/>
|
/>
|
||||||
<div class="range-labels"><span>2 秒</span><span>4 秒</span><span>6 秒</span></div>
|
<div class="range-labels"><span>2 秒</span><span>4 秒</span><span>6 秒</span></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -63,7 +90,7 @@ const state = useDeviceCardState(() => props.device)
|
|||||||
:max="20"
|
:max="20"
|
||||||
:step="5"
|
:step="5"
|
||||||
:disabled="operationBusy || !state.available('fragrance_interval')"
|
:disabled="operationBusy || !state.available('fragrance_interval')"
|
||||||
@change="applyParam(fragranceDevice.deviceId, 'fragrance_interval', localParams.fragranceInterval)"
|
@change="applyParam('fragrance_interval', localParams.fragranceInterval)"
|
||||||
/>
|
/>
|
||||||
<div class="range-labels"><span>10 分钟</span><span>15 分钟</span><span>20 分钟</span></div>
|
<div class="range-labels"><span>10 分钟</span><span>15 分钟</span><span>20 分钟</span></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -77,7 +104,7 @@ const state = useDeviceCardState(() => props.device)
|
|||||||
class="mini-toggle"
|
class="mini-toggle"
|
||||||
:class="{ active: state.readable('fragrance_light') && localParams.fragranceLight }"
|
:class="{ active: state.readable('fragrance_light') && localParams.fragranceLight }"
|
||||||
:disabled="operationBusy || !state.available('fragrance_light')"
|
:disabled="operationBusy || !state.available('fragrance_light')"
|
||||||
@click="localParams.fragranceLight = !localParams.fragranceLight; applyParam(fragranceDevice.deviceId, 'fragrance_light', localParams.fragranceLight)"
|
@click="applyParam('fragrance_light', !localParams.fragranceLight)"
|
||||||
>{{ state.display('fragrance_light', localParams.fragranceLight ? '已开启' : '已关闭') }}</button>
|
>{{ state.display('fragrance_light', localParams.fragranceLight ? '已开启' : '已关闭') }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -90,7 +117,7 @@ const state = useDeviceCardState(() => props.device)
|
|||||||
class="mini-toggle"
|
class="mini-toggle"
|
||||||
:class="{ active: state.readable('fragrance_auto_release') && localParams.fragranceAutoRelease }"
|
:class="{ active: state.readable('fragrance_auto_release') && localParams.fragranceAutoRelease }"
|
||||||
:disabled="operationBusy || !state.available('fragrance_auto_release')"
|
:disabled="operationBusy || !state.available('fragrance_auto_release')"
|
||||||
@click="localParams.fragranceAutoRelease = !localParams.fragranceAutoRelease; applyParam(fragranceDevice.deviceId, 'fragrance_auto_release', localParams.fragranceAutoRelease)"
|
@click="applyParam('fragrance_auto_release', !localParams.fragranceAutoRelease)"
|
||||||
>{{ state.display('fragrance_auto_release', localParams.fragranceAutoRelease ? '已开启' : '已关闭') }}</button>
|
>{{ state.display('fragrance_auto_release', localParams.fragranceAutoRelease ? '已开启' : '已关闭') }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -103,7 +130,7 @@ const state = useDeviceCardState(() => props.device)
|
|||||||
class="mini-toggle"
|
class="mini-toggle"
|
||||||
:class="{ active: state.readable('fragrance_auto_light') && localParams.fragranceAutoLight }"
|
:class="{ active: state.readable('fragrance_auto_light') && localParams.fragranceAutoLight }"
|
||||||
:disabled="operationBusy || !state.available('fragrance_auto_light')"
|
:disabled="operationBusy || !state.available('fragrance_auto_light')"
|
||||||
@click="localParams.fragranceAutoLight = !localParams.fragranceAutoLight; applyParam(fragranceDevice.deviceId, 'fragrance_auto_light', localParams.fragranceAutoLight)"
|
@click="applyParam('fragrance_auto_light', !localParams.fragranceAutoLight)"
|
||||||
>{{ state.display('fragrance_auto_light', localParams.fragranceAutoLight ? '已开启' : '已关闭') }}</button>
|
>{{ state.display('fragrance_auto_light', localParams.fragranceAutoLight ? '已开启' : '已关闭') }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -116,7 +143,7 @@ const state = useDeviceCardState(() => props.device)
|
|||||||
class="mini-toggle"
|
class="mini-toggle"
|
||||||
:class="{ active: state.readable('fragrance_light_auto_off') && localParams.fragranceLightAutoOff }"
|
:class="{ active: state.readable('fragrance_light_auto_off') && localParams.fragranceLightAutoOff }"
|
||||||
:disabled="operationBusy || !state.available('fragrance_light_auto_off')"
|
:disabled="operationBusy || !state.available('fragrance_light_auto_off')"
|
||||||
@click="localParams.fragranceLightAutoOff = !localParams.fragranceLightAutoOff; applyParam(fragranceDevice.deviceId, 'fragrance_light_auto_off', localParams.fragranceLightAutoOff)"
|
@click="applyParam('fragrance_light_auto_off', !localParams.fragranceLightAutoOff)"
|
||||||
>{{ state.display('fragrance_light_auto_off', localParams.fragranceLightAutoOff ? '已开启' : '已关闭') }}</button>
|
>{{ state.display('fragrance_light_auto_off', localParams.fragranceLightAutoOff ? '已开启' : '已关闭') }}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -130,9 +157,9 @@ const state = useDeviceCardState(() => props.device)
|
|||||||
round
|
round
|
||||||
plain
|
plain
|
||||||
color="#0c5045"
|
color="#0c5045"
|
||||||
:loading="settingParam === `${fragranceDevice.deviceId}_fragrance_quick_release`"
|
:loading="settingParam === `${fragranceDevice.deviceId}_${parameterKey('fragrance_quick_release')}`"
|
||||||
:disabled="operationBusy || !state.available('fragrance_quick_release')"
|
:disabled="operationBusy || !state.available('fragrance_quick_release')"
|
||||||
@click="applyParam(fragranceDevice.deviceId, 'fragrance_quick_release', true)"
|
@click="applyParam('fragrance_quick_release', true)"
|
||||||
>{{ state.available('fragrance_quick_release') ? '快速出香' : '暂不可用' }}</VanButton>
|
>{{ state.available('fragrance_quick_release') ? '快速出香' : '暂不可用' }}</VanButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const transition = computed(() => lightTransitionForDevice(props.device, lightTr
|
|||||||
<template>
|
<template>
|
||||||
<StandardLightCard :device="device" category-label="卧室灯光"
|
<StandardLightCard :device="device" category-label="卧室灯光"
|
||||||
:reported-brightness="transition?.running ? transition.brightnessPercent : undefined"
|
:reported-brightness="transition?.running ? transition.brightnessPercent : undefined"
|
||||||
note="手动调节会停止当前渐变;本灯保留助眠、唤醒及灯灭停止按摩的专属联动。">
|
note="手动调节会停止当前渐变;本灯支持助眠渐暗和晨起唤醒。">
|
||||||
<template #before-controls>
|
<template #before-controls>
|
||||||
<div class="light-mode-panel">
|
<div class="light-mode-panel">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,155 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { toRefs } from 'vue'
|
|
||||||
import { Slider as VanSlider } from 'vant'
|
|
||||||
import type { HomeAssistantDiscoveredDevice } from '../../services/health'
|
|
||||||
import { useDeviceControlContext } from '../../devices/controlContext'
|
|
||||||
import { useDeviceCardState } from '../../devices/useDeviceCardState'
|
|
||||||
const props = defineProps<{ device: HomeAssistantDiscoveredDevice }>()
|
|
||||||
const { device: mattressDevice } = toRefs(props)
|
|
||||||
const { localParams, operationBusy, applyParam, mattressComfort, mattressActiveSide, mattressModeOptions, setMattressMode, setMattressSelect, mattressFirmnessOptions, mattressFirmnessZones, massagePartOptions } = useDeviceControlContext()
|
|
||||||
const state = useDeviceCardState(() => props.device)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<section class="device-card" v-if="mattressDevice">
|
|
||||||
<div class="device-head">
|
|
||||||
<div class="dev-info">
|
|
||||||
<span class="category-tag">智能承托与温控</span>
|
|
||||||
<h3>{{ mattressDevice.name }}</h3>
|
|
||||||
<span class="status-dot" :class="{ online: mattressDevice.online }">
|
|
||||||
{{ mattressDevice.online ? '设备在线' : '设备离线' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="params-body">
|
|
||||||
<div class="mattress-recommendation">
|
|
||||||
<strong>室内温度与 BMI 床垫建议</strong>
|
|
||||||
<p>{{ mattressComfort?.heatingReason || '室温建议读取中' }}</p>
|
|
||||||
<p>{{ mattressComfort?.firmnessReason || 'BMI 建议读取中' }}</p>
|
|
||||||
<small v-if="mattressComfort?.indoorTemperatureAvailable">
|
|
||||||
当前室温 {{ mattressComfort.indoorTemperatureCelsius }}℃
|
|
||||||
</small>
|
|
||||||
<small>下次一键启动使用当前建议;下面显示设备读数,可手动覆盖。</small>
|
|
||||||
</div>
|
|
||||||
<!-- 左侧加热档位 -->
|
|
||||||
<div class="param-row">
|
|
||||||
<div class="param-header">
|
|
||||||
<span class="p-title">左侧加热档位</span>
|
|
||||||
<strong class="p-val">{{ state.display('mattress_left_heating', localParams.mattressLeftHeating, ' 档') }}</strong>
|
|
||||||
</div>
|
|
||||||
<VanSlider
|
|
||||||
v-model="localParams.mattressLeftHeating"
|
|
||||||
:min="0"
|
|
||||||
:max="4"
|
|
||||||
:step="1"
|
|
||||||
:disabled="operationBusy || !state.available('mattress_left_heating')"
|
|
||||||
active-color="#d66927"
|
|
||||||
@change="applyParam(mattressDevice.deviceId, 'mattress_left_heating', localParams.mattressLeftHeating)"
|
|
||||||
/>
|
|
||||||
<div class="slider-scale">
|
|
||||||
<span>0 关闭</span>
|
|
||||||
<span>2 舒适</span>
|
|
||||||
<span>4 强加热</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 右侧加热档位 -->
|
|
||||||
<div class="param-row">
|
|
||||||
<div class="param-header">
|
|
||||||
<span class="p-title">右侧加热档位</span>
|
|
||||||
<strong class="p-val">{{ state.display('mattress_right_heating', localParams.mattressRightHeating, ' 档') }}</strong>
|
|
||||||
</div>
|
|
||||||
<VanSlider
|
|
||||||
v-model="localParams.mattressRightHeating"
|
|
||||||
:min="0"
|
|
||||||
:max="4"
|
|
||||||
:step="1"
|
|
||||||
:disabled="operationBusy || !state.available('mattress_right_heating')"
|
|
||||||
active-color="#d66927"
|
|
||||||
@change="applyParam(mattressDevice.deviceId, 'mattress_right_heating', localParams.mattressRightHeating)"
|
|
||||||
/>
|
|
||||||
<div class="slider-scale">
|
|
||||||
<span>0 关闭</span>
|
|
||||||
<span>2 舒适</span>
|
|
||||||
<span>4 强加热</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="param-row">
|
|
||||||
<p class="mattress-mode-note">
|
|
||||||
左右可分别预选模式,但共用气泵,同一时间仅最近启动的一侧实际运行;另一侧保留预选,处于待机状态。
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="param-row">
|
|
||||||
<span class="p-title">左侧承托模式 · {{ !state.readable('mattress_left_mode') ? '状态未确认(保留预选)' : mattressActiveSide === 'left' ? '运行中' : '预选待机' }}</span>
|
|
||||||
<div class="btn-group mattress-mode-buttons">
|
|
||||||
<button
|
|
||||||
v-for="mode in mattressModeOptions"
|
|
||||||
:key="`left-${mode}`"
|
|
||||||
:class="{ active: localParams.mattressLeftMode === mode, running: state.readable('mattress_left_mode') && mattressActiveSide === 'left' && localParams.mattressLeftMode === mode }"
|
|
||||||
:disabled="operationBusy || !state.available('mattress_left_mode')"
|
|
||||||
@click="setMattressMode('left', mode)"
|
|
||||||
>{{ mode }}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="param-row">
|
|
||||||
<span class="p-title">右侧承托模式 · {{ !state.readable('mattress_right_mode') ? '状态未确认(保留预选)' : mattressActiveSide === 'right' ? '运行中' : '预选待机' }}</span>
|
|
||||||
<div class="btn-group mattress-mode-buttons">
|
|
||||||
<button
|
|
||||||
v-for="mode in mattressModeOptions"
|
|
||||||
:key="`right-${mode}`"
|
|
||||||
:class="{ active: localParams.mattressRightMode === mode, running: state.readable('mattress_right_mode') && mattressActiveSide === 'right' && localParams.mattressRightMode === mode }"
|
|
||||||
:disabled="operationBusy || !state.available('mattress_right_mode')"
|
|
||||||
@click="setMattressMode('right', mode)"
|
|
||||||
>{{ mode }}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<details class="mattress-advanced">
|
|
||||||
<summary>分区软硬度与按摩调节</summary>
|
|
||||||
<p class="mattress-mode-note">软硬度按左、右各 6 个部位独立设置;BMI 只给出演示起点,并非医学建议。选择按摩部位可能让床垫立即动作。</p>
|
|
||||||
<div v-for="zone in mattressFirmnessZones" :key="zone.key" class="mattress-select-row">
|
|
||||||
<label :for="`firmness-${zone.key}`">{{ zone.label }}软硬度</label>
|
|
||||||
<select :id="`firmness-${zone.key}`"
|
|
||||||
:value="state.readable(`mattress_firmness_${zone.key}`) ? localParams.mattressFirmness[zone.key] || '' : ''"
|
|
||||||
:disabled="operationBusy || !state.available(`mattress_firmness_${zone.key}`)"
|
|
||||||
@change="setMattressSelect(`mattress_firmness_${zone.key}`, $event)">
|
|
||||||
<option value="" disabled>状态未确认</option>
|
|
||||||
<option v-for="level in mattressFirmnessOptions" :key="level" :value="level">{{ level }}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="mattress-select-row">
|
|
||||||
<label for="massage-left-part">左侧按摩部位</label>
|
|
||||||
<select id="massage-left-part" :value="state.readable('mattress_massage_left_part') ? localParams.mattressMassageLeftPart : ''"
|
|
||||||
:disabled="operationBusy || !state.available('mattress_massage_left_part')"
|
|
||||||
@change="setMattressSelect('mattress_massage_left_part', $event)">
|
|
||||||
<option value="" disabled>状态未确认</option>
|
|
||||||
<option v-for="part in massagePartOptions" :key="part" :value="part">{{ part }}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="mattress-select-row">
|
|
||||||
<label for="massage-right-part">右侧按摩部位</label>
|
|
||||||
<select id="massage-right-part" :value="state.readable('mattress_massage_right_part') ? localParams.mattressMassageRightPart : ''"
|
|
||||||
:disabled="operationBusy || !state.available('mattress_massage_right_part')"
|
|
||||||
@change="setMattressSelect('mattress_massage_right_part', $event)">
|
|
||||||
<option value="" disabled>状态未确认</option>
|
|
||||||
<option v-for="part in massagePartOptions" :key="part" :value="part">{{ part }}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="mattress-select-row">
|
|
||||||
<label for="massage-level">按摩力度</label>
|
|
||||||
<select id="massage-level" :value="state.readable('mattress_massage_level') ? localParams.mattressMassageLevel : ''"
|
|
||||||
:disabled="operationBusy || !state.available('mattress_massage_level')"
|
|
||||||
@change="setMattressSelect('mattress_massage_level', $event)">
|
|
||||||
<option value="" disabled>状态未确认</option>
|
|
||||||
<option value="轻柔">轻柔</option>
|
|
||||||
<option value="强劲">强劲</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</details>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
@@ -2,11 +2,8 @@ import { computed, onMounted, onUnmounted, ref } from 'vue'
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { showFailToast, showLoadingToast, showSuccessToast } from 'vant'
|
import { showFailToast, showLoadingToast, showSuccessToast } from 'vant'
|
||||||
import { healthApi, type HomeAssistantDiscoveredDevice, type HomeAssistantStatus,
|
import { healthApi, type HomeAssistantDiscoveredDevice, type HomeAssistantStatus,
|
||||||
type MattressComfort, type TcmAssessmentResult } from '../services/health'
|
type TcmAssessmentResult } from '../services/health'
|
||||||
import { createDeviceParameterState, parameterLabels, syncDeviceParameters } from '../devices/parameterRegistry'
|
import { createDeviceParameterState, parameterLabels, syncDeviceParameters } from '../devices/parameterRegistry'
|
||||||
import { mattressFirmnessOptions, mattressModeOptions, mattressFirmnessZones, massagePartOptions } from '../devices/mattress/parameters'
|
|
||||||
import { useMattressPreferences } from '../devices/mattress/useMattressPreferences'
|
|
||||||
import { useMattressControls } from '../devices/mattress/useMattressControls'
|
|
||||||
import { useDeviceTransitions } from './useDeviceTransitions'
|
import { useDeviceTransitions } from './useDeviceTransitions'
|
||||||
import { useDeviceScenes } from './useDeviceScenes'
|
import { useDeviceScenes } from './useDeviceScenes'
|
||||||
import { parameterHasReading, parameterIsAvailable } from '../devices/parameterState'
|
import { parameterHasReading, parameterIsAvailable } from '../devices/parameterState'
|
||||||
@@ -15,24 +12,18 @@ import { climateCapabilities } from '../devices/climate/capabilities'
|
|||||||
import { outletCapabilities } from '../devices/outlet/capabilities'
|
import { outletCapabilities } from '../devices/outlet/capabilities'
|
||||||
import { lightCapabilities } from '../devices/lighting/capabilities'
|
import { lightCapabilities } from '../devices/lighting/capabilities'
|
||||||
|
|
||||||
/** 页面公共交互;家具参数同步/左右预选/渐变轮询各有独立模块。 */
|
/** 页面公共交互;家具参数同步/渐变轮询各有独立模块。 */
|
||||||
export function useDeviceControl() {
|
export function useDeviceControl() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const haStatus = ref<HomeAssistantStatus>()
|
const haStatus = ref<HomeAssistantStatus>()
|
||||||
const tcmResult = ref<TcmAssessmentResult>()
|
const tcmResult = ref<TcmAssessmentResult>()
|
||||||
const mattressComfort = ref<MattressComfort>()
|
|
||||||
const settingParam = ref<string | null>(null)
|
const settingParam = ref<string | null>(null)
|
||||||
const switchingDeviceId = ref<string | null>(null)
|
const switchingDeviceId = ref<string | null>(null)
|
||||||
const lastUpdatedAt = ref('')
|
const lastUpdatedAt = ref('')
|
||||||
const actionFeedback = ref<{ type: 'success' | 'fail'; message: string }>()
|
const actionFeedback = ref<{ type: 'success' | 'fail'; message: string }>()
|
||||||
const lightActionBusy = ref(false)
|
const lightActionBusy = ref(false)
|
||||||
const currentUserId = ref<number>()
|
|
||||||
const localParams = createDeviceParameterState()
|
const localParams = createDeviceParameterState()
|
||||||
const mattressDevice = computed(() => haStatus.value?.devices.find(device => device.moduleKey === 'mattress')
|
|
||||||
?? haStatus.value?.devices.find(device => device.moduleKey === undefined && device.category === 'Sleep'))
|
|
||||||
const { mattressActiveSide, syncModes, commitMode } =
|
|
||||||
useMattressPreferences(localParams, currentUserId, () => mattressDevice.value?.deviceId)
|
|
||||||
const { lightTransition, musicTransition, syncLightTransitionStatus, syncMusicTransitionStatus } =
|
const { lightTransition, musicTransition, syncLightTransitionStatus, syncMusicTransitionStatus } =
|
||||||
useDeviceTransitions(localParams, async () => {
|
useDeviceTransitions(localParams, async () => {
|
||||||
await loadStatus(false, true)
|
await loadStatus(false, true)
|
||||||
@@ -56,7 +47,6 @@ export function useDeviceControl() {
|
|||||||
needsConstitution: () => { void router.push('/tcm-assessment') },
|
needsConstitution: () => { void router.push('/tcm-assessment') },
|
||||||
refresh: () => loadStatus(), refreshLater: () => loadStatus(false, true), feedback: setFeedback,
|
refresh: () => loadStatus(), refreshLater: () => loadStatus(false, true), feedback: setFeedback,
|
||||||
})
|
})
|
||||||
const { setMattressMode, setMattressSelect } = useMattressControls(mattressDevice, applyParam, loadStatus, commitMode)
|
|
||||||
function setFeedback(type: 'success' | 'fail', message: string) {
|
function setFeedback(type: 'success' | 'fail', message: string) {
|
||||||
if (active) actionFeedback.value = { type, message }
|
if (active) actionFeedback.value = { type, message }
|
||||||
}
|
}
|
||||||
@@ -106,14 +96,12 @@ const currentOperationText = computed(() => {
|
|||||||
if (!active || sequence !== loadSequence) return
|
if (!active || sequence !== loadSequence) return
|
||||||
haStatus.value = status
|
haStatus.value = status
|
||||||
if (dashboard) {
|
if (dashboard) {
|
||||||
currentUserId.value = dashboard.user.id
|
|
||||||
tcmResult.value = dashboard.tcmResult
|
tcmResult.value = dashboard.tcmResult
|
||||||
mattressComfort.value = dashboard.mattressComfort
|
|
||||||
}
|
}
|
||||||
const controls = status.controlParameters ?? {}
|
const controls = status.controlParameters ?? {}
|
||||||
syncDeviceParameters(localParams, controls)
|
syncDeviceParameters(localParams, controls)
|
||||||
syncModes(controls)
|
const hasSceneLights = Boolean(status.devices?.some(device => device.category === 'Lighting' && device.moduleKey))
|
||||||
await Promise.all([syncLightTransitionStatus().catch(() => undefined), syncMusicTransitionStatus().catch(() => undefined)])
|
await Promise.all([syncLightTransitionStatus(hasSceneLights).catch(() => undefined), syncMusicTransitionStatus().catch(() => undefined)])
|
||||||
if (!active || sequence !== loadSequence) return
|
if (!active || sequence !== loadSequence) return
|
||||||
lastUpdatedAt.value = new Intl.DateTimeFormat('zh-CN', {
|
lastUpdatedAt.value = new Intl.DateTimeFormat('zh-CN', {
|
||||||
hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false
|
hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false
|
||||||
@@ -260,8 +248,7 @@ async function applyParam(deviceId: string, paramType: string, val: unknown, ent
|
|||||||
const previousControls = haStatus.value?.controlParameters ?? {}
|
const previousControls = haStatus.value?.controlParameters ?? {}
|
||||||
const key = `${deviceId}_${paramType}`
|
const key = `${deviceId}_${paramType}`
|
||||||
settingParam.value = key
|
settingParam.value = key
|
||||||
const label = parameterLabels[paramType]
|
const label = parameterLabels[paramType] || '设备参数'
|
||||||
|| (paramType.startsWith('mattress_firmness_') ? '床垫分区软硬度' : '设备参数')
|
|
||||||
const loadingToast = operationToast(`正在设置${label}…`)
|
const loadingToast = operationToast(`正在设置${label}…`)
|
||||||
try {
|
try {
|
||||||
const res = await healthApi.setParameter({
|
const res = await healthApi.setParameter({
|
||||||
@@ -283,7 +270,6 @@ async function applyParam(deviceId: string, paramType: string, val: unknown, ent
|
|||||||
if (!active) return false
|
if (!active) return false
|
||||||
const message = err instanceof Error ? err.message : `${label}设置失败`
|
const message = err instanceof Error ? err.message : `${label}设置失败`
|
||||||
syncDeviceParameters(localParams, previousControls)
|
syncDeviceParameters(localParams, previousControls)
|
||||||
syncModes(previousControls)
|
|
||||||
await loadStatus()
|
await loadStatus()
|
||||||
if (!active) return false
|
if (!active) return false
|
||||||
setFeedback('fail', message)
|
setFeedback('fail', message)
|
||||||
@@ -315,9 +301,9 @@ function handleBack() {
|
|||||||
for (const toast of operationToasts) toast.close()
|
for (const toast of operationToasts) toast.close()
|
||||||
operationToasts.clear()
|
operationToasts.clear()
|
||||||
})
|
})
|
||||||
return { router, loading, haStatus, tcmResult, mattressComfort, sceneRunning, settingParam, switchingDeviceId,
|
return { router, loading, haStatus, tcmResult, sceneRunning, settingParam, switchingDeviceId,
|
||||||
lastUpdatedAt, actionFeedback, lightTransition, musicTransition, lightActionBusy, localParams, operationBusy,
|
lastUpdatedAt, actionFeedback, lightTransition, musicTransition, lightActionBusy, localParams, operationBusy,
|
||||||
currentOperationText, mattressActiveSide, mattressFirmnessOptions, mattressModeOptions, mattressFirmnessZones,
|
currentOperationText,
|
||||||
massagePartOptions, loadStatus, controlLightTransition, isDeviceTurnedOn, isDeviceControlAvailable, isParameterAvailable, hasParameterReading, toggleDevice, controlSpeaker,
|
loadStatus, controlLightTransition, isDeviceTurnedOn, isDeviceControlAvailable, isParameterAvailable, hasParameterReading, toggleDevice, controlSpeaker,
|
||||||
applyParam, setMattressMode, setMattressSelect, executeScene, handleBack }
|
applyParam, executeScene, handleBack }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,14 @@ export function useDeviceTransitions(parameters: DeviceParameterState, onLightEn
|
|||||||
try { await syncMusicTransitionStatus() } catch { /* 下个周期重试。 */ }
|
try { await syncMusicTransitionStatus() } catch { /* 下个周期重试。 */ }
|
||||||
finally { musicPolling = false }
|
finally { musicPolling = false }
|
||||||
}
|
}
|
||||||
async function syncLightTransitionStatus() {
|
async function syncLightTransitionStatus(enabled = true) {
|
||||||
const sequence = ++lightSequence
|
const sequence = ++lightSequence
|
||||||
|
if (!enabled) {
|
||||||
|
lightTransition.value = undefined
|
||||||
|
if (lightTimer) clearInterval(lightTimer)
|
||||||
|
lightTimer = undefined
|
||||||
|
return
|
||||||
|
}
|
||||||
const status = await healthApi.lightTransitionStatus()
|
const status = await healthApi.lightTransitionStatus()
|
||||||
if (!active || sequence !== lightSequence) return
|
if (!active || sequence !== lightSequence) return
|
||||||
lightTransition.value = status
|
lightTransition.value = status
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import DehumidifierCard from '../components/devices/DehumidifierCard.vue'
|
|||||||
import LightingCard from '../components/devices/LightingCard.vue'
|
import LightingCard from '../components/devices/LightingCard.vue'
|
||||||
import AudioCard from '../components/devices/AudioCard.vue'
|
import AudioCard from '../components/devices/AudioCard.vue'
|
||||||
import FragranceCard from '../components/devices/FragranceCard.vue'
|
import FragranceCard from '../components/devices/FragranceCard.vue'
|
||||||
import MattressCard from '../components/devices/MattressCard.vue'
|
|
||||||
import EnvironmentCard from '../components/devices/EnvironmentCard.vue'
|
import EnvironmentCard from '../components/devices/EnvironmentCard.vue'
|
||||||
import ScaleCard from '../components/devices/ScaleCard.vue'
|
import ScaleCard from '../components/devices/ScaleCard.vue'
|
||||||
import GenericDeviceCard from '../components/devices/GenericDeviceCard.vue'
|
import GenericDeviceCard from '../components/devices/GenericDeviceCard.vue'
|
||||||
@@ -17,7 +16,7 @@ import { deviceModuleKey } from './deviceKinds'
|
|||||||
/** 新增专属卡片只注册这里;主页面不增加家具分支。 */
|
/** 新增专属卡片只注册这里;主页面不增加家具分支。 */
|
||||||
const cards: Record<string, Component> = {
|
const cards: Record<string, Component> = {
|
||||||
dehumidifier: DehumidifierCard, lighting: LightingCard, audio: AudioCard,
|
dehumidifier: DehumidifierCard, lighting: LightingCard, audio: AudioCard,
|
||||||
fragrance: FragranceCard, mattress: MattressCard, environment: EnvironmentCard,
|
fragrance: FragranceCard, environment: EnvironmentCard,
|
||||||
climate: ClimateCard, curtain: CurtainCard, outlet: OutletCard
|
climate: ClimateCard, curtain: CurtainCard, outlet: OutletCard
|
||||||
}
|
}
|
||||||
export function deviceCardFor(device: HomeAssistantDiscoveredDevice): Component {
|
export function deviceCardFor(device: HomeAssistantDiscoveredDevice): Component {
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import type { HomeAssistantDiscoveredDevice } from '../services/health'
|
|||||||
|
|
||||||
const legacyCategories: Record<string, string> = {
|
const legacyCategories: Record<string, string> = {
|
||||||
EnvironmentControl: 'dehumidifier', Lighting: 'lighting', Media: 'audio',
|
EnvironmentControl: 'dehumidifier', Lighting: 'lighting', Media: 'audio',
|
||||||
Fragrance: 'fragrance', Sleep: 'mattress', EnvironmentSensor: 'environment',
|
Fragrance: 'fragrance', EnvironmentSensor: 'environment',
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 新接口未绑定模块时不借用另一台同类设备的参数;仅兼容旧接口没有 moduleKey 的情况。 */
|
/** 新接口未绑定模块时不借用另一台同类设备的参数;仅兼容旧接口没有 moduleKey 的情况。 */
|
||||||
export function deviceModuleKey(device: HomeAssistantDiscoveredDevice): string {
|
export function deviceModuleKey(device: HomeAssistantDiscoveredDevice): string {
|
||||||
|
if (device.moduleKey === 'wake-fragrance') return 'fragrance'
|
||||||
return device.moduleKey === undefined ? legacyCategories[device.category] ?? '' : device.moduleKey
|
return device.moduleKey === undefined ? legacyCategories[device.category] ?? '' : device.moduleKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,11 +51,6 @@ function metric(device: HomeAssistantDiscoveredDevice, key: string): number | un
|
|||||||
function formatted(value: number | undefined, unit: string): string {
|
function formatted(value: number | undefined, unit: string): string {
|
||||||
return value === undefined ? '' : `${Math.round(value * 10) / 10}${unit}`
|
return value === undefined ? '' : `${Math.round(value * 10) / 10}${unit}`
|
||||||
}
|
}
|
||||||
function ownState(device: HomeAssistantDiscoveredDevice, input: SummaryInput, parameter: string): string | undefined {
|
|
||||||
const state = input.controls?.[parameter]
|
|
||||||
return state?.available && !['unknown', 'unavailable', ''].includes(state.state) &&
|
|
||||||
device.entities.some(entity => entity.entityId === state.entityId) ? state.state : undefined
|
|
||||||
}
|
|
||||||
function powerText(power: boolean | null, running = '运行中'): string {
|
function powerText(power: boolean | null, running = '运行中'): string {
|
||||||
return power === null ? '状态未确认' : power ? running : '已关闭'
|
return power === null ? '状态未确认' : power ? running : '已关闭'
|
||||||
}
|
}
|
||||||
@@ -95,12 +90,6 @@ const presenters: Record<string, Presenter> = {
|
|||||||
fragrance(_device, _input, power) {
|
fragrance(_device, _input, power) {
|
||||||
return { statusText: powerText(power, '香薰已开启'), metricText: '香薰与夜灯独立控制' }
|
return { statusText: powerText(power, '香薰已开启'), metricText: '香薰与夜灯独立控制' }
|
||||||
},
|
},
|
||||||
mattress(device, input) {
|
|
||||||
const right = ownState(device, input, 'mattress_massage_right_part')
|
|
||||||
const left = ownState(device, input, 'mattress_massage_left_part')
|
|
||||||
return { statusText: right && right !== '无' ? '右侧按摩中' : left && left !== '无' ? '左侧按摩中' : '已连接',
|
|
||||||
metricText: '按摩 · 加热 · 承托' }
|
|
||||||
},
|
|
||||||
environment(device) {
|
environment(device) {
|
||||||
const values = [formatted(metric(device, 'temperature'), '℃'), formatted(metric(device, 'humidity'), '%')].filter(Boolean)
|
const values = [formatted(metric(device, 'temperature'), '℃'), formatted(metric(device, 'humidity'), '%')].filter(Boolean)
|
||||||
return { statusText: '正在监测', metricText: values.join(' · ') || '查看环境指标' }
|
return { statusText: '正在监测', metricText: values.join(' · ') || '查看环境指标' }
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
import { clamp, numberValue, type ParameterSnapshot } from '../parameterState'
|
|
||||||
export const mattressFirmnessOptions = ['最软', '很软', '稍软', '稍硬', '很硬', '最硬']
|
|
||||||
export const mattressModeOptions = ['无', '瑜伽助眠', '智能适配', '智能腰托']
|
|
||||||
export const massagePartOptions = ['无', '背部', '腰部', '牵引', '腿部', '全身']
|
|
||||||
export const mattressFirmnessZones = [
|
|
||||||
{ key: 'left_shoulder', label: '左肩' }, { key: 'right_shoulder', label: '右肩' },
|
|
||||||
{ key: 'left_back', label: '左背' }, { key: 'right_back', label: '右背' },
|
|
||||||
{ key: 'left_waist', label: '左腰' }, { key: 'right_waist', label: '右腰' },
|
|
||||||
{ key: 'left_lumbar', label: '左腰椎' }, { key: 'right_lumbar', label: '右腰椎' },
|
|
||||||
{ key: 'left_hip', label: '左臀' }, { key: 'right_hip', label: '右臀' },
|
|
||||||
{ key: 'left_leg', label: '左腿' }, { key: 'right_leg', label: '右腿' }
|
|
||||||
]
|
|
||||||
export const defaults = { mattressLeftHeating: 0, mattressRightHeating: 0, mattressLeftMode: '智能适配',
|
|
||||||
mattressRightMode: '智能适配', mattressFirmness: {} as Record<string, string>, mattressMassageLeftPart: '无',
|
|
||||||
mattressMassageRightPart: '无', mattressMassageLevel: '轻柔' }
|
|
||||||
export const labels = { mattress_left_heating: '床垫左侧加热', mattress_right_heating: '床垫右侧加热',
|
|
||||||
mattress_left_mode: '床垫左侧承托模式', mattress_right_mode: '床垫右侧承托模式',
|
|
||||||
mattress_massage_left_part: '左侧按摩部位', mattress_massage_right_part: '右侧按摩部位', mattress_massage_level: '按摩力度' }
|
|
||||||
export function sync(state: typeof defaults, controls: ParameterSnapshot) {
|
|
||||||
for (const [parameter, property] of [['mattress_left_heating', 'mattressLeftHeating'],
|
|
||||||
['mattress_right_heating', 'mattressRightHeating']] as const) {
|
|
||||||
const value = numberValue(controls[parameter]?.state)
|
|
||||||
if (controls[parameter]?.available && value !== undefined) state[property] = clamp(value, 0, 4)
|
|
||||||
}
|
|
||||||
for (const zone of mattressFirmnessZones) {
|
|
||||||
const control = controls['mattress_firmness_' + zone.key]
|
|
||||||
if (control?.available && mattressFirmnessOptions.includes(control.state)) state.mattressFirmness[zone.key] = control.state
|
|
||||||
}
|
|
||||||
for (const [parameter, property] of [['mattress_massage_left_part', 'mattressMassageLeftPart'],
|
|
||||||
['mattress_massage_right_part', 'mattressMassageRightPart']] as const) {
|
|
||||||
const control = controls[parameter]
|
|
||||||
if (control?.available && massagePartOptions.includes(control.state)) state[property] = control.state
|
|
||||||
}
|
|
||||||
const level = controls.mattress_massage_level
|
|
||||||
if (level?.available && ['轻柔', '强劲'].includes(level.state)) state.mattressMassageLevel = level.state
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import { showConfirmDialog } from 'vant'
|
|
||||||
import { onUnmounted, type ComputedRef } from 'vue'
|
|
||||||
import type { HomeAssistantDiscoveredDevice } from '../../services/health'
|
|
||||||
|
|
||||||
export function useMattressControls(device: ComputedRef<HomeAssistantDiscoveredDevice | undefined>,
|
|
||||||
applyParam: (deviceId: string, parameter: string, value: unknown) => Promise<boolean>,
|
|
||||||
loadStatus: () => Promise<void>, commitMode: (side: 'left' | 'right', mode: string) => void) {
|
|
||||||
let active = true
|
|
||||||
onUnmounted(() => { active = false })
|
|
||||||
async function setMattressMode(side: 'left' | 'right', mode: string) {
|
|
||||||
if (!active || !device.value) return
|
|
||||||
if (await applyParam(device.value.deviceId, 'mattress_' + side + '_mode', mode) && active) commitMode(side, mode)
|
|
||||||
}
|
|
||||||
async function setMattressSelect(parameterType: string, event: Event) {
|
|
||||||
if (!active || !device.value) return
|
|
||||||
const deviceId = device.value.deviceId
|
|
||||||
const value = (event.target as HTMLSelectElement).value
|
|
||||||
if (parameterType.startsWith('mattress_massage_') && value !== '无') {
|
|
||||||
try { await showConfirmDialog({ title: '确认启动床垫按摩',
|
|
||||||
message: '按摩或牵引可能让床垫立即动作,请确认设备周围安全后继续。' }) }
|
|
||||||
catch { if (active) await loadStatus(); return }
|
|
||||||
}
|
|
||||||
// 确认框等待期间可能离开页面或设备被移除,不能向新的床垫误发命令。
|
|
||||||
if (active && device.value?.deviceId === deviceId) await applyParam(deviceId, parameterType, value)
|
|
||||||
}
|
|
||||||
return { setMattressMode, setMattressSelect }
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
import { ref, type Ref } from 'vue'
|
|
||||||
import type { DeviceParameterState } from '../parameterRegistry'
|
|
||||||
import type { ParameterSnapshot } from '../parameterState'
|
|
||||||
import { mattressModeOptions } from './parameters'
|
|
||||||
|
|
||||||
export function useMattressPreferences(localParams: DeviceParameterState,
|
|
||||||
currentUserId: Ref<number | undefined>, getDeviceId: () => string | undefined) {
|
|
||||||
const mattressActiveSide = ref<'left' | 'right' | null>(null)
|
|
||||||
function storageKey() {
|
|
||||||
const deviceId = getDeviceId()
|
|
||||||
return currentUserId.value && deviceId ? 'evergreen-mattress-modes-' + currentUserId.value + '-' + deviceId : undefined
|
|
||||||
}
|
|
||||||
function readPreference(): { left: string; right: string } | undefined {
|
|
||||||
const key = storageKey()
|
|
||||||
if (!key) return undefined
|
|
||||||
try {
|
|
||||||
const saved = JSON.parse(localStorage.getItem(key) || 'null')
|
|
||||||
return mattressModeOptions.includes(saved?.left) && mattressModeOptions.includes(saved?.right) ? saved : undefined
|
|
||||||
} catch { return undefined }
|
|
||||||
}
|
|
||||||
function savePreference() {
|
|
||||||
const key = storageKey()
|
|
||||||
if (!key) return
|
|
||||||
try { localStorage.setItem(key, JSON.stringify({ left: localParams.mattressLeftMode, right: localParams.mattressRightMode })) }
|
|
||||||
catch { /* 禁止存储时仅保留本次页面预选。 */ }
|
|
||||||
}
|
|
||||||
function syncModes(controls: ParameterSnapshot) {
|
|
||||||
const left = controls.mattress_left_mode?.available ? controls.mattress_left_mode.state : undefined
|
|
||||||
const right = controls.mattress_right_mode?.available ? controls.mattress_right_mode.state : undefined
|
|
||||||
const leftRunning = Boolean(left && mattressModeOptions.includes(left) && left !== '无')
|
|
||||||
const rightRunning = Boolean(right && mattressModeOptions.includes(right) && right !== '无')
|
|
||||||
// 双侧云缓存尚未同步时保留已确认的一侧,不把两侧预选当作两侧物理运行。
|
|
||||||
mattressActiveSide.value = leftRunning && rightRunning ? mattressActiveSide.value
|
|
||||||
: rightRunning ? 'right' : leftRunning ? 'left' : null
|
|
||||||
const preference = readPreference()
|
|
||||||
localParams.mattressLeftMode = mattressActiveSide.value === 'left' ? left! : preference?.left ?? '智能适配'
|
|
||||||
localParams.mattressRightMode = mattressActiveSide.value === 'right' ? right! : preference?.right ?? '智能适配'
|
|
||||||
}
|
|
||||||
function commitMode(side: 'left' | 'right', mode: string) {
|
|
||||||
if (side === 'left') localParams.mattressLeftMode = mode
|
|
||||||
else localParams.mattressRightMode = mode
|
|
||||||
if (mode !== '无') mattressActiveSide.value = side
|
|
||||||
else if (mattressActiveSide.value === side) mattressActiveSide.value = null
|
|
||||||
savePreference()
|
|
||||||
}
|
|
||||||
return { mattressActiveSide, syncModes, commitMode }
|
|
||||||
}
|
|
||||||
@@ -3,22 +3,21 @@ import * as dehumidifier from './dehumidifier/parameters'
|
|||||||
import * as lighting from './lighting/parameters'
|
import * as lighting from './lighting/parameters'
|
||||||
import * as audio from './audio/parameters'
|
import * as audio from './audio/parameters'
|
||||||
import * as fragrance from './fragrance/parameters'
|
import * as fragrance from './fragrance/parameters'
|
||||||
import * as mattress from './mattress/parameters'
|
|
||||||
import * as climate from './climate/parameters'
|
import * as climate from './climate/parameters'
|
||||||
import * as curtain from './curtain/parameters'
|
import * as curtain from './curtain/parameters'
|
||||||
import type { ParameterSnapshot } from './parameterState'
|
import type { ParameterSnapshot } from './parameterState'
|
||||||
|
|
||||||
export const parameterLabels: Record<string, string> = {
|
export const parameterLabels: Record<string, string> = {
|
||||||
...dehumidifier.labels, ...lighting.labels, ...audio.labels, ...fragrance.labels, ...mattress.labels,
|
...dehumidifier.labels, ...lighting.labels, ...audio.labels, ...fragrance.labels,
|
||||||
|
...Object.fromEntries(Object.entries(fragrance.labels).map(([key, label]) => [`wake_${key}`, label])),
|
||||||
...climate.labels, ...curtain.labels
|
...climate.labels, ...curtain.labels
|
||||||
}
|
}
|
||||||
export function createDeviceParameterState() {
|
export function createDeviceParameterState() {
|
||||||
return reactive({ ...dehumidifier.defaults, ...lighting.defaults, ...audio.defaults,
|
return reactive({ ...dehumidifier.defaults, ...lighting.defaults, ...audio.defaults,
|
||||||
...fragrance.defaults, ...mattress.defaults, ...climate.defaults, ...curtain.defaults, mattressFirmness: {} as Record<string, string> })
|
...climate.defaults, ...curtain.defaults })
|
||||||
}
|
}
|
||||||
export type DeviceParameterState = ReturnType<typeof createDeviceParameterState>
|
export type DeviceParameterState = ReturnType<typeof createDeviceParameterState>
|
||||||
export function syncDeviceParameters(state: DeviceParameterState, controls: ParameterSnapshot) {
|
export function syncDeviceParameters(state: DeviceParameterState, controls: ParameterSnapshot) {
|
||||||
dehumidifier.sync(state, controls); lighting.sync(state, controls); audio.sync(state, controls)
|
dehumidifier.sync(state, controls); lighting.sync(state, controls); audio.sync(state, controls)
|
||||||
fragrance.sync(state, controls); mattress.sync(state, controls)
|
|
||||||
climate.sync(state, controls); curtain.sync(state, controls)
|
climate.sync(state, controls); curtain.sync(state, controls)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import ProfileView from './views/ProfileView.vue'
|
|||||||
import DeviceControlView from './views/DeviceControlView.vue'
|
import DeviceControlView from './views/DeviceControlView.vue'
|
||||||
import DeviceControlLayout from './views/DeviceControlLayout.vue'
|
import DeviceControlLayout from './views/DeviceControlLayout.vue'
|
||||||
import DeviceDetailView from './views/DeviceDetailView.vue'
|
import DeviceDetailView from './views/DeviceDetailView.vue'
|
||||||
|
import SleepDataView from './views/SleepDataView.vue'
|
||||||
import { hasToken } from './services/auth'
|
import { hasToken } from './services/auth'
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
@@ -17,6 +18,7 @@ const router = createRouter({
|
|||||||
{ path: '/auth', component: AuthView, meta: { guest: true } },
|
{ path: '/auth', component: AuthView, meta: { guest: true } },
|
||||||
{ path: '/onboarding', redirect: '/assessment' },
|
{ path: '/onboarding', redirect: '/assessment' },
|
||||||
{ path: '/dashboard', component: DashboardView },
|
{ path: '/dashboard', component: DashboardView },
|
||||||
|
{ path: '/sleep-data', component: SleepDataView },
|
||||||
{ path: '/assessment', component: AssessmentView },
|
{ path: '/assessment', component: AssessmentView },
|
||||||
{ path: '/tcm-assessment', component: TcmAssessmentView },
|
{ path: '/tcm-assessment', component: TcmAssessmentView },
|
||||||
{ path: '/profile', component: ProfileView },
|
{ path: '/profile', component: ProfileView },
|
||||||
|
|||||||
+2
-18
@@ -47,11 +47,6 @@ export type PersonalizedSceneConfig = {
|
|||||||
enableUv: boolean
|
enableUv: boolean
|
||||||
lightBrightnessPercent: number
|
lightBrightnessPercent: number
|
||||||
lightColorTemperatureKelvin: number
|
lightColorTemperatureKelvin: number
|
||||||
mattressTargetTemp: number
|
|
||||||
mattressLeftFirmness: number
|
|
||||||
mattressRightFirmness: number
|
|
||||||
mattressHeatingLevel: number
|
|
||||||
mattressMode: string
|
|
||||||
enableFragrance: boolean
|
enableFragrance: boolean
|
||||||
fragranceLevel: number
|
fragranceLevel: number
|
||||||
enableSpeakerSleepMode: boolean
|
enableSpeakerSleepMode: boolean
|
||||||
@@ -97,24 +92,13 @@ export type Dashboard = {
|
|||||||
bmiStatus?: string
|
bmiStatus?: string
|
||||||
sceneConfig?: PersonalizedSceneConfig
|
sceneConfig?: PersonalizedSceneConfig
|
||||||
tcmResult?: TcmAssessmentResult
|
tcmResult?: TcmAssessmentResult
|
||||||
mattressComfort?: MattressComfort
|
environmentAdvice?: EnvironmentAdvice
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MattressComfort = {
|
export type EnvironmentAdvice = {
|
||||||
bmi?: number | null
|
|
||||||
firmness?: string | null
|
|
||||||
heatingLevel: number
|
|
||||||
isWinter: boolean
|
|
||||||
outdoorTemperatureCelsius?: number | null
|
|
||||||
feelsLikeCelsius?: number | null
|
|
||||||
weatherAvailable: boolean
|
|
||||||
weatherObservedAt?: string | null
|
|
||||||
weatherReason: string
|
|
||||||
firmnessReason: string
|
|
||||||
indoorTemperatureCelsius?: number | null
|
indoorTemperatureCelsius?: number | null
|
||||||
indoorTemperatureAvailable: boolean
|
indoorTemperatureAvailable: boolean
|
||||||
indoorTemperatureObservedAt?: string | null
|
indoorTemperatureObservedAt?: string | null
|
||||||
heatingReason: string
|
|
||||||
climateAdvice?: ClimateAdvice
|
climateAdvice?: ClimateAdvice
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
import http from './http'
|
||||||
|
|
||||||
|
export const ib43Metrics = [
|
||||||
|
{ key: 'heartRate', label: '心率' },
|
||||||
|
{ key: 'respiration', label: '呼吸' },
|
||||||
|
{ key: 'presence', label: '在床' },
|
||||||
|
{ key: 'snoring', label: '打鼾' },
|
||||||
|
] as const
|
||||||
|
|
||||||
|
export type Ib43Metric = typeof ib43Metrics[number]['key']
|
||||||
|
|
||||||
|
export type Ib43Bed = {
|
||||||
|
id: string
|
||||||
|
bedName: string
|
||||||
|
side: 'left' | 'right'
|
||||||
|
simulation: boolean
|
||||||
|
startedAtMs: number | string
|
||||||
|
endedAtMs?: number | string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
type Ib43Reading = { value: number | null; receivedAt?: string | null }
|
||||||
|
export type Ib43Current = {
|
||||||
|
bed: Ib43Bed
|
||||||
|
transport: string
|
||||||
|
active: boolean
|
||||||
|
readings: Partial<Record<Ib43Metric, Ib43Reading & { freshness: 'recent' | 'stale' | 'unknown' }>>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Ib43HistoryItem = {
|
||||||
|
id: number | string
|
||||||
|
receivedAtMs: number | string
|
||||||
|
readings: Partial<Record<Ib43Metric, Ib43Reading>>
|
||||||
|
}
|
||||||
|
|
||||||
|
type Ib43History = { items: Ib43HistoryItem[]; nextBeforeId?: number | string | null }
|
||||||
|
export type Ib43HistoryQuery = { fromMs: number; toMs: number; beforeId?: number | string; take: number }
|
||||||
|
export type Ib43AutomationRecord = {
|
||||||
|
id: string
|
||||||
|
actionKey: string
|
||||||
|
targetLabel: string
|
||||||
|
triggeredAtMs: number | string
|
||||||
|
completedAtMs?: number | string | null
|
||||||
|
result: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Ib43AutomationRule = {
|
||||||
|
actionKey: string
|
||||||
|
enabled: boolean
|
||||||
|
actionLabel: string
|
||||||
|
targetLabel: string
|
||||||
|
previewOnly: boolean
|
||||||
|
conditionLabel?: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Ib43Automation = {
|
||||||
|
available: boolean
|
||||||
|
enabled: boolean
|
||||||
|
actionLabel: string
|
||||||
|
targetLabel: string
|
||||||
|
records: Ib43AutomationRecord[]
|
||||||
|
rules?: Ib43AutomationRule[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const bindingsUrl = '/api/health/ib43/bindings'
|
||||||
|
const bedUrl = (id: string) => `${bindingsUrl}/${encodeURIComponent(id)}`
|
||||||
|
|
||||||
|
export const ib43Api = {
|
||||||
|
bindings: () => http.get<never, Ib43Bed[]>(bindingsUrl),
|
||||||
|
current: (id: string) => http.get<never, Ib43Current>(`${bedUrl(id)}/current`),
|
||||||
|
history: (id: string, params: Ib43HistoryQuery) => http.get<never, Ib43History>(`${bedUrl(id)}/history`, { params }),
|
||||||
|
automation: (id: string) => http.get<never, Ib43Automation>(`${bedUrl(id)}/automation`),
|
||||||
|
startAutomation: (id: string, actionKey?: string) =>
|
||||||
|
http.post<never, void>(`${bedUrl(id)}/automation/start`, undefined, { params: { actionKey } }),
|
||||||
|
stopAutomation: (id: string, actionKey?: string) =>
|
||||||
|
http.post<never, void>(`${bedUrl(id)}/automation/stop`, undefined, { params: { actionKey } }),
|
||||||
|
}
|
||||||
|
|
||||||
|
export function displayIb43Value(metric: Ib43Metric, value?: number | null) {
|
||||||
|
if (typeof value !== 'number' || !Number.isFinite(value)) return '—'
|
||||||
|
if (metric === 'presence') return value === 1 ? '在床' : value === 0 ? '离床' : '—'
|
||||||
|
if (metric === 'snoring') return value === 1 ? '打鼾' : value === 0 ? '未打鼾' : '—'
|
||||||
|
return String(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeFormat = new Intl.DateTimeFormat('zh-CN', {
|
||||||
|
year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit', hourCycle: 'h23',
|
||||||
|
})
|
||||||
|
|
||||||
|
export function formatIb43Time(value?: number | string | null) {
|
||||||
|
if (value == null || value === '') return ''
|
||||||
|
// 最近读数的 UTC 时间经过 API 序列化后可能没有偏移;历史使用 Unix 毫秒。
|
||||||
|
const milliseconds = typeof value === 'number' || /^\d+$/.test(value) ? Number(value) : Date.parse(
|
||||||
|
/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d+)?$/.test(value) ? `${value.replace(' ', 'T')}Z` : value,
|
||||||
|
)
|
||||||
|
return Number.isFinite(new Date(milliseconds).getTime()) ? timeFormat.format(milliseconds) : ''
|
||||||
|
}
|
||||||
+318
-152
@@ -1,13 +1,23 @@
|
|||||||
:root {
|
:root {
|
||||||
font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||||
color: #173a34;
|
color: #0f172a;
|
||||||
background: #f2f0e9;
|
background: #f8fafc;
|
||||||
font-synthesis: none;
|
font-synthesis: none;
|
||||||
--green: #0c5045;
|
--primary: #0284c7;
|
||||||
--deep: #123f37;
|
--primary-light: #f0f9ff;
|
||||||
--cream: #f8f4e8;
|
--primary-border: #bae6fd;
|
||||||
--gold: #d6a657;
|
--primary-dark: #0369a1;
|
||||||
--line: rgba(18, 63, 55, 0.12);
|
--green: #0284c7;
|
||||||
|
--deep: #0f172a;
|
||||||
|
--text-main: #0f172a;
|
||||||
|
--text-body: #334155;
|
||||||
|
--text-muted: #64748b;
|
||||||
|
--cream: #f8fafc;
|
||||||
|
--gold: #0284c7;
|
||||||
|
--line: #e2e8f0;
|
||||||
|
--card-bg: #ffffff;
|
||||||
|
--card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
|
||||||
|
--card-radius: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
* { box-sizing: border-box; }
|
* { box-sizing: border-box; }
|
||||||
@@ -16,7 +26,7 @@ html, body {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
min-width: 320px;
|
min-width: 320px;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #e8e6df;
|
background: #f1f5f9;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
-webkit-text-size-adjust: 100%;
|
-webkit-text-size-adjust: 100%;
|
||||||
}
|
}
|
||||||
@@ -25,8 +35,8 @@ html, body {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: #f2f0e9;
|
background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%);
|
||||||
box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 0 32px rgba(15, 23, 42, 0.06);
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
button, input, textarea { font: inherit; }
|
button, input, textarea { font: inherit; }
|
||||||
@@ -34,98 +44,246 @@ button { cursor: pointer; }
|
|||||||
|
|
||||||
.eyebrow {
|
.eyebrow {
|
||||||
margin: 0 0 8px;
|
margin: 0 0 8px;
|
||||||
color: #b68b48;
|
color: #0284c7;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
letter-spacing: 0.16em;
|
letter-spacing: 0.16em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.auth-page { min-height: 100vh; background: var(--cream); }
|
.auth-page {
|
||||||
.brand-panel {
|
min-height: 100vh;
|
||||||
padding: 46px 24px 46px;
|
|
||||||
color: #fff;
|
|
||||||
background:
|
background:
|
||||||
radial-gradient(circle at 82% 12%, rgba(236, 202, 137, .28), transparent 28%),
|
radial-gradient(circle at 85% 10%, rgba(178, 225, 255, 0.45) 0%, rgba(224, 242, 254, 0.25) 35%, transparent 70%),
|
||||||
linear-gradient(145deg, #0b5548, #123d37 74%);
|
linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 25%, #f8fafc 55%, #f1f5f9 100%);
|
||||||
border-radius: 0 0 36px 36px;
|
padding: 20px 16px 40px;
|
||||||
|
}
|
||||||
|
.brand-panel {
|
||||||
|
max-width: 440px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 16px 4px 20px;
|
||||||
|
color: #0f172a;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
.brand-badge {
|
.brand-badge {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding: 5px 14px 5px 6px;
|
padding: 4px 12px 4px 4px;
|
||||||
background: rgba(255, 255, 255, 0.12);
|
background: rgba(255, 255, 255, 0.85);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
border: 1px solid rgba(191, 219, 254, 0.8);
|
||||||
border-radius: 24px;
|
border-radius: 20px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-bottom: 20px;
|
font-weight: 600;
|
||||||
|
color: #075985;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
box-shadow: 0 2px 8px rgba(2, 132, 199, 0.06);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
.brand-badge-icon {
|
.brand-badge-icon {
|
||||||
width: 24px;
|
width: 22px;
|
||||||
height: 24px;
|
height: 22px;
|
||||||
background: var(--gold);
|
background: #0284c7;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
font-family: serif;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 13px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
.brand-mark {
|
.brand-mark {
|
||||||
display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 28px;
|
display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 24px;
|
||||||
border: 1px solid rgba(255,255,255,.42); border-radius: 50%; font-family: serif; font-size: 24px;
|
border: 1px solid rgba(2, 132, 199, 0.3); border-radius: 50%; font-family: serif; font-size: 24px; color: #0284c7;
|
||||||
|
}
|
||||||
|
.brand-panel .eyebrow {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.14em;
|
||||||
|
color: #0284c7;
|
||||||
|
}
|
||||||
|
.brand-panel h1 {
|
||||||
|
max-width: 560px;
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(26px, 7vw, 32px);
|
||||||
|
line-height: 1.25;
|
||||||
|
font-weight: 800;
|
||||||
|
color: #0f172a;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
.brand-copy {
|
||||||
|
max-width: 480px;
|
||||||
|
margin: 10px 0 16px;
|
||||||
|
color: #475569;
|
||||||
|
line-height: 1.6;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.feature-row, .feature-pill-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.feature-row span, .feature-pill-row span {
|
||||||
|
padding: 5px 12px;
|
||||||
|
background: rgba(255, 255, 255, 0.85);
|
||||||
|
border: 1px solid rgba(191, 219, 254, 0.75);
|
||||||
|
border-radius: 18px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0284c7;
|
||||||
|
box-shadow: 0 2px 6px rgba(2, 132, 199, 0.04);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
}
|
}
|
||||||
.brand-panel h1 { max-width: 560px; margin: 0; font-family: "Songti SC", serif; font-size: clamp(32px, 8vw, 54px); line-height: 1.2; font-weight: 500; }
|
|
||||||
.brand-copy { max-width: 480px; margin: 14px 0 16px; color: rgba(255,255,255,.78); line-height: 1.6; }
|
|
||||||
.feature-row, .feature-pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
|
|
||||||
.feature-row span, .feature-pill-row span { padding: 6px 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: 20px; font-size: 12px; }
|
|
||||||
|
|
||||||
.auth-card { position: relative; width: calc(100% - 32px); max-width: 440px; margin: -16px auto 32px; padding: 24px 20px; background: #fff; border-radius: 24px; box-shadow: 0 14px 40px rgba(24,59,52,.12); }
|
.auth-card {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 440px;
|
||||||
|
margin: 0 auto 32px;
|
||||||
|
padding: 24px 20px 28px;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 22px;
|
||||||
|
border: 1px solid rgba(226, 232, 240, 0.85);
|
||||||
|
box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.02);
|
||||||
|
}
|
||||||
.auth-tab-switch {
|
.auth-tab-switch {
|
||||||
display: flex;
|
display: flex;
|
||||||
background: #f1efea;
|
background: #f1f5f9;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 3px;
|
padding: 4px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
.auth-tab-switch button {
|
.auth-tab-switch button {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 9px 0;
|
padding: 10px 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
border-radius: 9px;
|
border-radius: 9px;
|
||||||
color: #72847d;
|
color: #64748b;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
.auth-tab-switch button.active {
|
.auth-tab-switch button.active {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
color: var(--green);
|
color: #0284c7;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
|
||||||
|
}
|
||||||
|
.auth-heading h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
.auth-heading > p:last-child {
|
||||||
|
margin: 6px 0 20px;
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.auth-card .van-field {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
background: #f8fafc;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, margin-bottom 0.2s ease;
|
||||||
|
min-height: 48px;
|
||||||
|
}
|
||||||
|
.auth-card .van-field:focus-within {
|
||||||
|
background: #ffffff;
|
||||||
|
border-color: #0284c7;
|
||||||
|
box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
|
||||||
|
}
|
||||||
|
.auth-card .van-field__value {
|
||||||
|
position: static;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
.auth-card .van-field__label {
|
||||||
|
color: #334155;
|
||||||
|
font-weight: 600;
|
||||||
|
width: 4.8em;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
.auth-card .van-field__control {
|
||||||
|
color: #0f172a;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.auth-card .van-field__error-message {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 4px);
|
||||||
|
left: 12px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
color: #ef4444;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.auth-card .van-field__error-message::before {
|
||||||
|
content: "⚠";
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
.auth-card .van-field:has(.van-field__error-message),
|
||||||
|
.auth-card .van-field--error {
|
||||||
|
margin-bottom: 26px !important;
|
||||||
|
border-color: #ef4444 !important;
|
||||||
|
background-color: #fffafa !important;
|
||||||
|
}
|
||||||
|
.auth-card .van-field:has(.van-field__error-message):focus-within,
|
||||||
|
.auth-card .van-field--error:focus-within {
|
||||||
|
border-color: #ef4444 !important;
|
||||||
|
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
|
||||||
|
}
|
||||||
|
.auth-card .van-button {
|
||||||
|
margin-top: 20px;
|
||||||
|
height: 48px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%) !important;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 14px !important;
|
||||||
|
box-shadow: 0 8px 20px -3px rgba(2, 132, 199, 0.35);
|
||||||
|
color: #ffffff !important;
|
||||||
|
transition: transform 0.1s;
|
||||||
|
}
|
||||||
|
.auth-card .van-button:active {
|
||||||
|
transform: scale(0.985);
|
||||||
|
}
|
||||||
|
.text-button {
|
||||||
|
display: block;
|
||||||
|
margin: 18px auto 0;
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: #0284c7;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.privacy-note {
|
||||||
|
margin: 20px 0 0;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.6;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.auth-heading h2 { margin: 0; font-family: "Songti SC", serif; font-size: 24px; }
|
|
||||||
.auth-heading > p:last-child { margin: 8px 0 20px; color: #70817d; font-size: 13px; }
|
|
||||||
.auth-card .van-field { margin-bottom: 12px; padding: 14px 12px; background: #f7f7f3; border-radius: 12px; }
|
|
||||||
.auth-card .van-button { margin-top: 18px; height: 48px; font-size: 15px; font-weight: 600; }
|
|
||||||
.text-button { display: block; margin: 18px auto 0; border: 0; background: transparent; color: var(--green); font-size: 14px; }
|
|
||||||
.privacy-note { margin: 18px 0 0; color: #9a9f9c; font-size: 11px; line-height: 1.6; text-align: center; }
|
|
||||||
|
|
||||||
.page-shell { min-height: 100vh; padding: 28px 16px 110px; background: #f3f1ea; }
|
.page-shell { min-height: 100vh; padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%); }
|
||||||
.page-header, .dashboard-header { max-width: 760px; margin: 0 auto 24px; padding: 12px 4px; }
|
.page-header, .dashboard-header { max-width: 760px; margin: 0 auto 20px; padding: 12px 4px; }
|
||||||
.page-header h1, .dashboard-header h1 { margin: 0; font-family: "Songti SC", serif; font-size: 30px; font-weight: 600; }
|
.page-header h1, .dashboard-header h1 { margin: 0; font-size: 28px; font-weight: 700; color: #0f172a; }
|
||||||
.page-header > p:last-child, .dashboard-header > div > p:last-child { color: #73817d; line-height: 1.6; }
|
.page-header > p:last-child, .dashboard-header > div > p:last-child { color: #64748b; line-height: 1.6; }
|
||||||
|
|
||||||
.section-card, .hero-card, .metric-strip { max-width: 760px; margin: 0 auto 16px; padding: 20px; background: #fff; border: 1px solid rgba(18,63,55,.06); border-radius: 20px; box-shadow: 0 8px 24px rgba(31,66,58,.05); }
|
.section-card, .hero-card, .metric-strip { max-width: 760px; margin: 0 auto 16px; padding: 20px; background: #fff; border: 1px solid rgba(2, 132, 199, 0.06); border-radius: 18px; box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04); }
|
||||||
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
|
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
|
||||||
.section-title > span { font-size: 18px; font-weight: 700; }
|
.section-title > span { font-size: 17px; font-weight: 700; color: #0f172a; }
|
||||||
.section-title small { color: #82908c; }
|
.section-title small { color: #64748b; }
|
||||||
.section-title button {
|
.section-title button {
|
||||||
border: 0;
|
border: 0;
|
||||||
background: rgba(12, 80, 69, 0.08);
|
background: rgba(2, 132, 199, 0.08);
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
padding: 4px 10px;
|
padding: 4px 10px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
@@ -141,13 +299,13 @@ button { cursor: pointer; }
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px solid var(--line);
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
background: #f8f8f4;
|
background: #f8fafc;
|
||||||
color: var(--deep);
|
color: var(--deep);
|
||||||
transition: .2s;
|
transition: .2s;
|
||||||
}
|
}
|
||||||
.module-card.selected { color: #fff; background: var(--green); transform: translateY(-2px); box-shadow: 0 12px 24px rgba(12,80,69,.18); }
|
.module-card.selected { color: #fff; background: var(--green); transform: translateY(-2px); box-shadow: 0 12px 24px rgba(2, 132, 199, 0.2); }
|
||||||
.module-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 10px; border: 1px solid currentColor; border-radius: 50%; font-size: 20px; flex-shrink: 0; }
|
.module-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 10px; border: 1px solid currentColor; border-radius: 50%; font-size: 20px; flex-shrink: 0; }
|
||||||
.module-card strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
|
.module-card strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
|
||||||
.module-card small { display: flex; align-items: center; justify-content: center; min-height: 28px; margin-top: 2px; opacity: .7; line-height: 1.35; font-size: 11px; }
|
.module-card small { display: flex; align-items: center; justify-content: center; min-height: 28px; margin-top: 2px; opacity: .7; line-height: 1.35; font-size: 11px; }
|
||||||
@@ -162,7 +320,7 @@ button { cursor: pointer; }
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
background: rgba(18, 63, 55, 0.08);
|
background: #f1f5f9;
|
||||||
color: var(--deep);
|
color: var(--deep);
|
||||||
}
|
}
|
||||||
.module-card.selected i {
|
.module-card.selected i {
|
||||||
@@ -172,42 +330,43 @@ button { cursor: pointer; }
|
|||||||
.form-card .van-field { padding: 12px 0; border-bottom: 1px solid #eee; }
|
.form-card .van-field { padding: 12px 0; border-bottom: 1px solid #eee; }
|
||||||
.form-card .van-field:last-of-type { border-bottom: 0; }
|
.form-card .van-field:last-of-type { border-bottom: 0; }
|
||||||
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
|
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
|
||||||
.sticky-action { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; padding: 14px 20px max(14px, env(safe-area-inset-bottom)); background: rgba(248,246,240,.94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
|
.sticky-action { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; padding: 14px 20px max(14px, env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(14px); border-top: 1px solid rgba(2, 132, 199, 0.08); }
|
||||||
.sticky-action .van-button { max-width: 720px; height: 50px; margin: 0 auto; font-size: 15px; font-weight: 600; box-shadow: 0 6px 18px rgba(12,80,69,.2); }
|
.sticky-action .van-button { max-width: 720px; height: 50px; margin: 0 auto; font-size: 15px; font-weight: 600; box-shadow: 0 6px 18px rgba(2, 132, 199, 0.2); }
|
||||||
|
|
||||||
.dashboard-header { display: flex; align-items: center; justify-content: space-between; }
|
.dashboard-header { display: flex; align-items: center; justify-content: space-between; }
|
||||||
.avatar-button { width: 46px; height: 46px; color: #fff; border: 0; border-radius: 50%; background: var(--green); }
|
.avatar-button { width: 44px; height: 44px; color: #0284c7; border: 1.5px solid rgba(2, 132, 199, 0.2); border-radius: 50%; background: #f0f9ff; font-weight: 700; box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08); }
|
||||||
.hero-card { padding: 26px; color: #fff; background: linear-gradient(140deg, #0c5549, #163f38); }
|
.hero-card { padding: 20px 18px; color: #0f172a; background: #ffffff; border: 1px solid #eef2f6; border-radius: 16px; box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05); }
|
||||||
.hero-card h2 { margin: 6px 0 12px; font-family: "Songti SC", serif; font-size: 28px; }
|
.hero-card h2 { margin: 6px 0 10px; font-size: 20px; font-weight: 700; color: #0f172a; }
|
||||||
.hero-card > p:not(.eyebrow) { color: rgba(255,255,255,.72); line-height: 1.7; }
|
.hero-card > p:not(.eyebrow) { color: #64748b; line-height: 1.65; font-size: 13px; }
|
||||||
.tag-row { display: flex; gap: 8px; margin: 18px 0; }
|
.tag-row { display: flex; gap: 8px; margin: 18px 0; }
|
||||||
.tag-row span { padding: 6px 12px; border-radius: 20px; background: rgba(255,255,255,.12); font-size: 12px; }
|
.tag-row span { padding: 6px 12px; border-radius: 20px; background: rgba(255,255,255,.16); font-size: 12px; }
|
||||||
.metric-strip { display: grid; grid-template-columns: repeat(3, 1fr); padding: 16px 8px; }
|
.metric-strip { display: grid; grid-template-columns: repeat(3, 1fr); padding: 16px 8px; }
|
||||||
.metric-strip div { padding: 4px 14px; border-right: 1px solid var(--line); }
|
.metric-strip div { padding: 4px 14px; border-right: 1px solid var(--line); }
|
||||||
.metric-strip div:last-child { border-right: 0; }
|
.metric-strip div:last-child { border-right: 0; }
|
||||||
.metric-strip small, .metric-strip strong { display: block; }
|
.metric-strip small, .metric-strip strong { display: block; }
|
||||||
.metric-strip small { color: #80908b; font-size: 11px; }
|
.metric-strip small { color: #64748b; font-size: 11px; }
|
||||||
.metric-strip strong { margin-top: 7px; font-size: 21px; }
|
.metric-strip strong { margin-top: 7px; font-size: 21px; }
|
||||||
.metric-strip em { margin-left: 3px; font-size: 11px; font-style: normal; font-weight: 500; }
|
.metric-strip em { margin-left: 3px; font-size: 11px; font-style: normal; font-weight: 500; }
|
||||||
.plan-item { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 16px 0; border-top: 1px solid #edf0ec; }
|
.plan-item { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 16px 0; border-top: 1px solid #f1f5f9; }
|
||||||
.plan-item:first-of-type { border-top: 0; }
|
.plan-item:first-of-type { border-top: 0; }
|
||||||
.plan-index { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--green); background: #e9f1ed; }
|
.plan-index { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--green); background: #f0f9ff; }
|
||||||
.plan-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
|
.plan-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
|
||||||
.plan-heading span { color: #b1813f; font-size: 12px; text-align: right; }
|
.plan-heading span { color: #0284c7; font-size: 12px; text-align: right; }
|
||||||
.plan-item p, .scene-row p { margin: 7px 0 0; color: #75847f; font-size: 13px; line-height: 1.6; }
|
.plan-item p, .scene-row p { margin: 7px 0 0; color: #64748b; font-size: 13px; line-height: 1.6; }
|
||||||
.status-dot { color: #a27639 !important; text-align: right; }
|
.status-dot { color: #f59e0b !important; text-align: right; }
|
||||||
.status-dot.online { color: #1c806a !important; }
|
.status-dot.online { color: #10b981 !important; }
|
||||||
.device-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
|
.device-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
|
||||||
/* Health Space Enhancement */
|
/* Health Space Enhancement */
|
||||||
.ha-summary-bar {
|
.ha-summary-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
background: #fbfbf9;
|
background: #ffffff;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid rgba(2, 132, 199, 0.08);
|
||||||
|
box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
|
||||||
}
|
}
|
||||||
.summary-item {
|
.summary-item {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -221,18 +380,19 @@ button { cursor: pointer; }
|
|||||||
top: 20%;
|
top: 20%;
|
||||||
height: 60%;
|
height: 60%;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
background: rgba(18, 63, 55, 0.08);
|
background: rgba(226, 232, 240, 0.8);
|
||||||
}
|
}
|
||||||
.summary-item span { display: block; font-size: 11px; color: #82908c; }
|
.summary-item span { display: block; font-size: 11px; color: #82908c; }
|
||||||
.summary-item strong { display: block; font-size: 16px; color: var(--green); margin-top: 2px; }
|
.summary-item strong { display: block; font-size: 16px; color: var(--green); margin-top: 2px; }
|
||||||
.summary-item em { font-size: 12px; font-style: normal; color: #82908c; font-weight: normal; }
|
.summary-item em { font-size: 12px; font-style: normal; color: #82908c; font-weight: normal; }
|
||||||
|
|
||||||
.smart-subcard {
|
.smart-subcard {
|
||||||
background: #fafaf8;
|
background: #ffffff;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid rgba(2, 132, 199, 0.06);
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
padding: 13px;
|
padding: 13px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
|
||||||
}
|
}
|
||||||
.smart-subcard:last-child { margin-bottom: 0; }
|
.smart-subcard:last-child { margin-bottom: 0; }
|
||||||
.subcard-header {
|
.subcard-header {
|
||||||
@@ -265,10 +425,10 @@ button { cursor: pointer; }
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
background: #edf7f3;
|
background: #f0f9ff;
|
||||||
padding: 3px 9px;
|
padding: 3px 9px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
border: 1px solid rgba(12, 80, 69, 0.15);
|
border: 1px solid rgba(2, 132, 199, 0.2);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@@ -282,7 +442,7 @@ button { cursor: pointer; }
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
background: #edf7f3;
|
background: #f0f9ff;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@@ -296,7 +456,7 @@ button { cursor: pointer; }
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.device-mini-status.green { background: #edf7f3; color: var(--green); }
|
.device-mini-status.green { background: #f0f9ff; color: var(--green); }
|
||||||
.device-mini-status.yellow { background: #fef7ec; color: #b8860b; }
|
.device-mini-status.yellow { background: #fef7ec; color: #b8860b; }
|
||||||
.device-mini-status.gray { background: #f1f3f2; color: #82908c; }
|
.device-mini-status.gray { background: #f1f3f2; color: #82908c; }
|
||||||
|
|
||||||
@@ -305,7 +465,7 @@ button { cursor: pointer; }
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 3px 9px;
|
padding: 3px 9px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.15);
|
border: 1px solid rgba(2, 132, 199, 0.2);
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -314,7 +474,7 @@ button { cursor: pointer; }
|
|||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
.sensor-mini-sync-btn:active {
|
.sensor-mini-sync-btn:active {
|
||||||
background: #edf7f3;
|
background: #f0f9ff;
|
||||||
}
|
}
|
||||||
.sensor-mini-sync-btn:disabled {
|
.sensor-mini-sync-btn:disabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
@@ -329,8 +489,8 @@ button { cursor: pointer; }
|
|||||||
padding: 12px 14px;
|
padding: 12px 14px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid rgba(2, 132, 199, 0.06);
|
||||||
box-shadow: 0 1px 2px rgba(18, 63, 55, 0.02);
|
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
|
||||||
}
|
}
|
||||||
.scene-info {
|
.scene-info {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -342,7 +502,7 @@ button { cursor: pointer; }
|
|||||||
}
|
}
|
||||||
.scene-info p {
|
.scene-info p {
|
||||||
margin: 3px 0 0;
|
margin: 3px 0 0;
|
||||||
color: #75847f;
|
color: #64748b;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@@ -358,17 +518,17 @@ button { cursor: pointer; }
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
padding: 7px 15px;
|
padding: 7px 15px;
|
||||||
border: 1px solid rgba(12, 80, 69, 0.2);
|
border: 1px solid rgba(2, 132, 199, 0.2);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
background: #edf7f3;
|
background: #f0f9ff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: .2s;
|
transition: .2s;
|
||||||
}
|
}
|
||||||
.scene-row button:active { background: var(--green); color: #fff; }
|
.scene-row button:active { background: var(--green); color: #fff; }
|
||||||
.scene-row button.secondary { color: #6e604f; border-color: rgba(110,96,79,.2); background: #f6f3ee; }
|
.scene-row button.secondary { color: #475569; border-color: #cbd5e1; background: #f8fafc; }
|
||||||
.scene-row button:disabled { cursor: not-allowed; opacity: .45; }
|
.scene-row button:disabled { cursor: not-allowed; opacity: .45; }
|
||||||
|
|
||||||
.scene-device-list {
|
.scene-device-list {
|
||||||
@@ -383,11 +543,11 @@ button { cursor: pointer; }
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
padding: 6px 9px;
|
padding: 6px 9px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid rgba(2, 132, 199, 0.06);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
box-shadow: 0 1px 2px rgba(18, 63, 55, 0.02);
|
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
|
||||||
}
|
}
|
||||||
.scene-device-chip .dot {
|
.scene-device-chip .dot {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
@@ -422,9 +582,9 @@ button { cursor: pointer; }
|
|||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
.chip-toggle-btn.on {
|
.chip-toggle-btn.on {
|
||||||
background: #0c5045;
|
background: var(--primary);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
border-color: #0c5045;
|
border-color: var(--primary);
|
||||||
}
|
}
|
||||||
.chip-toggle-btn.disabled {
|
.chip-toggle-btn.disabled {
|
||||||
opacity: 0.45;
|
opacity: 0.45;
|
||||||
@@ -438,7 +598,7 @@ button { cursor: pointer; }
|
|||||||
.scene-presets-panel {
|
.scene-presets-panel {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
border-top: 1px dashed rgba(18, 63, 55, 0.12);
|
border-top: 1px dashed rgba(2, 132, 199, 0.12);
|
||||||
}
|
}
|
||||||
.preset-panel-header {
|
.preset-panel-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -462,13 +622,13 @@ button { cursor: pointer; }
|
|||||||
}
|
}
|
||||||
.preset-card-item {
|
.preset-card-item {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid rgba(2, 132, 199, 0.06);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
box-shadow: 0 1px 2px rgba(18, 63, 55, 0.02);
|
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
|
||||||
}
|
}
|
||||||
.preset-card-item.unavailable {
|
.preset-card-item.unavailable {
|
||||||
background: #f7f8f7;
|
background: #f8fafc;
|
||||||
opacity: 0.72;
|
opacity: 0.72;
|
||||||
}
|
}
|
||||||
.preset-card-top {
|
.preset-card-top {
|
||||||
@@ -495,21 +655,21 @@ button { cursor: pointer; }
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 1px 6px;
|
padding: 1px 6px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: #edf7f3;
|
background: #f0f9ff;
|
||||||
color: var(--green);
|
color: var(--primary);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.preset-detail {
|
.preset-detail {
|
||||||
margin: 3px 0 0 20px;
|
margin: 3px 0 0 20px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #657470;
|
color: #64748b;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
.preset-availability {
|
.preset-availability {
|
||||||
margin: 4px 0 0 20px;
|
margin: 4px 0 0 20px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: var(--green);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
.preset-availability.unavailable {
|
.preset-availability.unavailable {
|
||||||
color: #9a6a38;
|
color: #9a6a38;
|
||||||
@@ -731,13 +891,13 @@ button { cursor: pointer; }
|
|||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
.device-switch-pill.on {
|
.device-switch-pill.on {
|
||||||
background: #edf7f3;
|
background: #f0f9ff;
|
||||||
border-color: rgba(16, 185, 129, 0.4);
|
border-color: rgba(2, 132, 199, 0.4);
|
||||||
color: var(--green);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
.device-switch-pill.on .switch-knob {
|
.device-switch-pill.on .switch-knob {
|
||||||
background: #10b981;
|
background: #0284c7;
|
||||||
box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
|
box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
|
||||||
}
|
}
|
||||||
.device-switch-pill.disabled {
|
.device-switch-pill.disabled {
|
||||||
opacity: 0.45;
|
opacity: 0.45;
|
||||||
@@ -749,15 +909,15 @@ button { cursor: pointer; }
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.15);
|
border: 1px solid rgba(2, 132, 199, 0.2);
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: var(--green);
|
color: var(--primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
.sensor-sync-pill:active {
|
.sensor-sync-pill:active {
|
||||||
background: #edf7f3;
|
background: #f0f9ff;
|
||||||
}
|
}
|
||||||
.sensor-sync-pill:disabled {
|
.sensor-sync-pill:disabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
@@ -771,16 +931,16 @@ button { cursor: pointer; }
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.status-pill.green { background: #edf7f3; color: var(--green); }
|
.status-pill.green { background: #f0f9ff; color: var(--primary); }
|
||||||
.status-pill.yellow { background: #fef7ec; color: #b8860b; }
|
.status-pill.yellow { background: #fef7ec; color: #b8860b; }
|
||||||
.status-pill.gray { background: #f1f3f2; color: #82908c; }
|
.status-pill.gray { background: #f1f3f2; color: #82908c; }
|
||||||
.entity-count { font-size: 10px; color: #9aa4a1; }
|
.entity-count { font-size: 10px; color: #9aa4a1; }
|
||||||
.medical-note { max-width: 760px; margin: 24px auto; color: #969e9b; font-size: 11px; text-align: center; }
|
.medical-note { max-width: 760px; margin: 24px auto; color: #94a3b8; font-size: 11px; text-align: center; }
|
||||||
.loading-card { color: #73817d; text-align: center; }
|
.loading-card { color: #64748b; text-align: center; }
|
||||||
|
|
||||||
@media (max-width: 520px) {
|
@media (max-width: 520px) {
|
||||||
.brand-panel { padding: 42px 20px 42px; }
|
.brand-panel { padding: 16px 4px 20px; }
|
||||||
.auth-card { margin-top: -16px; }
|
.auth-card { margin-top: 0; }
|
||||||
.plan-heading { display: block; }
|
.plan-heading { display: block; }
|
||||||
.plan-heading span { display: block; margin-top: 5px; text-align: left; }
|
.plan-heading span { display: block; margin-top: 5px; text-align: left; }
|
||||||
.device-grid { grid-template-columns: 1fr; }
|
.device-grid { grid-template-columns: 1fr; }
|
||||||
@@ -791,6 +951,7 @@ button { cursor: pointer; }
|
|||||||
|
|
||||||
.dashboard-page {
|
.dashboard-page {
|
||||||
padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom, 0px));
|
padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom, 0px));
|
||||||
|
background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%);
|
||||||
}
|
}
|
||||||
.dashboard-header {
|
.dashboard-header {
|
||||||
margin: 0 auto 20px;
|
margin: 0 auto 20px;
|
||||||
@@ -808,12 +969,13 @@ button { cursor: pointer; }
|
|||||||
|
|
||||||
/* 评估未填提醒卡片 */
|
/* 评估未填提醒卡片 */
|
||||||
.assessment-guide-banner {
|
.assessment-guide-banner {
|
||||||
background: linear-gradient(135deg, #b37318, #92580c);
|
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
|
||||||
color: #fff;
|
color: #0f172a;
|
||||||
border-radius: 18px;
|
border-radius: 18px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
box-shadow: 0 6px 18px rgba(179, 115, 24, 0.22);
|
border: 1px solid rgba(2, 132, 199, 0.16);
|
||||||
|
box-shadow: 0 4px 14px rgba(2, 132, 199, 0.06);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -825,18 +987,19 @@ button { cursor: pointer; }
|
|||||||
bottom: -20px;
|
bottom: -20px;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
|
background: radial-gradient(circle, rgba(2, 132, 199, 0.08) 0%, transparent 70%);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
.guide-badge {
|
.guide-badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: rgba(255, 255, 255, 0.22);
|
background: #ffffff;
|
||||||
color: #fff;
|
color: #0284c7;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
|
border: 1px solid rgba(2, 132, 199, 0.18);
|
||||||
}
|
}
|
||||||
.guide-body {
|
.guide-body {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -848,11 +1011,12 @@ button { cursor: pointer; }
|
|||||||
margin: 0 0 4px;
|
margin: 0 0 4px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
.guide-text p {
|
.guide-text p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: rgba(255, 255, 255, 0.88);
|
color: #64748b;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
.guide-btn {
|
.guide-btn {
|
||||||
@@ -860,22 +1024,22 @@ button { cursor: pointer; }
|
|||||||
padding: 8px 14px;
|
padding: 8px 14px;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
border: 0;
|
border: 0;
|
||||||
background: #ffffff;
|
background: #0284c7;
|
||||||
color: #92580c;
|
color: #ffffff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 个性化舒睡启动参数卡片 */
|
/* 个性化舒睡启动参数卡片 */
|
||||||
.personalized-startup-card {
|
.personalized-startup-card {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border: 1px solid rgba(12, 80, 69, 0.1);
|
border: 1px solid rgba(2, 132, 199, 0.08);
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 18px 16px;
|
padding: 18px 16px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
box-shadow: 0 4px 16px rgba(18, 63, 55, 0.04);
|
box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
|
||||||
}
|
}
|
||||||
.personalized-startup-card .section-title {
|
.personalized-startup-card .section-title {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -885,13 +1049,13 @@ button { cursor: pointer; }
|
|||||||
.personalized-startup-card .section-title > span {
|
.personalized-startup-card .section-title > span {
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #143d36;
|
color: #0f172a;
|
||||||
letter-spacing: 0.01em;
|
letter-spacing: 0.01em;
|
||||||
}
|
}
|
||||||
.startup-card-desc {
|
.startup-card-desc {
|
||||||
margin: 0 0 14px;
|
margin: 0 0 14px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #72847e;
|
color: #64748b;
|
||||||
line-height: 1.55;
|
line-height: 1.55;
|
||||||
}
|
}
|
||||||
.startup-params-tags {
|
.startup-params-tags {
|
||||||
@@ -901,20 +1065,20 @@ button { cursor: pointer; }
|
|||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
}
|
}
|
||||||
.startup-param-badge {
|
.startup-param-badge {
|
||||||
background: #f7f6f2;
|
background: #f8fafc;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.08);
|
border: 1px solid rgba(2, 132, 199, 0.08);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
}
|
}
|
||||||
.startup-param-badge .lbl {
|
.startup-param-badge .lbl {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: #849690;
|
color: #64748b;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
.startup-param-badge strong {
|
.startup-param-badge strong {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #173d36;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
.startup-scene-actions {
|
.startup-scene-actions {
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -934,21 +1098,23 @@ button { cursor: pointer; }
|
|||||||
opacity: 0.45;
|
opacity: 0.45;
|
||||||
}
|
}
|
||||||
.startup-action-primary {
|
.startup-action-primary {
|
||||||
border: 1px solid #0c5045;
|
border: none;
|
||||||
background: #0c5045;
|
background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
box-shadow: 0 6px 16px -2px rgba(2, 132, 199, 0.35);
|
||||||
|
border-radius: 14px;
|
||||||
}
|
}
|
||||||
.startup-action-secondary {
|
.startup-action-secondary {
|
||||||
border: 1px solid rgba(12, 80, 69, 0.2);
|
border: 1px solid #e2e8f0;
|
||||||
background: #f7f6f2;
|
background: #f8fafc;
|
||||||
color: #335b53;
|
color: #475569;
|
||||||
}
|
}
|
||||||
.detail-entry-bar {
|
.detail-entry-bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
background: #f8f7f2;
|
background: #f8fafc;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.08);
|
border: 1px solid rgba(2, 132, 199, 0.06);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
@@ -956,7 +1122,7 @@ button { cursor: pointer; }
|
|||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
.detail-entry-bar:active {
|
.detail-entry-bar:active {
|
||||||
background: #f0eee7;
|
background: #f1f5f9;
|
||||||
}
|
}
|
||||||
.entry-left {
|
.entry-left {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -969,15 +1135,15 @@ button { cursor: pointer; }
|
|||||||
.entry-left strong {
|
.entry-left strong {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #173d36;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
.entry-left small {
|
.entry-left small {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #82928c;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
.detail-entry-bar .arrow {
|
.detail-entry-bar .arrow {
|
||||||
color: #a0ada7;
|
color: #94a3b8;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,8 +1152,8 @@ button { cursor: pointer; }
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
background: linear-gradient(135deg, #edf6f3, #e5f0ec);
|
background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
|
||||||
border: 1px solid rgba(12, 80, 69, 0.16);
|
border: 1px solid rgba(2, 132, 199, 0.16);
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
padding: 12px 14px;
|
padding: 12px 14px;
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
@@ -995,7 +1161,7 @@ button { cursor: pointer; }
|
|||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
.all-control-banner:active {
|
.all-control-banner:active {
|
||||||
background: #dbeef7;
|
background: #d4edff;
|
||||||
}
|
}
|
||||||
.ac-text {
|
.ac-text {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -1008,17 +1174,17 @@ button { cursor: pointer; }
|
|||||||
.ac-text strong {
|
.ac-text strong {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
.ac-text small {
|
.ac-text small {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #55756d;
|
color: #0284c7;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
.ac-arrow {
|
.ac-arrow {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-105
@@ -1,5 +1,5 @@
|
|||||||
.control-page {
|
.control-page {
|
||||||
background: #f2f0e9;
|
background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding-bottom: 40px;
|
padding-bottom: 40px;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
padding: 14px 16px;
|
padding: 14px 16px;
|
||||||
background: rgba(255, 255, 255, 0.95);
|
background: rgba(255, 255, 255, 0.95);
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
border-bottom: 1px solid rgba(18, 63, 55, 0.08);
|
border-bottom: 1px solid rgba(2, 132, 199, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .back-btn {
|
.control-page .back-btn {
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
gap: 4px;
|
gap: 4px;
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -34,13 +34,13 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #153e37;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .refresh-btn {
|
.control-page .refresh-btn {
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -58,19 +58,20 @@
|
|||||||
|
|
||||||
/* 汇总卡片 */
|
/* 汇总卡片 */
|
||||||
.control-page .summary-box {
|
.control-page .summary-box {
|
||||||
background: linear-gradient(135deg, #0c5045, #14443c);
|
background: #ffffff;
|
||||||
color: #fff;
|
color: #0f172a;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 16px;
|
padding: 18px 16px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
box-shadow: 0 6px 20px rgba(12, 80, 69, 0.12);
|
border: 1px solid rgba(2, 132, 199, 0.08);
|
||||||
|
box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .summary-info {
|
.control-page .summary-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
padding-bottom: 14px;
|
padding-bottom: 14px;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.15);
|
border-bottom: 1px solid #f1f5f9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .stat-item {
|
.control-page .stat-item {
|
||||||
@@ -81,16 +82,17 @@
|
|||||||
display: block;
|
display: block;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-family: serif;
|
font-family: inherit;
|
||||||
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .stat-item .num.online {
|
.control-page .stat-item .num.online {
|
||||||
color: #92eec4;
|
color: #0284c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .stat-item .label {
|
.control-page .stat-item .label {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: rgba(255, 255, 255, 0.75);
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .scene-actions-grid {
|
.control-page .scene-actions-grid {
|
||||||
@@ -118,17 +120,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.control-page .sleep-btn {
|
.control-page .sleep-btn {
|
||||||
background: rgba(214, 166, 87, 0.2);
|
background: #0284c7;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
border: 1px solid #0284c7;
|
||||||
|
box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .sleep-btn:active {
|
.control-page .sleep-btn:active {
|
||||||
background: rgba(214, 166, 87, 0.35);
|
background: #0958d9;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .off-btn {
|
.control-page .off-btn {
|
||||||
background: rgba(255, 255, 255, 0.08);
|
background: #f8fafc;
|
||||||
color: rgba(255, 255, 255, 0.85);
|
color: #475569;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .s-icon {
|
.control-page .s-icon {
|
||||||
@@ -156,7 +161,7 @@
|
|||||||
min-height: 38px;
|
min-height: 38px;
|
||||||
padding: 9px 12px;
|
padding: 9px 12px;
|
||||||
margin: -4px 2px 14px;
|
margin: -4px 2px 14px;
|
||||||
border: 1px solid rgba(12, 80, 69, 0.12);
|
border: 1px solid rgba(2, 132, 199, 0.12);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: rgba(255, 255, 255, 0.72);
|
background: rgba(255, 255, 255, 0.72);
|
||||||
color: #536a62;
|
color: #536a62;
|
||||||
@@ -164,9 +169,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.control-page .operation-status.success {
|
.control-page .operation-status.success {
|
||||||
border-color: rgba(12, 80, 69, 0.22);
|
border-color: rgba(2, 132, 199, 0.22);
|
||||||
background: #f0f8f5;
|
background: #f0f9ff;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .operation-status.fail {
|
.control-page .operation-status.fail {
|
||||||
@@ -204,8 +209,8 @@
|
|||||||
.control-page .operation-spinner {
|
.control-page .operation-spinner {
|
||||||
width: 15px;
|
width: 15px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
border: 2px solid rgba(12, 80, 69, 0.18);
|
border: 2px solid rgba(2, 132, 199, 0.18);
|
||||||
border-top-color: #0c5045;
|
border-top-color: #0284c7;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
animation: operation-spin 0.75s linear infinite;
|
animation: operation-spin 0.75s linear infinite;
|
||||||
}
|
}
|
||||||
@@ -220,8 +225,8 @@
|
|||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid rgba(2, 132, 199, 0.06);
|
||||||
box-shadow: 0 4px 16px rgba(18, 63, 55, 0.04);
|
box-shadow: 0 4px 16px rgba(2, 132, 199, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .device-head {
|
.control-page .device-head {
|
||||||
@@ -230,7 +235,7 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
border-bottom: 1px solid rgba(18, 63, 55, 0.06);
|
border-bottom: 1px solid rgba(2, 132, 199, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .speaker-actions {
|
.control-page .speaker-actions {
|
||||||
@@ -241,8 +246,8 @@
|
|||||||
|
|
||||||
.control-page .category-tag {
|
.control-page .category-tag {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
background: #eef6f3;
|
background: #f0f9ff;
|
||||||
padding: 2px 6px;
|
padding: 2px 6px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -251,7 +256,7 @@
|
|||||||
.control-page .dev-info h3 {
|
.control-page .dev-info h3 {
|
||||||
margin: 4px 0 2px;
|
margin: 4px 0 2px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #173d36;
|
color: #0f172a;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,14 +266,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.control-page .status-dot.online {
|
.control-page .status-dot.online {
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .text-refresh {
|
.control-page .text-refresh {
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
@@ -307,45 +312,16 @@
|
|||||||
|
|
||||||
.control-page .p-val {
|
.control-page .p-val {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .p-tip {
|
.control-page .p-tip {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #8fa099;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .mattress-mode-note {
|
|
||||||
margin: 0;
|
|
||||||
padding: 9px 11px;
|
|
||||||
border-radius: 9px;
|
|
||||||
background: #fff7e8;
|
|
||||||
color: #8a6428;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 1.55;
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-page .mattress-recommendation {
|
|
||||||
padding: 12px;
|
|
||||||
border: 1px solid #cde3dc;
|
|
||||||
border-radius: 12px;
|
|
||||||
background: #f3faf7;
|
|
||||||
color: #174d40;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 1.55;
|
|
||||||
}
|
|
||||||
.control-page .mattress-recommendation strong { font-size: 13px; }
|
|
||||||
.control-page .mattress-recommendation p { margin: 7px 0 0; }
|
|
||||||
.control-page .mattress-recommendation small { display: block; margin-top: 6px; color: #6a8479; }
|
|
||||||
.control-page .mattress-advanced { border-top: 1px solid #e8efea; padding-top: 12px; }
|
|
||||||
.control-page .mattress-advanced summary { cursor: pointer; color: #0c5045; font-weight: 700; font-size: 14px; }
|
|
||||||
.control-page .mattress-advanced .mattress-mode-note { margin: 12px 0; }
|
|
||||||
.control-page .mattress-select-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1ee; }
|
|
||||||
.control-page .mattress-select-row label { color: #556c64; font-size: 12px; }
|
|
||||||
.control-page .mattress-select-row select { width: 48%; min-height: 36px; border: 1px solid #d9e6de; border-radius: 9px; background: #fff; padding: 5px 8px; color: #174d40; font-size: 12px; }
|
|
||||||
|
|
||||||
.control-page .light-mode-panel {
|
.control-page .light-mode-panel {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
@@ -436,29 +412,23 @@
|
|||||||
.control-page .btn-group button {
|
.control-page .btn-group button {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 8px 4px;
|
padding: 8px 4px;
|
||||||
background: #f7f6f2;
|
background: #f8fafc;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.1);
|
border: 1px solid rgba(2, 132, 199, 0.1);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #4b5e57;
|
color: #334155;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .btn-group button.active {
|
.control-page .btn-group button.active {
|
||||||
background: #0c5045;
|
background: #0284c7;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-color: #0c5045;
|
border-color: #0284c7;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .mattress-mode-buttons button.active:not(.running) {
|
|
||||||
background: #e4f1ec;
|
|
||||||
color: #0c5045;
|
|
||||||
border-color: #87b9a7;
|
|
||||||
}
|
|
||||||
|
|
||||||
.control-page .btn-group button:disabled,
|
.control-page .btn-group button:disabled,
|
||||||
.control-page .mini-toggle:disabled {
|
.control-page .mini-toggle:disabled {
|
||||||
opacity: 0.55;
|
opacity: 0.55;
|
||||||
@@ -468,18 +438,18 @@
|
|||||||
.control-page .mini-toggle {
|
.control-page .mini-toggle {
|
||||||
padding: 6px 14px;
|
padding: 6px 14px;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.15);
|
border: 1px solid rgba(2, 132, 199, 0.15);
|
||||||
background: #f4f3ef;
|
background: #f8fafc;
|
||||||
color: #6a7c76;
|
color: #64748b;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .mini-toggle.active {
|
.control-page .mini-toggle.active {
|
||||||
background: #0c5045;
|
background: #0284c7;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-color: #0c5045;
|
border-color: #0284c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 传感器网格 */
|
/* 传感器网格 */
|
||||||
@@ -490,7 +460,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.control-page .sensor-box {
|
.control-page .sensor-box {
|
||||||
background: #f8f7f2;
|
background: #f8fafc;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 10px 8px;
|
padding: 10px 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -499,13 +469,13 @@
|
|||||||
.control-page .s-label {
|
.control-page .s-label {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #798a83;
|
color: #64748b;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .sensor-box strong {
|
.control-page .sensor-box strong {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #173d36;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .sensor-box small {
|
.control-page .sensor-box small {
|
||||||
@@ -516,17 +486,17 @@
|
|||||||
.control-page .scale-note {
|
.control-page .scale-note {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #72847d;
|
color: #64748b;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.control-page .tcm-guide-button {
|
.control-page .tcm-guide-button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
border: 1px solid rgba(255, 255, 255, .35);
|
border: 1px solid rgba(2, 132, 199, 0.2);
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: rgba(255, 255, 255, .12);
|
background: #f0f9ff;
|
||||||
color: #fff;
|
color: #0284c7;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -540,41 +510,41 @@
|
|||||||
.control-page .top-nav h2 { min-width: 0; margin: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.control-page .top-nav h2 { min-width: 0; margin: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.control-page .back-btn, .control-page .refresh-btn { flex-shrink: 0; }
|
.control-page .back-btn, .control-page .refresh-btn { flex-shrink: 0; }
|
||||||
.control-page .device-list-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 0; }
|
.control-page .device-list-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px 0; }
|
||||||
.control-page .device-list-heading h3 { margin: 0; color: #173d36; font-size: 18px; }
|
.control-page .device-list-heading h3 { margin: 0; color: #0f172a; font-size: 18px; }
|
||||||
.control-page .device-list-heading > span { color: #86948b; font-size: 12px; }
|
.control-page .device-list-heading > span { color: #86948b; font-size: 12px; }
|
||||||
.control-page .device-list-hint { margin: 7px 2px 14px; color: #84948b; font-size: 12px; line-height: 1.6; }
|
.control-page .device-list-hint { margin: 7px 2px 14px; color: #84948b; font-size: 12px; line-height: 1.6; }
|
||||||
.control-page .device-room-tabs { display: flex; gap: 22px; overflow-x: auto; padding: 0 2px; margin-bottom: 14px; scrollbar-width: none; }
|
.control-page .device-room-tabs { display: flex; gap: 22px; overflow-x: auto; padding: 0 2px; margin-bottom: 14px; scrollbar-width: none; }
|
||||||
.control-page .device-room-tabs button { flex-shrink: 0; border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 8px 0; color: #8a978f; font-size: 14px; cursor: pointer; }
|
.control-page .device-room-tabs button { flex-shrink: 0; border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 8px 0; color: #64748b; font-size: 14px; cursor: pointer; }
|
||||||
.control-page .device-room-tabs button.active { color: #0c5045; font-weight: 700; border-bottom-color: #0c5045; }
|
.control-page .device-room-tabs button.active { color: #0284c7; font-weight: 700; border-bottom-color: #0284c7; }
|
||||||
.control-page .device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
.control-page .device-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
||||||
.control-page .device-overview-tile { position: relative; min-width: 0; background: #fff; border: 1px solid rgba(18, 63, 55, .06); border-radius: 20px; overflow: hidden; box-shadow: 0 3px 16px rgba(18, 63, 55, .025); }
|
.control-page .device-overview-tile { position: relative; min-width: 0; background: #fff; border: 1px solid rgba(2, 132, 199, .06); border-radius: 20px; overflow: hidden; box-shadow: 0 3px 16px rgba(2, 132, 199, .025); }
|
||||||
.control-page .device-overview-tile.powered { border-color: #bfd7cb; }
|
.control-page .device-overview-tile.powered { border-color: rgba(2, 132, 199, 0.3); }
|
||||||
.control-page .device-tile-open { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 230px; padding: 17px 14px 13px; border: 0; background: transparent; color: #31584a; text-align: left; cursor: pointer; }
|
.control-page .device-tile-open { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 230px; padding: 17px 14px 13px; border: 0; background: transparent; color: #0f172a; text-align: left; cursor: pointer; }
|
||||||
.control-page .device-tile-category { width: calc(100% - 42px); font-size: 10px; color: #87968c; }
|
.control-page .device-tile-category { width: calc(100% - 42px); font-size: 10px; color: #87968c; }
|
||||||
.control-page .device-glyph { width: 76px; height: 76px; margin: 13px 0 9px; flex-shrink: 0; }
|
.control-page .device-glyph { width: 76px; height: 76px; margin: 13px 0 9px; flex-shrink: 0; }
|
||||||
.control-page .device-tile-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; width: 100%; min-height: 38px; line-height: 19px; font-size: 14px; font-weight: 700; color: #203d32; overflow-wrap: anywhere; }
|
.control-page .device-tile-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; width: 100%; min-height: 38px; line-height: 19px; font-size: 14px; font-weight: 700; color: #0f172a; overflow-wrap: anywhere; }
|
||||||
.control-page .device-tile-status { display: flex; align-items: center; gap: 5px; margin-top: 7px; color: #708279; font-size: 11px; line-height: 16px; }
|
.control-page .device-tile-status { display: flex; align-items: center; gap: 5px; margin-top: 7px; color: #64748b; font-size: 11px; line-height: 16px; }
|
||||||
.control-page .device-tile-status i { width: 5px; height: 5px; border-radius: 50%; background: #bcc4be; flex-shrink: 0; }
|
.control-page .device-tile-status i { width: 5px; height: 5px; border-radius: 50%; background: #bcc4be; flex-shrink: 0; }
|
||||||
.control-page .device-tile-status i.online { background: #609b7f; }
|
.control-page .device-tile-status i.online { background: #10b981; }
|
||||||
.control-page .device-tile-metric { margin-top: 3px; color: #9aa59d; font-size: 10px; line-height: 16px; }
|
.control-page .device-tile-metric { margin-top: 3px; color: #64748b; font-size: 10px; line-height: 16px; }
|
||||||
.control-page .device-tile-footer { display: flex; justify-content: space-between; align-items: center; gap: 4px; width: 100%; padding-top: 10px; margin-top: auto; color: #a0aaa2; font-size: 10px; line-height: 15px; }
|
.control-page .device-tile-footer { display: flex; justify-content: space-between; align-items: center; gap: 4px; width: 100%; padding-top: 10px; margin-top: auto; color: #64748b; font-size: 10px; line-height: 15px; }
|
||||||
.control-page .device-tile-footer > span { font-size: 18px; color: #738b7d; }
|
.control-page .device-tile-footer > span { font-size: 18px; color: #738b7d; }
|
||||||
.control-page .device-tile-power { position: absolute; right: 11px; top: 12px; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f0f2ed; color: #849187; cursor: pointer; }
|
.control-page .device-tile-power { position: absolute; right: 11px; top: 12px; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f8fafc; color: #849187; cursor: pointer; }
|
||||||
.control-page .device-tile-power.on { background: #e3f0e8; color: #0c5045; }
|
.control-page .device-tile-power.on { background: #f0f9ff; color: #0284c7; }
|
||||||
.control-page .device-tile-power svg { width: 21px; height: 21px; }
|
.control-page .device-tile-power svg { width: 21px; height: 21px; }
|
||||||
.control-page .device-tile-power:disabled { opacity: .45; cursor: not-allowed; }
|
.control-page .device-tile-power:disabled { opacity: .45; cursor: not-allowed; }
|
||||||
.control-page .device-overview-tile.offline .device-glyph { opacity: .45; }
|
.control-page .device-overview-tile.offline .device-glyph { opacity: .45; }
|
||||||
.control-page .device-overview-tile.offline .device-tile-name { color: #8e9991; }
|
.control-page .device-overview-tile.offline .device-tile-name { color: #8e9991; }
|
||||||
.control-page .device-tile-open:focus-visible, .control-page .device-tile-power:focus-visible, .control-page .device-room-tabs button:focus-visible { outline: 2px solid #649b82; outline-offset: -3px; }
|
.control-page .device-tile-open:focus-visible, .control-page .device-tile-power:focus-visible, .control-page .device-room-tabs button:focus-visible { outline: 2px solid #0284c7; outline-offset: -3px; }
|
||||||
.control-page .device-tile-skeleton { height: 252px; border-radius: 20px; background: #f9faf6; border: 1px solid rgba(18, 63, 55, .04); }
|
.control-page .device-tile-skeleton { height: 252px; border-radius: 20px; background: #f9faf6; border: 1px solid rgba(2, 132, 199, .04); }
|
||||||
.control-page .device-empty-state { padding: 28px 20px; border-radius: 20px; background: #fff; text-align: center; color: #86968d; font-size: 13px; line-height: 1.7; }
|
.control-page .device-empty-state { padding: 28px 20px; border-radius: 20px; background: #fff; text-align: center; color: #64748b; font-size: 13px; line-height: 1.7; }
|
||||||
.control-page .device-empty-state strong { display: block; color: #3f5e4d; font-size: 15px; }
|
.control-page .device-empty-state strong { display: block; color: #0f172a; font-size: 15px; }
|
||||||
.control-page .device-empty-state p { margin: 10px 0 16px; overflow-wrap: anywhere; }
|
.control-page .device-empty-state p { margin: 10px 0 16px; overflow-wrap: anywhere; }
|
||||||
.control-page .device-connection-note { padding: 11px 13px; margin-bottom: 14px; background: #fff5e5; border-radius: 12px; color: #a47b43; font-size: 12px; line-height: 1.6; }
|
.control-page .device-connection-note { padding: 11px 13px; margin-bottom: 14px; background: #fff5e5; border-radius: 12px; color: #a47b43; font-size: 12px; line-height: 1.6; }
|
||||||
.control-page .device-information { padding: 17px; border-radius: 20px; background: #fff; }
|
.control-page .device-information { padding: 17px; border-radius: 20px; background: #fff; }
|
||||||
.control-page .device-information h3 { margin: 0 0 10px; font-size: 13px; color: #607a6b; }
|
.control-page .device-information h3 { margin: 0 0 10px; font-size: 13px; color: #0f172a; }
|
||||||
.control-page .device-information p { display: flex; justify-content: space-between; gap: 16px; margin: 10px 0 0; font-size: 12px; color: #87968d; }
|
.control-page .device-information p { display: flex; justify-content: space-between; gap: 16px; margin: 10px 0 0; font-size: 12px; color: #64748b; }
|
||||||
.control-page .device-information p span:last-child { color: #486657; text-align: right; overflow-wrap: anywhere; }
|
.control-page .device-information p span:last-child { color: #0f172a; text-align: right; overflow-wrap: anywhere; }
|
||||||
@media (max-width: 350px) {
|
@media (max-width: 350px) {
|
||||||
.control-page .device-grid { gap: 8px; }
|
.control-page .device-grid { gap: 8px; }
|
||||||
.control-page .device-tile-open { padding-left: 11px; padding-right: 11px; }
|
.control-page .device-tile-open { padding-left: 11px; padding-right: 11px; }
|
||||||
|
|||||||
+84
-76
@@ -1,25 +1,28 @@
|
|||||||
/* Demo 的共用视觉层:沿用暖白 / 深绿,不改动设备参数或评分规则。 */
|
/* Demo 的共用视觉层:现代科技蓝 / 纯白轻卡片,不改动设备参数或评分规则。 */
|
||||||
:root {
|
:root {
|
||||||
--page-gutter: 16px;
|
--page-gutter: 16px;
|
||||||
--surface-radius: 20px;
|
--surface-radius: 20px;
|
||||||
--surface-shadow: 0 4px 18px rgba(18, 63, 55, .035);
|
--surface-shadow: 0 4px 20px rgba(15, 23, 42, .04);
|
||||||
--muted-text: #65776e;
|
--muted-text: #64748b;
|
||||||
}
|
}
|
||||||
button, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
|
button, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
|
||||||
button:focus-visible, summary:focus-visible, a:focus-visible {
|
button:focus-visible, summary:focus-visible, a:focus-visible {
|
||||||
outline: 2px solid #4d937b;
|
outline: 2px solid #0284c7;
|
||||||
outline-offset: 3px;
|
outline-offset: 3px;
|
||||||
}
|
}
|
||||||
input:focus-visible, textarea:focus-visible, select:focus-visible {
|
input:focus-visible, textarea:focus-visible, select:focus-visible {
|
||||||
outline: 2px solid rgba(12, 80, 69, .35);
|
outline: 2px solid rgba(2, 132, 199, .35);
|
||||||
outline-offset: 1px;
|
outline-offset: 1px;
|
||||||
}
|
}
|
||||||
button:disabled { cursor: not-allowed; }
|
button:disabled { cursor: not-allowed; }
|
||||||
button, input, textarea, select { max-width: 100%; }
|
button, input, textarea, select { max-width: 100%; }
|
||||||
input, textarea { accent-color: var(--green); }
|
input, textarea { accent-color: var(--green); }
|
||||||
|
|
||||||
#app :is(.page-shell, .assessment-page, .tcm-page, .profile-page) {
|
#app :is(.page-shell, .dashboard-page, .assessment-page, .tcm-page, .profile-page) {
|
||||||
padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
|
padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom, 0px));
|
||||||
|
background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
#app :is(.section-card, .profile-card, .tcm-card, .card-section) {
|
#app :is(.section-card, .profile-card, .tcm-card, .card-section) {
|
||||||
border-radius: var(--surface-radius);
|
border-radius: var(--surface-radius);
|
||||||
@@ -32,82 +35,83 @@ input, textarea { accent-color: var(--green); }
|
|||||||
}
|
}
|
||||||
#app .dashboard-header { gap: 16px; align-items: center; }
|
#app .dashboard-header { gap: 16px; align-items: center; }
|
||||||
#app .dashboard-header > div { min-width: 0; }
|
#app .dashboard-header > div { min-width: 0; }
|
||||||
#app .dashboard-header .eyebrow { margin-bottom: 7px; font-size: 10px; }
|
#app .dashboard-header .eyebrow { margin-bottom: 7px; font-size: 10px; color: #0284c7; }
|
||||||
#app .avatar-button { flex-shrink: 0; font-weight: 700; box-shadow: 0 0 0 5px rgba(12, 80, 69, .045); }
|
#app .avatar-button { flex-shrink: 0; font-weight: 700; box-shadow: 0 2px 8px rgba(2, 132, 199, .1); background: #f0f9ff; color: #0284c7; border: 1.5px solid rgba(2, 132, 199, 0.2); }
|
||||||
#app .dashboard-page .personalized-startup-card { padding: 20px 18px 16px; }
|
#app .dashboard-page .personalized-startup-card { padding: 20px 18px 16px; }
|
||||||
#app .personalized-startup-card .section-title { gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
|
#app .personalized-startup-card .section-title { gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
|
||||||
#app .personalized-startup-card .section-title > span:first-child { font-size: 19px; }
|
#app .personalized-startup-card .section-title > span:first-child { font-size: 19px; }
|
||||||
#app .constitution-chip { background: #eaf3ed; padding: 5px 10px; border-radius: 20px; color: #0c5045; font-size: 12px; font-weight: 600; }
|
#app .constitution-chip { background: #f0f9ff; padding: 5px 10px; border-radius: 20px; color: #0284c7; font-size: 12px; font-weight: 600; }
|
||||||
#app .startup-card-desc { color: var(--muted-text); font-size: 12px; line-height: 1.7; margin: 0 0 12px; }
|
#app .startup-card-desc { color: var(--muted-text); font-size: 12px; line-height: 1.7; margin: 0 0 12px; }
|
||||||
.scene-availability { margin: 0 0 14px; padding: 10px 12px; background: #f4f7f2; border-radius: 12px; color: #547263; font-size: 12px; line-height: 1.6; }
|
.scene-availability { margin: 0 0 14px; padding: 10px 12px; background: #f1f5f9; border-radius: 12px; color: #475569; font-size: 12px; line-height: 1.6; }
|
||||||
.scene-availability.unavailable { background: #faf5eb; color: #9a7647; }
|
.scene-availability.unavailable { background: #fff7ed; color: #c2410c; }
|
||||||
#app .startup-scene-actions { margin: 0; }
|
#app .startup-scene-actions { margin: 0; }
|
||||||
#app .startup-scene-actions button { min-height: 48px; font-size: 14px; border-radius: 14px; }
|
#app .startup-scene-actions button { min-height: 48px; font-size: 14px; border-radius: 14px; }
|
||||||
.scene-feedback { margin: 12px 0 0; font-size: 12px; line-height: 1.7; padding: 10px 12px; border-radius: 11px; background: #f4f7f2; color: #547263; overflow-wrap: anywhere; }
|
.scene-feedback { margin: 12px 0 0; font-size: 12px; line-height: 1.7; padding: 10px 12px; border-radius: 11px; background: #f1f5f9; color: #475569; overflow-wrap: anywhere; }
|
||||||
.scene-feedback.fail { color: #9b6144; background: #fff4ea; }
|
.scene-feedback.fail { color: #dc2626; background: #fef2f2; }
|
||||||
.scene-feedback.success { color: #0c5045; background: #eef7f1; }
|
.scene-feedback.success { color: #0284c7; background: #f0f9ff; }
|
||||||
.inline-link { border: 0; background: transparent; color: #0c5045; font-size: 13px; padding: 10px 0 0; min-height: 44px; font-weight: 600; }
|
.inline-link { border: 0; background: transparent; color: #0284c7; font-size: 13px; padding: 10px 0 0; min-height: 44px; font-weight: 600; }
|
||||||
#app .detail-entry-bar { width: 100%; text-align: left; margin-top: 16px; background: #f8f8f4; border: 1px solid #edf0e8; padding: 13px 12px; }
|
#app .detail-entry-bar { width: 100%; text-align: left; margin-top: 16px; background: #f8fafc; border: 1px solid rgba(2, 132, 199, 0.06); padding: 13px 12px; }
|
||||||
#app .entry-left { min-width: 0; gap: 12px; }
|
#app .entry-left { min-width: 0; gap: 12px; }
|
||||||
#app .entry-left strong { font-size: 14px; }
|
#app .entry-left strong { font-size: 14px; }
|
||||||
#app .entry-left small { font-size: 12px; margin-top: 3px; line-height: 1.5; }
|
#app .entry-left small { font-size: 12px; margin-top: 3px; line-height: 1.5; }
|
||||||
.entry-symbol { width: 34px; height: 34px; display: grid; place-items: center; flex-shrink: 0; background: #e9f1e9; color: #0c5045; border-radius: 10px; font-size: 23px; }
|
.entry-symbol { width: 34px; height: 34px; display: grid; place-items: center; flex-shrink: 0; background: #f0f9ff; color: #0284c7; border-radius: 10px; font-size: 23px; }
|
||||||
.startup-preset-details { border-top: 1px solid #edf0e9; margin-top: 16px; padding-top: 1px; }
|
.startup-preset-details { border-top: 1px solid #e2e8f0; margin-top: 16px; padding-top: 1px; }
|
||||||
.startup-preset-details summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; list-style: none; color: #698172; font-size: 12px; cursor: pointer; }
|
.startup-preset-details summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; list-style: none; color: #64748b; font-size: 12px; cursor: pointer; }
|
||||||
.startup-preset-details summary::-webkit-details-marker { display: none; }
|
.startup-preset-details summary::-webkit-details-marker { display: none; }
|
||||||
.startup-preset-details summary::after { content: '+'; color: #8da194; font-size: 18px; }
|
.startup-preset-details summary::after { content: '+'; color: #94a3b8; font-size: 18px; }
|
||||||
.startup-preset-details[open] summary::after { content: '−'; }
|
.startup-preset-details[open] summary::after { content: '−'; }
|
||||||
#app .startup-param-badge { border: 0; padding: 12px; }
|
#app .startup-param-badge { border: 0; padding: 12px; background: #f8fafc; }
|
||||||
#app .startup-param-badge .lbl { font-size: 11px; margin-bottom: 5px; }
|
#app .startup-param-badge .lbl { font-size: 11px; margin-bottom: 5px; color: #64748b; }
|
||||||
#app .startup-param-badge strong { line-height: 1.6; font-weight: 600; }
|
#app .startup-param-badge strong { line-height: 1.6; font-weight: 600; color: #0f172a; }
|
||||||
#app .assessment-guide-banner { background: #faf5e9; color: #745d3e; box-shadow: none; border: 1px solid #efe4cd; padding: 16px; }
|
#app .assessment-guide-banner { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); color: #0f172a; box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08); border: 1px solid rgba(2, 132, 199, 0.16); padding: 16px; }
|
||||||
#app .guide-badge { background: #efe4cc; color: #8e7148; }
|
#app .guide-badge { background: #ffffff; color: #0284c7; border: 1px solid rgba(2, 132, 199, 0.2); }
|
||||||
#app .guide-text p { color: #8a785b; font-size: 12px; line-height: 1.6; }
|
#app .guide-text p { color: #64748b; font-size: 12px; line-height: 1.6; }
|
||||||
#app .guide-text h3 { font-size: 14px; }
|
#app .guide-text h3 { font-size: 14px; color: #0f172a; }
|
||||||
#app .guide-btn { min-height: 42px; padding: 8px 12px; flex-shrink: 0; box-shadow: none; }
|
#app .guide-btn { min-height: 42px; padding: 8px 14px; flex-shrink: 0; box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25); color: #fff; background: #0284c7; }
|
||||||
#app .health-advice-card { padding: 20px; border-radius: 20px; }
|
#app .health-advice-card { padding: 20px 18px; border-radius: 20px; background: #ffffff; border: 1px solid rgba(2, 132, 199, 0.08); box-shadow: var(--surface-shadow); }
|
||||||
#app .health-advice-card .eyebrow { color: #e5c385; letter-spacing: .08em; }
|
#app .health-advice-card .eyebrow { display: inline-block; background: #f0f9ff; color: #0284c7; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: .04em; margin-bottom: 8px; }
|
||||||
#app .health-advice-card h2 { font-size: 22px; line-height: 1.4; }
|
#app .health-advice-card h2 { font-size: 20px; line-height: 1.4; color: #0f172a; margin: 4px 0 8px; }
|
||||||
#app .health-advice-card > p:not(.eyebrow) { font-size: 13px; line-height: 1.7; margin-bottom: 10px; }
|
#app .health-advice-card > p:not(.eyebrow) { font-size: 13px; line-height: 1.65; margin-bottom: 12px; color: #64748b; }
|
||||||
.health-advice-link { background: transparent; border: 0; color: #e3d5b6; font-size: 12px; min-height: 36px; padding: 0; }
|
.health-advice-link { background: transparent; border: 0; color: #0284c7; font-size: 13px; font-weight: 600; min-height: 36px; padding: 0; display: inline-flex; align-items: center; }
|
||||||
#app .metric-strip div { min-width: 0; padding: 4px 12px; }
|
#app .metric-strip div { min-width: 0; padding: 4px 12px; }
|
||||||
#app .metric-strip strong { font-variant-numeric: tabular-nums; font-size: 22px; }
|
#app .metric-strip strong { font-variant-numeric: tabular-nums; font-size: 22px; }
|
||||||
#app .medical-note { color: #829188; line-height: 1.7; margin: 20px 10px; }
|
#app .medical-note { color: #94a3b8; line-height: 1.7; margin: 20px 10px; }
|
||||||
|
|
||||||
#app :is(.page-load-state, .page-error-state) { text-align: center; padding: 28px 20px; font-size: 13px; color: var(--muted-text); line-height: 1.7; }
|
#app :is(.page-load-state, .page-error-state) { text-align: center; padding: 28px 20px; font-size: 13px; color: var(--muted-text); line-height: 1.7; }
|
||||||
#app :is(.page-load-state, .page-error-state) p { margin: 10px 0; overflow-wrap: anywhere; }
|
#app :is(.page-load-state, .page-error-state) p { margin: 10px 0; overflow-wrap: anywhere; }
|
||||||
#app .page-error-state :is(h2, h3) { margin: 0 0 10px; color: #315a4a; font-size: 16px; }
|
#app .page-error-state :is(h2, h3) { margin: 0 0 10px; color: #0f172a; font-size: 16px; }
|
||||||
.page-loading-mark { display: block; width: 28px; height: 28px; margin: 0 auto 14px; border: 2px solid #dde9df; border-top-color: #34795e; border-radius: 50%; animation: page-spin .9s linear infinite; }
|
.page-loading-mark { display: block; width: 28px; height: 28px; margin: 0 auto 14px; border: 2px solid #bae6fd; border-top-color: #0284c7; border-radius: 50%; animation: page-spin .9s linear infinite; }
|
||||||
.retry-button { border: 1px solid #d3e1d5; border-radius: 12px; background: #f4f8f1; color: #0c5045; font-size: 13px; min-height: 44px; min-width: 126px; padding: 10px 18px; font-weight: 600; margin-top: 10px; }
|
.retry-button { border: 1px solid rgba(2, 132, 199, 0.2); border-radius: 12px; background: #f0f9ff; color: #0284c7; font-size: 13px; min-height: 44px; min-width: 126px; padding: 10px 18px; font-weight: 600; margin-top: 10px; }
|
||||||
@keyframes page-spin { to { transform: rotate(360deg); } }
|
@keyframes page-spin { to { transform: rotate(360deg); } }
|
||||||
|
|
||||||
#app .profile-content, #app .assessment-content { padding-left: var(--page-gutter); padding-right: var(--page-gutter); }
|
#app .profile-content, #app .assessment-content { padding-left: 0; padding-right: 0; }
|
||||||
#app .profile-header { padding: 30px 22px; border-radius: 0 0 28px 28px; box-shadow: none; }
|
#app .profile-header { padding: 4px 4px 20px; border-radius: 0; box-shadow: none; background: transparent; }
|
||||||
#app .avatar-box { width: 56px; height: 56px; flex-shrink: 0; font-size: 24px; }
|
#app .avatar-box { width: 56px; height: 56px; flex-shrink: 0; font-size: 24px; background: #f0f9ff; color: #0284c7; border: 2px solid rgba(2, 132, 199, 0.2); box-shadow: 0 2px 10px rgba(2, 132, 199, 0.12); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif; }
|
||||||
#app .user-info { min-width: 0; }
|
#app .user-info { min-width: 0; }
|
||||||
#app .user-info h2 { overflow-wrap: anywhere; line-height: 1.4; }
|
#app .user-info h2 { overflow-wrap: anywhere; line-height: 1.4; }
|
||||||
#app .profile-card { padding: 20px 16px; }
|
#app .profile-card { padding: 20px 16px; }
|
||||||
#app .card-head { gap: 10px; }
|
#app .card-head { gap: 10px; }
|
||||||
#app .card-head h3 { min-width: 0; line-height: 1.5; }
|
#app .card-head h3 { min-width: 0; line-height: 1.5; color: #0f172a; }
|
||||||
#app .card-head :is(.status-indicator, .version-tag, .edit-btn) { flex-shrink: 0; }
|
#app .card-head :is(.status-indicator, .version-tag, .edit-btn) { flex-shrink: 0; }
|
||||||
#app .edit-btn { min-height: 36px; padding: 4px 0 4px 8px; }
|
#app .edit-btn { min-height: 36px; padding: 4px 0 4px 8px; color: #0284c7; }
|
||||||
#app .metric-item { padding: 12px 6px; min-width: 0; font-variant-numeric: tabular-nums; }
|
#app .metric-item { padding: 12px 6px; min-width: 0; font-variant-numeric: tabular-nums; background: #f8fafc; }
|
||||||
#app .bmi-metric { grid-column: 1 / -1; flex-direction: row; gap: 10px; padding: 12px 14px; }
|
#app .bmi-metric { grid-column: 1 / -1; flex-direction: row; gap: 10px; padding: 12px 14px; }
|
||||||
#app .bmi-metric .m-label { margin: 0 auto 0 0; font-size: 12px; }
|
#app .bmi-metric .m-label { margin: 0 auto 0 0; font-size: 12px; }
|
||||||
#app .bmi-metric .m-status-tag { margin: 0; padding: 4px 8px; }
|
#app .bmi-metric .m-status-tag { margin: 0; padding: 4px 8px; }
|
||||||
#app .plan-summary-text { font-size: 13px; line-height: 1.7; }
|
#app .plan-summary-text { font-size: 13px; line-height: 1.7; color: #64748b; }
|
||||||
#app .menu-item { width: 100%; background: #fff; border: 0; border-bottom: 1px solid #f0f2ec; text-align: left; font: inherit; padding: 15px 16px; gap: 12px; }
|
#app .menu-item { width: 100%; background: #fff; border: 0; border-bottom: 1px solid #f1f5f9; text-align: left; font: inherit; padding: 15px 16px; gap: 12px; }
|
||||||
#app .menu-item:last-child { border-bottom: 0; }
|
#app .menu-item:last-child { border-bottom: 0; }
|
||||||
#app .menu-item:active { background: #f6f8f2; }
|
#app .menu-item:active { background: #f8fafc; }
|
||||||
#app .menu-left { min-width: 0; }
|
#app .menu-left { min-width: 0; }
|
||||||
#app .menu-icon { flex-shrink: 0; }
|
#app .menu-icon { flex-shrink: 0; }
|
||||||
#app .menu-text { min-width: 0; line-height: 1.5; }
|
#app .menu-text { min-width: 0; line-height: 1.5; }
|
||||||
#app .menu-text small { font-size: 12px; }
|
#app .menu-text strong { color: #0f172a; }
|
||||||
|
#app .menu-text small { font-size: 12px; color: #64748b; }
|
||||||
#app .logout-wrap { margin-top: 20px; }
|
#app .logout-wrap { margin-top: 20px; }
|
||||||
#app .logout-btn { min-height: 48px; box-shadow: none; }
|
#app .logout-btn { min-height: 48px; box-shadow: none; }
|
||||||
|
|
||||||
#app .assessment-header { padding: 26px 22px 24px; }
|
#app .assessment-header { padding: 4px 4px 16px; background: transparent; box-shadow: none; border-radius: 0; }
|
||||||
#app .assessment-header h1 { font-size: 25px; margin-bottom: 12px; }
|
#app .assessment-header h1 { font-size: 25px; margin-bottom: 12px; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif; }
|
||||||
#app .header-desc { font-size: 13px; line-height: 1.7; }
|
#app .header-desc { font-size: 13px; line-height: 1.7; }
|
||||||
#app .card-section { padding: 20px 16px; }
|
#app .card-section { padding: 20px 16px; }
|
||||||
#app .section-subtitle { line-height: 1.65; }
|
#app .section-subtitle { line-height: 1.65; }
|
||||||
@@ -120,50 +124,55 @@ input, textarea { accent-color: var(--green); }
|
|||||||
#app .opt-head { gap: 8px; flex-wrap: wrap; }
|
#app .opt-head { gap: 8px; flex-wrap: wrap; }
|
||||||
#app .opt-desc { font-size: 12px; line-height: 1.65; }
|
#app .opt-desc { font-size: 12px; line-height: 1.65; }
|
||||||
#app :is(.saved-assessment-note, .tcm-dirty-note) { font-size: 12px; line-height: 1.7; }
|
#app :is(.saved-assessment-note, .tcm-dirty-note) { font-size: 12px; line-height: 1.7; }
|
||||||
#app .tcm-page { padding-left: var(--page-gutter); padding-right: var(--page-gutter); }
|
#app .tcm-page { padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%); }
|
||||||
#app .tcm-header { padding: 14px 5px 22px; }
|
#app .tcm-header { padding: 4px 4px 16px; background: transparent; }
|
||||||
#app .tcm-header h1 { font-size: 26px; }
|
#app .tcm-header h1 { font-size: 26px; }
|
||||||
#app .tcm-card { padding: 20px 16px; }
|
#app .tcm-card { padding: 20px 16px; }
|
||||||
#app .section-heading { gap: 10px; align-items: flex-start; }
|
#app .section-heading { gap: 10px; align-items: flex-start; }
|
||||||
#app .section-heading h2 { flex-shrink: 0; font-size: 18px; }
|
#app .section-heading h2 { flex-shrink: 0; font-size: 18px; }
|
||||||
#app .section-heading p { line-height: 1.6; }
|
#app .section-heading p { line-height: 1.6; }
|
||||||
#app .choice-grid button { padding: 10px 8px; }
|
#app .choice-grid button { padding: 10px 8px; }
|
||||||
#app .note-label textarea { font-size: 16px; min-height: 80px; line-height: 1.6; background: #fbfcf8; }
|
#app .note-label textarea { font-size: 16px; min-height: 80px; line-height: 1.6; background: #f8fafc; }
|
||||||
#app .result-top { gap: 8px; flex-wrap: wrap; }
|
#app .result-top { gap: 8px; flex-wrap: wrap; }
|
||||||
#app .recommendations div { align-items: flex-start; }
|
#app .recommendations div { align-items: flex-start; }
|
||||||
.assessment-progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 4px; overflow: hidden; margin-top: 12px; background: #e4e9df; accent-color: #0c5045; }
|
.assessment-progress { display: block; width: 100%; height: 5px; border: 0; border-radius: 4px; overflow: hidden; margin-top: 12px; background: #e2e8f0; accent-color: #0284c7; }
|
||||||
.assessment-progress::-webkit-progress-bar { background: #e4e9df; border-radius: 4px; }
|
.assessment-progress::-webkit-progress-bar { background: #e2e8f0; border-radius: 4px; }
|
||||||
.assessment-progress::-webkit-progress-value { background: #0c5045; border-radius: 4px; }
|
.assessment-progress::-webkit-progress-value { background: #0284c7; border-radius: 4px; }
|
||||||
.assessment-progress::-moz-progress-bar { background: #0c5045; border-radius: 4px; }
|
.assessment-progress::-moz-progress-bar { background: #0284c7; border-radius: 4px; }
|
||||||
|
|
||||||
#app .auth-page { padding-bottom: env(safe-area-inset-bottom, 0px); }
|
#app .auth-page { padding-bottom: env(safe-area-inset-bottom, 0px); }
|
||||||
#app .brand-panel { padding: 32px 24px 38px; border-radius: 0 0 30px 30px; }
|
#app .brand-panel { padding: 16px 4px 20px; border-radius: 0; background: transparent; }
|
||||||
#app .brand-panel h1 { font-size: 32px; line-height: 1.3; }
|
#app .brand-panel h1 { font-size: 28px; line-height: 1.25; color: #0f172a; }
|
||||||
#app .brand-copy { font-size: 13px; line-height: 1.7; }
|
#app .brand-copy { font-size: 13px; line-height: 1.6; color: #475569; }
|
||||||
#app .feature-pill-row span { padding: 5px 10px; font-size: 11px; }
|
#app .feature-pill-row span { padding: 5px 12px; font-size: 12px; font-weight: 600; color: #0284c7; background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(191, 219, 254, 0.75); }
|
||||||
#app .auth-card { padding: 24px 20px; box-shadow: var(--surface-shadow); }
|
#app .auth-card { padding: 24px 20px 28px; box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.02); border: 1px solid rgba(226, 232, 240, 0.85); border-radius: 22px; }
|
||||||
#app .auth-heading h2 { font-size: 22px; line-height: 1.4; }
|
#app .auth-heading h2 { font-size: 22px; line-height: 1.4; color: #0f172a; font-weight: 700; }
|
||||||
#app .auth-heading p { font-size: 13px; line-height: 1.6; }
|
#app .auth-heading p { font-size: 13px; line-height: 1.6; color: #64748b; }
|
||||||
#app .auth-card .van-field__control { font-size: 16px; }
|
#app .auth-card .van-field { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; }
|
||||||
#app .auth-tab-switch button { min-height: 44px; }
|
#app .auth-card .van-field:focus-within { background: #ffffff; border-color: #0284c7; box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12); }
|
||||||
|
#app .auth-card .van-field__control { font-size: 15px; color: #0f172a; }
|
||||||
|
#app .auth-card .van-field__label { color: #334155; font-weight: 600; }
|
||||||
|
#app .auth-card .van-field__error-message { color: #ef4444; font-size: 12px; }
|
||||||
|
#app .auth-tab-switch button { min-height: 42px; }
|
||||||
|
#app .auth-tab-switch button.active { color: #0284c7; background: #ffffff; }
|
||||||
#app .auth-tab-switch button:disabled { opacity: .55; }
|
#app .auth-tab-switch button:disabled { opacity: .55; }
|
||||||
#app .privacy-note { color: #819086; }
|
#app .privacy-note { color: #94a3b8; }
|
||||||
|
|
||||||
#app .app-tab-bar { box-shadow: 0 -2px 12px rgba(18, 63, 55, .025); }
|
#app .app-tab-bar { box-shadow: 0 -2px 16px rgba(15, 23, 42, .04); }
|
||||||
#app .tab-item { margin: 0 4px; border-radius: 12px; }
|
#app .tab-item { margin: 0 4px; border-radius: 12px; }
|
||||||
#app .tab-item.active { background: #edf4ed; }
|
#app .tab-item.active { background: transparent; }
|
||||||
#app .tab-label { font-size: 11px; }
|
#app .tab-label { font-size: 11px; }
|
||||||
#app .control-page .control-content { padding: 16px; }
|
#app .control-page .control-content { padding: 16px; }
|
||||||
#app .control-page .param-row { padding-top: 17px; padding-bottom: 17px; }
|
#app .control-page .param-row { padding-top: 17px; padding-bottom: 17px; }
|
||||||
#app .control-page :is(.p-tip, .scale-note, .mattress-mode-note) { font-size: 12px; line-height: 1.7; }
|
#app .control-page :is(.p-tip, .scale-note) { font-size: 12px; line-height: 1.7; }
|
||||||
#app .control-page .mini-toggle { min-height: 36px; }
|
#app .control-page .mini-toggle { min-height: 36px; }
|
||||||
#app .control-page .device-tile-power { width: 42px; height: 42px; }
|
#app .control-page .device-tile-power { width: 42px; height: 42px; }
|
||||||
#app .control-page .device-tile-category { width: calc(100% - 46px); }
|
#app .control-page .device-tile-category { width: calc(100% - 46px); }
|
||||||
#app .control-page .device-tile-status { font-size: 12px; color: #5e7467; }
|
#app .control-page .device-tile-status { font-size: 12px; color: #64748b; }
|
||||||
#app .control-page .device-tile-metric { font-size: 11px; color: #6a7c70; }
|
#app .control-page .device-tile-metric { font-size: 11px; color: #64748b; }
|
||||||
#app .control-page .device-tile-footer { color: #718175; }
|
#app .control-page .device-tile-footer { color: #94a3b8; }
|
||||||
#app .control-page .device-information { border: 1px solid rgba(18, 63, 55, .05); }
|
#app .control-page .device-information { border: 1px solid rgba(2, 132, 199, .05); }
|
||||||
.device-detail-hint { margin: 0 0 14px; padding: 0 3px; font-size: 12px; color: #758579; line-height: 1.7; }
|
.device-detail-hint { margin: 0 0 14px; padding: 0 3px; font-size: 12px; color: #64748b; line-height: 1.7; }
|
||||||
|
|
||||||
@media (max-width: 359px) {
|
@media (max-width: 359px) {
|
||||||
:root { --page-gutter: 12px; }
|
:root { --page-gutter: 12px; }
|
||||||
@@ -174,7 +183,6 @@ input, textarea { accent-color: var(--green); }
|
|||||||
#app .control-page .control-content { padding: 12px; }
|
#app .control-page .control-content { padding: 12px; }
|
||||||
}
|
}
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
/* 停止动画,不把无限循环的加载图标加速;加载文字仍由页面正常显示。 */
|
|
||||||
*, *::before, *::after {
|
*, *::before, *::after {
|
||||||
animation: none !important;
|
animation: none !important;
|
||||||
transition-duration: 0s !important;
|
transition-duration: 0s !important;
|
||||||
|
|||||||
+125
-108
@@ -54,7 +54,7 @@ const bmiStatus = computed(() => {
|
|||||||
const bmi = computedBmi.value
|
const bmi = computedBmi.value
|
||||||
if (!bmi) return { label: '待填写', color: '#909399' }
|
if (!bmi) return { label: '待填写', color: '#909399' }
|
||||||
if (bmi < 18.5) return { label: '偏瘦', color: '#e6a23c' }
|
if (bmi < 18.5) return { label: '偏瘦', color: '#e6a23c' }
|
||||||
if (bmi <= 23.9) return { label: '正常健康', color: '#0c5045' }
|
if (bmi <= 23.9) return { label: '正常健康', color: '#0284c7' }
|
||||||
if (bmi <= 27.9) return { label: '偏胖超重', color: '#e6a23c' }
|
if (bmi <= 27.9) return { label: '偏胖超重', color: '#e6a23c' }
|
||||||
return { label: '肥胖预警', color: '#f56c6c' }
|
return { label: '肥胖预警', color: '#f56c6c' }
|
||||||
})
|
})
|
||||||
@@ -766,7 +766,7 @@ onMounted(() => {
|
|||||||
block
|
block
|
||||||
round
|
round
|
||||||
size="large"
|
size="large"
|
||||||
color="#0c5045"
|
color="#0284c7"
|
||||||
:loading="submitting"
|
:loading="submitting"
|
||||||
:disabled="submitting"
|
:disabled="submitting"
|
||||||
@click="handleSave"
|
@click="handleSave"
|
||||||
@@ -784,76 +784,89 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.assessment-page {
|
.assessment-page {
|
||||||
padding-bottom: 90px;
|
max-width: 480px;
|
||||||
background: #f2f0e9;
|
margin: 0 auto;
|
||||||
|
padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom));
|
||||||
|
background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assessment-header {
|
.assessment-header {
|
||||||
background: linear-gradient(135deg, #0c5045, #14463d);
|
background: transparent;
|
||||||
color: #fff;
|
color: #0f172a;
|
||||||
padding: 32px 20px 24px;
|
padding: 4px 4px 16px;
|
||||||
border-radius: 0 0 28px 28px;
|
border-radius: 0;
|
||||||
box-shadow: 0 10px 30px rgba(12, 80, 69, 0.12);
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-tag {
|
.brand-tag {
|
||||||
display: inline-block;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
letter-spacing: 0.14em;
|
font-weight: 600;
|
||||||
background: rgba(255, 255, 255, 0.15);
|
letter-spacing: 0.04em;
|
||||||
padding: 4px 10px;
|
background: rgba(255, 255, 255, 0.9);
|
||||||
|
border: 1px solid #bae6fd;
|
||||||
|
padding: 4px 12px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
color: #eeddbb;
|
color: #0284c7;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.assessment-header h1 {
|
.assessment-header h1 {
|
||||||
margin: 0 0 10px;
|
margin: 0 0 8px;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-family: "Songti SC", serif;
|
font-family: inherit;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
|
color: #0f172a;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-desc {
|
.header-desc {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
color: rgba(255, 255, 255, 0.8);
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assessment-content {
|
.assessment-content {
|
||||||
padding: 16px 14px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assessment-form { min-width: 0; padding: 0; margin: 0; border: 0; }
|
.assessment-form { min-width: 0; padding: 0; margin: 0; border: 0; }
|
||||||
.assessment-form[disabled] { opacity: .72; }
|
.assessment-form[disabled] { opacity: .72; }
|
||||||
.saved-assessment-note { margin: 0 4px 14px; color: #527169; font-size: 12px; line-height: 1.6; }
|
.saved-assessment-note { margin: 0 4px 14px; color: #64748b; font-size: 12px; line-height: 1.6; }
|
||||||
.page-error-state h3 { margin: 0 0 8px; font-size: 16px; }
|
.page-error-state h3 { margin: 0 0 8px; font-size: 16px; color: #0f172a; }
|
||||||
.page-error-state p { font-size: 13px; line-height: 1.6; }
|
.page-error-state p { font-size: 13px; line-height: 1.6; color: #64748b; }
|
||||||
|
|
||||||
.card-section {
|
.card-section {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 20px;
|
border-radius: 16px;
|
||||||
padding: 18px 16px;
|
padding: 20px 16px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
box-shadow: 0 4px 18px rgba(18, 63, 55, 0.04);
|
box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid #eef2f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
display: flex;
|
display: flex !important;
|
||||||
align-items: center;
|
align-items: center !important;
|
||||||
gap: 8px;
|
justify-content: flex-start !important;
|
||||||
|
gap: 8px !important;
|
||||||
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-num {
|
.step-num {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: #0c5045;
|
background: #f0f9ff;
|
||||||
color: #fff;
|
color: #0284c7;
|
||||||
font-size: 10px;
|
border: 1px solid #bae6fd;
|
||||||
|
font-size: 11px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
padding: 2px 6px;
|
padding: 2px 7px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -861,13 +874,13 @@ onMounted(() => {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #123f37;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-subtitle {
|
.section-subtitle {
|
||||||
margin: 4px 0 16px;
|
margin: 2px 0 16px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #7b8e88;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 基础信息表单 */
|
/* 基础信息表单 */
|
||||||
@@ -885,15 +898,16 @@ onMounted(() => {
|
|||||||
|
|
||||||
.form-field label {
|
.form-field label {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #556b64;
|
color: #334155;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle-group {
|
.toggle-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
background: #f1efea;
|
background: #f1f5f9;
|
||||||
border-radius: 10px;
|
border-radius: 12px;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle-group button {
|
.toggle-group button {
|
||||||
@@ -901,17 +915,18 @@ onMounted(() => {
|
|||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: #6a7c76;
|
color: #64748b;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
border-radius: 8px;
|
border-radius: 9px;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle-group button.active {
|
.toggle-group button.active {
|
||||||
background: #0c5045;
|
background: #ffffff;
|
||||||
color: #ffffff;
|
color: #0284c7;
|
||||||
box-shadow: 0 2px 6px rgba(12, 80, 69, 0.2);
|
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-wrap {
|
.input-wrap {
|
||||||
@@ -922,34 +937,36 @@ onMounted(() => {
|
|||||||
|
|
||||||
.input-wrap input {
|
.input-wrap input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #f7f6f2;
|
background: #f8fafc;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.1);
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 10px;
|
border-radius: 12px;
|
||||||
padding: 9px 36px 9px 12px;
|
padding: 10px 36px 10px 12px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #123f37;
|
color: #0f172a;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-wrap input:focus {
|
.input-wrap input:focus {
|
||||||
border-color: #0c5045;
|
border-color: #0284c7;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-wrap .unit {
|
.input-wrap .unit {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 12px;
|
right: 12px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #8c9e97;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bmi-result-card {
|
.bmi-result-card {
|
||||||
grid-column: span 2;
|
grid-column: span 2;
|
||||||
background: #f7faf8;
|
background: #f8fafc;
|
||||||
border: 1px solid rgba(12, 80, 69, 0.14);
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 10px 14px;
|
padding: 12px 14px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -964,28 +981,29 @@ onMounted(() => {
|
|||||||
|
|
||||||
.bmi-val span {
|
.bmi-val span {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #7b8e88;
|
color: #64748b;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bmi-val strong {
|
.bmi-val strong {
|
||||||
font-size: 20px;
|
font-size: 22px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-family: serif;
|
font-family: inherit;
|
||||||
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bmi-tag {
|
.bmi-tag {
|
||||||
font-size: 12px;
|
font-size: 11px;
|
||||||
font-weight: 700;
|
font-weight: 600;
|
||||||
border: 1px solid currentColor;
|
padding: 3px 9px;
|
||||||
padding: 2px 10px;
|
border-radius: 20px;
|
||||||
border-radius: 12px;
|
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
border: 1px solid currentColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bmi-tip {
|
.bmi-tip {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #8a9c95;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 问答模块 */
|
/* 问答模块 */
|
||||||
@@ -1005,17 +1023,19 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.q-badge {
|
.q-badge {
|
||||||
background: #ebf3f0;
|
background: #f0f9ff;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
|
border: 1px solid #bae6fd;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
font-weight: 800;
|
font-weight: 700;
|
||||||
padding: 2px 6px;
|
padding: 1px 6px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.question-label strong {
|
.question-label strong {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #173d36;
|
color: #0f172a;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.options-grid {
|
.options-grid {
|
||||||
@@ -1023,57 +1043,51 @@ onMounted(() => {
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.options-grid.cols-1 {
|
.options-grid.cols-1 { grid-template-columns: 1fr; }
|
||||||
grid-template-columns: 1fr;
|
.options-grid.cols-2 { grid-template-columns: 1fr 1fr; }
|
||||||
}
|
.options-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
|
||||||
|
|
||||||
.options-grid.cols-2 {
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
.options-grid.cols-3 {
|
|
||||||
grid-template-columns: 1fr 1fr 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
.option-pill {
|
.option-pill {
|
||||||
padding: 10px 8px;
|
padding: 11px 8px;
|
||||||
background: #f6f5f0;
|
background: #f8fafc;
|
||||||
border: 1.5px solid transparent;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 10px;
|
border-radius: 12px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #4b5e57;
|
color: #334155;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.option-pill.active {
|
.option-pill.active {
|
||||||
background: #eef6f3;
|
background: #f0f9ff;
|
||||||
border-color: #0c5045;
|
border: 1.5px solid #0284c7;
|
||||||
color: #0c5045;
|
color: #0369a1;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.option-card {
|
.option-card {
|
||||||
padding: 12px;
|
padding: 12px 14px;
|
||||||
background: #f9f8f4;
|
background: #f8fafc;
|
||||||
border: 1.5px solid transparent;
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.option-pill:focus-visible, .option-card:focus-visible { outline: 2px solid #0c5045; outline-offset: 3px; }
|
.option-pill:focus-visible, .option-card:focus-visible { outline: 2px solid #0284c7; outline-offset: 2px; }
|
||||||
|
|
||||||
.option-card.active {
|
.option-card.active {
|
||||||
background: #eef7f3;
|
background: #f0f9ff;
|
||||||
border-color: #0c5045;
|
border: 1.5px solid #0284c7;
|
||||||
|
box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
.opt-head {
|
.opt-head {
|
||||||
@@ -1086,37 +1100,40 @@ onMounted(() => {
|
|||||||
.opt-title {
|
.opt-title {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #183d36;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.opt-tag {
|
.opt-tag {
|
||||||
font-size: 11px;
|
font-size: 10px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
background: rgba(12, 80, 69, 0.08);
|
background: #f0f9ff;
|
||||||
padding: 2px 8px;
|
border: 1px solid #bae6fd;
|
||||||
|
padding: 1px 7px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-cool {
|
.tag-cool {
|
||||||
color: #2b7bc4;
|
color: #0284c7;
|
||||||
background: rgba(43, 123, 196, 0.1);
|
background: #f0f9ff;
|
||||||
|
border-color: #bae6fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-warm {
|
.tag-warm {
|
||||||
color: #c06927;
|
color: #d97706;
|
||||||
background: rgba(192, 105, 39, 0.1);
|
background: #fffbeb;
|
||||||
|
border-color: #fde68a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.opt-desc {
|
.opt-desc {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #72847d;
|
color: #64748b;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.submit-action-bar {
|
.submit-action-bar {
|
||||||
margin-top: 20px;
|
margin-top: 24px;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+228
-26
@@ -36,20 +36,22 @@ async function submit() {
|
|||||||
if (pageRequest.isCurrent(requestId)) loading.value = false
|
if (pageRequest.isCurrent(requestId)) loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onFailed(errorInfo: { errors?: Array<{ message?: string }> }) {
|
||||||
|
const first = errorInfo?.errors?.[0]?.message
|
||||||
|
if (first) showToast(first)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="auth-page">
|
<main class="auth-page">
|
||||||
<section class="brand-panel">
|
<section class="brand-panel">
|
||||||
<div class="brand-badge">
|
<div class="banner-card-wrap">
|
||||||
<span class="brand-badge-icon">常</span>
|
<img
|
||||||
<span>一人一方 · 康养管理</span>
|
src="/header-banner.jpg"
|
||||||
</div>
|
alt="一人一方 · 康养管理 健康与空间协同"
|
||||||
<p class="eyebrow">EVERGREEN HEALTH</p>
|
class="banner-card-img"
|
||||||
<h1>一人一方<br />健康与空间协同</h1>
|
/>
|
||||||
<p class="brand-copy">以睡眠为切入点,融合五感空间与动态健康方案,开启日常健康管理。</p>
|
|
||||||
<div class="feature-pill-row">
|
|
||||||
<span>体质评估</span><span>舒睡联动</span><span>健康档案</span>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -73,41 +75,65 @@ async function submit() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="auth-heading">
|
<p class="auth-hint">
|
||||||
<h2>{{ title }}</h2>
|
{{ mode === 'login' ? '登录后查看今日健康方案与智能空间联动' : '第一步,填写基本信息创建您的专属健康档案' }}
|
||||||
<p>
|
</p>
|
||||||
{{ mode === 'login' ? '登录后查看今日健康方案与空间联动' : '第一步,填写信息创建您的专属健康档案' }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<van-form @submit="submit">
|
<van-form @submit="submit" @failed="onFailed">
|
||||||
<van-field
|
<van-field
|
||||||
v-if="mode === 'register'"
|
v-if="mode === 'register'"
|
||||||
v-model="form.displayName"
|
v-model="form.displayName"
|
||||||
label="姓名"
|
|
||||||
:disabled="loading" autocomplete="name" maxlength="30"
|
:disabled="loading" autocomplete="name" maxlength="30"
|
||||||
placeholder="请输入姓名或称呼"
|
placeholder="请输入您的姓名或称呼"
|
||||||
:rules="[{ required: true, message: '请输入姓名' }]"
|
:rules="[{ required: true, message: '请输入姓名' }]"
|
||||||
/>
|
>
|
||||||
|
<template #left-icon>
|
||||||
|
<span class="field-icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
|
||||||
|
<circle cx="12" cy="7" r="4" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</van-field>
|
||||||
|
|
||||||
<van-field
|
<van-field
|
||||||
v-model="form.phone"
|
v-model="form.phone"
|
||||||
type="tel"
|
type="tel"
|
||||||
:disabled="loading" autocomplete="username" inputmode="tel"
|
:disabled="loading" autocomplete="username" inputmode="tel"
|
||||||
label="手机号"
|
|
||||||
maxlength="11"
|
maxlength="11"
|
||||||
placeholder="请输入 11 位手机号"
|
placeholder="请输入 11 位手机号"
|
||||||
:rules="[{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' }]"
|
:rules="[{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' }]"
|
||||||
/>
|
>
|
||||||
|
<template #left-icon>
|
||||||
|
<span class="field-icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<rect x="5" y="2" width="14" height="20" rx="2" ry="2" />
|
||||||
|
<line x1="12" y1="18" x2="12.01" y2="18" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</van-field>
|
||||||
|
|
||||||
<van-field
|
<van-field
|
||||||
v-model="form.password"
|
v-model="form.password"
|
||||||
type="password"
|
type="password"
|
||||||
:disabled="loading" :autocomplete="mode === 'register' ? 'new-password' : 'current-password'"
|
:disabled="loading" :autocomplete="mode === 'register' ? 'new-password' : 'current-password'"
|
||||||
label="密码"
|
:placeholder="mode === 'register' ? '设置至少 8 位登录密码' : '请输入登录密码'"
|
||||||
:placeholder="mode === 'register' ? '设置至少 8 位密码' : '请输入密码'"
|
|
||||||
:rules="[{ required: true, message: '请输入密码' }, { validator: (value: string) => mode === 'login' || value.length >= 8, message: '注册密码至少 8 位' }]"
|
:rules="[{ required: true, message: '请输入密码' }, { validator: (value: string) => mode === 'login' || value.length >= 8, message: '注册密码至少 8 位' }]"
|
||||||
/>
|
>
|
||||||
<van-button block round color="#0c5045" native-type="submit" :loading="loading" :disabled="loading">
|
<template #left-icon>
|
||||||
{{ mode === 'login' ? '登 录' : '创建档案并继续' }}
|
<span class="field-icon" aria-hidden="true">
|
||||||
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2" />
|
||||||
|
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</van-field>
|
||||||
|
|
||||||
|
<van-button block round color="#0284c7" native-type="submit" :loading="loading" :disabled="loading">
|
||||||
|
{{ mode === 'login' ? '立即登录' : '创建档案并继续' }}
|
||||||
</van-button>
|
</van-button>
|
||||||
</van-form>
|
</van-form>
|
||||||
|
|
||||||
@@ -115,3 +141,179 @@ async function submit() {
|
|||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.auth-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background:
|
||||||
|
radial-gradient(circle at 85% 10%, rgba(178, 225, 255, 0.45) 0%, rgba(224, 242, 254, 0.25) 35%, transparent 70%),
|
||||||
|
linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 25%, #f8fafc 55%, #f1f5f9 100%);
|
||||||
|
padding: 16px 16px 40px;
|
||||||
|
}
|
||||||
|
.brand-panel {
|
||||||
|
max-width: 440px;
|
||||||
|
margin: 0 auto 16px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 顶部完整 3D 科技健康守护卡片 */
|
||||||
|
.banner-card-wrap {
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 10px 28px -4px rgba(2, 132, 199, 0.15), 0 2px 8px rgba(15, 23, 42, 0.04);
|
||||||
|
background: transparent;
|
||||||
|
border: 1px solid rgba(186, 230, 253, 0.85);
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.banner-card-img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
object-fit: cover;
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 登录白卡片 */
|
||||||
|
.auth-card {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 440px;
|
||||||
|
margin: 0 auto 32px;
|
||||||
|
padding: 22px 20px 26px;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 24px;
|
||||||
|
border: 1px solid rgba(226, 232, 240, 0.85);
|
||||||
|
box-shadow: 0 12px 36px -4px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.02);
|
||||||
|
}
|
||||||
|
.auth-tab-switch {
|
||||||
|
display: flex;
|
||||||
|
background: #f1f5f9;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 4px;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
.auth-tab-switch button {
|
||||||
|
flex: 1;
|
||||||
|
padding: 10px 0;
|
||||||
|
border: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 9px;
|
||||||
|
color: #64748b;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.auth-tab-switch button.active {
|
||||||
|
background: #ffffff;
|
||||||
|
color: #0284c7;
|
||||||
|
box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
|
||||||
|
}
|
||||||
|
.auth-hint {
|
||||||
|
margin: 0 0 18px;
|
||||||
|
font-size: 12.5px;
|
||||||
|
color: #64748b;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 现代化通栏输入框与左侧图标 */
|
||||||
|
:deep(.van-field) {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
padding: 13px 14px;
|
||||||
|
background: #f8fafc !important;
|
||||||
|
border-radius: 14px;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, margin-bottom 0.2s ease;
|
||||||
|
min-height: 50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
:deep(.van-field::after) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
:deep(.van-field:focus-within) {
|
||||||
|
background: #ffffff !important;
|
||||||
|
border-color: #0284c7 !important;
|
||||||
|
box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
|
||||||
|
}
|
||||||
|
:deep(.van-field:focus-within .field-icon) {
|
||||||
|
color: #0284c7;
|
||||||
|
}
|
||||||
|
.field-icon {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
color: #94a3b8;
|
||||||
|
margin-right: 10px;
|
||||||
|
transition: color 0.2s ease;
|
||||||
|
}
|
||||||
|
:deep(.van-field__value) {
|
||||||
|
position: static;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
:deep(.van-field__control) {
|
||||||
|
color: #0f172a;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
:deep(.van-field__control::placeholder) {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
:deep(.van-field__error-message) {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 4px);
|
||||||
|
left: 14px;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
color: #ef4444;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
:deep(.van-field__error-message::before) {
|
||||||
|
content: "⚠";
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
:deep(.van-field:has(.van-field__error-message)),
|
||||||
|
:deep(.van-field--error) {
|
||||||
|
margin-bottom: 26px !important;
|
||||||
|
border-color: #ef4444 !important;
|
||||||
|
background-color: #fffafa !important;
|
||||||
|
}
|
||||||
|
:deep(.van-field:has(.van-field__error-message):focus-within),
|
||||||
|
:deep(.van-field--error:focus-within) {
|
||||||
|
border-color: #ef4444 !important;
|
||||||
|
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.van-button--primary) {
|
||||||
|
margin-top: 18px;
|
||||||
|
height: 50px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%) !important;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 14px !important;
|
||||||
|
box-shadow: 0 8px 20px -3px rgba(2, 132, 199, 0.32);
|
||||||
|
color: #ffffff !important;
|
||||||
|
transition: transform 0.1s;
|
||||||
|
}
|
||||||
|
:deep(.van-button--primary:active) {
|
||||||
|
transform: scale(0.985);
|
||||||
|
}
|
||||||
|
.privacy-note {
|
||||||
|
margin: 18px 0 0;
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.6;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ const sceneHint = computed(() => {
|
|||||||
if (!dashboard.value?.tcmResult?.hasCompleted) return '完成中医四诊、生成体质倾向后,即可一键开启。'
|
if (!dashboard.value?.tcmResult?.hasCompleted) return '完成中医四诊、生成体质倾向后,即可一键开启。'
|
||||||
if (!homeAssistant.value?.connected) return '设备连接暂时不可用,可进入设备总览检查并重试。'
|
if (!homeAssistant.value?.connected) return '设备连接暂时不可用,可进入设备总览检查并重试。'
|
||||||
if (sceneAvailable.value === 0) return '当前没有可用场景设备,请在设备总览检查连接。'
|
if (sceneAvailable.value === 0) return '当前没有可用场景设备,请在设备总览检查连接。'
|
||||||
return `${sceneAvailable.value} 台场景设备可用 · 加热看室温,承托看 BMI`
|
return `${sceneAvailable.value} 台场景设备可用 · 根据室温调节空调`
|
||||||
})
|
})
|
||||||
const comfortReason = computed(() => [dashboard.value?.mattressComfort?.heatingReason || dashboard.value?.mattressComfort?.weatherReason,
|
const comfortReason = computed(() => dashboard.value?.environmentAdvice?.climateAdvice?.reason || '')
|
||||||
dashboard.value?.mattressComfort?.firmnessReason].filter(Boolean).join(';'))
|
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
const sequence = ++loadSequence, statusRequest = ++statusSequence
|
const sequence = ++loadSequence, statusRequest = ++statusSequence
|
||||||
@@ -105,15 +104,21 @@ onUnmounted(() => { active = false; loadSequence++; statusSequence++ })
|
|||||||
<strong>查看舒睡设备</strong><small>设备总览、快捷开关与完整参数</small>
|
<strong>查看舒睡设备</strong><small>设备总览、快捷开关与完整参数</small>
|
||||||
</span></span><span class="arrow" aria-hidden="true">›</span>
|
</span></span><span class="arrow" aria-hidden="true">›</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button class="detail-entry-bar" type="button" @click="router.push('/sleep-data')">
|
||||||
|
<span class="entry-left"><span class="entry-symbol" aria-hidden="true">☾</span><span>
|
||||||
|
<strong>睡眠数据</strong><small>最近读数与历史记录</small>
|
||||||
|
</span></span><span class="arrow" aria-hidden="true">›</span>
|
||||||
|
</button>
|
||||||
<details v-if="dashboard.tcmResult?.hasCompleted" class="startup-preset-details">
|
<details v-if="dashboard.tcmResult?.hasCompleted" class="startup-preset-details">
|
||||||
<summary>查看体质启动预设</summary>
|
<summary>查看体质启动预设</summary>
|
||||||
<div class="startup-params-tags">
|
<div v-if="homeAssistant?.scenePresets?.length" class="startup-params-tags">
|
||||||
<div class="startup-param-badge"><span class="lbl">恒湿目标</span><strong>{{ dashboard.sceneConfig?.targetHumidity ?? '--' }}% · {{ dashboard.sceneConfig?.fanLevel || '待读取' }}</strong></div>
|
<div v-for="preset in homeAssistant.scenePresets" :key="`${preset.entityId}-${preset.action}`" class="startup-param-badge">
|
||||||
<div class="startup-param-badge"><span class="lbl">助眠灯光</span><strong>{{ dashboard.sceneConfig?.lightBrightnessPercent ?? '--' }}% 渐暗 · {{ dashboard.sceneConfig?.lightColorTemperatureKelvin ?? '--' }}K</strong></div>
|
<span class="lbl">{{ preset.deviceName }}</span><strong>{{ preset.detail || preset.action }}</strong>
|
||||||
<div class="startup-param-badge"><span class="lbl">体质音乐</span><strong>循环播放,50% 起每 5 秒降 1%</strong></div>
|
<small v-if="!preset.available">{{ preset.availabilityMessage }}</small>
|
||||||
<div class="startup-param-badge"><span class="lbl">智能床垫</span><strong>{{ dashboard.mattressComfort?.heatingLevel ?? 0 }} 档加热 · {{ dashboard.mattressComfort?.firmness || '待填写 BMI' }}</strong></div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="startup-card-desc">右侧全身轻柔按摩;灯灭后停止按摩。香型需人工更换。</p>
|
<p v-else class="startup-card-desc">暂无可显示的设备预设。</p>
|
||||||
|
<p class="startup-card-desc">香型需人工更换。</p>
|
||||||
<p v-if="dashboard.sceneConfig?.enableUv" class="startup-card-desc">除湿机预设开启 UV 消杀。</p>
|
<p v-if="dashboard.sceneConfig?.enableUv" class="startup-card-desc">除湿机预设开启 UV 消杀。</p>
|
||||||
<p v-if="comfortReason" class="startup-card-desc">{{ comfortReason }}</p>
|
<p v-if="comfortReason" class="startup-card-desc">{{ comfortReason }}</p>
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
+88
-107
@@ -193,7 +193,7 @@ onUnmounted(() => { active = false })
|
|||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
round
|
round
|
||||||
color="#0c5045"
|
color="#0284c7"
|
||||||
@click="router.replace('/assessment')"
|
@click="router.replace('/assessment')"
|
||||||
>
|
>
|
||||||
立即进行健康评估
|
立即进行健康评估
|
||||||
@@ -214,7 +214,7 @@ onUnmounted(() => { active = false })
|
|||||||
<p class="plan-summary-text">香型建议:{{ dashboard.tcmResult.aromaRecommendation }};音乐建议:{{ dashboard.tcmResult.musicRecommendation }}</p>
|
<p class="plan-summary-text">香型建议:{{ dashboard.tcmResult.aromaRecommendation }};音乐建议:{{ dashboard.tcmResult.musicRecommendation }}</p>
|
||||||
</template>
|
</template>
|
||||||
<p v-else class="plan-summary-text">完成四诊后,才能一键启动体质相关的设备预设。</p>
|
<p v-else class="plan-summary-text">完成四诊后,才能一键启动体质相关的设备预设。</p>
|
||||||
<VanButton type="primary" size="small" round color="#0c5045" @click="router.push('/tcm-assessment')">
|
<VanButton type="primary" size="small" round color="#0284c7" @click="router.push('/tcm-assessment')">
|
||||||
{{ dashboard?.tcmResult?.hasCompleted ? '重新评估体质' : '去完成四诊' }}
|
{{ dashboard?.tcmResult?.hasCompleted ? '重新评估体质' : '去完成四诊' }}
|
||||||
</VanButton>
|
</VanButton>
|
||||||
</section>
|
</section>
|
||||||
@@ -300,17 +300,20 @@ onUnmounted(() => { active = false })
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.profile-page {
|
.profile-page {
|
||||||
padding-bottom: 90px;
|
max-width: 480px;
|
||||||
background: #f2f0e9;
|
margin: 0 auto;
|
||||||
|
padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom));
|
||||||
|
background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-header {
|
.profile-header {
|
||||||
background: linear-gradient(135deg, #0c5045, #123d36);
|
background: transparent;
|
||||||
color: #fff;
|
color: #0f172a;
|
||||||
padding: 34px 20px 28px;
|
padding: 4px 4px 20px;
|
||||||
border-radius: 0 0 32px 32px;
|
border-radius: 0;
|
||||||
box-shadow: 0 10px 30px rgba(12, 80, 69, 0.12);
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-row {
|
.user-row {
|
||||||
@@ -320,52 +323,54 @@ onUnmounted(() => { active = false })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.avatar-box {
|
.avatar-box {
|
||||||
width: 60px;
|
width: 58px;
|
||||||
height: 60px;
|
height: 58px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: linear-gradient(135deg, #d6a657, #b88636);
|
background: #f0f9ff;
|
||||||
color: #fff;
|
color: #0284c7;
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
font-size: 26px;
|
font-size: 24px;
|
||||||
font-family: serif;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 2px 10px rgba(2, 132, 199, 0.12);
|
||||||
border: 2px solid rgba(255, 255, 255, 0.4);
|
border: 2px solid #bae6fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info h2 {
|
.user-info h2 {
|
||||||
margin: 0 0 4px;
|
margin: 0 0 4px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phone-text {
|
.phone-text {
|
||||||
margin: 0 0 6px;
|
margin: 0 0 6px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: rgba(255, 255, 255, 0.7);
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-badge {
|
.user-badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
background: rgba(255, 255, 255, 0.15);
|
background: #f0f9ff;
|
||||||
color: #ffe6ba;
|
color: #0284c7;
|
||||||
|
border: 1px solid #bae6fd;
|
||||||
|
font-weight: 600;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-content {
|
.profile-content {
|
||||||
padding: 16px 14px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile-card {
|
.profile-card {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 20px;
|
border-radius: 16px;
|
||||||
padding: 18px 16px;
|
padding: 20px 16px;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
box-shadow: 0 4px 18px rgba(18, 63, 55, 0.04);
|
box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04);
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid #eef2f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-head {
|
.card-head {
|
||||||
@@ -378,14 +383,14 @@ onUnmounted(() => { active = false })
|
|||||||
.card-head h3 {
|
.card-head h3 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #123f37;
|
color: #0f172a;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-btn {
|
.edit-btn {
|
||||||
border: 0;
|
border: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
@@ -394,13 +399,14 @@ onUnmounted(() => { active = false })
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: #f0f0ed;
|
background: #f1f5f9;
|
||||||
color: #88948e;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-indicator.done {
|
.status-indicator.done {
|
||||||
background: #eef6f3;
|
background: #f0f9ff;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
|
border: 1px solid #bae6fd;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +417,8 @@ onUnmounted(() => { active = false })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.metric-item {
|
.metric-item {
|
||||||
background: #f8f7f3;
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 10px 6px;
|
padding: 10px 6px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -422,30 +429,31 @@ onUnmounted(() => { active = false })
|
|||||||
|
|
||||||
.m-label {
|
.m-label {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #798a83;
|
color: #64748b;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m-val {
|
.m-val {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #173d36;
|
color: #0f172a;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m-val small {
|
.m-val small {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: #8fa099;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m-val.highlight {
|
.m-val.highlight {
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m-status-tag {
|
.m-status-tag {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
background: rgba(12, 80, 69, 0.1);
|
background: #f0f9ff;
|
||||||
|
border: 1px solid #bae6fd;
|
||||||
padding: 1px 6px;
|
padding: 1px 6px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
@@ -466,40 +474,28 @@ onUnmounted(() => { active = false })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.profile-tag-item.theme-gold {
|
.profile-tag-item.theme-gold {
|
||||||
background: #fcf9f2;
|
background: #fffbeb;
|
||||||
border-color: rgba(214, 166, 87, 0.3);
|
border-color: #fde68a;
|
||||||
}
|
|
||||||
|
|
||||||
.profile-tag-item.theme-gold .tag-title {
|
|
||||||
color: #9c6c19;
|
|
||||||
}
|
}
|
||||||
|
.profile-tag-item.theme-gold .tag-title { color: #d97706; }
|
||||||
|
|
||||||
.profile-tag-item.theme-blue {
|
.profile-tag-item.theme-blue {
|
||||||
background: #f3f8fd;
|
background: #f0f9ff;
|
||||||
border-color: rgba(66, 153, 225, 0.3);
|
border-color: #bae6fd;
|
||||||
}
|
|
||||||
|
|
||||||
.profile-tag-item.theme-blue .tag-title {
|
|
||||||
color: #2b6cb0;
|
|
||||||
}
|
}
|
||||||
|
.profile-tag-item.theme-blue .tag-title { color: #0284c7; }
|
||||||
|
|
||||||
.profile-tag-item.theme-green {
|
.profile-tag-item.theme-green {
|
||||||
background: #f1f8f5;
|
background: #ecfdf5;
|
||||||
border-color: rgba(12, 80, 69, 0.2);
|
border-color: #a7f3d0;
|
||||||
}
|
|
||||||
|
|
||||||
.profile-tag-item.theme-green .tag-title {
|
|
||||||
color: #0c5045;
|
|
||||||
}
|
}
|
||||||
|
.profile-tag-item.theme-green .tag-title { color: #10b981; }
|
||||||
|
|
||||||
.profile-tag-item.theme-purple {
|
.profile-tag-item.theme-purple {
|
||||||
background: #f8f4fd;
|
background: #faf5ff;
|
||||||
border-color: rgba(159, 122, 234, 0.3);
|
border-color: #e9d5ff;
|
||||||
}
|
|
||||||
|
|
||||||
.profile-tag-item.theme-purple .tag-title {
|
|
||||||
color: #6b46c1;
|
|
||||||
}
|
}
|
||||||
|
.profile-tag-item.theme-purple .tag-title { color: #9333ea; }
|
||||||
|
|
||||||
.tag-title {
|
.tag-title {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@@ -509,7 +505,7 @@ onUnmounted(() => { active = false })
|
|||||||
|
|
||||||
.tag-desc {
|
.tag-desc {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #60736c;
|
color: #64748b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
@@ -520,15 +516,15 @@ onUnmounted(() => { active = false })
|
|||||||
.empty-state p {
|
.empty-state p {
|
||||||
margin: 0 0 12px;
|
margin: 0 0 12px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #84968f;
|
color: #64748b;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 方案卡片 */
|
|
||||||
.version-tag {
|
.version-tag {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
background: #eef6f3;
|
background: #f0f9ff;
|
||||||
|
border: 1px solid #bae6fd;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
@@ -537,7 +533,7 @@ onUnmounted(() => { active = false })
|
|||||||
.plan-summary-text {
|
.plan-summary-text {
|
||||||
margin: 0 0 14px;
|
margin: 0 0 14px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #556c64;
|
color: #475569;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +544,8 @@ onUnmounted(() => { active = false })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.plan-row {
|
.plan-row {
|
||||||
background: #f9f8f4;
|
background: #f8fafc;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
}
|
}
|
||||||
@@ -564,28 +561,28 @@ onUnmounted(() => { active = false })
|
|||||||
width: 6px;
|
width: 6px;
|
||||||
height: 6px;
|
height: 6px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: #0c5045;
|
background: #0284c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plan-row-head strong {
|
.plan-row-head strong {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #173e37;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plan-target, .plan-advice {
|
.plan-target, .plan-advice {
|
||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #697c75;
|
color: #64748b;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 菜单导航 */
|
|
||||||
.action-card-menu {
|
.action-card-menu {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 20px;
|
border-radius: 16px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
border: 1px solid rgba(18, 63, 55, 0.06);
|
border: 1px solid #eef2f6;
|
||||||
|
box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
@@ -593,24 +590,15 @@ onUnmounted(() => { active = false })
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 14px 16px;
|
padding: 14px 16px;
|
||||||
border-bottom: 1px solid rgba(18, 63, 55, 0.05);
|
border-bottom: 1px solid #f1f5f9;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.2s;
|
transition: background 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item:last-child {
|
.menu-item:last-child { border-bottom: none; }
|
||||||
border-bottom: none;
|
.menu-item:active { background: #f8fafc; }
|
||||||
}
|
|
||||||
|
|
||||||
.menu-item:active {
|
.menu-left { display: flex; align-items: center; gap: 12px; }
|
||||||
background: #f8f7f3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-left {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu-icon {
|
.menu-icon {
|
||||||
width: 36px;
|
width: 36px;
|
||||||
@@ -621,51 +609,44 @@ onUnmounted(() => { active = false })
|
|||||||
}
|
}
|
||||||
|
|
||||||
.icon-assess {
|
.icon-assess {
|
||||||
background: #eef7f3;
|
background: #f0f9ff;
|
||||||
color: #0c5045;
|
color: #0284c7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-device {
|
.icon-device {
|
||||||
background: #fbf5e8;
|
background: #f0fdf4;
|
||||||
color: #b07e26;
|
color: #16a34a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-text strong {
|
.menu-text strong {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #183e37;
|
color: #0f172a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-text small {
|
.menu-text small {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #7b8e88;
|
color: #64748b;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
color: #b3bfb9;
|
color: #94a3b8;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logout-wrap {
|
.logout-wrap { margin-top: 24px; }
|
||||||
margin-top: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout-btn {
|
.logout-btn {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 13px 0;
|
padding: 13px 0;
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
border: 1px solid rgba(220, 70, 70, 0.25);
|
border: 1px solid #fecaca;
|
||||||
background: #ffffff;
|
background: #fff5f5;
|
||||||
color: #d64545;
|
color: #ef4444;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout-btn:active {
|
|
||||||
background: #fff5f5;
|
|
||||||
}
|
}
|
||||||
|
.logout-btn:active { background: #fee2e2; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,248 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
|
import AppTabBar from '../components/AppTabBar.vue'
|
||||||
|
import Ib43AutomationCard from '../components/Ib43AutomationCard.vue'
|
||||||
|
import { usePageRequest } from '../composables/usePageRequest'
|
||||||
|
import { displayIb43Value, formatIb43Time, ib43Api, ib43Metrics,
|
||||||
|
type Ib43Bed, type Ib43Current, type Ib43HistoryItem, type Ib43HistoryQuery } from '../services/ib43'
|
||||||
|
|
||||||
|
const beds = ref<Ib43Bed[]>([])
|
||||||
|
const bedId = ref('')
|
||||||
|
const selectedBed = computed(() => beds.value.find(bed => bed.id === bedId.value))
|
||||||
|
const current = ref<Ib43Current>()
|
||||||
|
const history = ref<Ib43HistoryItem[]>([])
|
||||||
|
const historyDays = ref(7)
|
||||||
|
const nextBeforeId = ref<number | string>()
|
||||||
|
const bindingsLoading = ref(true)
|
||||||
|
const currentLoading = ref(false)
|
||||||
|
const historyLoading = ref(false)
|
||||||
|
const bindingsError = ref('')
|
||||||
|
const currentError = ref('')
|
||||||
|
const historyError = ref('')
|
||||||
|
const bindingsRequest = usePageRequest()
|
||||||
|
const currentRequest = usePageRequest()
|
||||||
|
const historyRequest = usePageRequest()
|
||||||
|
let historyRange: Pick<Ib43HistoryQuery, 'fromMs' | 'toMs'>
|
||||||
|
let refreshTimer: ReturnType<typeof setInterval>
|
||||||
|
|
||||||
|
function message(error: unknown, fallback: string) {
|
||||||
|
return error instanceof Error && error.message ? error.message : fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
function bedLabel(bed: Ib43Bed) {
|
||||||
|
const side = bed.side === 'left' ? '左侧' : '右侧'
|
||||||
|
const name = bed.bedName.endsWith(side) ? bed.bedName : `${bed.bedName} · ${side}`
|
||||||
|
return bed.endedAtMs == null ? name : `${name}(已解绑)`
|
||||||
|
}
|
||||||
|
|
||||||
|
const connectionLabel = computed(() => {
|
||||||
|
if (!current.value) return ''
|
||||||
|
if (!current.value.active) return '已解绑'
|
||||||
|
switch (current.value.transport) {
|
||||||
|
case 'connected': return '数据服务已连接'
|
||||||
|
case 'connecting': return '数据服务正在连接'
|
||||||
|
case 'disconnected': return '数据服务连接中断'
|
||||||
|
case 'disabled': return '数据采集未开启'
|
||||||
|
case 'unconfigured': return '设备未配置采集'
|
||||||
|
default: return '连接状态未知'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
async function loadBindings() {
|
||||||
|
const requestId = bindingsRequest.begin()
|
||||||
|
currentRequest.begin()
|
||||||
|
historyRequest.begin()
|
||||||
|
bindingsLoading.value = true
|
||||||
|
bindingsError.value = ''
|
||||||
|
try {
|
||||||
|
const result = await ib43Api.bindings()
|
||||||
|
if (!bindingsRequest.isCurrent(requestId)) return
|
||||||
|
beds.value = result
|
||||||
|
bedId.value = result.find(bed => bed.id === bedId.value)?.id ??
|
||||||
|
result.find(bed => bed.endedAtMs == null)?.id ?? result[0]?.id ?? ''
|
||||||
|
if (bedId.value) loadBed()
|
||||||
|
} catch (error) {
|
||||||
|
if (bindingsRequest.isCurrent(requestId)) bindingsError.value = message(error, '暂时无法读取床位')
|
||||||
|
} finally {
|
||||||
|
if (bindingsRequest.isCurrent(requestId)) bindingsLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadCurrent() {
|
||||||
|
const id = bedId.value
|
||||||
|
const requestId = currentRequest.begin()
|
||||||
|
currentLoading.value = true
|
||||||
|
currentError.value = ''
|
||||||
|
try {
|
||||||
|
const result = await ib43Api.current(id)
|
||||||
|
if (currentRequest.isCurrent(requestId)) current.value = result
|
||||||
|
} catch (error) {
|
||||||
|
if (currentRequest.isCurrent(requestId)) currentError.value = message(error, '暂时无法读取最近数据')
|
||||||
|
} finally {
|
||||||
|
if (currentRequest.isCurrent(requestId)) currentLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadHistory(append = false) {
|
||||||
|
const id = bedId.value
|
||||||
|
const requestId = historyRequest.begin()
|
||||||
|
const beforeId = append ? nextBeforeId.value : undefined
|
||||||
|
if (!append) {
|
||||||
|
const toMs = Date.now() + 1
|
||||||
|
historyRange = { fromMs: toMs - historyDays.value * 86400000, toMs }
|
||||||
|
history.value = []
|
||||||
|
nextBeforeId.value = undefined
|
||||||
|
}
|
||||||
|
historyLoading.value = true
|
||||||
|
historyError.value = ''
|
||||||
|
try {
|
||||||
|
const result = await ib43Api.history(id, { ...historyRange, beforeId, take: 20 })
|
||||||
|
if (!historyRequest.isCurrent(requestId)) return
|
||||||
|
history.value = append ? [...history.value, ...result.items] : result.items
|
||||||
|
nextBeforeId.value = result.nextBeforeId ?? undefined
|
||||||
|
} catch (error) {
|
||||||
|
if (historyRequest.isCurrent(requestId)) historyError.value = message(error, '暂时无法读取历史记录')
|
||||||
|
} finally {
|
||||||
|
if (historyRequest.isCurrent(requestId)) historyLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadBed() {
|
||||||
|
current.value = undefined
|
||||||
|
void loadCurrent()
|
||||||
|
void loadHistory()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
void loadBindings()
|
||||||
|
refreshTimer = setInterval(() => {
|
||||||
|
if (!document.hidden && !bindingsLoading.value && !bindingsError.value && !currentLoading.value &&
|
||||||
|
selectedBed.value && selectedBed.value.endedAtMs == null) void loadCurrent()
|
||||||
|
}, 30000)
|
||||||
|
})
|
||||||
|
onUnmounted(() => clearInterval(refreshTimer))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<main class="page-shell sleep-data-page">
|
||||||
|
<header class="sleep-heading">
|
||||||
|
<div>
|
||||||
|
<RouterLink class="sleep-back" to="/dashboard">‹ 返回首页</RouterLink>
|
||||||
|
<h1>睡眠数据</h1>
|
||||||
|
</div>
|
||||||
|
<button class="sleep-button" type="button" :disabled="bindingsLoading" @click="loadBindings">刷新</button>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section v-if="bindingsLoading" class="section-card page-load-state" role="status">
|
||||||
|
<span class="page-loading-mark" aria-hidden="true"></span><p>正在读取床位…</p>
|
||||||
|
</section>
|
||||||
|
<section v-else-if="bindingsError" class="section-card page-error-state" role="alert">
|
||||||
|
<h2>暂时无法读取床位</h2><p>{{ bindingsError }}</p>
|
||||||
|
<button class="retry-button" type="button" @click="loadBindings">重新加载</button>
|
||||||
|
</section>
|
||||||
|
<section v-else-if="!selectedBed" class="section-card page-load-state">
|
||||||
|
<h2>暂无绑定床位</h2><p>绑定床位后,这里会显示该侧的观测记录。</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<section class="section-card sleep-bed" aria-label="当前床位">
|
||||||
|
<label v-if="beds.length > 1" for="sleep-bed">我的床位</label>
|
||||||
|
<span v-else class="sleep-muted">我的床位</span>
|
||||||
|
<select v-if="beds.length > 1" id="sleep-bed" v-model="bedId" @change="loadBed">
|
||||||
|
<option v-for="bed in beds" :key="bed.id" :value="bed.id">{{ bedLabel(bed) }}</option>
|
||||||
|
</select>
|
||||||
|
<strong v-else>{{ bedLabel(selectedBed) }}</strong>
|
||||||
|
<div class="sleep-bed-status">
|
||||||
|
<span v-if="selectedBed.simulation" class="sleep-chip">模拟设备</span>
|
||||||
|
<span v-if="connectionLabel">{{ connectionLabel }}</span>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section-card" aria-labelledby="sleep-current-title">
|
||||||
|
<div class="sleep-section-title"><h2 id="sleep-current-title">最近读数</h2></div>
|
||||||
|
<p v-if="currentLoading && !current" class="sleep-muted" role="status">正在读取最近读数…</p>
|
||||||
|
<div v-if="currentError" class="sleep-error" role="alert">
|
||||||
|
<p>{{ currentError }}</p>
|
||||||
|
<button class="sleep-button" type="button" :disabled="currentLoading" @click="loadCurrent">重试</button>
|
||||||
|
</div>
|
||||||
|
<dl v-if="current" class="sleep-metrics">
|
||||||
|
<div v-for="metric in ib43Metrics" :key="metric.key">
|
||||||
|
<dt>{{ metric.label }}</dt>
|
||||||
|
<dd class="sleep-metric-value">{{ displayIb43Value(metric.key, current.readings[metric.key]?.value) }}</dd>
|
||||||
|
<dd class="sleep-metric-meta">
|
||||||
|
<small>{{ formatIb43Time(current.readings[metric.key]?.receivedAt) || '暂无上报' }}</small>
|
||||||
|
<span v-if="current.readings[metric.key]?.freshness === 'stale'" class="sleep-chip stale">数据已过期</span>
|
||||||
|
<small v-else-if="current.readings[metric.key]?.receivedAt && current.readings[metric.key]?.value == null">暂无有效读数</small>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<Ib43AutomationCard v-if="selectedBed.simulation" :key="bedId" :binding-id="bedId" />
|
||||||
|
|
||||||
|
<section class="section-card" aria-labelledby="sleep-history-title">
|
||||||
|
<div class="sleep-section-title">
|
||||||
|
<h2 id="sleep-history-title">历史记录</h2>
|
||||||
|
<select v-model.number="historyDays" aria-label="历史时间范围" @change="loadHistory()">
|
||||||
|
<option :value="7">最近 7 天</option>
|
||||||
|
<option :value="1">最近 24 小时</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<p v-if="historyLoading && history.length === 0" class="sleep-muted" role="status">正在读取历史记录…</p>
|
||||||
|
<p v-else-if="!historyError && history.length === 0" class="sleep-muted">这段时间暂无记录。</p>
|
||||||
|
<ol v-if="history.length" class="sleep-history">
|
||||||
|
<li v-for="item in history" :key="item.id">
|
||||||
|
<time>{{ formatIb43Time(item.receivedAtMs) }}</time>
|
||||||
|
<dl>
|
||||||
|
<template v-for="metric in ib43Metrics" :key="metric.key">
|
||||||
|
<div v-if="item.readings[metric.key]">
|
||||||
|
<dt>{{ metric.label }}</dt>
|
||||||
|
<dd>{{ displayIb43Value(metric.key, item.readings[metric.key]?.value) }}</dd>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
<div v-if="historyError" class="sleep-error" role="alert">
|
||||||
|
<p>{{ historyError }}</p>
|
||||||
|
<button class="sleep-button" type="button" @click="loadHistory(history.length > 0)">重试</button>
|
||||||
|
</div>
|
||||||
|
<button v-else-if="nextBeforeId != null" class="sleep-button sleep-more" type="button"
|
||||||
|
:disabled="historyLoading" @click="loadHistory(true)">{{ historyLoading ? '正在加载…' : '加载更多' }}</button>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
<AppTabBar />
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.sleep-heading, .sleep-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||||
|
.sleep-heading { margin-bottom: 18px; }
|
||||||
|
.sleep-heading h1 { margin: 5px 0 0; font-size: 26px; line-height: 1.3; }
|
||||||
|
.sleep-back { display: inline-flex; align-items: center; min-height: 40px; color: var(--green); font-size: 13px; text-decoration: none; }
|
||||||
|
.sleep-section-title { margin-bottom: 14px; }
|
||||||
|
.sleep-data-page h2 { margin: 0; font-size: 17px; }
|
||||||
|
.sleep-button, .sleep-data-page select { min-height: 44px; border: 1px solid #bae6fd; border-radius: 12px; background: #f0f9ff; color: #0284c7; padding: 8px 12px; font: inherit; font-size: 13px; }
|
||||||
|
.sleep-button:disabled { opacity: .55; }
|
||||||
|
.sleep-bed { display: grid; gap: 8px; overflow-wrap: anywhere; }
|
||||||
|
.sleep-bed label, .sleep-bed-status, .sleep-muted, .sleep-metrics small { font-size: 13px; color: var(--muted-text); }
|
||||||
|
.sleep-bed-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
||||||
|
.sleep-chip { display: inline-block; width: fit-content; padding: 4px 8px; border-radius: 8px; background: #f0f9ff; color: #0284c7; font-size: 12px; }
|
||||||
|
.sleep-chip.stale { background: #fef3c7; color: #92400e; }
|
||||||
|
.sleep-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
|
||||||
|
.sleep-metrics > div { display: grid; align-content: start; gap: 5px; padding: 12px; border-radius: 13px; background: #f8fafc; border: 1px solid #e2e8f0; }
|
||||||
|
.sleep-metrics dt, .sleep-history dt { color: var(--muted-text); font-size: 13px; }
|
||||||
|
.sleep-metrics dd { margin: 0; }
|
||||||
|
.sleep-metric-value { font-size: 22px; font-weight: 700; }
|
||||||
|
.sleep-metric-meta { display: grid; gap: 5px; }
|
||||||
|
.sleep-metrics small, .sleep-history time { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
|
||||||
|
.sleep-history { list-style: none; padding: 0; margin: 0; }
|
||||||
|
.sleep-history li { border-top: 1px solid #e2e8f0; padding: 12px 0; }
|
||||||
|
.sleep-history time { color: #0f172a; font-size: 13px; font-weight: 600; }
|
||||||
|
.sleep-history dl { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0 0; }
|
||||||
|
.sleep-history dl > div { display: flex; align-items: baseline; gap: 5px; }
|
||||||
|
.sleep-history dd { margin: 0; font-size: 14px; }
|
||||||
|
.sleep-more { width: 100%; margin-top: 8px; }
|
||||||
|
.sleep-error { color: #8b432f; font-size: 13px; padding: 8px 0; overflow-wrap: anywhere; }
|
||||||
|
.sleep-error p { margin: 0 0 8px; }
|
||||||
|
</style>
|
||||||
@@ -168,9 +168,9 @@ async function submit() {
|
|||||||
<p class="capability-note">香型需人工更换,体质音乐可由音箱自动播放,室温仅供参考;一键启动只下发当前已支持的设备参数。</p>
|
<p class="capability-note">香型需人工更换,体质音乐可由音箱自动播放,室温仅供参考;一键启动只下发当前已支持的设备参数。</p>
|
||||||
<div class="parameter-preview">
|
<div class="parameter-preview">
|
||||||
<span>一键启动预设</span>
|
<span>一键启动预设</span>
|
||||||
<p>湿度 {{ result.sceneConfig.targetHumidity }}% · 灯光 {{ result.sceneConfig.lightColorTemperatureKelvin }}K</p>
|
<p>目标湿度 {{ result.sceneConfig.targetHumidity }}%</p>
|
||||||
<p>香氛{{ result.sceneConfig.enableFragrance ? '开启' : '关闭' }} · 体质音乐循环播放,从 50% 每 5 秒降 1% 至停止</p>
|
<p>香氛{{ result.sceneConfig.enableFragrance ? '开启' : '关闭' }} · 体质音乐循环播放,从 50% 每 5 秒降 1% 至停止</p>
|
||||||
<p>床垫加热根据当前室温与体质建议区间决定;室温不可用时不自动加热。软硬度按健康档案 BMI 给出演示起点,可手动调整。</p>
|
<p>空调根据当前室温与体质建议区间决定制热或制冷;室温不可用时不自动开启,区间内保持当前运行状态。</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -212,42 +212,43 @@ async function submit() {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.tcm-page { max-width: 480px; margin: 0 auto; padding: 18px 16px calc(100px + env(safe-area-inset-bottom)); color: #173d35; box-sizing: border-box; }
|
.tcm-page { max-width: 480px; margin: 0 auto; padding: 20px var(--page-gutter, 16px) calc(88px + env(safe-area-inset-bottom)); color: #0f172a; box-sizing: border-box; background: linear-gradient(180deg, #bfe3fc 0%, #e0f2fe 22%, #f0f9ff 48%, #f8fafc 100%); min-height: 100vh; }
|
||||||
.tcm-header { padding: 18px 8px 20px; }
|
.tcm-header { padding: 4px 4px 16px; background: transparent; }
|
||||||
.eyebrow { color: #a37941; font-size: 11px; font-weight: 700; letter-spacing: .14em; }
|
.eyebrow { color: #0284c7; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
|
||||||
.tcm-header h1 { font-size: 26px; margin: 5px 0 8px; }
|
.tcm-header h1 { font-size: 26px; margin: 5px 0 8px; color: #0f172a; font-weight: 700; }
|
||||||
.tcm-header > p:not(.eyebrow) { color: #71837b; font-size: 13px; line-height: 1.65; }
|
.tcm-header > p:not(.eyebrow) { color: #64748b; font-size: 13px; line-height: 1.65; }
|
||||||
.progress-row { display: flex; justify-content: space-between; color: #527169; font-size: 12px; margin-top: 18px; }
|
.progress-row { display: flex; justify-content: space-between; color: #64748b; font-size: 12px; margin-top: 14px; }
|
||||||
.tcm-card { background: #fff; border: 1px solid #e9eee9; box-shadow: 0 8px 26px rgba(18, 62, 55, .06); border-radius: 20px; padding: 20px; margin-bottom: 15px; }
|
.tcm-card { background: #ffffff; border: 1px solid #eef2f6; box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.04); border-radius: 16px; padding: 20px 16px; margin-bottom: 15px; }
|
||||||
.tcm-form { min-width: 0; margin: 0; padding: 0; border: 0; }
|
.tcm-form { min-width: 0; margin: 0; padding: 0; border: 0; }
|
||||||
.tcm-form[disabled] { opacity: .72; }
|
.tcm-form[disabled] { opacity: .72; }
|
||||||
.page-error-state h2 { margin: 0 0 8px; font-size: 17px; }
|
.page-error-state h2 { margin: 0 0 8px; font-size: 17px; color: #0f172a; }
|
||||||
.page-error-state p { color: #71837b; font-size: 13px; line-height: 1.6; }
|
.page-error-state p { color: #64748b; font-size: 13px; line-height: 1.6; }
|
||||||
.result-change-note { padding: 10px 12px; border-radius: 10px; background: rgba(238,221,187,.15); color: #f2e4c8; }
|
.result-change-note { padding: 10px 12px; border-radius: 10px; background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
|
||||||
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-bottom: 1px solid #edf1ee; padding-bottom: 12px; }
|
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; }
|
||||||
.section-heading h2 { margin: 0; font-size: 19px; }
|
.section-heading h2 { margin: 0; font-size: 18px; color: #0f172a; font-weight: 700; }
|
||||||
.section-heading p { margin: 0; color: #86958d; font-size: 11px; text-align: right; }
|
.section-heading p { margin: 0; color: #64748b; font-size: 11px; text-align: right; }
|
||||||
.question { padding: 15px 0; border-bottom: 1px solid #f0f2f0; scroll-margin-top: 80px; }
|
.question { padding: 14px 0; border-bottom: 1px solid #f1f5f9; scroll-margin-top: 80px; }
|
||||||
.question h3 { font-size: 14px; margin: 0 0 10px; }
|
.question h3 { font-size: 14px; margin: 0 0 10px; color: #0f172a; font-weight: 600; }
|
||||||
.question small { color: #a88b5c; font-size: 10px; font-weight: 400; margin-left: 5px; }
|
.question small { color: #d97706; font-size: 10px; font-weight: 600; margin-left: 5px; background: #fffbeb; padding: 1px 5px; border-radius: 4px; border: 1px solid #fde68a; }
|
||||||
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
|
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
|
||||||
.choice-grid button { min-height: 39px; border: 1px solid #e4e9e5; border-radius: 11px; background: #f9fbf9; color: #496158; font-size: 13px; }
|
.choice-grid button { min-height: 42px; border: 1px solid #e2e8f0; border-radius: 12px; background: #f8fafc; color: #334155; font-size: 13px; font-weight: 500; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
|
||||||
.choice-grid button.selected { border-color: #0c5045; background: #0c5045; color: #fff; font-weight: 700; }
|
.choice-grid button.selected { border-color: #0284c7; background: #f0f9ff; color: #0369a1; font-weight: 700; box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08); }
|
||||||
.note-label { display: block; font-size: 13px; font-weight: 600; margin-top: 15px; }
|
.note-label { display: block; font-size: 12px; font-weight: 600; color: #334155; margin-top: 15px; }
|
||||||
.note-label textarea { display: block; width: 100%; min-height: 68px; resize: vertical; box-sizing: border-box; margin-top: 8px; border: 1px solid #e4e9e5; border-radius: 11px; padding: 10px; font: inherit; font-weight: 400; color: #173d35; }
|
.note-label textarea { display: block; width: 100%; min-height: 68px; resize: vertical; box-sizing: border-box; margin-top: 8px; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; font: inherit; font-weight: 400; color: #0f172a; background: #f8fafc; }
|
||||||
.result-card { background: linear-gradient(150deg, #123e37, #0b5144); color: #fff; scroll-margin-top: 16px; }
|
.note-label textarea:focus { border-color: #0284c7; background: #ffffff; outline: none; box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12); }
|
||||||
.result-top { display: flex; justify-content: space-between; font-size: 12px; opacity: .8; }
|
.result-card { background: #ffffff; color: #0f172a; border: 1px solid #bae6fd; box-shadow: 0 4px 20px -2px rgba(2, 132, 199, 0.08); border-radius: 16px; padding: 20px 16px; }
|
||||||
.result-card h2 { font-size: 27px; margin: 14px 0 8px; }
|
.result-top { display: flex; justify-content: space-between; font-size: 12px; color: #64748b; }
|
||||||
.result-card p { font-size: 12px; line-height: 1.6; }
|
.result-card h2 { font-size: 26px; margin: 14px 0 8px; color: #0284c7; font-weight: 800; }
|
||||||
|
.result-card p { font-size: 12px; line-height: 1.6; color: #475569; }
|
||||||
.recommendations { display: grid; gap: 7px; margin: 16px 0; }
|
.recommendations { display: grid; gap: 7px; margin: 16px 0; }
|
||||||
.recommendations div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.17); font-size: 12px; }
|
.recommendations div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px; }
|
||||||
.recommendations span { opacity: .7; }
|
.recommendations span { color: #64748b; }
|
||||||
.recommendations strong { text-align: right; }
|
.recommendations strong { color: #0f172a; text-align: right; }
|
||||||
.capability-note { opacity: .78; }
|
.capability-note { color: #64748b; }
|
||||||
.parameter-preview { background: rgba(255,255,255,.1); border-radius: 12px; padding: 12px; margin-top: 16px; }
|
.parameter-preview { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; margin-top: 16px; }
|
||||||
.parameter-preview span { font-size: 12px; font-weight: 700; }
|
.parameter-preview span { font-size: 12px; font-weight: 700; color: #0f172a; }
|
||||||
.parameter-preview p { margin: 6px 0 0; }
|
.parameter-preview p { margin: 6px 0 0; color: #64748b; }
|
||||||
.submit-button { width: 100%; min-height: 49px; border: 0; border-radius: 25px; background: #0c5045; color: #fff; font-weight: 700; font-size: 15px; }
|
.submit-button { width: 100%; min-height: 48px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); color: #fff; font-weight: 700; font-size: 15px; box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28); }
|
||||||
.submit-button:disabled { opacity: .55; }
|
.submit-button:disabled { opacity: .55; }
|
||||||
.tcm-disclaimer { color: #8a9890; font-size: 11px; line-height: 1.6; text-align: center; margin: 14px 12px 0; }
|
.tcm-disclaimer { color: #94a3b8; font-size: 11px; line-height: 1.6; text-align: center; margin: 14px 12px 0; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+2
-1
@@ -6,7 +6,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
return {
|
return {
|
||||||
plugins: [vue()],
|
plugins: [vue()],
|
||||||
server: {
|
server: {
|
||||||
port: 5173,
|
port: 5176,
|
||||||
|
strictPort: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: env.VITE_API_BASE_URL || 'http://localhost:5005',
|
target: env.VITE_API_BASE_URL || 'http://localhost:5005',
|
||||||
|
|||||||
Reference in New Issue
Block a user