From 8d5cf5ee172cde90b4db202f835077b97b901460 Mon Sep 17 00:00:00 2001 From: tsui110 Date: Sat, 3 Jan 2026 09:26:03 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=EF=BC=9A=E4=BF=AE=E5=A4=8D=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D=E6=97=A0?= =?UTF-8?q?=E9=99=90=E5=A2=9E=E5=8A=A0=20feat:=E6=96=B0=E5=A2=9E=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=99=90=E5=88=B6=E4=BF=AE=E6=94=B9=E6=98=B5=E7=A7=B0?= =?UTF-8?q?=E5=92=8C=E5=A4=B4=E5=83=8F=E9=9C=80=E8=A6=817=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/SplashScreen.vue | 7 +++++++ pages/mine/index.vue | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/components/SplashScreen.vue b/components/SplashScreen.vue index 711405c..20d000a 100644 --- a/components/SplashScreen.vue +++ b/components/SplashScreen.vue @@ -38,6 +38,13 @@ onMounted(() => { splashData = {} } + // 清理不是今天的缓存,只保留今天的记录 + const cleanedSplashData = {} + if (splashData[dateStr]) { + cleanedSplashData[dateStr] = splashData[dateStr] + } + splashData = cleanedSplashData + // 获取今天的显示次数 const todayCount = splashData[dateStr] || 0 diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 1b698ae..f0b6a9a 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -585,6 +585,21 @@ export default { if (!this.checkPhoneBound()) return + // 检查冷却时间 + const cooldownKey = 'avatar_update_cooldown' + const lastUpdate = uni.getStorageSync(cooldownKey) + const now = Date.now() + const cooldownDays = 7 + + if (lastUpdate && now - lastUpdate < cooldownDays * 24 * 60 * 60 * 1000) { + const daysRemaining = Math.ceil((cooldownDays * 24 * 60 * 60 * 1000 - (now - lastUpdate)) / (24 * 60 * 60 * 1000)) + uni.showToast({ + title: `头像修改冷却中,还需${daysRemaining}天`, + icon: 'none' + }) + return + } + uni.chooseImage({ count: 1, sizeType: ['compressed'], // 选择压缩图 @@ -615,6 +630,9 @@ export default { userInfo.avatar = data.avatar || base64 uni.setStorageSync('user_info', userInfo) + // 记录修改时间(7天冷却) + uni.setStorageSync('avatar_update_cooldown', Date.now()) + uni.hideLoading() uni.showToast({ title: '头像修改成功', icon: 'success' }) } catch (err) { @@ -653,6 +671,21 @@ export default { return } + // 检查冷却时间 + const cooldownKey = 'nickname_update_cooldown' + const lastUpdate = uni.getStorageSync(cooldownKey) + const now = Date.now() + const cooldownDays = 7 + + if (lastUpdate && now - lastUpdate < cooldownDays * 24 * 60 * 60 * 1000) { + const daysRemaining = Math.ceil((cooldownDays * 24 * 60 * 60 * 1000 - (now - lastUpdate)) / (24 * 60 * 60 * 1000)) + uni.showToast({ + title: `昵称修改冷却中,还需${daysRemaining}天`, + icon: 'none' + }) + return + } + uni.showModal({ title: '修改昵称', editable: true, @@ -685,6 +718,9 @@ export default { userInfo.nickname = data.nickname || newNickname uni.setStorageSync('user_info', userInfo) + // 记录修改时间(7天冷却) + uni.setStorageSync('nickname_update_cooldown', Date.now()) + uni.hideLoading() uni.showToast({ title: '昵称修改成功', icon: 'success' }) } catch (err) {