|
|
@@ -146,9 +146,15 @@
|
|
|
<text class="activity-time">{{ activity.time }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-if="patientActivities.length === 0" class="no-activity">
|
|
|
+ <view v-if="patientActivities.length === 0 && !patientActivitiesError" class="no-activity">
|
|
|
<text>暂无患者动态</text>
|
|
|
</view>
|
|
|
+ <view v-if="patientActivitiesError" class="error-activity">
|
|
|
+ <text class="error-text">加载失败,请重试</text>
|
|
|
+ <view class="retry-button" @click="fetchPatientActivities">
|
|
|
+ <text class="retry-text">重试</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -214,6 +220,9 @@ const patientActivities = ref<Array<{
|
|
|
// 患者动态加载状态
|
|
|
const patientActivitiesLoading = ref(true)
|
|
|
|
|
|
+// 患者动态获取失败状态
|
|
|
+const patientActivitiesError = ref(false)
|
|
|
+
|
|
|
const loadUser = () => {
|
|
|
try {
|
|
|
const u = uni.getStorageSync('user_info')
|
|
|
@@ -311,6 +320,7 @@ const fetchTodayReminders = async () => {
|
|
|
const fetchPatientActivities = async () => {
|
|
|
try {
|
|
|
patientActivitiesLoading.value = true
|
|
|
+ patientActivitiesError.value = false
|
|
|
const token = uni.getStorageSync('token')
|
|
|
if (!token) {
|
|
|
console.log('No token found, skipping fetchPatientActivities')
|
|
|
@@ -350,7 +360,8 @@ const fetchPatientActivities = async () => {
|
|
|
}
|
|
|
} catch (err) {
|
|
|
console.error('Fetch patient activities error:', err)
|
|
|
- // 如果接口调用失败,显示空数据
|
|
|
+ // 如果接口调用失败,显示错误状态
|
|
|
+ patientActivitiesError.value = true
|
|
|
patientActivities.value = []
|
|
|
} finally {
|
|
|
patientActivitiesLoading.value = false
|
|
|
@@ -912,6 +923,33 @@ const formatActivityDescription = (activity: any) => {
|
|
|
color: #999;
|
|
|
}
|
|
|
|
|
|
+.error-activity {
|
|
|
+ padding: 40rpx;
|
|
|
+ text-align: center;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.error-text {
|
|
|
+ color: #ff6b6b;
|
|
|
+ font-size: 28rpx;
|
|
|
+ margin-bottom: 20rpx;
|
|
|
+}
|
|
|
+
|
|
|
+.retry-button {
|
|
|
+ background-color: #007aff;
|
|
|
+ color: white;
|
|
|
+ padding: 16rpx 32rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ display: inline-block;
|
|
|
+}
|
|
|
+
|
|
|
+.retry-text {
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: white;
|
|
|
+}
|
|
|
+
|
|
|
/* 骨架屏样式 */
|
|
|
.skeleton-container {
|
|
|
padding: 20rpx;
|