From b09b821ef36fd1ea979e9a5daa98e95732ac81d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 16 七月 2025 18:16:00 +0800 Subject: [PATCH] 2025-07-16 --- src/views/mkiframe/index.jsx | 89 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 77 insertions(+), 12 deletions(-) diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index d8ca857..cfd57df 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' -import { Spin, notification, ConfigProvider } from 'antd' -import zhCN from 'antd/es/locale/zh_CN' +import { Spin, notification } from 'antd' import Api from '@/api' import asyncComponent from '@/utils/asyncLoadComponent' @@ -18,6 +17,8 @@ MenuId: '', type: 'CustomPage' } + + reloading = false UNSAFE_componentWillMount() { const { params, path } = this.props.match @@ -54,8 +55,29 @@ if (window.GLOB.mkActions && window.GLOB.mkActions.loaded) { this.setState({loading: false}) - } else { + } else if (sessionStorage.getItem('UserID')) { this.getPermRole() + } else { + Api.getTouristMsg().then(res => { + if (res.status) { + sessionStorage.setItem('UserID', res.UserID) + sessionStorage.setItem('LoginUID', res.LoginUID) + sessionStorage.setItem('User_Name', res.UserName) + sessionStorage.setItem('Full_Name', res.FullName) + sessionStorage.setItem('avatar', res.icon || '') + sessionStorage.setItem('dataM', res.dataM ? 'true' : '') + sessionStorage.setItem('debug', res.debug || '') + sessionStorage.setItem('role_id', res.role_id || '') + sessionStorage.setItem('departmentcode', res.departmentcode || '') + sessionStorage.setItem('organization', res.organization || '') + sessionStorage.setItem('mk_user_type', res.mk_user_type || '') + this.getPermRole() + } else { + sessionStorage.clear() + this.props.history.replace('/login') + window.location.reload() + } + }) } }, 20) } else if (sessionStorage.getItem('UserID')) { @@ -81,6 +103,7 @@ sessionStorage.clear() sessionStorage.setItem('iframe', `/iframe/${menuId}/@loginuid@/${bid || ''}`) this.props.history.replace('/login') + window.location.reload() } }) } @@ -92,15 +115,31 @@ 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, enumerable: true, set(value) { - if (value + '' === 'false') { - window.GLOB.debugger = false - } else { + if (value === true) { window.GLOB.debugger = true + } else if (value === 0) { + if (window.backend) { + sessionStorage.setItem('systemRun', 'front') + window.location.reload() + } else { + window.mkInfo('绯荤粺褰撳墠鏈娇鐢ㄥ悗绔剼鏈紒') + } + } else if (value === false) { + if (sessionStorage.getItem('systemRun') === 'front') { + sessionStorage.removeItem('systemRun') + window.location.reload() + } else { + window.GLOB.debugger = false + } } } }) @@ -132,7 +171,32 @@ return } MKEmitter.removeListener('modifyTabs', this.modifyTabs) + MKEmitter.removeListener('reloadTabs', this.reloadTabs) MKEmitter.removeListener('closeTabView', this.closeTabView) + } + + reloadTabs = () => { + if (this.reloading) return + + let time = new Date().getTime() + + let oldTime = sessionStorage.getItem('mk_reloadTabs') + + if (oldTime && time - oldTime < 180000) return + + sessionStorage.setItem('mk_reloadTabs', time) + + this.reloading = true + + Api.getAppVersion(true).then(() => { + window.location.reload() + }, (message) => { + notification.error({ + top: 92, + message: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�', + duration: 10 + }) + }) } modifyTabs = (tab) => { @@ -163,7 +227,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() @@ -221,11 +288,9 @@ return ( <div className="main-iframe"> - <ConfigProvider locale={zhCN}> - {loading ? <Spin size="large" /> : null} - {!loading && type === 'CustomPage' ? <CustomPage MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} - {!loading && type === 'BaseTable' ? <BaseTable MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} - </ConfigProvider> + {loading ? <Spin size="large" /> : null} + {!loading && type === 'CustomPage' ? <CustomPage MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} + {!loading && type === 'BaseTable' ? <BaseTable MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} <ImgScale /> </div> ) -- Gitblit v1.8.0