diff --git a/mock/dashboard.js b/mock/dashboard.js index a87a342..6dbe9f8 100644 --- a/mock/dashboard.js +++ b/mock/dashboard.js @@ -7,12 +7,23 @@ import {color} from '../src/utils/theme' let dataKey = mockStorge('Dashboard', Mock.mock({ 'sales|12': [ { - 'name|+1': 01, + 'name|+1': 1, 'Clothes|200-500': 1, 'Food|180-700': 1, 'Electronics|300-850': 1 } ], + 'recentSales|36':[ + { + 'id|+1': 1, + name: '@last', + 'status|1-5': 1, + date:function(){ + return Mock.Random.integer(2015, 2016)+'-'+Mock.Random.date('MM-dd')+' '+Mock.Random.time('HH:mm:ss') + }, + 'price|10-200.1-2':1 + } + ], quote: { name: 'Joho Doe', title: 'Graphic Designer', @@ -46,6 +57,7 @@ let dataKey = mockStorge('Dashboard', Mock.mock({ module.exports = { 'GET /api/dashboard' (req, res) { + console.log(global[dataKey].recentSales); res.json(global[dataKey]) } } diff --git a/src/components/dashboard/recentSales.js b/src/components/dashboard/recentSales.js new file mode 100644 index 0000000..29c19d6 --- /dev/null +++ b/src/components/dashboard/recentSales.js @@ -0,0 +1,29 @@ +import React, {PropTypes} from 'react' +import {Icon,Table} from 'antd' +import styles from './recentSales.less' +import {classnames} from '../../utils' + +function recentSales(props) { + const columns = [ + { + title: 'NAME', + dataIndex: 'name', + }, { + title: 'STATUS', + dataIndex: 'status', + }, { + title: 'DATE', + dataIndex: 'date', + }, { + title: 'PRICE', + dataIndex: 'price', + } + ] + return ( +
+ key} dataSource={props.data}/> + + ) +} + +export default recentSales diff --git a/src/components/dashboard/recentSales.less b/src/components/dashboard/recentSales.less new file mode 100644 index 0000000..9146181 --- /dev/null +++ b/src/components/dashboard/recentSales.less @@ -0,0 +1 @@ +@import "../vars.less"; diff --git a/src/models/dashboard.js b/src/models/dashboard.js index 9b10024..c3650ce 100644 --- a/src/models/dashboard.js +++ b/src/models/dashboard.js @@ -178,6 +178,7 @@ export default { avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236' }, numbers:[], + recentSales:[] }, subscriptions : { setup({dispatch}) { diff --git a/src/routes/dashboard.js b/src/routes/dashboard.js index 079ff96..123b2a4 100644 --- a/src/routes/dashboard.js +++ b/src/routes/dashboard.js @@ -6,11 +6,12 @@ import NumberCard from '../components/dashboard/numberCard' import Quote from '../components/dashboard/quote' import Sales from '../components/dashboard/sales' import Weather from '../components/dashboard/weather' +import RecentSales from '../components/dashboard/recentSales' import styles from './dashboard.less' import {color} from '../utils' function Dashboard({dashboard}) { - const {weather, sales, quote, numbers} = dashboard + const {weather, sales, quote, numbers, recentSales} = dashboard const numberCards = numbers.map((item, key) => ) @@ -52,7 +53,9 @@ function Dashboard({dashboard}) { padding: 0, height: 432, background: '#fff' - }}> + }}> + +