no message

Former-commit-id: 511753a92afc6b4e155dd92c08a769a45e6bff95
Former-commit-id: f75b803d390be369bf7ddd532efeafe6f65b4f4b
Former-commit-id: 930e77ed313f139b66cae13179bb677f88f2f8c9
This commit is contained in:
李杨
2018-02-18 11:25:24 +08:00
parent 873233943b
commit 7317d13d7f
8 changed files with 62 additions and 62 deletions

View File

@@ -1,22 +0,0 @@
import Mock from 'mockjs'
Mock.mock('/api/chart/G2Column', 'post', ({body, type, url}) => {
const _body = JSON.parse(body)
switch (_body.code) {
case 1:
return {
code: 0,
msg: '请求成功',
data: [
{ year: '1951', sales: 38 },
{ year: '1952', sales: 52 },
{ year: '1956', sales: 61 },
{ year: '1957', sales: 145 },
{ year: '1958', sales: 48 },
{ year: '1959', sales: 38 }
]
}
default:
return {}
}
})

View File

@@ -7,20 +7,13 @@ const r = (add = 0) => {
Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => {
const _body = JSON.parse(body)
switch (_body.code) {
case 1:
case 1: {
let lastValue = 0
const temp = [
{ year: '1991', value: 0 },
{ year: '1992', value: 0 },
{ year: '1993', value: 0 },
{ year: '1994', value: 0 },
{ year: '1995', value: 0 },
{ year: '1996', value: 0 },
{ year: '1997', value: 0 },
{ year: '1998', value: 0 },
{ year: '1999', value: 0 }
]
const data = temp.map(e => {
const year = ['1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999']
const data = year.map(y => ({
year: y,
value: 0
})).map(e => {
e.value = lastValue + r()
lastValue = e.value
return e
@@ -31,6 +24,22 @@ Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => {
msg: '请求成功',
data
}
}
case 2: {
const month = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
const data = month.map(y => ({
month: y,
value: 0
})).map(e => {
e.value = r()
return e
})
return {
code: 0,
msg: '请求成功',
data
}
}
default:
return {}
}

View File

@@ -1,20 +0,0 @@
import Mock from 'mockjs'
Mock.mock('/api/chart/G2Pie', 'post', ({body, type, url}) => {
const _body = JSON.parse(body)
switch (_body.code) {
case 1:
return {
code: 0,
msg: '请求成功',
data: [
{ item: '分类1', count: 40 },
{ item: '分类2', count: 21 },
{ item: '分类3', count: 17 },
{ item: '分类4', count: 22 }
]
}
default:
return {}
}
})

View File

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