snowy/_web/src/mock/services/manage.js

253 lines
5.7 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Mock from 'mockjs2'
import { builder, getQueryParameters } from '../util'
const totalCount = 5701
const serverList = (options) => {
const parameters = getQueryParameters(options)
const result = []
const pageNo = parseInt(parameters.pageNo)
const pageSize = parseInt(parameters.pageSize)
const totalPage = Math.ceil(totalCount / pageSize)
const key = (pageNo - 1) * pageSize
const next = (pageNo >= totalPage ? (totalCount % pageSize) : pageSize) + 1
for (let i = 1; i < next; i++) {
const tmpKey = key + i
result.push({
key: tmpKey,
id: tmpKey,
no: 'No ' + tmpKey,
description: '',
callNo: Mock.mock('@integer(1, 999)'),
status: Mock.mock('@integer(0, 3)'),
updatedAt: Mock.mock('@datetime'),
editable: false
})
}
return builder({
pageSize: pageSize,
pageNo: pageNo,
totalCount: totalCount,
totalPage: totalPage,
data: result
})
}
const projects = () => {
return builder({
'data': [{
id: 1,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
title: 'Alipay',
description: '西 ',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 2,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
title: 'Angular',
description: '西西',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 3,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png',
title: 'Ant Design',
description: '',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 4,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png',
title: 'Snowy',
description: '',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 5,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png',
title: 'Bootstrap',
description: '',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 6,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png',
title: 'Vue',
description: '',
status: 1,
updatedAt: '2018-07-26 00:00:00'
}
],
'pageSize': 10,
'pageNo': 0,
'totalPage': 6,
'totalCount': 57
})
}
const activity = () => {
return builder([{
id: 1,
user: {
nickname: '@name',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
},
project: {
name: '',
action: '',
event: ''
},
time: '2018-08-23 14:47:00'
},
{
id: 1,
user: {
nickname: '',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png'
},
project: {
name: '',
action: '',
event: ''
},
time: '2018-08-23 09:35:37'
},
{
id: 1,
user: {
nickname: '@name',
avatar: '@image(64x64)'
},
project: {
name: '',
action: '',
event: ''
},
time: '2017-05-27 00:00:00'
},
{
id: 1,
user: {
nickname: '',
avatar: '@image(64x64)'
},
project: {
name: '',
action: '',
event: ''
},
time: '2018-08-23 14:47:00'
},
{
id: 1,
user: {
nickname: '@name',
avatar: '@image(64x64)'
},
project: {
name: '',
action: 'created',
event: ''
},
time: '2018-08-23 14:47:00'
},
{
id: 1,
user: {
nickname: '',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
},
project: {
name: '',
action: 'created',
event: ''
},
time: '2018-08-23 14:47:00'
}
])
}
const teams = () => {
return builder([{
id: 1,
name: '',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
},
{
id: 2,
name: '',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png'
},
{
id: 1,
name: '',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png'
},
{
id: 1,
name: '',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png'
},
{
id: 1,
name: '',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png'
}
])
}
const radar = () => {
return builder([{
item: '',
'': 70,
'': 30,
'': 40
},
{
item: '',
'': 60,
'': 70,
'': 40
},
{
item: '',
'': 50,
'': 60,
'': 40
},
{
item: '',
'': 40,
'': 50,
'': 40
},
{
item: '',
'': 60,
'': 70,
'': 40
},
{
item: '',
'': 70,
'': 50,
'': 40
}
])
}
Mock.mock(/\/service/, 'get', serverList)
Mock.mock(/\/list\/search\/projects/, 'get', projects)
Mock.mock(/\/workplace\/activity/, 'get', activity)
Mock.mock(/\/workplace\/teams/, 'get', teams)
Mock.mock(/\/workplace\/radar/, 'get', radar)