no message

Former-commit-id: 3e6434c86b341668215ee62f1bb8a051d3e6cf61
Former-commit-id: 560c230393b7171404bc75faee74ea061a46ade1
Former-commit-id: 9248be31f0fe0e1e123509c7ea90634fe6f92505
This commit is contained in:
李杨
2018-02-18 17:56:08 +08:00
parent d6d01a06bc
commit 94658db1bf
5 changed files with 87 additions and 1 deletions

35
src/mock/chart/G2Bar.js Normal file
View File

@@ -0,0 +1,35 @@
import Mock from 'mockjs'
const r = (add = 0) => {
return Math.round(Math.random() * 100) + add
}
const returnMaker = (data = []) => {
return {
code: 0,
msg: '请求成功',
data
}
}
Mock.mock('/api/chart/G2Bar', 'post', ({body, type, url}) => {
const _body = JSON.parse(body)
switch (_body.type) {
// 基础折线图
case 'base': {
const year = ['3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月']
const data = year.map(e => ({
year: e,
value: r()
})).map(e => ({
x: e.year,
y: e.value
})).sort((a, b) => {
return a.y - b.y
})
return returnMaker(data)
}
default:
return {}
}
})

View File

@@ -1,2 +1,3 @@
import './G2Bar'
import './G2Column'
import './G2Line'