no message

Former-commit-id: 648de15b0be18286cf40e4527285dd41c53a4a83
Former-commit-id: 712e392b2ff0285e2229985a0283322182020841
Former-commit-id: 4ce1c9f6ed83541655eb941ab64c8b58e608b4d2
This commit is contained in:
李杨
2018-02-18 18:04:45 +08:00
parent 94658db1bf
commit 03c37e4e9c
4 changed files with 22 additions and 44 deletions

View File

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

View File

@@ -1,16 +1,5 @@
import Mock from 'mockjs'
const r = (add = 0) => {
return Math.round(Math.random() * 100) + add
}
const returnMaker = (data = []) => {
return {
code: 0,
msg: '请求成功',
data
}
}
import * as fn from './_publicFunction'
Mock.mock('/api/chart/G2Column', 'post', ({body, type, url}) => {
const _body = JSON.parse(body)
@@ -20,12 +9,12 @@ Mock.mock('/api/chart/G2Column', 'post', ({body, type, url}) => {
const year = ['3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月']
const data = year.map(e => ({
year: e,
value: r()
value: fn.r()
})).map(e => ({
x: e.year,
y: e.value
}))
return returnMaker(data)
return fn.returnMaker(data)
}
default:
return {}

View File

@@ -1,16 +1,5 @@
import Mock from 'mockjs'
const r = (add = 0) => {
return Math.round(Math.random() * 100) + add
}
const returnMaker = (data = []) => {
return {
code: 0,
msg: '请求成功',
data
}
}
import * as fn from './_publicFunction'
Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => {
const _body = JSON.parse(body)
@@ -23,7 +12,7 @@ Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => {
year: e,
value: 0
})).map(e => {
e.value = last + r()
e.value = last + fn.r()
last = e.value
return e
}).map(e => ({
@@ -31,19 +20,19 @@ Mock.mock('/api/chart/G2Line', 'post', ({body, type, url}) => {
y: e.value
}))
last = 0
return returnMaker(data)
return fn.returnMaker(data)
}
// 阶梯折线图
case 'step': {
const month = ['3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月']
const data = month.map(e => ({
month: e,
value: r()
value: fn.r()
})).map(e => ({
x: e.month,
y: e.value
}))
return returnMaker(data)
return fn.returnMaker(data)
}
default:
return {}

View File

@@ -0,0 +1,11 @@
export const r = (add = 0) => {
return Math.round(Math.random() * 100) + add
}
export const returnMaker = (data = []) => {
return {
code: 0,
msg: '请求成功',
data
}
}