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 文件)
147 lines
3.8 KiB
Vue
147 lines
3.8 KiB
Vue
<template>
|
|
<scroll-view scroll-y class="page-scroll">
|
|
<view class="page-content">
|
|
<text class="page-title">新建预约</text>
|
|
|
|
<view class="form-group">
|
|
<text class="form-label">选择医生</text>
|
|
<picker :range="doctorNames" @change="onDoctorChange">
|
|
<view class="form-picker">
|
|
{{ selectedDoctorName || '请选择医生' }}
|
|
<text class="picker-arrow">▼</text>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
|
|
<view class="form-group">
|
|
<text class="form-label">预约日期</text>
|
|
<picker mode="date" :value="date" @change="(e: any) => date = e.detail.value">
|
|
<view class="form-picker">
|
|
{{ date || '请选择日期' }}
|
|
<text class="picker-arrow">▼</text>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
|
|
<view class="form-group">
|
|
<text class="form-label">预约时间</text>
|
|
<picker mode="time" :value="time" @change="(e: any) => time = e.detail.value">
|
|
<view class="form-picker">
|
|
{{ time || '请选择时间' }}
|
|
<text class="picker-arrow">▼</text>
|
|
</view>
|
|
</picker>
|
|
</view>
|
|
|
|
<view class="form-group">
|
|
<text class="form-label">备注</text>
|
|
<textarea v-model="notes" class="form-textarea" placeholder="请输入备注信息" />
|
|
</view>
|
|
|
|
<view class="submit-btn" @tap="handleSubmit">
|
|
{{ submitting ? '提交中...' : '提交预约' }}
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, computed, onMounted } from 'vue'
|
|
import { api } from '@/services/request'
|
|
|
|
const doctors = ref<any[]>([])
|
|
const selectedDoctorIdx = ref(-1)
|
|
const date = ref('')
|
|
const time = ref('')
|
|
const notes = ref('')
|
|
const submitting = ref(false)
|
|
|
|
const doctorNames = computed(() => doctors.value.map(d => d.name || d.display_name || '医生'))
|
|
const selectedDoctorName = computed(() => selectedDoctorIdx.value >= 0 ? doctorNames.value[selectedDoctorIdx.value] : '')
|
|
|
|
function onDoctorChange(e: any) {
|
|
selectedDoctorIdx.value = e.detail.value
|
|
}
|
|
|
|
async function fetchDoctors() {
|
|
try { doctors.value = await api.get<any[]>('/health/doctors') || [] }
|
|
catch { doctors.value = [] }
|
|
}
|
|
|
|
async function handleSubmit() {
|
|
if (selectedDoctorIdx.value < 0) {
|
|
uni.showToast({ title: '请选择医生', icon: 'none' })
|
|
return
|
|
}
|
|
if (!date.value || !time.value) {
|
|
uni.showToast({ title: '请选择日期和时间', icon: 'none' })
|
|
return
|
|
}
|
|
submitting.value = true
|
|
try {
|
|
await api.post('/health/appointments', {
|
|
doctor_id: doctors.value[selectedDoctorIdx.value].id,
|
|
appointment_time: `${date.value} ${time.value}`,
|
|
notes: notes.value,
|
|
})
|
|
uni.showToast({ title: '预约成功', icon: 'success' })
|
|
setTimeout(() => uni.navigateBack(), 1500)
|
|
} catch (err: any) {
|
|
uni.showToast({ title: err.message || '预约失败', icon: 'none' })
|
|
}
|
|
submitting.value = false
|
|
}
|
|
|
|
onMounted(fetchDoctors)
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.page-scroll { height: 100vh; background: $bg; }
|
|
.page-content { padding: 28px 24px 120px; }
|
|
.page-title { @include section-title; }
|
|
|
|
.form-group {
|
|
margin-bottom: 28px;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-size: var(--tk-font-body);
|
|
color: $tx2;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.form-picker {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background: $card;
|
|
border-radius: $r-sm;
|
|
padding: 18px 20px;
|
|
font-size: var(--tk-font-body);
|
|
color: $tx;
|
|
box-shadow: $shadow-sm;
|
|
}
|
|
|
|
.picker-arrow {
|
|
font-size: var(--tk-font-cap);
|
|
color: $tx3;
|
|
}
|
|
|
|
.form-textarea {
|
|
width: 100%;
|
|
min-height: 160px;
|
|
background: $card;
|
|
border-radius: $r-sm;
|
|
padding: 18px 20px;
|
|
font-size: var(--tk-font-body);
|
|
color: $tx;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.submit-btn {
|
|
@include btn-primary;
|
|
margin-top: 16px;
|
|
}
|
|
</style>
|