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:
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<view :class="['consents-page', elderClass]">
|
||||
<text class="page-title">知情同意</text>
|
||||
|
||||
<view class="consent-list">
|
||||
<view v-for="c in consents" :key="c.id" class="consent-card">
|
||||
<view class="consent-card__header">
|
||||
<text class="consent-card__type">{{ CONSENT_TYPE_MAP[c.consent_type] || c.consent_type }}</text>
|
||||
<text :class="['status-tag', (STATUS_MAP[c.status] || { cls: '' }).cls]">
|
||||
{{ (STATUS_MAP[c.status] || { label: c.status }).label }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="consent-card__scope">范围: {{ c.consent_scope }}</text>
|
||||
<text v-if="c.granted_at" class="consent-card__date">签署时间: {{ c.granted_at }}</text>
|
||||
<text v-if="c.revoked_at" class="consent-card__date">撤回时间: {{ c.revoked_at }}</text>
|
||||
<text v-if="c.expiry_date" class="consent-card__expiry">有效期至: {{ c.expiry_date }}</text>
|
||||
<view
|
||||
v-if="c.status === 'granted'"
|
||||
:class="['revoke-btn', revoking === c.id ? 'revoke-btn--disabled' : '']"
|
||||
@tap="handleRevoke(c)"
|
||||
>
|
||||
<text class="revoke-btn__text">{{ revoking === c.id ? '处理中...' : '撤回同意' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<EmptyState
|
||||
v-if="consents.length === 0 && !loading"
|
||||
:text="authStore.currentPatient ? '暂无知情同意记录' : '请先在就诊人管理中选择就诊人'"
|
||||
/>
|
||||
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { listConsents, revokeConsent, type Consent } from '@/services/consent'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
|
||||
const CONSENT_TYPE_MAP: Record<string, string> = {
|
||||
data_processing: '数据处理同意',
|
||||
health_data_collection: '健康数据采集',
|
||||
research_use: '科研使用',
|
||||
third_party_share: '第三方共享',
|
||||
genetic_testing: '基因检测',
|
||||
telemedicine: '远程医疗',
|
||||
}
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; cls: string }> = {
|
||||
granted: { label: '已签署', cls: 'granted' },
|
||||
revoked: { label: '已撤回', cls: 'revoked' },
|
||||
}
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const consents = ref<Consent[]>([])
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
const revoking = ref<string | null>(null)
|
||||
|
||||
const fetchData = async (p: number, append = false) => {
|
||||
if (!authStore.currentPatient) {
|
||||
consents.value = []
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listConsents(authStore.currentPatient.id, { page: p, page_size: 20 })
|
||||
const list = res.data || []
|
||||
consents.value = append ? [...consents.value, ...list] : list
|
||||
total.value = res.total
|
||||
page.value = p
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && consents.value.length < total.value) {
|
||||
fetchData(page.value + 1, true)
|
||||
}
|
||||
}
|
||||
|
||||
const handleRevoke = async (consent: Consent) => {
|
||||
const res = await uni.showModal({
|
||||
title: '确认撤回',
|
||||
content: `确定要撤回「${CONSENT_TYPE_MAP[consent.consent_type] || consent.consent_type}」的同意吗?`,
|
||||
})
|
||||
if (!res.confirm) return
|
||||
revoking.value = consent.id
|
||||
try {
|
||||
const updated = await revokeConsent(consent.id, consent.version)
|
||||
consents.value = consents.value.map((c) => c.id === updated.id ? updated : c)
|
||||
uni.showToast({ title: '已撤回', icon: 'success' })
|
||||
} catch {
|
||||
uni.showToast({ title: '撤回失败', icon: 'none' })
|
||||
} finally {
|
||||
revoking.value = null
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => { fetchData(1) })
|
||||
onPullDownRefresh(() => { fetchData(1).finally(() => uni.stopPullDownRefresh()) })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.consents-page { min-height: 100vh; background: $bg; padding: 32px 24px; padding-bottom: 40px; }
|
||||
.page-title { @include section-title; padding-left: 4px; }
|
||||
.consent-list { display: flex; flex-direction: column; gap: 16px; }
|
||||
.consent-card { background: $card; border-radius: $r; padding: 28px; box-shadow: $shadow-sm; }
|
||||
.consent-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
|
||||
.consent-card__type { font-size: var(--tk-font-body-lg); font-weight: bold; color: $tx; }
|
||||
.status-tag {
|
||||
@include tag($bd-l, $tx3);
|
||||
&.granted { @include tag($acc-l, $acc); }
|
||||
&.revoked { @include tag($dan-l, $dan); }
|
||||
}
|
||||
.consent-card__scope,
|
||||
.consent-card__date,
|
||||
.consent-card__expiry {
|
||||
font-size: var(--tk-font-h2);
|
||||
color: $tx2;
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.revoke-btn {
|
||||
margin-top: 16px;
|
||||
padding: 12px 0;
|
||||
min-height: $touch-min;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
border-radius: $r-sm;
|
||||
border: 1px solid $dan;
|
||||
&:active { background: $dan-l; }
|
||||
&--disabled { opacity: 0.5; }
|
||||
}
|
||||
.revoke-btn__text { font-size: var(--tk-font-h2); color: $dan; font-weight: 500; }
|
||||
</style>
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<view :class="['diagnoses-page', elderClass]">
|
||||
<text class="page-title">诊断记录</text>
|
||||
|
||||
<scroll-view scroll-y class="diagnosis-scroll" @scrolltolower="loadMore">
|
||||
<view class="diagnosis-list">
|
||||
<view v-for="d in records" :key="d.id" class="diagnosis-card">
|
||||
<view class="diagnosis-card__header">
|
||||
<text class="diagnosis-card__name">{{ d.diagnosis_name }}</text>
|
||||
<text :class="['diagnosis-card__status', (STATUS_MAP[d.status] || { cls: '' }).cls]">
|
||||
{{ (STATUS_MAP[d.status] || { label: d.status }).label }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="diagnosis-card__meta">
|
||||
<text :class="['diagnosis-card__type', (TYPE_MAP[d.diagnosis_type] || { cls: '' }).cls]">
|
||||
{{ (TYPE_MAP[d.diagnosis_type] || { label: d.diagnosis_type }).label }}
|
||||
</text>
|
||||
<text class="diagnosis-card__code">{{ d.icd_code }}</text>
|
||||
</view>
|
||||
<text class="diagnosis-card__date">诊断日期:{{ d.diagnosed_date }}</text>
|
||||
<text v-if="d.notes" class="diagnosis-card__notes">{{ d.notes }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<EmptyState
|
||||
v-if="records.length === 0 && !loading"
|
||||
:text="authStore.currentPatient ? '暂无诊断记录' : '请先在就诊人管理中选择就诊人'"
|
||||
/>
|
||||
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { listDiagnoses, type Diagnosis } from '@/services/health-record'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
|
||||
const TYPE_MAP: Record<string, { label: string; cls: string }> = {
|
||||
primary: { label: '主要', cls: 'primary' },
|
||||
secondary: { label: '次要', cls: 'secondary' },
|
||||
comorbid: { label: '合并症', cls: 'comorbid' },
|
||||
}
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; cls: string }> = {
|
||||
active: { label: '活动', cls: 'active' },
|
||||
resolved: { label: '已解决', cls: 'resolved' },
|
||||
chronic: { label: '慢性', cls: 'chronic' },
|
||||
}
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const records = ref<Diagnosis[]>([])
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
const fetchData = async (p: number, append = false) => {
|
||||
if (!authStore.currentPatient) {
|
||||
records.value = []
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listDiagnoses(authStore.currentPatient.id, { page: p, page_size: 20 })
|
||||
const list = res.data || []
|
||||
records.value = append ? [...records.value, ...list] : list
|
||||
total.value = res.total
|
||||
page.value = p
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && records.value.length < total.value) {
|
||||
fetchData(page.value + 1, true)
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => { fetchData(1) })
|
||||
onPullDownRefresh(() => { fetchData(1).finally(() => uni.stopPullDownRefresh()) })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.diagnoses-page { min-height: 100vh; background: $bg; padding: 32px 24px 0; }
|
||||
.page-title {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
margin-bottom: 20px;
|
||||
display: block;
|
||||
padding-left: 4px;
|
||||
}
|
||||
.diagnosis-scroll { height: calc(100vh - 80px); }
|
||||
.diagnosis-list { display: flex; flex-direction: column; gap: 16px; }
|
||||
.diagnosis-card { background: $card; border-radius: $r; padding: 28px; box-shadow: $shadow-sm; }
|
||||
.diagnosis-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
|
||||
.diagnosis-card__name { font-size: var(--tk-font-body-lg); font-weight: bold; color: $tx; flex: 1; margin-right: 12px; }
|
||||
.diagnosis-card__status {
|
||||
@include tag($bd-l, $tx3);
|
||||
&.active { @include tag($acc-l, $acc); }
|
||||
&.resolved { @include tag($acc-l, $acc); }
|
||||
&.chronic { @include tag($wrn-l, $wrn); }
|
||||
}
|
||||
.diagnosis-card__meta { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
|
||||
.diagnosis-card__type {
|
||||
@include tag($pri-l, $pri-d);
|
||||
&.secondary { @include tag($bd-l, $tx2); }
|
||||
&.comorbid { @include tag($wrn-l, $wrn); }
|
||||
}
|
||||
.diagnosis-card__code { font-size: var(--tk-font-body); color: $tx3; font-variant-numeric: tabular-nums; }
|
||||
.diagnosis-card__date { font-size: var(--tk-font-body); color: $tx2; display: block; }
|
||||
.diagnosis-card__notes { font-size: var(--tk-font-body); color: $tx2; display: block; margin-top: 8px; }
|
||||
</style>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view :class="['detail-page', elderClass]">
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
<EmptyState v-else-if="!rx" icon="📋" title="处方不存在" />
|
||||
<template v-else>
|
||||
<view class="detail-card header-card">
|
||||
<view class="header-row">
|
||||
<text class="detail-title">{{ rx.dialyzer_model || '透析处方' }}</text>
|
||||
<text :class="['status-tag', statusInfo(rx.status).cls]">{{ statusInfo(rx.status).label }}</text>
|
||||
</view>
|
||||
<text v-if="rx.effective_from || rx.effective_to" class="header-sub">
|
||||
{{ rx.effective_from || '...' }} ~ {{ rx.effective_to || '...' }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="detail-card">
|
||||
<text class="section-title">基本参数</text>
|
||||
<view v-if="rx.dialyzer_model" class="detail-row"><text class="detail-label">透析器型号</text><text class="detail-value">{{ rx.dialyzer_model }}</text></view>
|
||||
<view v-if="rx.membrane_area != null" class="detail-row"><text class="detail-label">膜面积</text><text class="detail-value">{{ rx.membrane_area }} m²</text></view>
|
||||
<view v-if="rx.blood_flow_rate != null" class="detail-row"><text class="detail-label">血流速</text><text class="detail-value">{{ rx.blood_flow_rate }} ml/min</text></view>
|
||||
<view v-if="rx.dialysate_flow_rate != null" class="detail-row"><text class="detail-label">透析液流量</text><text class="detail-value">{{ rx.dialysate_flow_rate }} ml/min</text></view>
|
||||
<view v-if="rx.frequency_per_week != null" class="detail-row"><text class="detail-label">频率</text><text class="detail-value">{{ rx.frequency_per_week }} 次/周</text></view>
|
||||
<view v-if="rx.duration_minutes != null" class="detail-row"><text class="detail-label">每次时长</text><text class="detail-value">{{ rx.duration_minutes }} 分钟</text></view>
|
||||
</view>
|
||||
|
||||
<view class="detail-card">
|
||||
<text class="section-title">透析液配比</text>
|
||||
<view v-if="rx.dialysate_potassium != null" class="detail-row"><text class="detail-label">钾浓度</text><text class="detail-value">{{ rx.dialysate_potassium }} mmol/L</text></view>
|
||||
<view v-if="rx.dialysate_calcium != null" class="detail-row"><text class="detail-label">钙浓度</text><text class="detail-value">{{ rx.dialysate_calcium }} mmol/L</text></view>
|
||||
<view v-if="rx.dialysate_bicarbonate != null" class="detail-row"><text class="detail-label">碳酸氢盐浓度</text><text class="detail-value">{{ rx.dialysate_bicarbonate }} mmol/L</text></view>
|
||||
</view>
|
||||
|
||||
<view class="detail-card">
|
||||
<text class="section-title">抗凝方案</text>
|
||||
<view v-if="rx.anticoagulation_type" class="detail-row"><text class="detail-label">抗凝类型</text><text class="detail-value">{{ rx.anticoagulation_type }}</text></view>
|
||||
<view v-if="rx.anticoagulation_dose" class="detail-row"><text class="detail-label">抗凝剂量</text><text class="detail-value">{{ rx.anticoagulation_dose }}</text></view>
|
||||
</view>
|
||||
|
||||
<view v-if="rx.vascular_access_type || rx.vascular_access_location" class="detail-card">
|
||||
<text class="section-title">血管通路</text>
|
||||
<view v-if="rx.vascular_access_type" class="detail-row"><text class="detail-label">通路类型</text><text class="detail-value">{{ rx.vascular_access_type }}</text></view>
|
||||
<view v-if="rx.vascular_access_location" class="detail-row"><text class="detail-label">通路位置</text><text class="detail-value">{{ rx.vascular_access_location }}</text></view>
|
||||
</view>
|
||||
|
||||
<view v-if="rx.target_ultrafiltration_ml != null || rx.target_dry_weight != null" class="detail-card">
|
||||
<text class="section-title">超滤目标</text>
|
||||
<view v-if="rx.target_ultrafiltration_ml != null" class="detail-row"><text class="detail-label">目标超滤量</text><text class="detail-value">{{ rx.target_ultrafiltration_ml }} ml</text></view>
|
||||
<view v-if="rx.target_dry_weight != null" class="detail-row"><text class="detail-label">目标干体重</text><text class="detail-value">{{ rx.target_dry_weight }} kg</text></view>
|
||||
</view>
|
||||
|
||||
<view v-if="rx.notes" class="detail-card">
|
||||
<text class="section-title">备注</text>
|
||||
<text class="notes-text">{{ rx.notes }}</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getDialysisPrescription, type DialysisPrescription } from '@/services/dialysis'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; cls: string }> = {
|
||||
active: { label: '生效中', cls: 'active' },
|
||||
inactive: { label: '已停用', cls: 'inactive' },
|
||||
expired: { label: '已过期', cls: 'expired' },
|
||||
}
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const rx = ref<DialysisPrescription | null>(null)
|
||||
const loading = ref(true)
|
||||
let id = ''
|
||||
|
||||
const statusInfo = (s: string) => STATUS_MAP[s] || { label: s, cls: '' }
|
||||
|
||||
onLoad((query) => {
|
||||
id = query?.id || ''
|
||||
if (!id) { loading.value = false; return }
|
||||
loading.value = true
|
||||
getDialysisPrescription(id)
|
||||
.then(data => { rx.value = data })
|
||||
.catch(() => uni.showToast({ title: '加载失败', icon: 'none' }))
|
||||
.finally(() => { loading.value = false })
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-page { min-height: 100vh; background: $bg; padding: 24px; }
|
||||
.detail-card { @include card; margin-bottom: 16px; }
|
||||
.header-card { border-left: 4px solid $pri; }
|
||||
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
|
||||
.detail-title { font-size: var(--tk-font-title); font-weight: 600; color: $tx; }
|
||||
.status-tag { padding: 2px 10px; border-radius: 4px; font-size: var(--tk-font-cap);
|
||||
&.active { background: rgba(82,196,26,0.1); color: $acc; }
|
||||
&.inactive { background: rgba(0,0,0,0.04); color: $tx3; }
|
||||
&.expired { background: rgba(255,77,79,0.1); color: $dan; }
|
||||
}
|
||||
.header-sub { font-size: var(--tk-font-cap); color: $tx3; display: block; margin-top: 4px; }
|
||||
.section-title { font-size: var(--tk-font-body); font-weight: 500; color: $tx; margin-bottom: 12px; display: block; }
|
||||
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; }
|
||||
.detail-label { font-size: var(--tk-font-cap); color: $tx3; }
|
||||
.detail-value { font-size: var(--tk-font-body); color: $tx; }
|
||||
.notes-text { font-size: var(--tk-font-cap); color: $tx2; line-height: 1.6; }
|
||||
</style>
|
||||
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<view :class="['dialysis-prescriptions-page', elderClass]">
|
||||
<text class="page-title">透析处方</text>
|
||||
|
||||
<template v-if="!authStore.currentPatient">
|
||||
<EmptyState icon="📋" title="请先在就诊人管理中选择就诊人" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<view v-if="prescriptions.length === 0 && !loading" class="empty-wrap">
|
||||
<EmptyState icon="📋" title="暂无透析处方" />
|
||||
</view>
|
||||
|
||||
<scroll-view v-else scroll-y class="prescription-scroll" @scrolltolower="loadMore">
|
||||
<view
|
||||
v-for="p in prescriptions" :key="p.id"
|
||||
class="prescription-card"
|
||||
@tap="goDetail(p.id)"
|
||||
>
|
||||
<view class="prescription-card-top">
|
||||
<text class="prescription-model">{{ p.dialyzer_model || '未指定型号' }}</text>
|
||||
<text :class="['status-tag', statusInfo(p.status).cls]">{{ statusInfo(p.status).label }}</text>
|
||||
</view>
|
||||
<view class="prescription-meta">
|
||||
<text v-if="p.frequency_per_week != null" class="meta-item">{{ p.frequency_per_week }}次/周</text>
|
||||
<text v-if="p.duration_minutes != null" class="meta-item">每次{{ p.duration_minutes }}分钟</text>
|
||||
</view>
|
||||
<text v-if="p.effective_from || p.effective_to" class="prescription-date">
|
||||
{{ p.effective_from || '...' }} ~ {{ p.effective_to || '...' }}
|
||||
</text>
|
||||
</view>
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
<view v-if="!loading && prescriptions.length >= total && total > 0" class="no-more"><text class="no-more-text">没有更多了</text></view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { listDialysisPrescriptions, type DialysisPrescription } from '@/services/dialysis'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; cls: string }> = {
|
||||
active: { label: '生效中', cls: 'active' },
|
||||
inactive: { label: '已停用', cls: 'inactive' },
|
||||
expired: { label: '已过期', cls: 'expired' },
|
||||
}
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const prescriptions = ref<DialysisPrescription[]>([])
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
let loadingGuard = false
|
||||
|
||||
const statusInfo = (s: string) => STATUS_MAP[s] || { label: s, cls: '' }
|
||||
|
||||
const fetchData = async (p: number, append = false) => {
|
||||
if (!authStore.currentPatient || loadingGuard) return
|
||||
loadingGuard = true
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listDialysisPrescriptions({ patient_id: authStore.currentPatient.id, page: p, page_size: 20 })
|
||||
const list = res.data || []
|
||||
prescriptions.value = append ? [...prescriptions.value, ...list] : list
|
||||
total.value = res.total
|
||||
page.value = p
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loadingGuard = false
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && prescriptions.value.length < total.value) {
|
||||
fetchData(page.value + 1, true)
|
||||
}
|
||||
}
|
||||
|
||||
const goDetail = (id: string) => {
|
||||
uni.navigateTo({ url: `/pages-sub/pkg-profile/dialysis-prescriptions/detail/index?id=${id}` })
|
||||
}
|
||||
|
||||
onShow(() => { fetchData(1) })
|
||||
onPullDownRefresh(() => { fetchData(1).finally(() => uni.stopPullDownRefresh()) })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialysis-prescriptions-page { min-height: 100vh; background: $bg; padding: 24px; }
|
||||
.page-title { @include section-title; }
|
||||
.prescription-scroll { height: calc(100vh - 80px); }
|
||||
.prescription-card { @include card; margin-bottom: 12px; }
|
||||
.prescription-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
|
||||
.prescription-model { font-size: var(--tk-font-body); font-weight: 500; color: $tx; }
|
||||
.status-tag { padding: 2px 10px; border-radius: 4px; font-size: var(--tk-font-cap);
|
||||
&.active { background: rgba(82,196,26,0.1); color: $acc; }
|
||||
&.inactive { background: rgba(0,0,0,0.04); color: $tx3; }
|
||||
&.expired { background: rgba(255,77,79,0.1); color: $dan; }
|
||||
}
|
||||
.prescription-meta { display: flex; gap: 16px; margin-top: 4px; }
|
||||
.meta-item { font-size: var(--tk-font-cap); color: $tx2; }
|
||||
.prescription-date { font-size: var(--tk-font-cap); color: $tx3; display: block; margin-top: 4px; }
|
||||
.no-more { @include flex-center; padding: 20px; }
|
||||
.no-more-text { font-size: var(--tk-font-cap); color: $tx3; }
|
||||
.empty-wrap { padding-top: 40px; }
|
||||
</style>
|
||||
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view :class="['detail-page', elderClass]">
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
<EmptyState v-else-if="!record" icon="📋" title="记录不存在" />
|
||||
<template v-else>
|
||||
<view class="detail-card header-card">
|
||||
<view class="header-row">
|
||||
<text class="detail-title">{{ record.dialysis_date }}</text>
|
||||
<text :class="['status-tag', statusInfo(record.status).cls]">{{ statusInfo(record.status).label }}</text>
|
||||
</view>
|
||||
<text class="header-sub">{{ TYPE_MAP[record.dialysis_type] || record.dialysis_type }}</text>
|
||||
<text v-if="record.reviewed_at" class="review-info">审核时间 {{ record.reviewed_at }}</text>
|
||||
</view>
|
||||
|
||||
<view class="detail-card">
|
||||
<text class="section-title">基本信息</text>
|
||||
<view v-if="record.start_time" class="detail-row"><text class="detail-label">开始时间</text><text class="detail-value">{{ record.start_time }}</text></view>
|
||||
<view v-if="record.end_time" class="detail-row"><text class="detail-label">结束时间</text><text class="detail-value">{{ record.end_time }}</text></view>
|
||||
<view v-if="record.dialysis_duration != null" class="detail-row"><text class="detail-label">透析时长</text><text class="detail-value">{{ record.dialysis_duration }} 分钟</text></view>
|
||||
<view v-if="record.blood_flow_rate != null" class="detail-row"><text class="detail-label">血流速</text><text class="detail-value">{{ record.blood_flow_rate }} ml/min</text></view>
|
||||
<view v-if="record.ultrafiltration_volume != null" class="detail-row"><text class="detail-label">超滤量</text><text class="detail-value">{{ record.ultrafiltration_volume }} ml</text></view>
|
||||
</view>
|
||||
|
||||
<view class="detail-card">
|
||||
<text class="section-title">体重与血压</text>
|
||||
<view v-if="record.dry_weight != null" class="detail-row"><text class="detail-label">干体重</text><text class="detail-value">{{ record.dry_weight }} kg</text></view>
|
||||
<view v-if="record.pre_weight != null" class="detail-row"><text class="detail-label">透前体重</text><text class="detail-value">{{ record.pre_weight }} kg</text></view>
|
||||
<view v-if="record.post_weight != null" class="detail-row"><text class="detail-label">透后体重</text><text class="detail-value">{{ record.post_weight }} kg</text></view>
|
||||
<view v-if="record.pre_bp_systolic != null && record.pre_bp_diastolic != null" class="detail-row"><text class="detail-label">透前血压</text><text class="detail-value">{{ record.pre_bp_systolic }}/{{ record.pre_bp_diastolic }} mmHg</text></view>
|
||||
<view v-if="record.post_bp_systolic != null && record.post_bp_diastolic != null" class="detail-row"><text class="detail-label">透后血压</text><text class="detail-value">{{ record.post_bp_systolic }}/{{ record.post_bp_diastolic }} mmHg</text></view>
|
||||
<view v-if="record.pre_heart_rate != null" class="detail-row"><text class="detail-label">透前心率</text><text class="detail-value">{{ record.pre_heart_rate }} bpm</text></view>
|
||||
<view v-if="record.post_heart_rate != null" class="detail-row"><text class="detail-label">透后心率</text><text class="detail-value">{{ record.post_heart_rate }} bpm</text></view>
|
||||
</view>
|
||||
|
||||
<view v-if="record.symptoms || record.complication_notes" class="detail-card">
|
||||
<text class="section-title">症状与并发症</text>
|
||||
<view v-if="record.symptoms && Object.keys(record.symptoms).length > 0" class="detail-row"><text class="detail-label">症状</text><text class="detail-value">{{ JSON.stringify(record.symptoms) }}</text></view>
|
||||
<view v-if="record.complication_notes" class="detail-row"><text class="detail-label">并发症备注</text><text class="detail-value">{{ record.complication_notes }}</text></view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getDialysisRecord, type DialysisRecord } from '@/services/dialysis'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; cls: string }> = {
|
||||
draft: { label: '草稿', cls: 'draft' },
|
||||
completed: { label: '已完成', cls: 'completed' },
|
||||
reviewed: { label: '已审核', cls: 'reviewed' },
|
||||
}
|
||||
|
||||
const TYPE_MAP: Record<string, string> = {
|
||||
HD: '血液透析',
|
||||
HDF: '血液透析滤过',
|
||||
HF: '血液滤过',
|
||||
}
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const record = ref<DialysisRecord | null>(null)
|
||||
const loading = ref(true)
|
||||
let id = ''
|
||||
|
||||
const statusInfo = (s: string) => STATUS_MAP[s] || { label: s, cls: '' }
|
||||
|
||||
onLoad((query) => {
|
||||
id = query?.id || ''
|
||||
if (!id) { loading.value = false; return }
|
||||
loading.value = true
|
||||
getDialysisRecord(id)
|
||||
.then(data => { record.value = data })
|
||||
.catch(() => uni.showToast({ title: '加载失败', icon: 'none' }))
|
||||
.finally(() => { loading.value = false })
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.detail-page { min-height: 100vh; background: $bg; padding: 24px; }
|
||||
.detail-card { @include card; margin-bottom: 16px; }
|
||||
.header-card { border-left: 4px solid $pri; }
|
||||
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
|
||||
.detail-title { font-size: var(--tk-font-title); font-weight: 600; color: $tx; }
|
||||
.status-tag { padding: 2px 10px; border-radius: 4px; font-size: var(--tk-font-cap);
|
||||
&.draft { background: rgba(0,0,0,0.04); color: $tx3; }
|
||||
&.completed { background: rgba(82,196,26,0.1); color: $acc; }
|
||||
&.reviewed { background: rgba(22,119,255,0.1); color: $info; }
|
||||
}
|
||||
.header-sub { font-size: var(--tk-font-body); color: $tx2; display: block; margin-top: 4px; }
|
||||
.review-info { font-size: var(--tk-font-cap); color: $tx3; display: block; margin-top: 4px; }
|
||||
.section-title { font-size: var(--tk-font-body); font-weight: 500; color: $tx; margin-bottom: 12px; display: block; }
|
||||
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; }
|
||||
.detail-label { font-size: var(--tk-font-cap); color: $tx3; }
|
||||
.detail-value { font-size: var(--tk-font-body); color: $tx; }
|
||||
</style>
|
||||
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<view :class="['dialysis-records-page', elderClass]">
|
||||
<text class="page-title">透析记录</text>
|
||||
|
||||
<template v-if="!authStore.currentPatient">
|
||||
<EmptyState icon="📋" title="请先在就诊人管理中选择就诊人" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<view v-if="records.length === 0 && !loading" class="empty-wrap">
|
||||
<EmptyState icon="📋" title="暂无透析记录" />
|
||||
</view>
|
||||
|
||||
<scroll-view v-else scroll-y class="record-scroll" @scrolltolower="loadMore">
|
||||
<view
|
||||
v-for="r in records" :key="r.id"
|
||||
class="record-card"
|
||||
@tap="goDetail(r.id)"
|
||||
>
|
||||
<view class="record-card-top">
|
||||
<text :class="['type-tag', typeInfo(r.dialysis_type).cls]">{{ typeInfo(r.dialysis_type).label }}</text>
|
||||
<text :class="['status-tag', statusInfo(r.status).cls]">{{ statusInfo(r.status).label }}</text>
|
||||
</view>
|
||||
<text class="record-date">{{ r.dialysis_date }}</text>
|
||||
<view v-if="r.pre_weight || r.post_weight" class="weight-row">
|
||||
<text v-if="r.pre_weight" class="weight-item">透前 {{ r.pre_weight }}kg</text>
|
||||
<text v-if="r.post_weight" class="weight-item">透后 {{ r.post_weight }}kg</text>
|
||||
</view>
|
||||
<text v-if="r.dialysis_duration" class="record-meta">时长 {{ r.dialysis_duration }}分钟</text>
|
||||
</view>
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
<view v-if="!loading && records.length >= total && total > 0" class="no-more"><text class="no-more-text">没有更多了</text></view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { listDialysisRecords, type DialysisRecord } from '@/services/dialysis'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
|
||||
const TYPE_MAP: Record<string, { label: string; cls: string }> = {
|
||||
HD: { label: 'HD', cls: 'hd' },
|
||||
HDF: { label: 'HDF', cls: 'hdf' },
|
||||
HF: { label: 'HF', cls: 'hf' },
|
||||
}
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; cls: string }> = {
|
||||
draft: { label: '草稿', cls: 'draft' },
|
||||
completed: { label: '已完成', cls: 'completed' },
|
||||
reviewed: { label: '已审核', cls: 'reviewed' },
|
||||
}
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const records = ref<DialysisRecord[]>([])
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
let loadingGuard = false
|
||||
|
||||
const typeInfo = (t: string) => TYPE_MAP[t] || { label: t, cls: '' }
|
||||
const statusInfo = (s: string) => STATUS_MAP[s] || { label: s, cls: '' }
|
||||
|
||||
const fetchData = async (p: number, append = false) => {
|
||||
if (!authStore.currentPatient || loadingGuard) return
|
||||
loadingGuard = true
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listDialysisRecords(authStore.currentPatient.id, { page: p, page_size: 20 })
|
||||
const list = res.data || []
|
||||
records.value = append ? [...records.value, ...list] : list
|
||||
total.value = res.total
|
||||
page.value = p
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loadingGuard = false
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && records.value.length < total.value) {
|
||||
fetchData(page.value + 1, true)
|
||||
}
|
||||
}
|
||||
|
||||
const goDetail = (id: string) => {
|
||||
uni.navigateTo({ url: `/pages-sub/pkg-profile/dialysis-records/detail/index?id=${id}` })
|
||||
}
|
||||
|
||||
onShow(() => { fetchData(1) })
|
||||
onPullDownRefresh(() => { fetchData(1).finally(() => uni.stopPullDownRefresh()) })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dialysis-records-page { min-height: 100vh; background: $bg; padding: 24px; }
|
||||
.page-title { @include section-title; }
|
||||
.record-scroll { height: calc(100vh - 80px); }
|
||||
.record-card { @include card; margin-bottom: 12px; }
|
||||
.record-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
|
||||
.type-tag { padding: 2px 10px; border-radius: 4px; font-size: var(--tk-font-cap); font-weight: 500;
|
||||
&.hd { background: rgba(22,119,255,0.1); color: $info; }
|
||||
&.hdf { background: rgba(114,46,209,0.1); color: #722ed1; }
|
||||
&.hf { background: rgba(250,173,20,0.1); color: $wrn; }
|
||||
}
|
||||
.status-tag { padding: 2px 10px; border-radius: 4px; font-size: var(--tk-font-cap);
|
||||
&.draft { background: rgba(0,0,0,0.04); color: $tx3; }
|
||||
&.completed { background: rgba(82,196,26,0.1); color: $acc; }
|
||||
&.reviewed { background: rgba(22,119,255,0.1); color: $info; }
|
||||
}
|
||||
.record-date { font-size: var(--tk-font-body); color: $tx; display: block; margin-bottom: 4px; }
|
||||
.weight-row { display: flex; gap: 16px; margin-top: 4px; }
|
||||
.weight-item { font-size: var(--tk-font-cap); color: $tx2; }
|
||||
.record-meta { font-size: var(--tk-font-cap); color: $tx3; display: block; margin-top: 4px; }
|
||||
.no-more { @include flex-center; padding: 20px; }
|
||||
.no-more-text { font-size: var(--tk-font-cap); color: $tx3; }
|
||||
.empty-wrap { padding-top: 40px; }
|
||||
</style>
|
||||
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<view :class="['elder-mode-page', elderClass]">
|
||||
<view class="elder-mode-card">
|
||||
<view class="elder-mode-header">
|
||||
<text class="elder-mode-icon">老</text>
|
||||
<view class="elder-mode-info">
|
||||
<text class="elder-mode-title">长辈模式</text>
|
||||
<text class="elder-mode-desc">放大字体和按钮,更易阅读和操作</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="elder-mode-status">
|
||||
<text class="elder-mode-status-text">
|
||||
当前状态:{{ uiStore.elderMode ? '已开启' : '已关闭' }}
|
||||
</text>
|
||||
<view
|
||||
:class="['elder-mode-switch', { 'elder-mode-switch--on': uiStore.elderMode }]"
|
||||
@tap="handleToggle"
|
||||
>
|
||||
<view class="elder-mode-switch-thumb" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="elder-mode-preview">
|
||||
<text class="elder-mode-preview-title">效果预览</text>
|
||||
<view class="elder-mode-preview-card">
|
||||
<text :class="['elder-mode-preview-sample', { 'elder-mode-preview-sample--large': uiStore.elderMode }]">
|
||||
{{ uiStore.elderMode ? '长辈模式字体示例' : '标准模式字体示例' }}
|
||||
</text>
|
||||
<text class="elder-mode-preview-note">
|
||||
{{ uiStore.elderMode ? '字号放大 1.3 倍,间距放大 1.2 倍' : '正常字号和间距' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useUIStore } from '@/stores/ui'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
|
||||
const uiStore = useUIStore()
|
||||
const { elderClass } = useElderClass()
|
||||
|
||||
function handleToggle() {
|
||||
uiStore.toggleElderMode()
|
||||
uni.showToast({
|
||||
title: uiStore.elderMode ? '已开启长辈模式' : '已关闭长辈模式',
|
||||
icon: 'none',
|
||||
duration: 1500,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
background: $bg;
|
||||
}
|
||||
|
||||
.elder-mode-page {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.elder-mode-card {
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 24px;
|
||||
box-shadow: $shadow-md;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.elder-mode-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.elder-mode-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: $r-sm;
|
||||
background: $acc-l;
|
||||
@include flex-center;
|
||||
font-size: var(--tk-font-body);
|
||||
font-weight: 700;
|
||||
color: $acc;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.elder-mode-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.elder-mode-title {
|
||||
font-size: var(--tk-font-body-sm);
|
||||
font-weight: 700;
|
||||
color: $tx;
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.elder-mode-desc {
|
||||
font-size: var(--tk-font-cap);
|
||||
color: var(--tk-text-secondary);
|
||||
}
|
||||
|
||||
.elder-mode-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 0 0;
|
||||
border-top: 1px solid $bd-l;
|
||||
}
|
||||
|
||||
.elder-mode-status-text {
|
||||
font-size: var(--tk-font-cap);
|
||||
color: $tx2;
|
||||
}
|
||||
|
||||
.elder-mode-switch {
|
||||
width: 52px;
|
||||
height: 30px;
|
||||
border-radius: $r-pill;
|
||||
background: $bd;
|
||||
position: relative;
|
||||
transition: background 0.25s;
|
||||
transition: background 0.25s;
|
||||
|
||||
&--on {
|
||||
background: $acc;
|
||||
}
|
||||
}
|
||||
|
||||
.elder-mode-switch-thumb {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border-radius: $r-pill;
|
||||
background: $card;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
transition: transform 0.25s;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
||||
|
||||
.elder-mode-switch--on & {
|
||||
transform: translateX(22px);
|
||||
}
|
||||
}
|
||||
|
||||
.elder-mode-preview {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.elder-mode-preview-title {
|
||||
font-size: var(--tk-font-cap);
|
||||
font-weight: 600;
|
||||
color: $tx2;
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.elder-mode-preview-card {
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 20px;
|
||||
box-shadow: $shadow-sm;
|
||||
}
|
||||
|
||||
.elder-mode-preview-sample {
|
||||
font-size: var(--tk-font-body-sm);
|
||||
color: $tx;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
transition: font-size 0.25s;
|
||||
|
||||
&--large {
|
||||
font-size: var(--tk-font-body);
|
||||
}
|
||||
}
|
||||
|
||||
.elder-mode-preview-note {
|
||||
font-size: var(--tk-font-cap);
|
||||
color: var(--tk-text-secondary);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,261 @@
|
||||
<template>
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<view :class="['family-add-page', elderClass]">
|
||||
<text class="page-title">{{ editId ? '编辑就诊人' : '添加就诊人' }}</text>
|
||||
|
||||
<view class="form-card">
|
||||
<view class="form-item">
|
||||
<text class="form-label">姓名</text>
|
||||
<input
|
||||
class="form-input"
|
||||
placeholder="请输入姓名"
|
||||
placeholder-class="form-placeholder"
|
||||
:value="name"
|
||||
@input="name = ($event as any).detail.value"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">关系</text>
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="RELATION_OPTIONS"
|
||||
:value="relationIdx"
|
||||
@change="onRelationChange"
|
||||
>
|
||||
<view class="form-picker">
|
||||
<text class="form-picker-text">{{ RELATION_OPTIONS[relationIdx] }}</text>
|
||||
<text class="form-picker-arrow">></text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">性别</text>
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="GENDER_OPTIONS"
|
||||
:value="genderIdx"
|
||||
@change="onGenderChange"
|
||||
>
|
||||
<view class="form-picker">
|
||||
<text class="form-picker-text">{{ GENDER_OPTIONS[genderIdx] }}</text>
|
||||
<text class="form-picker-arrow">></text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">出生日期</text>
|
||||
<picker
|
||||
mode="date"
|
||||
:value="birthDate || '2000-01-01'"
|
||||
@change="onDateChange"
|
||||
>
|
||||
<view class="form-picker">
|
||||
<text :class="['form-picker-text', { placeholder: !birthDate }]">
|
||||
{{ birthDate || '请选择' }}
|
||||
</text>
|
||||
<text class="form-picker-arrow">></text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
:class="['submit-btn', { disabled: submitting }]"
|
||||
@tap="submitting ? undefined : handleSubmit()"
|
||||
>
|
||||
<text class="submit-text">{{ submitting ? '提交中...' : editId ? '保存修改' : '确认添加' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||
import { createPatient, updatePatient, Patient } from '@/services/patient'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
|
||||
const RELATION_OPTIONS = ['本人', '配偶', '父母', '子女', '其他']
|
||||
const GENDER_OPTIONS = ['男', '女']
|
||||
|
||||
const editId = ref('')
|
||||
const editData = ref<Patient | null>(null)
|
||||
|
||||
const name = ref('')
|
||||
const relationIdx = ref(0)
|
||||
const genderIdx = ref(0)
|
||||
const birthDate = ref('')
|
||||
const submitting = ref(false)
|
||||
|
||||
function onRelationChange(e: any) {
|
||||
relationIdx.value = Number(e.detail.value)
|
||||
}
|
||||
|
||||
function onGenderChange(e: any) {
|
||||
genderIdx.value = Number(e.detail.value)
|
||||
}
|
||||
|
||||
function onDateChange(e: any) {
|
||||
birthDate.value = e.detail.value
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
if (!name.value.trim()) {
|
||||
uni.showToast({ title: '请输入姓名', icon: 'none' })
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
const gender = GENDER_OPTIONS[genderIdx.value] === '男' ? 'male' : 'female'
|
||||
if (editId.value && editData.value) {
|
||||
await updatePatient(editId.value, {
|
||||
name: name.value.trim(),
|
||||
gender,
|
||||
birth_date: birthDate.value || undefined,
|
||||
relation: RELATION_OPTIONS[relationIdx.value],
|
||||
}, editData.value.version)
|
||||
uni.showToast({ title: '修改成功', icon: 'success' })
|
||||
} else {
|
||||
await createPatient({
|
||||
name: name.value.trim(),
|
||||
gender,
|
||||
birth_date: birthDate.value || undefined,
|
||||
})
|
||||
uni.showToast({ title: '添加成功', icon: 'success' })
|
||||
}
|
||||
setTimeout(() => uni.navigateBack(), 1000)
|
||||
} catch {
|
||||
uni.showToast({ title: editId.value ? '修改失败' : '添加失败', icon: 'none' })
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onLoad((query) => {
|
||||
if (query?.id) {
|
||||
editId.value = query.id
|
||||
const stored = uni.getStorageSync('edit_patient') as Patient | null
|
||||
if (stored) {
|
||||
editData.value = stored
|
||||
name.value = stored.name || ''
|
||||
relationIdx.value = stored.relation ? RELATION_OPTIONS.indexOf(stored.relation) : 0
|
||||
genderIdx.value = stored.gender === 'female' ? 1 : 0
|
||||
birthDate.value = stored.birth_date || ''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
uni.removeStorageSync('edit_patient')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
background: $bg;
|
||||
}
|
||||
|
||||
.family-add-page {
|
||||
padding: 32px 24px;
|
||||
padding-bottom: 160px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
@include section-title;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.form-card {
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 4px 28px;
|
||||
box-shadow: $shadow-sm;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 28px 0;
|
||||
border-bottom: 1px solid $bd-l;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.form-label {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-body-lg);
|
||||
color: $tx;
|
||||
flex-shrink: 0;
|
||||
width: 140px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
flex: 1;
|
||||
font-size: var(--tk-font-body-lg);
|
||||
color: $tx;
|
||||
text-align: right;
|
||||
border: none;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.form-placeholder {
|
||||
color: $tx3;
|
||||
}
|
||||
|
||||
.form-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.form-picker-text {
|
||||
font-size: var(--tk-font-body-lg);
|
||||
color: $tx;
|
||||
margin-right: 10px;
|
||||
|
||||
&.placeholder {
|
||||
color: $tx3;
|
||||
}
|
||||
}
|
||||
|
||||
.form-picker-arrow {
|
||||
font-size: var(--tk-font-h2);
|
||||
color: $tx3;
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: $pri;
|
||||
padding: 28px;
|
||||
text-align: center;
|
||||
box-shadow: 0 -2px 12px rgba(196, 98, 58, 0.15);
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.submit-text {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
color: $white;
|
||||
font-weight: bold;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,239 @@
|
||||
<template>
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
<view :class="['family-page', elderClass]">
|
||||
<text class="family-page-title">就诊人管理</text>
|
||||
|
||||
<view class="family-list">
|
||||
<view
|
||||
v-for="p in patients"
|
||||
:key="p.id"
|
||||
:class="['family-item', { active: authStore.currentPatient?.id === p.id }]"
|
||||
@tap="handleSelect(p)"
|
||||
>
|
||||
<view class="family-avatar">
|
||||
<text class="family-avatar-text">{{ relationInitial(p.relation || '本人') }}</text>
|
||||
</view>
|
||||
<view class="family-info">
|
||||
<view class="family-name-row">
|
||||
<text class="family-name">{{ p.name }}</text>
|
||||
<text v-if="authStore.currentPatient?.id === p.id" class="family-current-tag">当前</text>
|
||||
</view>
|
||||
<view class="family-meta">
|
||||
<text class="family-relation-tag">{{ p.relation || '本人' }}</text>
|
||||
<text class="family-gender">{{ genderText(p.gender) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="family-edit" @tap.stop="goToEdit(p)">
|
||||
<text class="family-edit-text">编辑</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<EmptyState v-if="patients.length === 0 && !loading" text="暂无就诊人" />
|
||||
|
||||
<view class="family-add-btn" @tap="goToAdd">
|
||||
<text class="family-add-text">添加就诊人</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { listPatients, Patient } from '@/services/patient'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const { elderClass } = useElderClass()
|
||||
|
||||
const patients = ref<Patient[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
async function fetchPatients() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listPatients()
|
||||
patients.value = res.data || []
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSelect(patient: Patient) {
|
||||
authStore.setCurrentPatient({
|
||||
id: patient.id,
|
||||
name: patient.name,
|
||||
gender: patient.gender,
|
||||
birth_date: patient.birth_date,
|
||||
relation: patient.relation || '本人',
|
||||
})
|
||||
uni.showToast({ title: `已切换为 ${patient.name}`, icon: 'success' })
|
||||
}
|
||||
|
||||
function goToAdd() {
|
||||
uni.navigateTo({ url: '/pages-sub/pkg-profile/family-add/index' })
|
||||
}
|
||||
|
||||
function goToEdit(patient: Patient) {
|
||||
uni.setStorageSync('edit_patient', patient)
|
||||
uni.navigateTo({ url: `/pages-sub/pkg-profile/family-add/index?id=${patient.id}` })
|
||||
}
|
||||
|
||||
function genderText(g?: string) {
|
||||
if (g === 'male') return '男'
|
||||
if (g === 'female') return '女'
|
||||
return '未知'
|
||||
}
|
||||
|
||||
function relationInitial(relation: string) {
|
||||
return relation ? relation.charAt(0) : '本'
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
fetchPatients()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-scroll {
|
||||
height: 100vh;
|
||||
background: $bg;
|
||||
}
|
||||
|
||||
.family-page {
|
||||
padding: 32px 24px;
|
||||
padding-bottom: 160px;
|
||||
}
|
||||
|
||||
.family-page-title {
|
||||
@include section-title;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.family-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.family-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 24px;
|
||||
box-shadow: $shadow-sm;
|
||||
transition: box-shadow 0.2s;
|
||||
|
||||
&:active {
|
||||
box-shadow: $shadow-md;
|
||||
}
|
||||
|
||||
&.active {
|
||||
box-shadow: $shadow-md;
|
||||
}
|
||||
}
|
||||
|
||||
.family-avatar {
|
||||
@include flex-center;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: $r;
|
||||
background: $pri-l;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.family-avatar-text {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num-lg);
|
||||
font-weight: bold;
|
||||
color: $pri-d;
|
||||
}
|
||||
|
||||
.family-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.family-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.family-name {
|
||||
font-size: var(--tk-font-num);
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
}
|
||||
|
||||
.family-current-tag {
|
||||
@include tag($pri, $white);
|
||||
font-size: var(--tk-font-body-sm);
|
||||
padding: 2px 10px;
|
||||
}
|
||||
|
||||
.family-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.family-relation-tag {
|
||||
@include tag($pri-l, $pri-d);
|
||||
font-size: var(--tk-font-body);
|
||||
padding: 2px 12px;
|
||||
}
|
||||
|
||||
.family-gender {
|
||||
font-size: var(--tk-font-h2);
|
||||
color: $tx2;
|
||||
}
|
||||
|
||||
.family-edit {
|
||||
flex-shrink: 0;
|
||||
margin-left: 16px;
|
||||
padding: 14px 24px;
|
||||
border: 1px solid $bd;
|
||||
border-radius: $r-pill;
|
||||
min-height: 48px;
|
||||
@include flex-center;
|
||||
|
||||
&:active {
|
||||
background: $bd-l;
|
||||
}
|
||||
}
|
||||
|
||||
.family-edit-text {
|
||||
font-size: var(--tk-font-h2);
|
||||
color: $tx2;
|
||||
}
|
||||
|
||||
.family-add-btn {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: $pri;
|
||||
padding: 28px;
|
||||
text-align: center;
|
||||
box-shadow: 0 -2px 12px rgba(196, 98, 58, 0.15);
|
||||
}
|
||||
|
||||
.family-add-text {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
color: $white;
|
||||
font-weight: bold;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<view :class="['my-followups-page', elderClass]">
|
||||
<view class="tab-bar">
|
||||
<view
|
||||
v-for="tab in TABS" :key="tab.key"
|
||||
:class="['tab-item', activeTab === tab.key ? 'active' : '']"
|
||||
@tap="handleTabChange(tab.key)"
|
||||
>
|
||||
<text :class="['tab-text', activeTab === tab.key ? 'active' : '']">{{ tab.label }}</text>
|
||||
<view v-if="activeTab === tab.key" class="tab-indicator" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="task-list">
|
||||
<view
|
||||
v-for="t in tasks" :key="t.id"
|
||||
class="task-card"
|
||||
@tap="goToDetail(t.id)"
|
||||
>
|
||||
<view class="task-top">
|
||||
<text class="task-name">{{ t.follow_up_type }}</text>
|
||||
<text :class="['task-status', getStatusClass(t.status)]">
|
||||
{{ getStatusLabel(t.status) }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="task-desc">{{ t.content_template }}</text>
|
||||
<text class="task-due">截止: {{ t.planned_date }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<EmptyState
|
||||
v-if="tasks.length === 0 && !loading"
|
||||
:text="'暂无' + (TABS.find(t => t.key === activeTab)?.label || '') + '任务'"
|
||||
/>
|
||||
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { listTasks, type FollowUpTask } from '@/services/followup'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
|
||||
const TABS = [
|
||||
{ key: 'pending', label: '待完成' },
|
||||
{ key: 'completed', label: '已完成' },
|
||||
{ key: 'overdue', label: '已过期' },
|
||||
]
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const activeTab = ref('pending')
|
||||
const tasks = ref<FollowUpTask[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
const fetchTasks = async (status: string) => {
|
||||
loading.value = true
|
||||
try {
|
||||
const patientId = authStore.currentPatient?.id
|
||||
const res = await listTasks(patientId, status)
|
||||
tasks.value = res.data || []
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleTabChange = (key: string) => {
|
||||
activeTab.value = key
|
||||
fetchTasks(key)
|
||||
}
|
||||
|
||||
const goToDetail = (id: string) => {
|
||||
uni.navigateTo({ url: `/pages-sub/followup/detail/index?id=${id}` })
|
||||
}
|
||||
|
||||
const getStatusClass = (status: string) => {
|
||||
if (status === 'completed') return 'completed'
|
||||
if (status === 'overdue') return 'overdue'
|
||||
return 'pending'
|
||||
}
|
||||
|
||||
const getStatusLabel = (status: string) => {
|
||||
if (status === 'completed') return '已完成'
|
||||
if (status === 'overdue') return '已过期'
|
||||
return '待完成'
|
||||
}
|
||||
|
||||
onShow(() => { fetchTasks(activeTab.value) })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my-followups-page { min-height: 100vh; background: $bg; }
|
||||
.tab-bar { display: flex; background: $card; padding: 0; box-shadow: $shadow-sm; }
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 24px 0 20px;
|
||||
position: relative;
|
||||
}
|
||||
.tab-text {
|
||||
font-size: var(--tk-font-body-lg);
|
||||
color: $tx2;
|
||||
margin-bottom: 8px;
|
||||
&.active { color: $pri; font-weight: bold; }
|
||||
}
|
||||
.tab-indicator { width: 32px; height: 4px; background: $pri; border-radius: $r-xs; }
|
||||
.task-list { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
|
||||
.task-card {
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 28px;
|
||||
box-shadow: $shadow-sm;
|
||||
&:active { box-shadow: $shadow-md; }
|
||||
}
|
||||
.task-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
|
||||
.task-name {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
}
|
||||
.task-status {
|
||||
@include tag($bd-l, $tx2);
|
||||
&.pending { @include tag($wrn-l, $wrn); }
|
||||
&.completed { @include tag($acc-l, $acc); }
|
||||
&.overdue { @include tag($dan-l, $dan); }
|
||||
}
|
||||
.task-desc {
|
||||
font-size: var(--tk-font-h1);
|
||||
color: $tx2;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.task-due {
|
||||
@include serif-number;
|
||||
font-size: var(--tk-font-h2);
|
||||
color: $tx3;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<view :class="['health-records-page', elderClass]">
|
||||
<text class="page-title">健康记录</text>
|
||||
|
||||
<view class="record-list">
|
||||
<view v-for="r in records" :key="r.id" class="record-card">
|
||||
<view class="record-card__header">
|
||||
<text class="record-card__type">{{ TYPE_MAP[r.record_type] || r.record_type }}</text>
|
||||
<text class="record-card__date">{{ r.record_date }}</text>
|
||||
</view>
|
||||
<text v-if="r.overall_assessment" class="record-card__assessment">{{ r.overall_assessment }}</text>
|
||||
<text v-if="r.source" class="record-card__source">来源:{{ r.source }}</text>
|
||||
<text v-if="r.notes" class="record-card__notes">{{ r.notes }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<EmptyState
|
||||
v-if="records.length === 0 && !loading"
|
||||
:text="authStore.currentPatient ? '暂无健康记录' : '请先在就诊人管理中选择就诊人'"
|
||||
/>
|
||||
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { listHealthRecords, type HealthRecord } from '@/services/health-record'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
|
||||
const TYPE_MAP: Record<string, string> = {
|
||||
checkup: '体检',
|
||||
follow_up: '复查',
|
||||
referral: '转诊',
|
||||
}
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const records = ref<HealthRecord[]>([])
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
const fetchData = async (p: number, append = false) => {
|
||||
if (!authStore.currentPatient) {
|
||||
records.value = []
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listHealthRecords(authStore.currentPatient.id, { page: p, page_size: 20 })
|
||||
const list = res.data || []
|
||||
records.value = append ? [...records.value, ...list] : list
|
||||
total.value = res.total
|
||||
page.value = p
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && records.value.length < total.value) {
|
||||
fetchData(page.value + 1, true)
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => { fetchData(1) })
|
||||
onPullDownRefresh(() => { fetchData(1).finally(() => uni.stopPullDownRefresh()) })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.health-records-page { min-height: 100vh; background: $bg; padding: 32px 24px; padding-bottom: 40px; }
|
||||
.page-title {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
margin-bottom: 20px;
|
||||
display: block;
|
||||
padding-left: 4px;
|
||||
}
|
||||
.record-list { display: flex; flex-direction: column; gap: 16px; }
|
||||
.record-card { background: $card; border-radius: $r; padding: 28px; box-shadow: $shadow-sm; }
|
||||
.record-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
|
||||
.record-card__type { font-size: var(--tk-font-body-lg); font-weight: bold; color: $tx; }
|
||||
.record-card__date { font-size: var(--tk-font-h2); color: $tx2; font-variant-numeric: tabular-nums; }
|
||||
.record-card__assessment { font-size: var(--tk-font-h2); color: $tx; display: block; margin-bottom: 4px; }
|
||||
.record-card__source { font-size: var(--tk-font-body); color: $tx3; display: block; margin-bottom: 4px; }
|
||||
.record-card__notes { font-size: var(--tk-font-body); color: $tx2; display: block; margin-top: 8px; }
|
||||
</style>
|
||||
@@ -0,0 +1,291 @@
|
||||
<template>
|
||||
<view :class="['medication-page', elderClass]">
|
||||
<text class="page-title">用药提醒</text>
|
||||
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
|
||||
<template v-else>
|
||||
<view class="reminder-list">
|
||||
<view
|
||||
v-for="r in reminders" :key="r.id"
|
||||
:class="['reminder-card', !r.is_active ? 'disabled' : '']"
|
||||
>
|
||||
<view class="reminder-avatar">
|
||||
<text class="reminder-avatar-text">{{ nameInitial(r.medication_name) }}</text>
|
||||
</view>
|
||||
<view class="reminder-info">
|
||||
<text class="reminder-name">{{ r.medication_name }}</text>
|
||||
<text class="reminder-dosage">
|
||||
{{ r.dosage || '-' }} | {{ r.reminder_times?.join(', ') || '-' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="reminder-actions">
|
||||
<view
|
||||
:class="['toggle', r.is_active ? 'on' : 'off']"
|
||||
@tap="handleToggle(r)"
|
||||
>
|
||||
<view class="toggle-dot" />
|
||||
</view>
|
||||
<text class="delete-btn" @tap="handleDelete(r)">删除</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<EmptyState v-if="reminders.length === 0" text="暂无用药提醒" />
|
||||
|
||||
<view v-if="showForm" class="form-card">
|
||||
<text class="form-card-title">添加提醒</text>
|
||||
<view class="form-item">
|
||||
<text class="form-label">药品名称</text>
|
||||
<input
|
||||
class="form-input"
|
||||
placeholder="请输入药品名称"
|
||||
placeholder-class="form-placeholder"
|
||||
:value="formName"
|
||||
@input="formName = ($event as any).detail.value"
|
||||
/>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="form-label">剂量</text>
|
||||
<input
|
||||
class="form-input"
|
||||
placeholder="如: 1片、10ml"
|
||||
placeholder-class="form-placeholder"
|
||||
:value="formDosage"
|
||||
@input="formDosage = ($event as any).detail.value"
|
||||
/>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="form-label">提醒时间</text>
|
||||
<picker mode="time" :value="formTime" @change="formTime = ($event as any).detail.value">
|
||||
<view class="time-picker-wrap">
|
||||
<text class="time-value">{{ formTime }}</text>
|
||||
<text class="time-modify">修改</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="form-actions">
|
||||
<view class="form-cancel" @tap="showForm = false">
|
||||
<text class="form-cancel-text">取消</text>
|
||||
</view>
|
||||
<view class="form-confirm" @tap="handleAdd">
|
||||
<text class="form-confirm-text">确认</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="!showForm" class="add-btn" @tap="showForm = true">
|
||||
<text class="add-text">添加提醒</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onMounted } from 'vue'
|
||||
import {
|
||||
listReminders,
|
||||
createReminder,
|
||||
updateReminder,
|
||||
deleteReminder,
|
||||
type MedicationReminder,
|
||||
} from '@/services/medication-reminder'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const reminders = ref<MedicationReminder[]>([])
|
||||
const loading = ref(true)
|
||||
const showForm = ref(false)
|
||||
const formName = ref('')
|
||||
const formDosage = ref('')
|
||||
const formTime = ref('08:00')
|
||||
|
||||
const fetchReminders = async () => {
|
||||
try {
|
||||
const res = await listReminders()
|
||||
reminders.value = res.data ?? []
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleToggle = async (r: MedicationReminder) => {
|
||||
try {
|
||||
await updateReminder(r.id, { is_active: !r.is_active, version: r.version })
|
||||
fetchReminders()
|
||||
} catch {
|
||||
uni.showToast({ title: '操作失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
const handleDelete = (r: MedicationReminder) => {
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: '确定要删除这个提醒吗?',
|
||||
}).then(async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
await deleteReminder(r.id, r.version)
|
||||
uni.showToast({ title: '已删除', icon: 'success' })
|
||||
fetchReminders()
|
||||
} catch {
|
||||
uni.showToast({ title: '删除失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleAdd = async () => {
|
||||
if (!formName.value.trim()) {
|
||||
uni.showToast({ title: '请输入药品名称', icon: 'none' })
|
||||
return
|
||||
}
|
||||
const patientId = authStore.currentPatient?.id
|
||||
if (!patientId) {
|
||||
uni.showToast({ title: '请先绑定患者档案', icon: 'none' })
|
||||
return
|
||||
}
|
||||
try {
|
||||
await createReminder({
|
||||
patient_id: patientId,
|
||||
medication_name: formName.value.trim(),
|
||||
dosage: formDosage.value.trim() || undefined,
|
||||
reminder_times: [formTime.value],
|
||||
is_active: true,
|
||||
})
|
||||
formName.value = ''
|
||||
formDosage.value = ''
|
||||
formTime.value = '08:00'
|
||||
showForm.value = false
|
||||
uni.showToast({ title: '添加成功', icon: 'success' })
|
||||
fetchReminders()
|
||||
} catch {
|
||||
uni.showToast({ title: '添加失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
const nameInitial = (name: string) => {
|
||||
return name ? name.charAt(0) : '药'
|
||||
}
|
||||
|
||||
onMounted(() => { fetchReminders() })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.medication-page { min-height: 100vh; background: $bg; padding: 32px 24px; padding-bottom: 160px; }
|
||||
.page-title { @include section-title; padding-left: 4px; }
|
||||
.reminder-list { display: flex; flex-direction: column; gap: 16px; }
|
||||
.reminder-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 24px;
|
||||
box-shadow: $shadow-sm;
|
||||
&.disabled { opacity: 0.55; }
|
||||
}
|
||||
.reminder-avatar {
|
||||
@include flex-center;
|
||||
width: 72px; height: 72px;
|
||||
border-radius: $r;
|
||||
background: $acc-l;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.reminder-avatar-text {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
font-weight: bold;
|
||||
color: $acc;
|
||||
}
|
||||
.reminder-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
|
||||
.reminder-name {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.reminder-dosage {
|
||||
@include serif-number;
|
||||
font-size: var(--tk-font-h2);
|
||||
color: $tx2;
|
||||
}
|
||||
.reminder-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; margin-left: 12px; }
|
||||
.toggle {
|
||||
width: 84px; height: 48px;
|
||||
border-radius: $r-pill;
|
||||
padding: 4px;
|
||||
position: relative;
|
||||
transition: background 0.3s;
|
||||
&.on { background: $pri; }
|
||||
&.off { background: $bd; }
|
||||
}
|
||||
.toggle-dot {
|
||||
width: 40px; height: 40px;
|
||||
border-radius: 50%;
|
||||
background: $card;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
transition: left 0.3s;
|
||||
.toggle.on & { left: 40px; }
|
||||
.toggle.off & { left: 4px; }
|
||||
}
|
||||
.delete-btn {
|
||||
font-size: var(--tk-font-h2);
|
||||
color: $dan;
|
||||
padding: 14px 16px;
|
||||
min-height: 48px;
|
||||
@include flex-center;
|
||||
}
|
||||
.form-card { background: $card; border-radius: $r; padding: 28px; margin-top: 24px; box-shadow: $shadow-sm; }
|
||||
.form-card-title {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-body-lg);
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
margin-bottom: 20px;
|
||||
display: block;
|
||||
}
|
||||
.form-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24px 0;
|
||||
border-bottom: 1px solid $bd-l;
|
||||
&:last-of-type { border-bottom: none; }
|
||||
}
|
||||
.form-label { font-size: var(--tk-font-body-lg); color: $tx; flex-shrink: 0; width: 160px; }
|
||||
.form-input { flex: 1; font-size: var(--tk-font-body-lg); color: $tx; text-align: right; border: none; background: transparent; outline: none; }
|
||||
.form-placeholder { color: $tx3; }
|
||||
.time-picker-wrap { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
|
||||
.time-value { @include serif-number; font-size: var(--tk-font-body-lg); color: $tx; }
|
||||
.time-modify { font-size: var(--tk-font-h2); color: $pri; }
|
||||
.form-actions { display: flex; gap: 16px; margin-top: 24px; }
|
||||
.form-cancel { flex: 1; background: $bd-l; border-radius: $r-sm; padding: 20px; text-align: center; }
|
||||
.form-cancel-text { font-size: var(--tk-font-body-lg); color: $tx2; }
|
||||
.form-confirm { flex: 1; background: $pri; border-radius: $r-sm; padding: 20px; text-align: center; }
|
||||
.form-confirm-text { font-size: var(--tk-font-body-lg); color: $white; font-weight: bold; }
|
||||
.add-btn {
|
||||
position: fixed;
|
||||
bottom: 0; left: 0; right: 0;
|
||||
background: $pri;
|
||||
padding: 28px;
|
||||
text-align: center;
|
||||
box-shadow: 0 -2px 12px rgba(196, 98, 58, 0.15);
|
||||
}
|
||||
.add-text {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
color: $white;
|
||||
font-weight: bold;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<view :class="['my-reports-page', elderClass]">
|
||||
<text class="page-title">检查报告</text>
|
||||
|
||||
<view class="report-list">
|
||||
<view
|
||||
v-for="r in reports" :key="r.id"
|
||||
class="report-card"
|
||||
@tap="goToDetail(r.id)"
|
||||
>
|
||||
<view class="report-card-top">
|
||||
<view class="report-type-row">
|
||||
<view class="report-avatar">
|
||||
<text class="report-avatar-text">{{ typeInitial(r.report_type) }}</text>
|
||||
</view>
|
||||
<text class="report-type">{{ r.report_type }}</text>
|
||||
</view>
|
||||
<text :class="['report-status', formatStatus(r)]">
|
||||
{{ formatStatus(r) === 'normal' ? '正常' : formatStatus(r) === 'abnormal' ? '异常' : '未知' }}
|
||||
</text>
|
||||
</view>
|
||||
<text class="report-date">{{ r.report_date }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<EmptyState
|
||||
v-if="reports.length === 0 && !loading"
|
||||
:text="authStore.currentPatient ? '暂无报告记录' : '请先在就诊人管理中选择就诊人'"
|
||||
/>
|
||||
|
||||
<Loading v-if="loading" text="加载中..." />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import { listReports, type LabReport } from '@/services/report'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useElderClass } from '@/composables/useElderClass'
|
||||
import EmptyState from '@/components/EmptyState.vue'
|
||||
import Loading from '@/components/Loading.vue'
|
||||
|
||||
const { elderClass } = useElderClass()
|
||||
const authStore = useAuthStore()
|
||||
const reports = ref<LabReport[]>([])
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
const fetchData = async (p: number, append = false) => {
|
||||
if (!authStore.currentPatient) {
|
||||
reports.value = []
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await listReports(authStore.currentPatient.id, p)
|
||||
const list = res.data || []
|
||||
reports.value = append ? [...reports.value, ...list] : list
|
||||
total.value = res.total
|
||||
page.value = p
|
||||
} catch {
|
||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadMore = () => {
|
||||
if (!loading.value && reports.value.length < total.value) {
|
||||
fetchData(page.value + 1, true)
|
||||
}
|
||||
}
|
||||
|
||||
const goToDetail = (id: string) => {
|
||||
uni.navigateTo({ url: `/pages-sub/report/detail/index?id=${id}` })
|
||||
}
|
||||
|
||||
const formatStatus = (report: LabReport) => {
|
||||
const indicators = report.indicators
|
||||
if (!indicators || typeof indicators !== 'object') return 'unknown'
|
||||
const vals = Object.values(indicators) as Array<{ status?: string }>
|
||||
const hasAbnormal = vals.some((v) => v.status === 'high' || v.status === 'low')
|
||||
return hasAbnormal ? 'abnormal' : 'normal'
|
||||
}
|
||||
|
||||
const typeInitial = (type: string) => {
|
||||
return type ? type.charAt(0) : '报'
|
||||
}
|
||||
|
||||
onShow(() => { fetchData(1) })
|
||||
onPullDownRefresh(() => { fetchData(1).finally(() => uni.stopPullDownRefresh()) })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.my-reports-page {
|
||||
min-height: 100vh;
|
||||
background: $bg;
|
||||
padding: 32px 24px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
.page-title { @include section-title; padding-left: 4px; }
|
||||
.report-list { display: flex; flex-direction: column; gap: 16px; }
|
||||
.report-card {
|
||||
background: $card;
|
||||
border-radius: $r;
|
||||
padding: 28px;
|
||||
box-shadow: $shadow-sm;
|
||||
&:active { box-shadow: $shadow-md; }
|
||||
}
|
||||
.report-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
|
||||
.report-type-row { display: flex; align-items: center; }
|
||||
.report-avatar {
|
||||
@include flex-center;
|
||||
width: 56px; height: 56px;
|
||||
border-radius: $r-sm;
|
||||
background: $pri-l;
|
||||
margin-right: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.report-avatar-text {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-body-lg);
|
||||
font-weight: bold;
|
||||
color: $pri-d;
|
||||
}
|
||||
.report-type {
|
||||
font-family: 'Georgia', 'Times New Roman', serif;
|
||||
font-size: var(--tk-font-num);
|
||||
font-weight: bold;
|
||||
color: $tx;
|
||||
}
|
||||
.report-status {
|
||||
@include tag($bd-l, $tx2);
|
||||
&.normal { @include tag($acc-l, $acc); }
|
||||
&.abnormal { @include tag($dan-l, $dan); }
|
||||
}
|
||||
.report-date {
|
||||
@include serif-number;
|
||||
font-size: var(--tk-font-h1);
|
||||
color: $tx2;
|
||||
display: block;
|
||||
padding-left: 72px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,173 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user