feat(my): 我的页新增退出登录,清空 lefu 与本地信息

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
17792275749
2026-08-24 19:39:42 +08:00
co-authored by Claude Sonnet 4.6
parent 4b61c882a1
commit 0fcb6eebef
2 changed files with 19 additions and 1 deletions
+18
View File
@@ -1,5 +1,6 @@
import { calcAge } from '../../utils/idCard/index'
import type { UserInfo } from '../../api/index'
import { leFuService } from '../../lefu/index'
/** 页面展示用用户信息 */
interface PageUserInfo {
@@ -45,6 +46,23 @@ Page({
wx.navigateTo({ url: '/pages/helpCenter/helpCenter' })
},
// 退出登录:清空 lefu 连接与本地信息,回到登录页
onLogout() {
wx.showModal({
title: '退出登录',
content: '确定要退出登录吗?',
confirmText: '退出',
cancelText: '取消',
success: (res) => {
if (!res.confirm) return
leFuService.disconnect()
leFuService.stopScan()
wx.clearStorageSync()
wx.reLaunch({ url: '/pages/login/login' })
},
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
+1 -1
View File
@@ -37,6 +37,6 @@
</view>
</view>
<view class="exitBtn">退出登录</view>
<view class="exitBtn" bind:tap="onLogout">退出登录</view>
</view>
</view>