mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-27 18:53:43 +00:00
fix some bugs
This commit is contained in:
+7
-7
@@ -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,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -51,8 +51,9 @@ class DataTable extends React.Component {
|
||||
sortOrder: sorter.order,
|
||||
...filters,
|
||||
},
|
||||
}, () => {
|
||||
this.fetch()
|
||||
})
|
||||
this.fetch()
|
||||
}
|
||||
|
||||
fetch = () => {
|
||||
|
||||
@@ -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 = (
|
||||
<span>{pathSet[item].icon
|
||||
? <Icon type={pathSet[item].icon} style={{ marginRight: 4 }} />
|
||||
: ''}{pathSet[item].name}</span>
|
||||
)
|
||||
return (
|
||||
<Breadcrumb.Item key={key} {...((pathNames.length - 1 === key) || !pathSet[item].clickable) ? '' : { href: `#${pathSet[item].path}` }}>
|
||||
{pathSet[item].icon
|
||||
? <Icon type={pathSet[item].icon} />
|
||||
: ''}
|
||||
<span>{pathSet[item].name}</span>
|
||||
<Breadcrumb.Item key={key}>
|
||||
{((breadsArray.length - 1) !== key && pathSet[item].clickable)
|
||||
? <Link to={pathSet[item].path}>
|
||||
{content}
|
||||
</Link>
|
||||
: content}
|
||||
</Breadcrumb.Item>
|
||||
)
|
||||
})
|
||||
@@ -46,8 +52,11 @@ function Bread ({ location }) {
|
||||
return (
|
||||
<div className={styles.bread}>
|
||||
<Breadcrumb>
|
||||
<Breadcrumb.Item href="/"><Icon type="home" />
|
||||
<span>主页</span>
|
||||
<Breadcrumb.Item >
|
||||
<Link to="/dashboard">
|
||||
<Icon type="home" />
|
||||
<span>Home</span>
|
||||
</Link>
|
||||
</Breadcrumb.Item>
|
||||
{breads}
|
||||
</Breadcrumb>
|
||||
|
||||
@@ -16,7 +16,6 @@ const getMenus = function (menuArray, siderFold, parentPath = '/') {
|
||||
}
|
||||
return (
|
||||
<Menu.Item key={linkTo}>
|
||||
|
||||
<Link to={linkTo}>
|
||||
{item.icon ? <Icon type={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,
|
||||
|
||||
+1
-1
@@ -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 }) {
|
||||
|
||||
@@ -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 } })
|
||||
},
|
||||
}
|
||||
|
||||
+22
-13
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user