From 252cd3594da7e99e50d8e40446ab7b47bd35443b Mon Sep 17 00:00:00 2001 From: pengyuthon Date: Wed, 13 May 2026 08:50:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sun_badge_menu/static/src/webclient/navbar/navbar.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sun_badge_menu/static/src/webclient/navbar/navbar.js b/sun_badge_menu/static/src/webclient/navbar/navbar.js index f278db4b2..d28696844 100644 --- a/sun_badge_menu/static/src/webclient/navbar/navbar.js +++ b/sun_badge_menu/static/src/webclient/navbar/navbar.js @@ -5,7 +5,7 @@ import { patch } from "@web/core/utils/patch"; import { deepCopy } from "@web/core/utils/objects"; import { useService } from "@web/core/utils/hooks"; import { url } from "@web/core/utils/urls"; -import { clickRefreshButton} from "../actions/client_actions"; +import { clickRefreshButton } from "../actions/client_actions"; const WKF_NOTIFY_TYPE = 'wkf_notify' @@ -17,10 +17,11 @@ patch(NavBar.prototype, { this.audio.src = this.audio.canPlayType("audio/ogg; codecs=vorbis") ? url("/mail/static/src/audio/ting.ogg") : url("/mail/static/src/audio/ting.mp3"); - + const clearCache = () => this.env.bus.trigger("CLEAR-CACHES"); const play = () => { return this.audio.play() .then(() => { + clearCache() clickRefreshButton() }) .catch((e) => { @@ -28,13 +29,13 @@ patch(NavBar.prototype, { }); } /** - * 监听后端发送的信号,重新加载菜单数据 + * 监听后端发送的信号,重新加载菜单数据,清除viewSevice的缓存 * 1. 通知类型为WKF_NOTIFY_TYPE时,直接刷新菜单播放音频 * 2. 其余则通过菜单badge_count对比 */ this.busService.subscribe("sun_badge_menu.reload_menu_data", (detail) => { console.log('[sun_badge_menu.reload_menu_data]重新加载数据...') - debugger + // debugger for (const d of detail) { if (d?.type === WKF_NOTIFY_TYPE) { this.menuService.reload(); @@ -48,7 +49,7 @@ patch(NavBar.prototype, { return value ? value.reduce((count, app) => count + (app?.badge_count || 0), 0) : 0; } browser.setTimeout(() => { - debugger + // debugger const oldCount = getReduceCount(oldMenuApps) const newMenuApps = this.menuService.getApps() const newCount = getReduceCount(newMenuApps)