Files
hms/apps/miniprogram-uniapp/src/pages-sub/pkg-profile/settings/index.vue
iven 2c567bd772 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 文件)
2026-05-15 11:22:51 +08:00

174 lines
4.0 KiB
Vue

<template>
<scroll-view scroll-y class="page-scroll">
<view :class="['settings-page', elderClass]">
<text class="page-title">设置</text>
<view class="settings-group">
<view class="settings-item" @tap="handleClearCache">
<view class="settings-icon">
<text class="settings-icon-text"></text>
</view>
<text class="settings-label">清除缓存</text>
<text class="settings-arrow">></text>
</view>
<view class="settings-item" @tap="handleAbout">
<view class="settings-icon">
<text class="settings-icon-text"></text>
</view>
<text class="settings-label">关于我们</text>
<text class="settings-arrow">></text>
</view>
<view class="settings-item" @tap="handlePrivacy">
<view class="settings-icon">
<text class="settings-icon-text"></text>
</view>
<text class="settings-label">隐私政策</text>
<text class="settings-arrow">></text>
</view>
</view>
<view class="settings-group">
<view class="settings-item logout-item" @tap="handleLogout">
<text class="settings-label logout-label">退出登录</text>
</view>
</view>
</view>
</scroll-view>
</template>
<script setup lang="ts">
import { useAuthStore } from '@/stores/auth'
import { clearRequestCache } from '@/services/request'
import { useElderClass } from '@/composables/useElderClass'
const authStore = useAuthStore()
const { elderClass } = useElderClass()
function handleClearCache() {
uni.showModal({
title: '清除缓存',
content: '确定要清除本地缓存数据吗?不会影响账号信息。',
success: (res: any) => {
if (res.confirm) {
const preservedKeys = [
'access_token', 'refresh_token', 'user_data', 'user_roles',
'tenant_id', 'wechat_openid', 'current_patient', 'current_patient_id',
]
const preservedData: Record<string, unknown> = {}
for (const key of preservedKeys) {
const val = uni.getStorageSync(key)
if (val) preservedData[key] = val
}
try { uni.clearStorageSync() } catch { /* ignore */ }
for (const [key, val] of Object.entries(preservedData)) {
uni.setStorageSync(key, val)
}
clearRequestCache()
uni.showToast({ title: '缓存已清除', icon: 'success' })
}
},
})
}
function handleAbout() {
uni.showModal({
title: '关于我们',
content: 'HMS 健康管理平台 v1.0.0\n为您的健康保驾护航',
showCancel: false,
})
}
function handlePrivacy() {
uni.navigateTo({ url: '/pages/legal/privacy-policy' })
}
function handleLogout() {
uni.showModal({
title: '退出登录',
content: '确定要退出登录吗?',
success: (res: any) => {
if (res.confirm) {
authStore.logout()
}
},
})
}
</script>
<style lang="scss" scoped>
.page-scroll {
height: 100vh;
background: $bg;
}
.settings-page {
padding: 32px 24px;
}
.page-title {
@include section-title;
padding-left: 4px;
}
.settings-group {
background: $card;
border-radius: $r;
overflow: hidden;
margin-bottom: 24px;
box-shadow: $shadow-sm;
}
.settings-item {
display: flex;
align-items: center;
padding: 28px 24px;
border-bottom: 1px solid $bd-l;
&:last-child {
border-bottom: none;
}
&.logout-item {
justify-content: center;
}
}
.settings-icon {
@include flex-center;
width: 48px;
height: 48px;
border-radius: $r-sm;
background: $pri-l;
margin-right: 16px;
flex-shrink: 0;
}
.settings-icon-text {
font-family: 'Georgia', 'Times New Roman', serif;
font-size: var(--tk-font-h2);
font-weight: bold;
color: $pri-d;
}
.settings-label {
flex: 1;
font-size: var(--tk-font-num);
color: $tx;
}
.logout-label {
color: $dan;
font-weight: bold;
}
.settings-arrow {
font-size: var(--tk-font-h2);
color: $tx3;
font-family: 'Georgia', 'Times New Roman', serif;
flex-shrink: 0;
}
</style>