From 82d6b98f5b6b88e223259547208ab59829ad723e Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 01 十一月 2025 21:30:52 +0800
Subject: [PATCH] fix:增加旧系统状态同步到新系统,新系统状态同步到旧系统
---
app/pages/index.vue | 43 +++++++++++++++++++++++++++----------------
1 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/app/pages/index.vue b/app/pages/index.vue
index 62a019b..27abff0 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -163,6 +163,7 @@
import { getUserProfile } from '@/api/system/user'
import { getUserBoundVehicle } from '@/api/vehicle'
import { getUnreadCount } from '@/api/message'
+ import { formatDateTime } from '@/utils/common'
export default {
data() {
@@ -245,13 +246,36 @@
// 鍔犺浇鏈娑堟伅鏁伴噺
loadUnreadMessageCount() {
+ // 妫�鏌ョ敤鎴锋槸鍚﹀凡鐧诲綍
+ const userId = this.currentUser.userId
+ if (!userId) {
+ console.log('鐢ㄦ埛鏈櫥褰曪紝璺宠繃鑾峰彇鏈娑堟伅鏁伴噺')
+ return
+ }
+
getUnreadCount().then(response => {
if (response.code === 200) {
this.unreadMessageCount = response.data || 0
+ // 鏇存柊TabBar寰芥爣
+ this.updateTabBarBadge(this.unreadMessageCount)
}
}).catch(error => {
console.error('鑾峰彇鏈娑堟伅鏁伴噺澶辫触:', error)
})
+ },
+
+ // 鏇存柊TabBar寰芥爣
+ updateTabBarBadge(count) {
+ if (count > 0) {
+ uni.setTabBarBadge({
+ index: 3, // 娑堟伅椤甸潰鍦╰abBar涓殑绱㈠紩
+ text: count > 99 ? '99+' : count.toString()
+ })
+ } else {
+ uni.removeTabBarBadge({
+ index: 3
+ })
+ }
},
// 鍔犺浇鐢ㄦ埛淇℃伅锛堜繚鐣欎互鍏煎涔嬪墠鐨勪唬鐮侊級
@@ -315,7 +339,7 @@
vehicleList: task.assignedVehicles || [],
startLocation: this.formatAddress(task.departureAddress || task.startLocation || '鏈缃�'),
endLocation: this.formatAddress(task.destinationAddress || task.endLocation || '鏈缃�'),
- startTime: task.plannedStartTime ? this.formatDateTime(task.plannedStartTime) : '鏈缃�',
+ startTime: task.plannedStartTime ? formatDateTime(task.plannedStartTime, 'YYYY-MM-DD HH:mm') : '鏈缃�',
assignee: task.assigneeName || '鏈垎閰�',
taskNo: task.taskCode || '鏈煡缂栧彿',
status: this.convertStatus(task.taskStatus) // 杞崲鐘舵�佹牸寮忎互鍏煎鏃I
@@ -324,19 +348,6 @@
}).catch(error => {
this.loading = false
console.error('鍔犺浇浠诲姟鍒楄〃澶辫触:', error)
- })
- },
-
- // 鏍煎紡鍖栨棩鏈熸椂闂�
- formatDateTime(dateTime) {
- if (!dateTime) return ''
- const date = new Date(dateTime)
- return date.toLocaleString('zh-CN', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit'
})
},
@@ -528,13 +539,13 @@
'MAINTENANCE': '缁翠慨淇濆吇',
'FUEL': '鍔犳补',
'OTHER': '鍏朵粬',
- 'EMERGENCY_TRANSFER': '鎬ユ晳杞繍',
+ 'EMERGENCY_TRANSFER': '杞繍浠诲姟',
'WELFARE': '绂忕杞�',
// 鏃ф牸寮忥紙UI绫诲瀷锛�
'maintenance': '缁翠慨淇濆吇',
'refuel': '鍔犳补',
'inspection': '宸℃',
- 'emergency': '鎬ユ晳杞繍',
+ 'emergency': '杞繍浠诲姟',
'welfare': '绂忕杞�'
}
return typeMap[type] || '鏈煡绫诲瀷'
--
Gitblit v1.9.1