更新
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<view class="card-container">
|
||||
<!-- 顶部标题栏 -->
|
||||
<view class="header">
|
||||
<text class="header-title">我的就诊卡</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 就诊卡列表 -->
|
||||
<view class="card-list">
|
||||
@@ -61,6 +59,7 @@
|
||||
<view v-if="!loading && cardList.length === 0" class="empty-state">
|
||||
<uni-icons type="wallet" size="60" color="#999"></uni-icons>
|
||||
<text class="empty-text">暂无就诊卡</text>
|
||||
<view class="add-card-btn" @click="createCard">新建就诊卡</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载状态 -->
|
||||
@@ -73,7 +72,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, getCurrentInstance } from 'vue'
|
||||
|
||||
import { onLaunch, onShow, onHide, onError ,onShareAppMessage} from '@dcloudio/uni-app'
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
// 数据
|
||||
@@ -84,7 +83,9 @@ const loading = ref(false)
|
||||
onMounted(() => {
|
||||
loadCardList()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
loadCardList()
|
||||
})
|
||||
// 加载就诊卡列表
|
||||
const loadCardList = async () => {
|
||||
loading.value = true
|
||||
@@ -93,9 +94,9 @@ const loadCardList = async () => {
|
||||
const token = uni.getStorageSync('token')
|
||||
if (!token) {
|
||||
uni.showToast({ title: '请先登录', icon: 'none' })
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({ url: '/pages/login/login' })
|
||||
}, 1500)
|
||||
// setTimeout(() => {
|
||||
// uni.redirectTo({ url: '/pages/login/login' })
|
||||
// }, 1500)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ const loadCardList = async () => {
|
||||
const patientId = userData?.diagnosis?.patient_id
|
||||
|
||||
if (!patientId) {
|
||||
uni.showToast({ title: '患者信息不存在', icon: 'none' })
|
||||
//uni.showToast({ title: '患者信息不存在', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -137,6 +138,18 @@ const viewCardDetail = (card) => {
|
||||
})
|
||||
}
|
||||
|
||||
// 新建就诊卡(patient_id 创建后自动生成,仅需登录)
|
||||
const createCard = () => {
|
||||
const token = uni.getStorageSync('token')
|
||||
if (!token) {
|
||||
uni.showToast({ title: '请先登录', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/Card/edit_card?add=1'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取状态文本
|
||||
const getStatusText = (status) => {
|
||||
return status === 1 ? '启用' : '禁用'
|
||||
@@ -257,8 +270,8 @@ const formatDate = (timestamp) => {
|
||||
|
||||
&.status-confirmed {
|
||||
background: #f6ffed;
|
||||
color: #52c41a;
|
||||
border: 2rpx solid #b7eb8f;
|
||||
color: #204e2b;
|
||||
border: 2rpx solid #204e2b;
|
||||
}
|
||||
|
||||
&.status-pending {
|
||||
@@ -343,9 +356,19 @@ const formatDate = (timestamp) => {
|
||||
.empty-text {
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.add-card-btn {
|
||||
padding: 24rpx 64rpx;
|
||||
background: #1890ff;
|
||||
color: #ffffff;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 48rpx;
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
Reference in New Issue
Block a user