feat(my): 我的页新增退出登录,清空 lefu 与本地信息
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
4b61c882a1
commit
0fcb6eebef
@@ -1,5 +1,6 @@
|
|||||||
import { calcAge } from '../../utils/idCard/index'
|
import { calcAge } from '../../utils/idCard/index'
|
||||||
import type { UserInfo } from '../../api/index'
|
import type { UserInfo } from '../../api/index'
|
||||||
|
import { leFuService } from '../../lefu/index'
|
||||||
|
|
||||||
/** 页面展示用用户信息 */
|
/** 页面展示用用户信息 */
|
||||||
interface PageUserInfo {
|
interface PageUserInfo {
|
||||||
@@ -45,6 +46,23 @@ Page({
|
|||||||
wx.navigateTo({ url: '/pages/helpCenter/helpCenter' })
|
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' })
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,6 +37,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="exitBtn">退出登录</view>
|
<view class="exitBtn" bind:tap="onLogout">退出登录</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
Reference in New Issue
Block a user