diff --git a/src/components/dashboard/weather.js b/src/components/dashboard/weather.js new file mode 100644 index 0000000..d2daabe --- /dev/null +++ b/src/components/dashboard/weather.js @@ -0,0 +1,27 @@ +import React, {PropTypes} from 'react' +import {Icon} from 'antd' +import styles from './weather.less' +import {classnames, request} from '../../utils' + + +const Weather = React.createClass({ + componentDidMount() { + this.fetch() + }, + fetch() { + request('http://api.map.baidu.com/telematics/v3/weather?location=成都&output=json&ak=33MHEPwOLqG8YwynptbWCCFSqry9IEYb',{ + method:'get', + dataType:'JSON', + success: function (res) { + console.log(res) + } + }) + }, + render() { + return
+ 天气 +
+ } +}) + +export default Weather diff --git a/src/components/dashboard/weather.less b/src/components/dashboard/weather.less new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/dashboard.js b/src/routes/dashboard.js index edc8497..27002d1 100644 --- a/src/routes/dashboard.js +++ b/src/routes/dashboard.js @@ -4,6 +4,7 @@ import {Row, Col, Icon, Card} from 'antd' 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 styles from './dashboard.less' import {color} from '../utils' @@ -41,6 +42,14 @@ const quoteProps={ avatar:'http://img.hb.aicdn.com/bc442cf0cc6f7940dcc567e465048d1a8d634493198c4-sPx5BR_fw236', } +// http://api.map.baidu.com/telematics/v3/weather?location=%E5%8C%97%E4%BA%AC&output=json&ak=E4805d16520de693a3fe707cdc962045 +const weatherProps={ + weatherText:'雨', + weatherIcon:'雨', + location:'成都', + +} + function Dashboard() { const numberCards = numberCardData.map((item,key) => @@ -56,12 +65,14 @@ function Dashboard() { - + - + + + diff --git a/src/services/app.js b/src/services/app.js index 71b562e..e8b2562 100644 --- a/src/services/app.js +++ b/src/services/app.js @@ -21,3 +21,10 @@ export async function userInfo(params) { data:params, }) } + +// export async function myCity() { +// return request('http://www.zuimeitianqi.com/zuimei/myCity', { +// method: 'get', +// data:{flg:0}, +// }) +// }