rencentsales

This commit is contained in:
zuiidea
2016-12-20 22:04:48 +08:00
parent e3b4ecc491
commit 0e7c89c885
5 changed files with 49 additions and 3 deletions
+13 -1
View File
@@ -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])
}
}
+29
View File
@@ -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 (
<div className={styles.recentsales}>
<Table columns={columns} key={(record,key)=>key} dataSource={props.data}/>
</div>
)
}
export default recentSales
@@ -0,0 +1 @@
@import "../vars.less";
+1
View File
@@ -178,6 +178,7 @@ export default {
avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236'
},
numbers:[],
recentSales:[]
},
subscriptions : {
setup({dispatch}) {
+5 -2
View File
@@ -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) => <Col key={key} lg={6} md={12}>
<NumberCard {...item}/>
</Col>)
@@ -52,7 +53,9 @@ function Dashboard({dashboard}) {
padding: 0,
height: 432,
background: '#fff'
}}></Card>
}}>
<RecentSales data={recentSales}/>
</Card>
</Col>
<Col lg={12} md={24}>
<Card bordered={false} bodyStyle={{