退出登录位置修改
parent
9e4814638f
commit
cac9a78f0c
|
|
@ -84,6 +84,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="logout" type="primary" @click="handleLogout">退出登录</button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -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;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -20,13 +20,6 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-list menu">
|
||||
<view class="cu-item item-box">
|
||||
<view class="content text-center" @click="handleLogout">
|
||||
<text class="text-black">退出登录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -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')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue