diff --git a/mock/dashboard.js b/mock/dashboard.js index 9a65a8a..489529c 100644 --- a/mock/dashboard.js +++ b/mock/dashboard.js @@ -99,24 +99,24 @@ let dataKey = mockStorge('Dashboard', Mock.mock({ }, numbers: [ { - icon: 'message', + icon: 'pay-circle-o', color: color.green, - title: '总浏览PV', + title: 'Online Review', number: 2781, }, { icon: 'team', color: color.blue, - title: '总浏览UV', + title: 'New Customers', number: 3241, }, { - icon: 'shopping-cart', + icon: 'message', color: color.purple, - title: '成交订单数', + title: 'Active Projects', number: 253, }, { - icon: 'pay-circle-o', + icon: 'shopping-cart', color: color.red, - title: '交易额', + title: 'Referrals', number: 4324, }, ], diff --git a/mock/users.js b/mock/users.js index af99419..eecdebf 100644 --- a/mock/users.js +++ b/mock/users.js @@ -30,7 +30,6 @@ let usersListData = global[dataKey] module.exports = { 'GET /api/users' (req, res) { - console.log(req, res) const page = qs.parse(req.query) const pageSize = page.pageSize || 10 const currentPage = page.page || 1 diff --git a/src/components/DataTable/DataTable.js b/src/components/DataTable/DataTable.js index 9a15473..076e181 100644 --- a/src/components/DataTable/DataTable.js +++ b/src/components/DataTable/DataTable.js @@ -51,8 +51,9 @@ class DataTable extends React.Component { sortOrder: sorter.order, ...filters, }, + }, () => { + this.fetch() }) - this.fetch() } fetch = () => { diff --git a/src/components/Layout/Bread.js b/src/components/Layout/Bread.js index 5db9e34..ea030d7 100644 --- a/src/components/Layout/Bread.js +++ b/src/components/Layout/Bread.js @@ -1,5 +1,6 @@ import React, { PropTypes } from 'react' import { Breadcrumb, Icon } from 'antd' +import { Link } from 'dva/router' import styles from './Bread.less' import { menu } from '../../utils' @@ -29,16 +30,21 @@ function Bread ({ location }) { pathNames.push((`-${item}`).hyphenToHump()) } }) - const breads = pathNames.map((item, key) => { - if (!(item in pathSet)) { - item = 'Dashboard' - } + + const breadsArray = pathNames.filter(item => (item in pathSet)) + const breads = breadsArray.map((item, key) => { + const content = ( + {pathSet[item].icon + ? + : ''}{pathSet[item].name} + ) return ( - - {pathSet[item].icon - ? - : ''} - {pathSet[item].name} + + {((breadsArray.length - 1) !== key && pathSet[item].clickable) + ? + {content} + + : content} ) }) @@ -46,8 +52,11 @@ function Bread ({ location }) { return (
- - 主页 + + + + Home + {breads} diff --git a/src/components/Layout/Menu.js b/src/components/Layout/Menu.js index 378bfc2..8fea75a 100644 --- a/src/components/Layout/Menu.js +++ b/src/components/Layout/Menu.js @@ -16,7 +16,6 @@ const getMenus = function (menuArray, siderFold, parentPath = '/') { } return ( - {item.icon ? : ''} {siderFold && topMenus.indexOf(item.key) >= 0 ? '' : item.name} @@ -48,7 +47,7 @@ function Menus ({ siderFold, darkTheme, location, handleClickNavMenu, navOpenKey } changeOpenKeys(nextOpenKeys) } - // 菜单栏收起时,不能操作openKeys + let menuProps = !siderFold ? { onOpenChange, openKeys: navOpenKeys, diff --git a/src/models/app.js b/src/models/app.js index 29e39f3..ecf2d3b 100644 --- a/src/models/app.js +++ b/src/models/app.js @@ -13,7 +13,7 @@ export default { siderFold: localStorage.getItem('antdAdminSiderFold') === 'true', darkTheme: localStorage.getItem('antdAdminDarkTheme') !== 'false', isNavbar: document.body.clientWidth < 769, - navOpenKeys: JSON.parse(localStorage.getItem('navOpenKeys') || '[]'), + navOpenKeys: [], }, subscriptions: { setup ({ dispatch }) { diff --git a/src/routes/app.js b/src/routes/app.js index dd94bb7..0efebbd 100644 --- a/src/routes/app.js +++ b/src/routes/app.js @@ -36,7 +36,6 @@ const App = ({ children, location, dispatch, app, loading }) => { dispatch({ type: 'app/switchSider' }) }, changeOpenKeys (openKeys) { - localStorage.setItem('navOpenKeys', JSON.stringify(openKeys)) dispatch({ type: 'app/handleNavOpenKeys', payload: { navOpenKeys: openKeys } }) }, } diff --git a/src/utils/menu.js b/src/utils/menu.js index 0b4e5eb..3f815c7 100644 --- a/src/utils/menu.js +++ b/src/utils/menu.js @@ -1,12 +1,12 @@ module.exports = [ { key: 'dashboard', - name: '仪表盘', + name: 'Dashboard', icon: 'laptop', }, { key: 'users', - name: '用户管理', + name: 'User Manage', icon: 'user', }, { @@ -22,27 +22,33 @@ module.exports = [ child: [ { key: 'iconfont', - name: 'IconFont 字体图标', + name: 'IconFont', + icon: 'heart-o', }, { key: 'dataTable', - name: 'DataTable 数据表格', + name: 'DataTable', + icon: 'database', }, { key: 'dropOption', - name: 'DropOption 下拉操作', + name: 'DropOption', + icon: 'bars', }, { key: 'search', - name: 'Search 搜索', + name: 'Search', + icon: 'search', }, { key: 'editor', - name: 'Editor 编辑器', + name: 'Editor', + icon: 'edit', }, { key: 'layer', - name: 'layer 弹层【方法】', + name: 'layer (Function)', + icon: 'credit-card', }, ], }, @@ -54,37 +60,40 @@ module.exports = [ { key: 'lineChart', name: 'LineChart', + icon: 'line-chart', }, { key: 'barChart', name: 'BarChart', + icon: 'bar-chart', }, { key: 'areaChart', name: 'AreaChart', + icon: 'area-chart', }, ], }, { key: 'navigation', - name: '测试导航', + name: 'Test Navigation', icon: 'setting', child: [ { key: 'navigation1', - name: '二级导航1', + name: 'Test Navigation1', }, { key: 'navigation2', - name: '二级导航2', + name: 'Test Navigation2', child: [ { key: 'navigation21', - name: '三级导航1', + name: 'Test Navigation21', }, { key: 'navigation22', - name: '三级导航2', + name: 'Test Navigation22', }, ], },