fix(miniprogram): 审计修复 — P0/P1 共 16 个问题
P0 功能阻断: - 修复 login→bindPhone openid 状态传递断裂 - 首页健康卡片对接 useHealthStore 真实数据 - 血压录入改为收缩压/舒张压双输入 - 快捷服务路径修正(报告→/pages/report、随访→/pages/followup) P1 类型安全 + 组件: - 替换所有 <input>/<image>/<textarea> 为 Taro 组件 - service 层 any 类型全部替换(Doctor/DoctorSchedule/IndicatorDetail/FollowUpContent/PatientUpdateInput) - 预约详情数据传递简化为纯 Storage 缓存 - Article 接口添加 author 字段
This commit is contained in:
@@ -17,28 +17,9 @@ export default function AppointmentDetail() {
|
||||
const id = router.params.id || '';
|
||||
const [cancelling, setCancelling] = useState(false);
|
||||
|
||||
// 从页面参数或全局缓存获取预约数据
|
||||
const encodedData = router.params.data || '';
|
||||
let appointment: Appointment | null = null;
|
||||
try {
|
||||
if (encodedData) {
|
||||
appointment = JSON.parse(decodeURIComponent(encodedData));
|
||||
}
|
||||
} catch {
|
||||
// 解析失败则尝试从 Storage 获取
|
||||
const cached = Taro.getStorageSync('appointment_detail_cache');
|
||||
if (cached && cached.id === id) {
|
||||
appointment = cached;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有传数据,尝试从缓存获取
|
||||
if (!appointment) {
|
||||
const cached = Taro.getStorageSync('appointment_detail_cache');
|
||||
if (cached && cached.id === id) {
|
||||
appointment = cached;
|
||||
}
|
||||
}
|
||||
// 从缓存获取预约数据
|
||||
const cached = Taro.getStorageSync('appointment_detail_cache');
|
||||
const appointment: Appointment | null = (cached && cached.id === id) ? cached : null;
|
||||
|
||||
const status = appointment ? (STATUS_MAP[appointment.status] || { label: appointment.status, className: 'tag-pending' }) : { label: '未知', className: 'tag-pending' };
|
||||
const canCancel = appointment && (appointment.status === 'pending' || appointment.status === 'confirmed');
|
||||
|
||||
Reference in New Issue
Block a user