import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { sessionConsts } from '../../consts/storageConsts';
import { Store } from 'amos-tool';
import Header from './../main/header';

const lsTool = Store.lsTool;

/**
 * root
 *监控主屏
 * @class RootView
 * @extends {Component}
 */
class RootView extends Component {
  constructor(props) {
    super(props);
    this.state = {
      submenu: [],
      extendSystem: []
    };
  }

  componentWillMount() {
    let systemMenu = JSON.parse(lsTool.read(sessionConsts.systemMenu));
    this.setState({ extendSystem: systemMenu });
  }

  componentDidMount() {

  }

  componentWillUnmount() {

  }
  render() {
    const { children } = this.props;
    return (
      <div className="view-root">
        <div className="header">
          <Header extendSystem={this.state.extendSystem} add={this.add} />
        </div>
        <div className="content-body">
          {children}
        </div>
      </div>
    );
  }
}

RootView.propTypes = {
  children: PropTypes.node
};

export default RootView;
