| | |
| | | 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' |
| | |
| | | type: 'CustomPage' |
| | | } |
| | | |
| | | reloading = false |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { params, path } = this.props.match |
| | | const { menuId, loginUid, bid } = params |
| | |
| | | let values = event.newValue |
| | | values = JSON.parse(values) |
| | | |
| | | window.GLOB.mkThdMenus = values.mkThdMenus |
| | | window.GLOB.mkActions = values.mkActions |
| | | values.mkThdMenus && values.mkThdMenus.forEach(item => { |
| | | window.GLOB.mkThdMenus.set(item.MenuID, item) |
| | | }) |
| | | } else if (event.key === 'menuUpdate') { |
| | | let vals = event.newValue.split(',') |
| | | let MenuId = vals[1] |
| | |
| | | |
| | | 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') |
| | | } |
| | | }) |
| | | } |
| | | }, 20) |
| | | } else if (sessionStorage.getItem('UserID')) { |
| | |
| | | componentDidMount () { |
| | | 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', { |
| | |
| | | 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) => { |
| | |
| | | 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() |
| | | |
| | |
| | | |
| | | 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> |
| | | ) |