From 96f2ee15eb109a86c9d6446a2c989bcd9c5e4f9b Mon Sep 17 00:00:00 2001 From: Daniel Kou Date: Mon, 22 Jun 2026 13:56:12 +0800 Subject: [PATCH] fix login --- packages/user/index/index.css | 6 ++ packages/user/index/index.vue | 31 ++++++++++ pages/login/login.vue | 103 ++++++++++++++++++++++++++++++++-- 3 files changed, 135 insertions(+), 5 deletions(-) diff --git a/packages/user/index/index.css b/packages/user/index/index.css index 4d73d001..ee8ce2c8 100644 --- a/packages/user/index/index.css +++ b/packages/user/index/index.css @@ -53,6 +53,12 @@ page { font-size: 36rpx; color: #ffffff; } +.logout-btn { + margin-top: 40rpx; + background: #ffffff; + border: 1rpx solid #ff370b; + color: #ff370b; +} .tabel1 { margin: 0 20rpx; border-bottom: 1rpx solid #ebebeb; diff --git a/packages/user/index/index.vue b/packages/user/index/index.vue index 69d67a54..29dc8621 100644 --- a/packages/user/index/index.vue +++ b/packages/user/index/index.vue @@ -73,6 +73,7 @@ + 退出登录 @@ -191,6 +192,36 @@ export default { }); }, + // 退出登录 + headerLogoutClick() { + uni.showModal({ + title: '提示', + content: '确定要退出登录吗?', + success: (res) => { + if (!res.confirm) return; + // 清除全部登录态缓存 + const keys = [ + 'ctoken', 'userId', 'openId', 'phone', 'is_deal', 'is_dev', + 'is_shop', 'is_merchant', 'is_worker', 'shopId', + 'order_dispatch_permission', 'work_order_permission', + 'nickName', 'headPhoto', 'changeCommData', 'currentRoomNo' + ]; + keys.forEach(k => uni.removeStorageSync(k)); + uni.showToast({ + title: '已退出登录', + icon: 'success', + mask: true, + duration: 1500, + success: () => { + setTimeout(() => { + uni.reLaunch({ url: '/pages/login/login' }); + }, 1500); + } + }); + } + }); + }, + headerRadioClick(item) { this.sex = item; }, diff --git a/pages/login/login.vue b/pages/login/login.vue index daa8ec27..dc9e53b7 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -17,6 +17,16 @@ + + + + + +