fix(miniprogram): 统一状态色映射,对齐设计系统色板
- 创建 utils/statusTag.ts 共享状态色工具(对齐 variables.scss) - doctor/consultation: 使用共享状态色替代 Tailwind 硬编码 - doctor/followup: 使用共享状态色替代 Tailwind 硬编码 - doctor/action-inbox: SCSS 状态点替换为设计系统变量 - doctor/index: SCSS 告警/搜索区替换为设计系统变量 - pkg-health/alerts: SCSS 严重度标签替换为设计系统变量
This commit is contained in:
@@ -142,10 +142,10 @@
|
||||
margin-top: 4px;
|
||||
flex-shrink: 0;
|
||||
|
||||
&.completed { background: #52c41a; }
|
||||
&.in_progress { background: #faad14; }
|
||||
&.pending { background: #d9d9d9; }
|
||||
&.dismissed { background: #ff4d4f; }
|
||||
&.completed { background: $acc; }
|
||||
&.in_progress { background: $wrn; }
|
||||
&.pending { background: $tx3; }
|
||||
&.dismissed { background: $dan; }
|
||||
}
|
||||
|
||||
.thread-content {
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
type ThreadResponse,
|
||||
} from '@/services/action-inbox';
|
||||
import Loading from '@/components/Loading';
|
||||
import { getStatusInlineStyle, getStatusLabel } from '@/utils/statusTag';
|
||||
import './index.scss';
|
||||
|
||||
const TYPE_LABEL: Record<string, string> = {
|
||||
|
||||
@@ -4,14 +4,10 @@ import Taro from '@tarojs/taro';
|
||||
import * as doctorApi from '@/services/doctor';
|
||||
import Loading from '@/components/Loading';
|
||||
import EmptyState from '@/components/EmptyState';
|
||||
import { getStatusInlineStyle, getStatusLabel } from '@/utils/statusTag';
|
||||
import { formatDateTime } from '@/utils/date';
|
||||
import './index.scss';
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; color: string }> = {
|
||||
waiting: { label: '等待中', color: '#f59e0b' },
|
||||
active: { label: '进行中', color: '#10b981' },
|
||||
closed: { label: '已关闭', color: '#94a3b8' },
|
||||
};
|
||||
|
||||
const TABS = [
|
||||
{ key: '', label: '全部' },
|
||||
{ key: 'active', label: '进行中' },
|
||||
@@ -54,12 +50,7 @@ export default function ConsultationList() {
|
||||
|
||||
const formatTime = (dateStr?: string | null) => {
|
||||
if (!dateStr) return '';
|
||||
const d = new Date(dateStr);
|
||||
const now = new Date();
|
||||
if (d.toDateString() === now.toDateString()) {
|
||||
return d.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
return d.toLocaleDateString('zh-CN', { month: 'numeric', day: 'numeric' });
|
||||
return formatDateTime(dateStr);
|
||||
};
|
||||
|
||||
if (loading && sessions.length === 0) return <Loading />;
|
||||
@@ -83,7 +74,6 @@ export default function ConsultationList() {
|
||||
) : (
|
||||
<View className='session-list'>
|
||||
{sessions.map((s) => {
|
||||
const st = STATUS_MAP[s.status] || { label: s.status, color: '#94a3b8' };
|
||||
return (
|
||||
<View
|
||||
key={s.id}
|
||||
@@ -92,8 +82,8 @@ export default function ConsultationList() {
|
||||
>
|
||||
<View className='session-card__top'>
|
||||
<Text className='session-card__subject'>{s.subject || '在线咨询'}</Text>
|
||||
<View className='session-card__status' style={`background: ${st.color}20; color: ${st.color}`}>
|
||||
<Text className='session-card__status-text'>{st.label}</Text>
|
||||
<View className='session-card__status' style={getStatusInlineStyle(s.status)}>
|
||||
<Text className='session-card__status-text'>{getStatusLabel(s.status)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className='session-card__info'>
|
||||
|
||||
@@ -4,16 +4,9 @@ import Taro, { useRouter } from '@tarojs/taro';
|
||||
import * as doctorApi from '@/services/doctor';
|
||||
import Loading from '@/components/Loading';
|
||||
import EmptyState from '@/components/EmptyState';
|
||||
import { getStatusInlineStyle, getStatusLabel } from '@/utils/statusTag';
|
||||
import './index.scss';
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; color: string }> = {
|
||||
pending: { label: '待处理', color: '#f59e0b' },
|
||||
in_progress: { label: '进行中', color: '#0891b2' },
|
||||
completed: { label: '已完成', color: '#10b981' },
|
||||
overdue: { label: '已逾期', color: '#ef4444' },
|
||||
cancelled: { label: '已取消', color: '#94a3b8' },
|
||||
};
|
||||
|
||||
const TABS = [
|
||||
{ key: '', label: '全部' },
|
||||
{ key: 'pending', label: '待处理' },
|
||||
@@ -91,7 +84,6 @@ export default function FollowUpList() {
|
||||
) : (
|
||||
<View className='task-list'>
|
||||
{tasks.map((task) => {
|
||||
const st = STATUS_MAP[task.status] || { label: task.status, color: '#94a3b8' };
|
||||
return (
|
||||
<View
|
||||
key={task.id}
|
||||
@@ -100,8 +92,8 @@ export default function FollowUpList() {
|
||||
>
|
||||
<View className='task-card__header'>
|
||||
<Text className='task-card__type'>{getTypeLabel(task.follow_up_type)}</Text>
|
||||
<View className='task-card__status' style={`background: ${st.color}20; color: ${st.color}`}>
|
||||
<Text>{st.label}</Text>
|
||||
<View className='task-card__status' style={getStatusInlineStyle(task.status)}>
|
||||
<Text>{getStatusLabel(task.status)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<Text className='task-card__patient'>{task.patient_name || '未知患者'}</Text>
|
||||
|
||||
@@ -34,16 +34,16 @@
|
||||
align-items: center;
|
||||
margin: 16px 24px;
|
||||
padding: 16px 20px;
|
||||
background: #FEF2F2;
|
||||
background: $dan-l;
|
||||
border-radius: $r;
|
||||
border-left: 4px solid #EF4444;
|
||||
border-left: 4px solid $dan;
|
||||
}
|
||||
|
||||
&__alert-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
background: #EF4444;
|
||||
background: $dan;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 36px;
|
||||
@@ -56,12 +56,12 @@
|
||||
&__alert-text {
|
||||
flex: 1;
|
||||
font-size: 26px;
|
||||
color: #991B1B;
|
||||
color: $dan;
|
||||
}
|
||||
|
||||
&__alert-link {
|
||||
font-size: 24px;
|
||||
color: #EF4444;
|
||||
color: $dan;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -70,11 +70,11 @@
|
||||
}
|
||||
|
||||
&__search-input {
|
||||
background: #F1F5F9;
|
||||
background: $surface-alt;
|
||||
border-radius: $r;
|
||||
padding: 16px 20px;
|
||||
font-size: 26px;
|
||||
color: #94A3B8;
|
||||
color: $tx3;
|
||||
}
|
||||
|
||||
&__section {
|
||||
|
||||
@@ -55,19 +55,19 @@
|
||||
}
|
||||
|
||||
.alert-badge.sev-info {
|
||||
background: #e6f7ff;
|
||||
background: $bd-l;
|
||||
}
|
||||
|
||||
.alert-badge.sev-warning {
|
||||
background: #fff7e6;
|
||||
background: $wrn-l;
|
||||
}
|
||||
|
||||
.alert-badge.sev-critical {
|
||||
background: #fff1f0;
|
||||
background: $dan-l;
|
||||
}
|
||||
|
||||
.alert-badge.sev-urgent {
|
||||
background: #ff4d4f;
|
||||
background: $dan;
|
||||
}
|
||||
|
||||
.alert-badge-text {
|
||||
@@ -76,15 +76,15 @@
|
||||
}
|
||||
|
||||
.alert-badge.sev-info .alert-badge-text {
|
||||
color: #1890ff;
|
||||
color: $tx3;
|
||||
}
|
||||
|
||||
.alert-badge.sev-warning .alert-badge-text {
|
||||
color: #fa8c16;
|
||||
color: $wrn;
|
||||
}
|
||||
|
||||
.alert-badge.sev-critical .alert-badge-text {
|
||||
color: #f5222d;
|
||||
color: $dan;
|
||||
}
|
||||
|
||||
.alert-badge.sev-urgent .alert-badge-text {
|
||||
|
||||
Reference in New Issue
Block a user