diff --git a/pages/mine/index.vue b/pages/mine/index.vue
index be614d8..4542262 100644
--- a/pages/mine/index.vue
+++ b/pages/mine/index.vue
@@ -84,6 +84,7 @@
+
@@ -141,6 +142,19 @@
},
handleBuilding() {
this.$modal.showToast('模块建设中~')
+ },
+ handleLogout() {
+ this.$modal.confirm('确定注销并退出系统吗?').then(() => {
+ this.$store.dispatch('LogOut').then(() => {
+ // ========== 新增:登出时断开MQTT并清空状态 ==========
+ // 1. 获取全局App实例
+ const app = getApp()
+ // 2. 调用App.vue的logout方法(断开MQTT+清空订阅列表)
+ app.logout()
+ }).finally(()=>{
+ this.$tab.reLaunch('/pages/index')
+ })
+ })
}
}
}
@@ -220,4 +234,10 @@
/* 或者写成 border: 0 !important; */
}
}
+
+ .logout {
+ margin: 25rpx;
+ background: #4e84f2;
+ color: #fff;
+ }
diff --git a/pages/mine/subpages/setting/index.vue b/pages/mine/subpages/setting/index.vue
index a3ea46c..02c9a73 100644
--- a/pages/mine/subpages/setting/index.vue
+++ b/pages/mine/subpages/setting/index.vue
@@ -20,13 +20,6 @@
-
@@ -47,19 +40,7 @@
handleCleanTmp() {
this.$modal.showToast('模块建设中~')
},
- handleLogout() {
- this.$modal.confirm('确定注销并退出系统吗?').then(() => {
- this.$store.dispatch('LogOut').then(() => {
- // ========== 新增:登出时断开MQTT并清空状态 ==========
- // 1. 获取全局App实例
- const app = getApp()
- // 2. 调用App.vue的logout方法(断开MQTT+清空订阅列表)
- app.logout()
- }).finally(()=>{
- this.$tab.reLaunch('/pages/index')
- })
- })
- }
+
}
}