fix(mp): T40 UI 审查全量修复 + 设计体系一致性优化

Phase 0 基础设施:
- statusTag.ts: getStatusInlineStyle() 移除内联 borderRadius/padding/fontSize,仅返回 {background, color}
- 新增 SEVERITY_COLORS + getSeverityStyle() + getSeverityLabel() 统一告警严重程度样式
- variables.scss: 新增 9 个语义颜色别名 ($success/$danger/$warning/$info 等)
- mixins.scss: 新增 status-inline mixin 统一状态标签样式
- 7 个消费者页面添加 @include status-inline CSS 补偿

Phase 1 HIGH 修复 (4 页面):
- P46 随访管理: 移除 getTypeStyle() 硬编码 fontSize,替换文字 Loading 为组件
- P45 咨询详情医护: 添加 Loading/ErrorState 三态模板 + error ref
- P02 健康数据: 添加 loading ref + Loading 组件 + 错误 toast 提示
- P48 告警中心: 替换本地 SEVERITY_COLORS/SEVERITY_LABELS 为 statusTag.ts 导出

Phase 2 全局一致性:
- 2.1 触控补全: 17 页面为可点击元素添加 min-height: $touch-min
- 2.2 字号替换: 19 文件 31 处硬编码 px → Design Token CSS 变量
- 2.3 颜色替换: 18 文件 ~50 处硬编码十六进制 → SCSS 语义变量
- 2.4 elder-mode.scss: 新增 9 个选择器到触控放大清单

Phase 3 LOW 修复:
- 3.1 统一 Loading: 21 页面旧式文字加载 → <Loading> 组件
- 3.2 useElderClass: 8 页面补全长者模式 class 绑定
- 3.3 零散修复: 按钮 44px→48px,诊断记录添加 scroll-view 无限加载

同时新增 UniApp (Vue 3 + Vite) 小程序完整代码库 (146 文件)
This commit is contained in:
iven
2026-05-15 11:22:51 +08:00
parent 18fa6ce6d4
commit 2c567bd772
147 changed files with 36561 additions and 564 deletions

View File

@@ -0,0 +1,143 @@
<template>
<view :class="['chat-page', elderClass]">
<!-- 消息列表 -->
<scroll-view scroll-y class="chat-scroll" :scroll-top="scrollTop" :scroll-with-animation="true">
<Loading v-if="loading" text="加载中..." />
<template v-else>
<view v-for="msg in messages" :key="msg.id" :class="['msg-bubble', msg.sender === 'user' ? 'right' : 'left']">
<text class="msg-text">{{ msg.content }}</text>
<text class="msg-time">{{ formatDate(msg.created_at, 'HH:mm') }}</text>
</view>
</template>
</scroll-view>
<!-- 输入框 -->
<view class="input-bar">
<input v-model="inputText" class="chat-input" placeholder="输入消息..." confirm-type="send" @confirm="send" />
<view class="send-btn" @tap="send">
<text class="send-text">发送</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { api } from '@/services/request'
import { formatDate } from '@/utils/date'
import Loading from '@/components/Loading.vue'
import { useElderClass } from '@/composables/useElderClass'
const { elderClass } = useElderClass()
const consultationId = ref('')
const loading = ref(false)
const messages = ref<any[]>([])
const inputText = ref('')
const scrollTop = ref(0)
async function fetchMessages() {
loading.value = true
try {
messages.value = await api.get<any[]>(`/health/consultations/${consultationId.value}/messages`) || []
scrollTop.value = 99999
} catch { messages.value = [] }
loading.value = false
}
async function send() {
const text = inputText.value.trim()
if (!text || !consultationId.value) return
inputText.value = ''
try {
await api.post(`/health/consultations/${consultationId.value}/messages`, { content: text })
await fetchMessages()
} catch {
uni.showToast({ title: '发送失败', icon: 'none' })
}
}
onLoad((query: any) => {
consultationId.value = query?.id || ''
if (consultationId.value) fetchMessages()
})
</script>
<style lang="scss" scoped>
.chat-page {
display: flex;
flex-direction: column;
height: 100vh;
background: $bg;
}
.chat-scroll {
flex: 1;
padding: 20px 24px;
}
.msg-bubble {
max-width: 75%;
padding: 16px 20px;
border-radius: $r;
margin-bottom: 16px;
&.left {
background: $card;
align-self: flex-start;
}
&.right {
background: $pri;
align-self: flex-end;
}
}
.msg-text {
display: block;
font-size: var(--tk-font-body);
.left & { color: $tx; }
.right & { color: $white; }
}
.msg-time {
display: block;
font-size: var(--tk-font-micro);
margin-top: 4px;
.left & { color: $tx3; }
.right & { color: rgba(255,255,255,0.7); }
}
.input-bar {
display: flex;
align-items: center;
padding: 12px 16px;
background: $card;
border-top: 1px solid $bd-l;
@include safe-bottom;
}
.chat-input {
flex: 1;
height: 72px;
background: $bg;
border-radius: $r-sm;
padding: 0 16px;
font-size: var(--tk-font-body);
}
.send-btn {
margin-left: 12px;
background: $pri;
border-radius: $r-sm;
padding: 16px 24px;
}
.send-text {
color: $white;
font-size: var(--tk-font-body-sm);
font-weight: 600;
}
</style>

