From 2375f544f30a1254df08703022a4722ac4d6434f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?= <15778543+xufeiyang6017@user.noreply.gitee.com> Date: Wed, 21 Jan 2026 13:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=A7=BB=E5=8A=A8=E5=88=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=8D=A1=E7=89=87=E5=8F=B3=E4=BE=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/profile/index.js | 35 +++++++++++++++++++++++++++++++++++ pages/profile/index.wxml | 10 +++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/pages/profile/index.js b/pages/profile/index.js index 04558a2..b2085dd 100644 --- a/pages/profile/index.js +++ b/pages/profile/index.js @@ -1023,4 +1023,39 @@ Page({ }); }, + // 退出登录 + logout() { + wx.showModal({ + title: '退出登录', + content: '确定要退出登录吗?', + success: (res) => { + if (res.confirm) { + // 清除本地缓存 + wx.clearStorageSync(); + + // 重置全局用户信息 + const app = getApp(); + app.globalData.userInfo = {}; + app.globalData.userType = ''; + + // 重新加载页面 + this.setData({ + userInfo: {}, + userType: '', + userTags: [], + needPhoneAuth: true, + locationInfo: '', + hasLocationAuth: false + }); + + wx.showToast({ + title: '退出登录成功', + icon: 'success', + duration: 2000 + }); + } + } + }); + }, + }) diff --git a/pages/profile/index.wxml b/pages/profile/index.wxml index 64e1692..4ccc763 100644 --- a/pages/profile/index.wxml +++ b/pages/profile/index.wxml @@ -12,7 +12,15 @@ - + + +