Commit 4b3c4b84 authored by 刘松's avatar 刘松

界面 bug

parent 8c59f7a9
This diff is collapsed.
......@@ -59,11 +59,12 @@ body{
.logo{
width: 120px;
height: 31px;
background: #333;
border-radius: 6px;
margin: 16px 24px 16px 0;
float: left;
}
.logo span{
color: #f04134;
font-size: 20px;
}
.box{
box-shadow: 0 0 1px #ddd;
background: #f7f7f7;
......
......@@ -47,8 +47,11 @@ exports.getDetailData = (data) => {
};
}
exports.getMenu = (data) => {
exports.getMenu = () => {
const mapLocations = ['/manage','/manage/statistics','/manage/setting'];
let key = mapLocations.indexOf(location.pathname);
return (dispatch) => {
dispatch({ data, type: types.CURRENTPAGE});
dispatch({currentPage:key, type: types.CURRENTPAGE})
//dispatch({ data, type: types.CURRENTPAGE});
};
}
const types = require('../actions/actionTypes');
const _ = require('lodash');
const mapLocations = ['/manage','/manage/statistics','/manage/setting'];
const key = mapLocations.indexOf(location.pathname);
const defaultData = {
currentPage: 'statistics'
currentPage: key
};
module.exports = function menu (state = defaultData, action) {
switch (action.type) {
case types.CURRENTPAGE:
......
......@@ -8,12 +8,12 @@ const MenuItemGroup = Menu.ItemGroup;
const ButtonGroup = Button.Group;
const { Header, Footer, Sider, Content } = Layout;
const mapLocations = ['/manage','/manage/statistics/','/manage/setting']
const mapLocations = ['/manage','/manage/statistics','/manage/setting']
class Main extends React.Component{
constructor(props){
super(props);
this.map = ['数据统计','账户与配置']
this.map = ['数据统计','数据统计','配置']
this.state = {
current: '0',
openKeys: [],
......@@ -22,8 +22,7 @@ class Main extends React.Component{
}
handleClick(e){
console.dir(e);
this.props.dispatch(actions.getMenu(e.key));
//this.props.dispatch(actions.getMenu());
location.href = mapLocations[ e.key ];
}
......@@ -38,14 +37,17 @@ class Main extends React.Component{
}
render(){
console.log(this.props.menu.currentPage);
return (
<Layout className="layout">
<Header>
<div className="logo" />
<div className="logo" >
<span>蜂巢</span>
</div>
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['0']}
defaultSelectedKeys = {[ this.props.menu.currentPage ]}
onClick={ this.handleClick.bind(this) }
style={{ lineHeight: '64px' }}
>
......@@ -53,13 +55,13 @@ class Main extends React.Component{
<Menu.Item key="0">基础数据</Menu.Item>
<Menu.Item key="1">详细数据</Menu.Item>
</SubMenu>
<Menu.Item key="2">账户与配置</Menu.Item>
<Menu.Item key="2">配置</Menu.Item>
</Menu>
</Header>
<Content style={{ padding: '0 50px' }}>
<Breadcrumb style={{ margin: '12px 0' }}>
<Breadcrumb.Item>{ this.map[ this.state.current ]}</Breadcrumb.Item>
<Breadcrumb.Item>{ this.state.current == '0' ? '基础数据' : (this.state.current == '1' ? '详细数据' : "详细" )}</Breadcrumb.Item>
<Breadcrumb.Item>{ this.map[ this.props.menu.currentPage ]}</Breadcrumb.Item>
<Breadcrumb.Item>{ this.props.menu.currentPage == '0' ? '基础数据' : (this.props.menu.currentPage == '1' ? '详细数据' : "账户与配置" )}</Breadcrumb.Item>
</Breadcrumb>
<div style={{ background: '#fff', padding: 24, minHeight: 280 }}>{
this.props.children
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment