From 8ce7a5d48b850d52b2d9e8e7958496457fb3ef66 Mon Sep 17 00:00:00 2001 From: zuiidea Date: Wed, 21 Dec 2016 21:19:33 +0800 Subject: [PATCH] comments --- mock/dashboard.js | 20 ++++++++++ src/components/dashboard/comments.js | 51 +++++++++++++++++++++++++ src/components/dashboard/comments.less | 36 +++++++++++++++++ src/components/dashboard/completed.js | 38 ++++++++++++++++++ src/components/dashboard/completed.less | 42 ++++++++++++++++++++ src/components/dashboard/recentSales.js | 4 +- src/models/dashboard.js | 4 +- src/routes/dashboard.js | 17 +++++---- 8 files changed, 202 insertions(+), 10 deletions(-) create mode 100644 src/components/dashboard/comments.js create mode 100644 src/components/dashboard/comments.less create mode 100644 src/components/dashboard/completed.js create mode 100644 src/components/dashboard/completed.less diff --git a/mock/dashboard.js b/mock/dashboard.js index 5f16526..956a701 100644 --- a/mock/dashboard.js +++ b/mock/dashboard.js @@ -13,6 +13,26 @@ let dataKey = mockStorge('Dashboard', Mock.mock({ 'Electronics|300-850': 1 } ], + 'completed|12': [ + { + 'name|+1': 2008, + 'Task complete|200-1000': 1, + 'Cards Complete|200-1000': 1 + } + ], + 'comments|5': [ + { + name: '@last', + 'status|1-3': 1, + content:'@sentence', + avatar: function(){ + return Mock.Random.image('100x100', Mock.Random.color(),"#757575",'png',this.name.substr(0,1)) + }, + date:function(){ + return '2016-'+Mock.Random.date('MM-dd')+' '+Mock.Random.time('HH:mm:ss') + }, + } + ], 'recentSales|36':[ { 'id|+1': 1, diff --git a/src/components/dashboard/comments.js b/src/components/dashboard/comments.js new file mode 100644 index 0000000..b9bf50e --- /dev/null +++ b/src/components/dashboard/comments.js @@ -0,0 +1,51 @@ +import React, {PropTypes} from 'react' +import {Icon,Table,Tag} from 'antd' +import styles from './comments.less' +import {classnames,color} from '../../utils' + + +const status = { + 1:{ + color:color.green, + text:'APPROVED' + }, + 2:{ + color:color.yellow, + text:'PENDING' + }, + 3:{ + color:color.red, + text:'REJECTED' + }, +} + +function Comments(props) { + const columns = [ + { + title: 'avatar', + dataIndex: 'avatar', + width:48, + className:'avatarcolumn', + render: text => , + }, { + title: 'content', + dataIndex: 'content', + render:(text,it) =>
+
{it.name}
+

{it.content}

+

+ {status[it.status].text} + {it.date} +

+
, + }, + ] + console.log(props); + return ( +
+ key} dataSource={props.data.filter((item,key) => key<3)}/> + + ) +} + +export default Comments diff --git a/src/components/dashboard/comments.less b/src/components/dashboard/comments.less new file mode 100644 index 0000000..d3abdc8 --- /dev/null +++ b/src/components/dashboard/comments.less @@ -0,0 +1,36 @@ +@import "../vars.less"; +.comments{ + :global .ant-table-thead > tr > th{ + background: #fff; + border-bottom: solid 1px @border-color-base; + } + .avatar{ + width: 48px; + height: 48px; + background-position: center; + background-size: cover; + border-radius: 50%; + background: #f8f8f8; + display: inline-block; + } + .content{ + text-align: left; + color: #757575; + } + .date{ + color: #a3a3a3; + line-height: 30px; + } + .daterow{ + display: flex; + justify-content: space-between; + } + .name{ + font-size: 14px; + color: #474747; + text-align: left; + } + .avatarcolumn{ + vertical-align: top; + } +} diff --git a/src/components/dashboard/completed.js b/src/components/dashboard/completed.js new file mode 100644 index 0000000..3165c27 --- /dev/null +++ b/src/components/dashboard/completed.js @@ -0,0 +1,38 @@ +import React, { PropTypes } from 'react' +import { Icon } from 'antd' +import styles from './completed.less' +import {color} from '../../utils' +import {LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts' + +function Completed(props) { + return ( +
+
TEAM TOTAL COMPLETED
+ + + { + const { payload } = props + return
    + {payload.map((item,key) =>
  • {item.value}
  • ) } +
+ }}/> + + + + { + const list = content.payload.map((item,key) =>
  • {item.name+':'+item.value}
  • ) + return

    {content.label}

      {list}
    + }}/> + + + +
    +
    +
    + ) +} + +export default Completed diff --git a/src/components/dashboard/completed.less b/src/components/dashboard/completed.less new file mode 100644 index 0000000..bc211ac --- /dev/null +++ b/src/components/dashboard/completed.less @@ -0,0 +1,42 @@ +@import "../vars.less"; +.sales{ + .title{ + margin-left: 32px; + font-size: 16px; + } +} +.radiusdot{ + width:12px; + height:12px; + margin-right: 8px; + border-radius:50%; + display:inline-block; +} +.legend{ + color: @dark-half; + text-align: right; + color: #999; + font-size: 14px; + li{ + height: 48px; + line-height: 48px; + display: inline-block; + &+li{ + margin-left: 24px; + } + } +} +.tooltip{ + background: #fff; + padding: 20px; + font-size: 14px; + .tiptitle{ + font-weight: 700; + font-size: 16px; + margin-bottom: 8px; + } + .tipitem{ + height: 32px; + line-height: 32px; + } +} diff --git a/src/components/dashboard/recentSales.js b/src/components/dashboard/recentSales.js index da2ade5..589b029 100644 --- a/src/components/dashboard/recentSales.js +++ b/src/components/dashboard/recentSales.js @@ -23,7 +23,7 @@ const status = { } } -function recentSales(props) { +function RecentSales(props) { const columns = [ { title: 'NAME', @@ -49,4 +49,4 @@ function recentSales(props) { ) } -export default recentSales +export default RecentSales diff --git a/src/models/dashboard.js b/src/models/dashboard.js index c3650ce..8dec154 100644 --- a/src/models/dashboard.js +++ b/src/models/dashboard.js @@ -178,7 +178,9 @@ export default { avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236' }, numbers:[], - recentSales:[] + recentSales:[], + completed:[], + comments:[], }, subscriptions : { setup({dispatch}) { diff --git a/src/routes/dashboard.js b/src/routes/dashboard.js index 40e0eae..01b7674 100644 --- a/src/routes/dashboard.js +++ b/src/routes/dashboard.js @@ -7,11 +7,13 @@ 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 Comments from '../components/dashboard/comments' +// import Completed from '../components/dashboard/completed' import styles from './dashboard.less' import {color} from '../utils' function Dashboard({dashboard}) { - const {weather, sales, quote, numbers, recentSales} = dashboard + const {weather, sales, quote, numbers, recentSales, comments, completed} = dashboard const numberCards = numbers.map((item, key) => ) @@ -58,17 +60,18 @@ function Dashboard({dashboard}) { + }}> + + + padding: '24px 36px 24px 0' + }}> + {/* */} +