Commit 97dcfcca by bert

自动化构建

parent 2d18835f
...@@ -17,109 +17,113 @@ const SubMenu = Menu.SubMenu ...@@ -17,109 +17,113 @@ const SubMenu = Menu.SubMenu
import styles from '../../views/App/index.less' import styles from '../../views/App/index.less'
const defaultProps = { const defaultProps = {
leftMenu: [], leftMenu: [],
currentIndex: 0 currentIndex: 0
} }
const propTypes = { const propTypes = {
leftMenu: PropTypes.array, leftMenu: PropTypes.array,
currentIndex: PropTypes.number currentIndex: PropTypes.number
} }
const contextTypes = { const contextTypes = {
router: PropTypes.object.isRequired, router: PropTypes.object.isRequired,
store: PropTypes.object.isRequired store: PropTypes.object.isRequired
}; };
class Sidebar extends React.Component { class Sidebar extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.menuClickHandle = this.menuClickHandle.bind(this); this.menuClickHandle = this.menuClickHandle.bind(this);
this.logout = this.logout.bind(this); this.logout = this.logout.bind(this);
} }
componentDidMount() { componentDidMount() {
this.props.MenuAction.getCaseMenu(); this.props.MenuAction.getCaseMenu();
} }
menuClickHandle(item) { menuClickHandle(item) {
this.props.updateNavPath(item.keyPath, item.key) this.props.updateNavPath(item.keyPath, item.key)
console.log('menuClickHandle click ', item); console.log('menuClickHandle click ', item);
this.setState({ this.setState({
current: item.key, current: item.key,
}); });
} }
logout() { logout() {
this.props.logout(); this.props.logout();
} }
onClick(e) { onClick(e) {
} }
render() { render() {
const { leftMenu } = this.props const { leftMenu } = this.props
console.log('this.props', this.props.dispatch);
let openKey = []
const menu = leftMenu.map((item) => { let openKey = []
openKey.push('sub' + item.key) const menu = leftMenu.map((item) => {
openKey.push('sub' + item.key)
return (
<Menu.Item style={{ zIndex: 10 }} key={item.key}> return (
<Badge dot={item.dot}> <Menu.Item style={{ zIndex: 10 }} key={item.key}>
<Icon type={item.icon} /> <Link to={'' + item.key}>
</Badge> <Badge dot={item.dot}>
<span className={styles["nav-text"]}>{item.name}</span> <Icon type={item.icon} />
<span className={styles["nav-badge"]} style={{ float: 'right' }}>{ item.num }</span> </Badge>
</Menu.Item> <span className={styles["nav-text"]}>{item.name}</span>
)
}); <span className={styles["nav-badge"]} style={{ float: 'right' }}>{ item.num }</span>
// <div className="nav-portrait-title">编辑显示昵称</div> </Link>
// return ( </Menu.Item>
// <aside className="ant-layout-sider"> )
// <div className="ant-layout-logo"><img src={logo} /><span className="nav-text">催费跟踪后台</span></div> });
// <div className="ant-layout-portrait"> // <div className="nav-portrait-title">编辑显示昵称</div>
// <div className="nav-portrait"><img src={OPERATOR_INFO.avatarUrl + OPERATOR_INFO.operatorId} /></div> // return (
// <div className="nav-portrait-name">{OPERATOR_INFO.operator}</div> // <aside className="ant-layout-sider">
// <div className="nav-portrait-title" onClick={this.logout}>注销</div> // <div className="ant-layout-logo"><img src={logo} /><span className="nav-text">催费跟踪后台</span></div>
// </div> // <div className="ant-layout-portrait">
// <Menu mode="inline" theme="dark" onClick={this.onClick.bind(this)} selectedKeys={defaultSelectedKeys}> // <div className="nav-portrait"><img src={OPERATOR_INFO.avatarUrl + OPERATOR_INFO.operatorId} /></div>
// { menu } // <div className="nav-portrait-name">{OPERATOR_INFO.operator}</div>
// </Menu> // <div className="nav-portrait-title" onClick={this.logout}>注销</div>
// </aside> // </div>
// ) // <Menu mode="inline" theme="dark" onClick={this.onClick.bind(this)} selectedKeys={defaultSelectedKeys}>
// { menu }
return ( // </Menu>
<aside className={styles["ant-layout-sider"]}> // </aside>
<div className={styles["ant-layout-logo"]}><img src={logo} /><span className={styles["nav-text"]}>xxxx后台</span></div> // )
<div className={styles["ant-layout-portrait"]} style={{marginBottom: '10px'}}>
<div className={styles["nav-portrait"]}><img src={touxiang} /></div> return (
<div className={styles["nav-portrait-name"]}>admin</div> <aside className={styles["ant-layout-sider"]}>
</div> <div className={styles["ant-layout-logo"]}><img src={logo} /><span className={styles["nav-text"]}>xxxx后台</span></div>
<Menu mode="inline" theme="dark" onClick={this.onClick.bind(this) }> <div className={styles["ant-layout-portrait"]} style={{ marginBottom: '10px' }}>
{ menu } <div className={styles["nav-portrait"]}><img src={touxiang} /></div>
</Menu> <div className={styles["nav-portrait-name"]}>admin</div>
</aside> </div>
) <Menu mode="inline" theme="dark" onClick={this.onClick.bind(this) }>
} { menu }
</Menu>
</aside>
)
}
} }
Sidebar.propTypes = propTypes; Sidebar.propTypes = propTypes;
Sidebar.defaultProps = defaultProps; Sidebar.defaultProps = defaultProps;
Sidebar.contextTypes = contextTypes; Sidebar.contextTypes = contextTypes;
function mapStateToProps(state) { function mapStateToProps(state) {
console.log('state', state); console.log('state', state);
return { return {
leftMenuType: state.menu.leftMenuType, leftMenuType: state.menu.leftMenuType,
leftMenu: state.menu.leftMenu, leftMenu: state.menu.leftMenu,
currentIndex: state.menu.currentIndex, currentIndex: state.menu.currentIndex,
} }
} }
function mapDispatchToProps(dispatch) { function mapDispatchToProps(dispatch) {
return { return {
logout: bindActionCreators(logout, dispatch), logout: bindActionCreators(logout, dispatch),
MenuAction: bindActionCreators(MenuAction, dispatch) MenuAction: bindActionCreators(MenuAction, dispatch)
} }
} }
export default connect(mapStateToProps, mapDispatchToProps)(Sidebar) export default connect(mapStateToProps, mapDispatchToProps)(Sidebar)
// 纯数据展现情况列表 // 纯数据展现情况列表
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
import Reqwest from 'reqwest'; import Reqwest from 'reqwest';
......
// 纯数据展现情况列表 // 纯数据展现情况列表
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
import Reqwest from 'reqwest'; import Reqwest from 'reqwest';
......
// 纯数据展现情况列表 // 纯数据展现情况列表
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
import Reqwest from 'reqwest'; import Reqwest from 'reqwest';
......
// 纯数据展现情况列表 // 纯数据展现情况列表
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
import Reqwest from 'reqwest'; import Reqwest from 'reqwest';
......
// 含有可操作 table 栏的数据展示 // 含有可操作 table 栏的数据展示
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
//https://github.com/ded/reqwest //https://github.com/ded/reqwest
......
// 含有可操作 table 栏的数据展示 // 含有可操作 table 栏的数据展示
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
//https://github.com/ded/reqwest //https://github.com/ded/reqwest
......
// 纯数据展现情况列表 // 纯数据展现情况列表
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
import Reqwest from 'reqwest'; import Reqwest from 'reqwest';
......
// 含有可操作 table 栏的数据展示 // 含有可操作 table 栏的数据展示
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
//https://github.com/ded/reqwest //https://github.com/ded/reqwest
......
// 含有可操作 table 栏的数据展示 // 含有可操作 table 栏的数据展示
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
//https://github.com/ded/reqwest //https://github.com/ded/reqwest
......
// 含有可操作 table 栏的数据展示 // 含有可操作 table 栏的数据展示
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
//https://github.com/ded/reqwest //https://github.com/ded/reqwest
......
// 含有可操作 table 栏的数据展示 // 含有可操作 table 栏的数据展示
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
//https://github.com/ded/reqwest //https://github.com/ded/reqwest
......
// 含有可操作 table 栏的数据展示 // 含有可操作 table 栏的数据展示
import React from 'react'; import React from 'react';
import FeatureSetConfig from '../component/FeatureSetConfig'; import FeatureSetConfig from '../components/FeatureSetConfig';
import Immutable from 'immutable'; import Immutable from 'immutable';
//https://github.com/ded/reqwest //https://github.com/ded/reqwest
......
...@@ -3,7 +3,7 @@ import React from 'react'; ...@@ -3,7 +3,7 @@ import React from 'react';
import { Upload, Icon } from 'antd'; import { Upload, Icon } from 'antd';
import baidubce from 'bce-sdk-js'; import baidubce from 'bce-sdk-js';
import BDUploader from '../component/BDUploader'; import BDUploader from '../components/BDUploader';
const Feature7 = React.createClass({ const Feature7 = React.createClass({
getInitialState: function() { getInitialState: function() {
......
module.exports.caseMenu = [ module.exports.caseMenu = [
{ {
key: 'ongoing', key: 'home',
name: '侧边菜单1', name: 'Home',
icon: 'info-circle-o', icon: 'info-circle-o',
num: '10', num: '10',
dot: false dot: false
}, },
{ {
key: 'completed', key: 'test',
name: '侧边菜单2', name: 'Test',
icon: 'check-circle-o', icon: 'check-circle-o',
num: '20', num: '20',
dot: false dot: false
}, },
{ {
key: 'confirm_completed', key: 'feature1',
name: '侧边菜单3', name: '列表',
icon: 'check-circle', icon: 'check-circle',
num: '11', num: '11',
dot: false dot: false
}, },
{ {
key: 'closed', key: 'feature1_1',
name: '侧边菜单4', name: '表单',
icon: 'poweroff',
num: '12',
dot: false
},
{
key: 'feature1_3',
name: '统计图',
icon: 'poweroff', icon: 'poweroff',
num: '12', num: '12',
dot: false dot: false
......
...@@ -8,20 +8,5 @@ module.exports = [ ...@@ -8,20 +8,5 @@ module.exports = [
key: 'test', key: 'test',
name: 'Test', name: 'Test',
icon: 'user' icon: 'user'
},
{
key: 'login',
name: 'Login',
icon: 'eye-o'
},
{
key: 'test2',
name: '404错误',
icon: 'setting'
},
{
key: 'feature1',
name: 'Feature1',
icon: 'poweroff'
} }
] ]
...@@ -5,6 +5,8 @@ import Home from '../views/Home'; ...@@ -5,6 +5,8 @@ import Home from '../views/Home';
import Login from '../views/Login'; import Login from '../views/Login';
import Test from '../views/Test'; import Test from '../views/Test';
import Feature1 from '../feature/Feature1'; import Feature1 from '../feature/Feature1';
import Feature1_1 from '../feature/Feature1-1';
import Feature1_3 from '../feature/Feature1-3';
import NotFound from '../components/NotFound'; import NotFound from '../components/NotFound';
function validate() { function validate() {
...@@ -21,6 +23,8 @@ const Routes = ({ history }) => ...@@ -21,6 +23,8 @@ const Routes = ({ history }) =>
<Route path="app" component={App}/> <Route path="app" component={App}/>
<Route path="test" component={Test}/> <Route path="test" component={Test}/>
<Route path="feature1" component={Feature1}/> <Route path="feature1" component={Feature1}/>
<Route path="feature1_1" component={Feature1_1}/>
<Route path="feature1_3" component={Feature1_3}/>
</Route> </Route>
</Route> </Route>
......
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