From 1cbbd66f6f0a4bc4208d650fa717e91722dbae65 Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期五, 21 八月 2026 10:31:52 +0800
Subject: [PATCH] feat0806: 只在进入微赞直播间和退出时清理微赞缓存
---
traditionalApp/pages/webview/webview.vue | 8 ++++++--
traditionalApp/pages/home/home.vue | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/traditionalApp/pages/home/home.vue b/traditionalApp/pages/home/home.vue
index a2454db..cc71964 100644
--- a/traditionalApp/pages/home/home.vue
+++ b/traditionalApp/pages/home/home.vue
@@ -370,7 +370,7 @@
return;
}
- const webviewUrl = `/pages/webview/webview?url=${encodeURIComponent(targetUrl)}&title=${encodeURIComponent('微赞直播')}`;
+ const webviewUrl = `/pages/webview/webview?url=${encodeURIComponent(targetUrl)}&title=${encodeURIComponent('微赞直播')}&clearCache=1`;
console.log('[goWeiZanLive] 准备跳转 WebView:', webviewUrl);
uni.navigateTo({
diff --git a/traditionalApp/pages/webview/webview.vue b/traditionalApp/pages/webview/webview.vue
index 951bbb6..84ed1a4 100644
--- a/traditionalApp/pages/webview/webview.vue
+++ b/traditionalApp/pages/webview/webview.vue
@@ -21,11 +21,15 @@
onLoad((options) => {
const resolvedUrl = decodeQueryValue(options?.url)
const resolvedTitle = decodeQueryValue(options?.title)
+ // 仅在入口显式要求时清理(如进入微赞直播间);直播订单、直播统计等无需清理
+ const shouldClearCache = String(options?.clearCache || '') === '1'
// #ifdef APP-PLUS
// 加载 URL 前先清理所有 webview 的缓存、Cookie 和存储,避免上次登录态残留
- clearWebViewData()
- console.log('[WebView] 进入前缓存已清理,URL:', resolvedUrl)
+ if (shouldClearCache) {
+ clearWebViewData()
+ console.log('[WebView] 进入前缓存已清理,URL:', resolvedUrl)
+ }
// #endif
webViewUrl.value = resolvedUrl
--
Gitblit v1.7.1