From 3a154198e9c999a5e5d5ef925459097480ca7eae Mon Sep 17 00:00:00 2001 From: kk <875203880@qq.com> Date: Fri, 10 Jul 2026 15:25:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E9=99=A4=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.vue | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index bb2431c..740637f 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -103,7 +103,7 @@ - + @@ -122,6 +122,13 @@ + + + + 退出登录 + + + 开发工具 @@ -171,6 +178,8 @@ export default { categoryList: [], activeCategory: 'all', userInfo: { nickname: '', phone: '', avatar: '' }, + avatarClickCount: 0, + avatarClickTimer: null, menuList: [ { title: '我的订单', action: 'order' }, { title: '常见问题', action: 'faq' }, @@ -309,6 +318,39 @@ export default { }, handleNavPrev() { this.currentTab = 'home'; }, handleNavNext() { uni.showToast({ title: '暂无下一页', icon: 'none' }); }, + handleAvatarClick() { + this.avatarClickCount++; + clearTimeout(this.avatarClickTimer); + + if (this.avatarClickCount >= 10) { + // 点击10次,清除缓存 + this.avatarClickCount = 0; + this.clearCacheAndReload(); + } else { + // 2秒后重置计数 + this.avatarClickTimer = setTimeout(() => { + this.avatarClickCount = 0; + }, 2000); + } + }, + handleLogout() { + uni.showModal({ + title: '退出登录', + content: '确定要退出登录吗?', + success: (res) => { + if (res.confirm) { + this.clearCacheAndReload(); + } + } + }); + }, + clearCacheAndReload() { + uni.clearStorageSync(); + uni.showToast({ title: '已退出登录', icon: 'success' }); + setTimeout(() => { + location.reload(); + }, 1000); + }, onVConsoleChange(e) { const enabled = e.detail.value; if (enabled) { @@ -457,6 +499,7 @@ page { height: 100%; background-color: #fff; } .menu-item:last-child { border-bottom: none; } .menu-text { font-size: 30rpx; color: #333; } .menu-arrow { font-size: 28rpx; color: #ccc; } +.logout-btn { margin-top: 20rpx; } /* 开发工具区域 */ .dev-tools { margin-top: 20rpx; background-color: #fff; border-radius: 16rpx; overflow: hidden; }