content: import React from 'react';
  import { Route, Redirect } from 'react-router-dom';
  import Menu from 'antd/lib/menu';
  import Layout from 'antd/lib/layout';
  import Message from 'antd/lib/message';
  import Breadcrumb from 'antd/lib/breadcrumb';
  
  import config from '../utils/config';
  import Menus from '../components/menus';
  import Dashboard from './app/dashboard';
  import GeneralLedger from './app/books/general_ledger';
  import SubsidiaryLedger from './app/books/subsidiary_ledger';
  import AccountSet from './app/settings/account_set/index';
  import Subject from './app/settings/subject/index';
  import VoucherList from './app/vouchers/voucher_list';
  import VoucherOriginal from './app/vouchers/voucher_original';
  import VoucherSummary from './app/vouchers/voucher_summary';
  import Voucher from './app/vouchers/voucher';
  import './app.css';
  
  class App extends React.Component {
  	handleClickMenu(e) {
  		switch(e.key) {
  			case 'logout':
  				window.localStorage.clear();
  				Message.success('再见！！');
  				this.props.history.push('/login');
  				break;
  			default:
  				return true;
  		}
  	}
  
  	render() {
  		console.log('App token');
  		if(window.localStorage.getItem('token') === null) {
  			return(<Redirect to={{
  				pathname: "/login",
  				state: { from: this.props.location }
  			}} />);
  		}
  
  		let user = window.localStorage.getItem('user')?JSON.parse(window.localStorage.getItem('user')):{"email": "未登录"};
  
  		console.log('App');
  		return(
  			<Layout className="app">
  				<Layout.Sider>
  					<div className="app-sider-logo">{config.name}</div>
  					<Menus />
  				</Layout.Sider>
  				<Layout className="app-wapper">
  					<Layout.Header className="app-wapper-header">
  						<div className="app-wapper-header-accounst-info">
  							<select>
  								<option>当前使用账套</option>
  							</select>
  							<span>2017年第6期</span>
  						</div>
  						<div className="app-wapper-header-user-info">
  							<Menu mode="inline" onClick={this.handleClickMenu.bind(this)}>
  								<Menu.SubMenu title={<span><i className="anticon anticon-user"></i> {user.email}</span>}>
  									<Menu.Item key="logout">退出</Menu.Item>
  								</Menu.SubMenu>
  							</Menu>
  						</div>
  						{/*
  						<div className="app-wapper-header-tools">
  							<a>常用</a>
  							<a>功能</a>
  							<a>菜单</a>
  							<a>位置</a>
  							<a>预留</a>
  						</div>
  						*/}
  					</Layout.Header>
  					<Layout.Content className="app-wapper-content">
  						<Breadcrumb className="app-wapper-content-breadcrumb">
  							<Breadcrumb.Item>___</Breadcrumb.Item>
  							<Breadcrumb.Item>___</Breadcrumb.Item>
  						</Breadcrumb>
  						<div className="app-wapper-content-main">
  							<Route path="/" exact component={Dashboard} />
  							<Route path="/app" exact component={Dashboard} />
  							<Route path="/app/dashboard" component={Dashboard} />
  							<Route path="/app/books/general_ledger" component={GeneralLedger} />
  							<Route path="/app/books/subsidiary_ledger" component={SubsidiaryLedger} />
  							<Route path="/app/settings/account_set" component={AccountSet} />
  							<Route path="/app/settings/subject" component={Subject} />
  							<Route path="/app/vouchers/voucher_list" component={VoucherList} />
  							<Route path="/app/vouchers/voucher_original" component={VoucherOriginal} />
  							<Route path="/app/vouchers/voucher_summary" component={VoucherSummary} />
  							<Route path="/app/vouchers/voucher" component={Voucher} />
  						</div>
  					</Layout.Content>
  					<Layout.Footer className="app-wapper-footer">
  						{config.footerText}
  					</Layout.Footer>
  				</Layout>
  			</Layout>
  		);
  	}
  }
  
  export default App;
  