View File

@@ -0,0 +1,95 @@
<template>
<scroll-view scroll-y :class="['page-scroll', elderClass]" @scrolltolower="loadMore">
<view class="page-content">
<text class="page-title">咨询列表</text>
<Loading v-if="loading && list.length === 0" text="加载中..." />
<EmptyState v-else-if="list.length === 0" icon="💬" title="暂无咨询记录" action-text="发起咨询" @action="navigateTo('/pages-sub/consultation/create')" />
<template v-else>
<view v-for="item in list" :key="item.id" class="consult-card" @tap="goDetail(item.id)">
<view class="consult-header">
<text class="consult-doctor">{{ item.doctor_name || '医生' }}</text>
<text :class="['consult-status', item.status]">{{ item.status_text || item.status }}</text>
</view>
<text class="consult-preview">{{ item.last_message || '暂无消息' }}</text>
<text class="consult-time">{{ getRelativeTime(item.updated_at) }}</text>
</view>
</template>
</view>
</scroll-view>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { api } from '@/services/request'
import { getRelativeTime } from '@/utils/date'
import Loading from '@/components/Loading.vue'
import EmptyState from '@/components/EmptyState.vue'
import { useElderClass } from '@/composables/useElderClass'
const { elderClass } = useElderClass()
const loading = ref(false)
const list = ref<any[]>([])
function navigateTo(url: string) { uni.navigateTo({ url }) }
function goDetail(id: string) { uni.navigateTo({ url: `/pages-sub/consultation/detail/index?id=${id}` }) }
async function fetchList() {
loading.value = true
try { list.value = await api.get<any[]>('/health/consultations') || [] }
catch { list.value = [] }
loading.value = false
}
function loadMore() { /* 预留 */ }
onMounted(fetchList)
</script>
<style lang="scss" scoped>
.page-scroll { height: 100vh; background: $bg; }
.page-content { padding: 28px 24px 120px; }
.page-title { @include section-title; }
.consult-card {
background: $card;
border-radius: $r;
padding: 20px 24px;
margin-bottom: 16px;
box-shadow: $shadow-sm;
}
.consult-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.consult-doctor {
font-size: var(--tk-font-body);
font-weight: 600;
color: $tx;
}
.consult-status {
font-size: var(--tk-font-body-sm);
padding: 4px 12px;
border-radius: $r-pill;
&.active { background: $acc-l; color: $acc; }
&.closed { background: $bd-l; color: $tx3; }
}
.consult-preview {
display: block;
font-size: var(--tk-font-body-sm);
color: $tx2;
margin-bottom: 8px;
}
.consult-time {
display: block;
font-size: var(--tk-font-cap);
color: $tx3;
}
</style>