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

界面 bug

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