feat(miniprogram): 老年友好版本全面重设计 — 5→4 Tab + 首页/健康/消息/我的重写
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

- TabBar 从 5 Tab 调整为 4 Tab(首页/健康/消息/我的)
- 首页重写为 5 区域布局:问候+进度环+体征2x2+待办+快捷操作
- 健康页重写:体征录入大输入框+趋势柱状图+BLE设备卡片
- 新建消息页:咨询对话+系统通知双 Tab
- 我的页调整:菜单高度64px+新增积分商城入口
- 设计系统更新:色彩对比度提升(WCAG AA)+触控参数+老年友好 mixin
- 新增 ProgressRing 组件(CSS conic-gradient 实现)
- 修复 diagnoses 页面 $suc-l 未定义变量
This commit is contained in:
iven
2026-04-30 22:51:05 +08:00
parent 813843e8cc
commit 50772878da
14 changed files with 1256 additions and 771 deletions

View File

@@ -0,0 +1,194 @@
@import '../../styles/variables.scss';
@import '../../styles/mixins.scss';
.messages-page {
min-height: 100vh;
background: $bg;
padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
/* ─── 页头 ─── */
.messages-header {
padding: 24px 32px 8px;
}
.messages-title {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: 36px;
font-weight: bold;
color: $tx;
}
/* ─── Tab 切换 ─── */
.msg-tabs {
display: flex;
padding: 16px 24px 0;
gap: 0;
}
.msg-tab {
flex: 1;
height: $tab-h;
@include flex-center;
&:active {
opacity: 0.85;
}
}
.msg-tab-text {
font-size: 28px;
font-weight: 600;
color: $tx2;
}
.msg-tab-active .msg-tab-text {
color: $pri;
}
.msg-tab-indicator {
padding: 0 24px;
height: 3px;
background: $bd-l;
margin-bottom: 16px;
}
.msg-tab-bar {
width: 50%;
height: 3px;
background: $pri;
border-radius: 2px;
transition: transform 0.2s;
&.msg-tab-bar-right {
transform: translateX(100%);
}
}
/* ─── 内容区 ─── */
.msg-content {
padding: 0 24px;
}
.msg-empty {
background: $card;
border-radius: $r;
padding: 48px 24px;
text-align: center;
box-shadow: $shadow-sm;
}
.msg-empty-text {
font-size: 26px;
color: $tx2;
}
/* ─── 咨询卡片 ─── */
.consult-card {
display: flex;
align-items: center;
background: $card;
border-radius: $r;
padding: 24px;
margin-bottom: 12px;
box-shadow: $shadow-sm;
&:active {
opacity: 0.85;
}
}
.consult-info {
flex: 1;
min-width: 0;
}
.consult-doctor {
font-size: 28px;
font-weight: 600;
color: $tx;
display: block;
margin-bottom: 6px;
}
.consult-preview {
font-size: 24px;
color: $tx2;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.consult-meta {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 8px;
flex-shrink: 0;
margin-left: 16px;
}
.consult-time {
font-size: 22px;
color: $tx2;
}
.consult-badge {
min-width: 24px;
height: 24px;
border-radius: 12px;
background: $dan;
@include flex-center;
padding: 0 6px;
}
.consult-badge-text {
font-size: 18px;
color: #fff;
font-weight: 600;
}
/* ─── 通知卡片 ─── */
.notify-card {
display: flex;
align-items: center;
background: $card;
border-radius: $r;
padding: 24px;
margin-bottom: 12px;
box-shadow: $shadow-sm;
&:active {
opacity: 0.85;
}
}
.notify-info {
flex: 1;
min-width: 0;
}
.notify-title {
font-size: 28px;
font-weight: 600;
color: $tx;
display: block;
margin-bottom: 6px;
}
.notify-desc {
font-size: 24px;
color: $tx2;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.notify-time {
font-size: 22px;
color: $tx2;
flex-shrink: 0;
margin-left: 16px;
}

View File

@@ -0,0 +1,154 @@
import { useState } from 'react';
import { View, Text } from '@tarojs/components';
import Taro, { useDidShow } from '@tarojs/taro';
import { listConsultations, ConsultationSession } from '../../services/consultation';
import Loading from '../../components/Loading';
import './index.scss';
type MsgTab = 'consultation' | 'notification';
interface NotificationItem {
id: string;
title: string;
desc: string;
time: string;
type: string;
}
export default function Messages() {
const [activeTab, setActiveTab] = useState<MsgTab>('consultation');
const [sessions, setSessions] = useState<ConsultationSession[]>([]);
const [notifications, setNotifications] = useState<NotificationItem[]>([]);
const [loading, setLoading] = useState(false);
useDidShow(() => {
loadData(activeTab);
});
const loadData = async (tab: MsgTab) => {
setLoading(true);
try {
if (tab === 'consultation') {
const res = await listConsultations({ page: 1, page_size: 20 });
setSessions(res.data || []);
} else {
// 通知目前从咨询中提取状态变化作为示例
// 后续可对接独立通知 API
setNotifications([]);
}
} catch {
if (tab === 'consultation') setSessions([]);
else setNotifications([]);
} finally {
setLoading(false);
}
};
const handleTabChange = (tab: MsgTab) => {
setActiveTab(tab);
loadData(tab);
};
const formatTime = (dateStr: string | null) => {
if (!dateStr) return '';
const d = new Date(dateStr);
const now = new Date();
const diffMs = now.getTime() - d.getTime();
const diffMin = Math.floor(diffMs / 60000);
if (diffMin < 60) return `${diffMin} 分钟前`;
const diffHour = Math.floor(diffMin / 60);
if (diffHour < 24) return `${diffHour} 小时前`;
return dateStr.slice(0, 10);
};
return (
<View className='messages-page'>
{/* 页头 */}
<View className='messages-header'>
<Text className='messages-title'></Text>
</View>
{/* Tab 切换 */}
<View className='msg-tabs'>
<View
className={`msg-tab ${activeTab === 'consultation' ? 'msg-tab-active' : ''}`}
onClick={() => handleTabChange('consultation')}
>
<Text className='msg-tab-text'></Text>
</View>
<View
className={`msg-tab ${activeTab === 'notification' ? 'msg-tab-active' : ''}`}
onClick={() => handleTabChange('notification')}
>
<Text className='msg-tab-text'></Text>
</View>
</View>
<View className='msg-tab-indicator'>
<View className={`msg-tab-bar ${activeTab === 'notification' ? 'msg-tab-bar-right' : ''}`} />
</View>
{/* 咨询列表 */}
{activeTab === 'consultation' && (
<View className='msg-content'>
{loading ? (
<Loading />
) : sessions.length === 0 ? (
<View className='msg-empty'>
<Text className='msg-empty-text'></Text>
</View>
) : (
sessions.map((session) => (
<View
key={session.id}
className='consult-card'
onClick={() => Taro.navigateTo({ url: `/pages/consultation/detail/index?id=${session.id}` })}
>
<View className='consult-info'>
<Text className='consult-doctor'>
{session.consultation_type === 'online' ? '在线咨询' : '门诊咨询'}
</Text>
<Text className='consult-preview'>
{session.last_message || session.subject || '暂无消息'}
</Text>
</View>
<View className='consult-meta'>
<Text className='consult-time'>{formatTime(session.last_message_at)}</Text>
{session.unread_count_patient > 0 && (
<View className='consult-badge'>
<Text className='consult-badge-text'>
{session.unread_count_patient > 99 ? '99+' : session.unread_count_patient}
</Text>
</View>
)}
</View>
</View>
))
)}
</View>
)}
{/* 通知列表 */}
{activeTab === 'notification' && (
<View className='msg-content'>
{loading ? (
<Loading />
) : notifications.length === 0 ? (
<View className='msg-empty'>
<Text className='msg-empty-text'></Text>
</View>
) : (
notifications.map((n) => (
<View key={n.id} className='notify-card'>
<View className='notify-info'>
<Text className='notify-title'>{n.title}</Text>
<Text className='notify-desc'>{n.desc}</Text>
</View>
<Text className='notify-time'>{n.time}</Text>
</View>
))
)}
</View>
)}
</View>
);
}