| | |
| | | import React, {Component} from 'react' |
| | | import { ConfigProvider } from 'antd' |
| | | import { connect } from 'react-redux' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Header from '@/components/header' |
| | | import Sidemenu from '@/components/sidemenu' |
| | | import Tabview from '@/components/tabview' |
| | | import { resetDebug, modifyDataManager, initRolesPermission } from '@/store/action' |
| | | import QueryLog from '@/components/querylog' |
| | | import ImgScale from '@/components/imgScale' |
| | | |
| | | import './index.scss' |
| | | |
| | | const _locale = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const Tabview = asyncComponent(() => import('@/components/tabview')) |
| | | const Breadview = asyncComponent(() => import('@/components/breadview')) |
| | | const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | class Main extends Component { |
| | | UNSAFE_componentWillMount() { |
| | | if (sessionStorage.getItem('dataM') === 'true') { |
| | | this.props.modifyDataManager(true) |
| | | } |
| | | if (sessionStorage.getItem('debug') === 'true') { |
| | | this.props.resetDebug() |
| | | } |
| | | if (sessionStorage.getItem('role_id')) { |
| | | let roles = sessionStorage.getItem('role_id') |
| | | roles = roles.split(',') |
| | | |
| | | this.props.initRolesPermission(roles) |
| | | } |
| | | state = { |
| | | navBar: window.GLOB.navBar |
| | | } |
| | | |
| | | render () { |
| | | const { navBar } = this.state |
| | | const isSideMenu = !['linkage_navigation', 'linkage'].includes(navBar) |
| | | |
| | | return ( |
| | | <div className="flex-container"> |
| | | <div className="mk-main-view"> |
| | | <ConfigProvider locale={_locale}> |
| | | <Header key="header"/> |
| | | <Sidemenu key="sidemenu"/> |
| | | <Tabview key="tabview"/> |
| | | {isSideMenu ? <Sidemenu key="sidemenu"/> : null} |
| | | {isSideMenu ? <Tabview key="tabview"/> : null} |
| | | {!isSideMenu ? <Breadview key="breadview"/> : null} |
| | | <QueryLog /> |
| | | </ConfigProvider> |
| | | <ImgScale /> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | const mapStateToProps = () => { |
| | | return {} |
| | | } |
| | | |
| | | const mapDispatchToProps = (dispatch) => { |
| | | return { |
| | | resetDebug: () => dispatch(resetDebug()), |
| | | initRolesPermission: (roles) => dispatch(initRolesPermission(roles)), |
| | | modifyDataManager: (dataManager) => dispatch(modifyDataManager(dataManager)) |
| | | } |
| | | } |
| | | |
| | | export default connect(mapStateToProps, mapDispatchToProps)(Main) |
| | | export default Main |