From 6c9fb19770781611ffcda808b5bacf9dbec1d65f Mon Sep 17 00:00:00 2001 From: zuiidea Date: Thu, 15 Dec 2016 22:57:02 +0800 Subject: [PATCH] dashbord mockdata --- mock/dashboard.js | 34 ++++++++++++++++++++++++++------ src/components/skin.less | 5 +++++ src/models/dashboard.js | 1 + src/routes/dashboard.js | 41 +++++---------------------------------- src/routes/dashboard.less | 12 ++++++++++++ 5 files changed, 51 insertions(+), 42 deletions(-) diff --git a/mock/dashboard.js b/mock/dashboard.js index 8eec901..a1dbfec 100644 --- a/mock/dashboard.js +++ b/mock/dashboard.js @@ -2,28 +2,50 @@ const qs = require('qs') const Mock = require('mockjs') const Watch = require("watchjs") import mockStorge from '../src/utils/mockStorge' +import {color} from '../src/utils/theme' - -let dataKey = mockStorge('Dashboard',Mock.mock({ +let dataKey = mockStorge('Dashboard', Mock.mock({ 'sales|16': [ { 'name|+1': 2000, 'Clothes|200-500': 1, 'Food|180-700': 1, - 'Electronics|300-850': 1, + 'Electronics|300-850': 1 } ], - quote:{ + quote: { name: 'Joho Doe', title: 'Graphic Designer', content: `I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.`, avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236' }, + numbers: [ + { + icon: 'dot-chart', + color: color.green, + title: 'Online Review', + number: 2781 + }, { + icon: 'pay-circle-o', + color: color.blue, + title: 'New Customers', + number: 3241 + }, { + icon: 'message', + color: color.purple, + title: 'Active Projects', + number: 253 + }, { + icon: 'paper-clip', + color: color.red, + title: 'Referrals', + number: 4324 + } + ] })) module.exports = { 'GET /api/dashboard' (req, res) { - console.log(global[dataKey]) res.json(global[dataKey]) - }, + } } diff --git a/src/components/skin.less b/src/components/skin.less index 4be6fe1..8705218 100644 --- a/src/components/skin.less +++ b/src/components/skin.less @@ -6,4 +6,9 @@ .ant-modal-content{ box-shadow: none; } + .ant-card{ + &:hover{ + overflow: auto; + } + } } diff --git a/src/models/dashboard.js b/src/models/dashboard.js index c7da47c..5fd5b32 100644 --- a/src/models/dashboard.js +++ b/src/models/dashboard.js @@ -175,6 +175,7 @@ export default { }, sales:[], quote:{}, + numbers:[], }, subscriptions : { setup({dispatch}) { diff --git a/src/routes/dashboard.js b/src/routes/dashboard.js index c45b6ef..079ff96 100644 --- a/src/routes/dashboard.js +++ b/src/routes/dashboard.js @@ -9,40 +9,9 @@ import Weather from '../components/dashboard/weather' import styles from './dashboard.less' import {color} from '../utils' -const numberCardData = [ - { - icon: 'dot-chart', - color: color.green, - title: 'Online Review', - number: 2781 - }, { - icon: 'pay-circle-o', - color: color.blue, - title: 'New Customers', - number: 3241 - }, { - icon: 'message', - color: color.purple, - title: 'Active Projects', - number: 253 - }, { - icon: 'paper-clip', - color: color.red, - title: 'Referrals', - number: 4324 - } -] - -const quoteProps = { - name: 'Joho Doe', - title: 'Graphic Designer', - content: `I'm selfish, impatient and a little insecure. I make mistakes, I am out of control and at times hard to handle. But if you can't handle me at my worst, then you sure as hell don't deserve me at my best.`, - avatar: 'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236' -} - function Dashboard({dashboard}) { - const {weather,sales,quote} = dashboard - const numberCards = numberCardData.map((item, key) => + const {weather, sales, quote, numbers} = dashboard + const numberCards = numbers.map((item, key) => ) @@ -53,13 +22,13 @@ function Dashboard({dashboard}) { - + - -