app/pages/index.vue
@@ -196,6 +196,13 @@ } }, onLoad() { // 检查用户是否已登录 const userId = this.currentUser.userId if (!userId) { console.log('用户未登录,跳过加载数据') return } // 加载用户绑定车辆信息 this.loadUserVehicle() // 加载正在运行的任务 @@ -204,6 +211,13 @@ this.loadUnreadMessageCount() }, onShow() { // 检查用户是否已登录 const userId = this.currentUser.userId if (!userId) { console.log('用户未登录,跳过加载数据') return } // 每次显示页面时刷新任务列表、绑定车辆和消息数量 this.loadUserVehicle() this.loadRunningTasks()