From c31efa892af204bf7f6f4712f2248b2a35033f8a Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Sat, 24 May 2025 16:20:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=88=86=E4=BA=AB=E6=97=A5=E5=BF=97):=20?= =?UTF-8?q?=E5=9C=A8=E5=A4=9A=E4=B8=AA=E9=A1=B5=E9=9D=A2=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0shareLog.clear()=E4=BB=A5=E9=87=8D=E7=BD=AE=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在group.vue、video.vue、article.vue和personal.vue中添加了shareLog.clear(),以确保在页面加载时重置分享日志,避免数据残留。同时,在shareLog.js中添加了clear方法来实现日志清空功能。此外,调整了popupAuditMsg.vue中的导航逻辑,使用uni.reLaunch代替uni.navigateTo,以确保页面正确跳转。 --- components/home/popupAuditMsg.vue | 146 ++++++++++++++++++-------------------- pages/index/index.vue | 59 +++++++-------- pages/index/record.vue | 3 + pages_order/sharing/article.vue | 2 + pages_order/sharing/group.vue | 2 + pages_order/sharing/personal.vue | 2 + pages_order/sharing/video.vue | 3 +- utils/shareLog.js | 64 ++++++++++------- 8 files changed, 150 insertions(+), 131 deletions(-) diff --git a/components/home/popupAuditMsg.vue b/components/home/popupAuditMsg.vue index 7d308c2..df1929b 100644 --- a/components/home/popupAuditMsg.vue +++ b/components/home/popupAuditMsg.vue @@ -1,94 +1,90 @@ \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index e22a9d7..73dc4bd 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -5,45 +5,40 @@ - + - - - + + - + - + \ No newline at end of file diff --git a/pages/index/record.vue b/pages/index/record.vue index 8e46e80..a4cb3d0 100644 --- a/pages/index/record.vue +++ b/pages/index/record.vue @@ -244,6 +244,9 @@ export default { .title { color: #1B1B1B; font-size: 28rpx; + overflow:hidden; //超出的文本隐藏 + text-overflow:ellipsis; //溢出用省略号显示 + white-space:nowrap; //溢出不换行 } .desc { diff --git a/pages_order/sharing/article.vue b/pages_order/sharing/article.vue index 7e00bca..8c87c3f 100644 --- a/pages_order/sharing/article.vue +++ b/pages_order/sharing/article.vue @@ -93,6 +93,8 @@ // } this.initData() + + shareLog.clear() }, onShareAppMessage(res) { const { diff --git a/pages_order/sharing/group.vue b/pages_order/sharing/group.vue index 4956838..d0ea13f 100644 --- a/pages_order/sharing/group.vue +++ b/pages_order/sharing/group.vue @@ -89,6 +89,8 @@ // } this.fetchDetails() + + shareLog.clear() }, onShareAppMessage(res) { diff --git a/pages_order/sharing/personal.vue b/pages_order/sharing/personal.vue index 2e2f799..4f740a3 100644 --- a/pages_order/sharing/personal.vue +++ b/pages_order/sharing/personal.vue @@ -89,6 +89,8 @@ // }) // } this.fetchDetails() + + shareLog.clear() }, onShareAppMessage(res) { const { diff --git a/pages_order/sharing/video.vue b/pages_order/sharing/video.vue index fbb8d2c..a940ae1 100644 --- a/pages_order/sharing/video.vue +++ b/pages_order/sharing/video.vue @@ -95,7 +95,8 @@ // } this.initData() - + + shareLog.clear() }, onShareAppMessage(res) { const { diff --git a/utils/shareLog.js b/utils/shareLog.js index 3b51192..8206e4d 100644 --- a/utils/shareLog.js +++ b/utils/shareLog.js @@ -1,44 +1,54 @@ import fetch from '@/api/fetch.js' -const slog = {} +let slog = {} const get = () => { - try { - return slog - // return JSON.parse(uni.getStorageSync('shareLog')) || {} - } catch (err) { - return {} - } + try { + return slog + // return JSON.parse(uni.getStorageSync('shareLog')) || {} + } catch (err) { + return {} + } +} + +const clear = () => { + slog = {} } const insert = (id) => { - const log = get() + const log = get() - let bef = log[id] || 0 + let bef = log[id] || 0 - log[id] = bef + 1 + log[id] = bef + 1 - uni.setStorageSync('shareLog', JSON.stringify(log)) + uni.setStorageSync('shareLog', JSON.stringify(log)) } const check = async (id, need_num) => { - try { - const log = get() - - const num = parseInt(log[id]) || 0 - const safeNeedNum = parseInt(need_num) || 0 - - const open = num >= safeNeedNum - - return { open, need_num: safeNeedNum, num, title: `已转发${num}次` } - } catch (err) { - console.error('--校验达标异常', err) - return {} - } + try { + const log = get() + + const num = parseInt(log[id]) || 0 + const safeNeedNum = parseInt(need_num) || 0 + + const open = num >= safeNeedNum + + return { + open, + need_num: safeNeedNum, + num, + title: `已转发${num}次` + } + } catch (err) { + console.error('--校验达标异常', err) + return {} + } } export default { - get, - insert, - check, + get, + insert, + check, + clear, } \ No newline at end of file