From f0bf8c399c354c22227f8f1a76ed806098db59c0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 21 五月 2024 16:51:02 +0800 Subject: [PATCH] 2024-05-21 --- src/views/mkiframe/index.jsx | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index 2547d9d..b6e9761 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -19,6 +19,8 @@ type: 'CustomPage' } + reloading = false + UNSAFE_componentWillMount() { const { params, path } = this.props.match const { menuId, loginUid, bid } = params @@ -112,6 +114,10 @@ MKEmitter.addListener('modifyTabs', this.modifyTabs) MKEmitter.addListener('closeTabView', this.closeTabView) + if (window.GLOB.forcedUpdate) { + MKEmitter.addListener('reloadTabs', this.reloadTabs) + } + if (window.GLOB.sysType !== 'cloud') { Object.defineProperty(window, 'debugger', { configurable: true, @@ -152,7 +158,24 @@ return } MKEmitter.removeListener('modifyTabs', this.modifyTabs) + MKEmitter.removeListener('reloadTabs', this.reloadTabs) MKEmitter.removeListener('closeTabView', this.closeTabView) + } + + reloadTabs = () => { + if (this.reloading) return + + this.reloading = true + + Api.getAppVersion(true).then(() => { + window.location.reload() + }, (message) => { + notification.error({ + top: 92, + message: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�', + duration: 10 + }) + }) } modifyTabs = (tab) => { @@ -183,7 +206,10 @@ let historys = sessionStorage.getItem('page_historys') historys = historys ? JSON.parse(historys) : [] - if (historys.length === 0) return + if (historys.length === 0) { + window.close() + return + } let tab = historys.shift() -- Gitblit v1.8.0