清除缓存
Uni-app H5 Deploy (Prod + Staging) / deploy (release) Successful in 42s

This commit is contained in:
kk
2026-07-10 15:25:36 +08:00
parent c84c9df5d4
commit 3a154198e9
+44 -1
View File
@@ -103,7 +103,7 @@
<!-- 蓝色个人信息区域 -->
<view class="user-header">
<view class="user-info">
<view class="avatar-wrapper">
<view class="avatar-wrapper" @click="handleAvatarClick">
<image class="avatar" :src="userInfo.avatar || '/static/default-avatar.png'" mode="aspectFill" />
</view>
<view class="user-detail">
@@ -122,6 +122,13 @@
</view>
</view>
<!-- 退出登录 -->
<view class="menu-list logout-btn" @click="handleLogout">
<view class="menu-item">
<text class="menu-text" style="color: #e4393c; text-align: center; width: 100%;">退出登录</text>
</view>
</view>
<!-- 开发调试工具仅开发环境显示 -->
<view v-if="isDev" class="dev-tools">
<view class="dev-tools-title">开发工具</view>
@@ -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; }