1257 lines
29 KiB
JavaScript
1257 lines
29 KiB
JavaScript
import { parse } from 'url';
|
||
|
||
const titles = [
|
||
'Alipay',
|
||
'Angular',
|
||
'Ant Design',
|
||
'Ant Design Pro',
|
||
'Bootstrap',
|
||
'React',
|
||
'Vue',
|
||
'Webpack',
|
||
];
|
||
const avatars = [
|
||
'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png', // Alipay
|
||
'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png', // Angular
|
||
'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png', // Ant Design
|
||
'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png', // Ant Design Pro
|
||
'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png', // Bootstrap
|
||
'https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png', // React
|
||
'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png', // Vue
|
||
'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png', // Webpack
|
||
];
|
||
|
||
const avatars2 = [
|
||
'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/psOgztMplJMGpVEqfcgF.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/ZpBqSxLxVEXfcUNoPKrz.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/laiEnJdGHVOhJrUShBaJ.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/UrQsqscbKEpNuJcvBZBu.png',
|
||
];
|
||
|
||
const covers = [
|
||
'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/uVZonEtjWwmUZPBQfycs.png',
|
||
'https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png',
|
||
];
|
||
const desc = [
|
||
'那是一种内在的东西, 他们到达不了,也无法触及的',
|
||
'希望是一个好东西,也许是最好的,好东西是不会消亡的',
|
||
'生命就像一盒巧克力,结果往往出人意料',
|
||
'城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
|
||
'那时候我只会想自己想要什么,从不想自己拥有什么',
|
||
];
|
||
|
||
const user = [
|
||
'付小小',
|
||
'曲丽丽',
|
||
'林东东',
|
||
'周星星',
|
||
'吴加好',
|
||
'朱偏右',
|
||
'鱼酱',
|
||
'乐哥',
|
||
'谭小仪',
|
||
'仲尼',
|
||
];
|
||
|
||
const sex = ['男', '女', '女', '男', '男', '男'];
|
||
|
||
const vip = ['是', '否', '否'];
|
||
|
||
const score = [12, 3213, 0, 31, 1, 15, 4213, 4123, 5, 0, 0, 0, 10];
|
||
|
||
const diamond = [1213, 433321, 0, 0, 0, 231, 31, 113, 14, 5123, 523];
|
||
|
||
const address = [
|
||
'江苏南京',
|
||
'四川成都',
|
||
'北京',
|
||
'上海',
|
||
'广东',
|
||
'深圳',
|
||
'杭州',
|
||
'江苏南京',
|
||
'江苏南京',
|
||
];
|
||
|
||
const historyMatch = [1, 3, 4, 41, 12, 12, 545, 12, 0, 0, 2134, 0];
|
||
|
||
const nowMatch = [1, 4, 0, 7, 0, 3, 0, 0, 56, 32, 213, 56];
|
||
|
||
const phone = [
|
||
'18200454554',
|
||
'15836541258',
|
||
'13358452214',
|
||
'13025874125',
|
||
'18751354421',
|
||
'13952154554',
|
||
'17754154154',
|
||
'17854654654',
|
||
'18054654544',
|
||
'18252465545',
|
||
];
|
||
|
||
const accumulationTitle = [
|
||
'九眼桥',
|
||
'春熙路',
|
||
'天府广场',
|
||
'软件园',
|
||
'犀浦',
|
||
'洪河',
|
||
'四川大学',
|
||
'榆林路',
|
||
'玉林路',
|
||
];
|
||
|
||
const place = [
|
||
'九眼桥',
|
||
'春熙路',
|
||
'天府广场',
|
||
'软件园',
|
||
'犀浦',
|
||
'洪河',
|
||
'四川大学',
|
||
'榆林路',
|
||
'玉林路',
|
||
];
|
||
|
||
const time = [
|
||
'早上10点到第二天凌晨6点',
|
||
'中午12点到第二天凌晨2点',
|
||
'早上10点到第二天凌晨6点',
|
||
'早上10点到第二天凌晨6点',
|
||
'早上9点到第二天凌晨1点',
|
||
'早上10点到第二天凌晨2点',
|
||
'早上8点到晚上12点',
|
||
'早上10点到晚上10点',
|
||
];
|
||
|
||
const pay = [250, 120, 600, 80, 20, 100, 150, 1000];
|
||
|
||
const payTime = [
|
||
'2018.02.15 22:18:50',
|
||
'2018.05.05 22:16:13',
|
||
'2018.05.03 20:16:01',
|
||
'2018.05.06 23:16:25',
|
||
'2018.05.05 20:36:37',
|
||
'2018.05.08 21:16:14',
|
||
'2018.05.09 22:16:45',
|
||
'2018.05.10 23:56:55',
|
||
];
|
||
|
||
const codeNum = [
|
||
13123124,
|
||
23123123,
|
||
12312312,
|
||
12414123,
|
||
23412131,
|
||
41234523,
|
||
35423542,
|
||
24352342,
|
||
25636342,
|
||
54754523,
|
||
14235423,
|
||
12301954,
|
||
];
|
||
|
||
const canal = ['渠道1', '渠道2', '渠道3', '渠道4', '渠道5', '渠道6', '渠道7', '渠道8'];
|
||
|
||
const batch = [1, 1, 2, 1, 4, 1, 4, 2, 2, 3, 3, 1, 3];
|
||
|
||
const timeOn = [12, 33, 41, 1, 43, 131, 241, 123, 523, 1342, 654];
|
||
|
||
export function fakeList(count) {
|
||
const list = [];
|
||
for (let i = 0; i < count; i += 1) {
|
||
list.push({
|
||
id: `fake-list-${i}`,
|
||
owner: user[i % 10],
|
||
title: titles[i % 8],
|
||
avatar: avatars[i % 8],
|
||
cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - i % 4],
|
||
status: ['active', 'exception', 'normal'][i % 3],
|
||
percent: Math.ceil(Math.random() * 50) + 50,
|
||
logo: avatars[i % 8],
|
||
href: 'https://ant.design',
|
||
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
|
||
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
|
||
subDescription: desc[i % 5],
|
||
description:
|
||
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
|
||
activeUser: Math.ceil(Math.random() * 100000) + 100000,
|
||
newUser: Math.ceil(Math.random() * 1000) + 1000,
|
||
star: Math.ceil(Math.random() * 100) + 100,
|
||
like: Math.ceil(Math.random() * 100) + 100,
|
||
message: Math.ceil(Math.random() * 10) + 10,
|
||
content:
|
||
'段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
|
||
members: [
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
|
||
name: '曲丽丽',
|
||
},
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
|
||
name: '王昭君',
|
||
},
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
|
||
name: '董娜娜',
|
||
},
|
||
],
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeNormalUserList(current, count) {
|
||
const list = [];
|
||
for (let i = 0; i < count; i++) {
|
||
list.push({
|
||
id: i + (current-1)*count + 1,
|
||
owner: user[i % 10],
|
||
title: titles[i % 8],
|
||
sex: sex[i % 3],
|
||
vip: vip[i % 3],
|
||
phone: phone[i % 8],
|
||
address: address[i % 3],
|
||
historyMatch: historyMatch[i % 3],
|
||
nowMatch: nowMatch[i % 3],
|
||
score: score[i % 3],
|
||
diamond: diamond[i % 3],
|
||
avatar: avatars[i % 8],
|
||
cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - i % 4],
|
||
status: ['active', 'exception', 'normal'][i % 3],
|
||
percent: Math.ceil(Math.random() * 50) + 50,
|
||
logo: avatars[i % 8],
|
||
href: 'https://ant.design',
|
||
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
|
||
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
|
||
subDescription: desc[i % 5],
|
||
description:
|
||
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
|
||
activeUser: Math.ceil(Math.random() * 100000) + 100000,
|
||
newUser: Math.ceil(Math.random() * 1000) + 1000,
|
||
star: Math.ceil(Math.random() * 100) + 100,
|
||
like: Math.ceil(Math.random() * 100) + 100,
|
||
message: Math.ceil(Math.random() * 10) + 10,
|
||
content:
|
||
'段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
|
||
members: [
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
|
||
name: '曲丽丽',
|
||
},
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
|
||
name: '王昭君',
|
||
},
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
|
||
name: '董娜娜',
|
||
},
|
||
],
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeComsumerList(current, count) {
|
||
const list = [];
|
||
for (let i = 0; i < count; i++) {
|
||
list.push({
|
||
id: i + (current-1)*count + 1,
|
||
owner: user[i % 10],
|
||
title: titles[i % 8],
|
||
sex: sex[i % 3],
|
||
vip: vip[i % 3],
|
||
phone: phone[i % 8],
|
||
address: address[i % 3],
|
||
historyMatch: historyMatch[i % 3],
|
||
nowMatch: nowMatch[i % 3],
|
||
score: score[i % 3],
|
||
diamond: diamond[i % 3],
|
||
avatar: avatars[i % 8],
|
||
cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - i % 4],
|
||
status: ['active', 'exception', 'normal'][i % 3],
|
||
percent: Math.ceil(Math.random() * 50) + 50,
|
||
logo: avatars[i % 8],
|
||
href: 'https://ant.design',
|
||
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
|
||
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
|
||
subDescription: desc[i % 5],
|
||
description:
|
||
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
|
||
activeUser: Math.ceil(Math.random() * 100000) + 100000,
|
||
newUser: Math.ceil(Math.random() * 1000) + 1000,
|
||
star: Math.ceil(Math.random() * 100) + 100,
|
||
like: Math.ceil(Math.random() * 100) + 100,
|
||
message: Math.ceil(Math.random() * 10) + 10,
|
||
content:
|
||
'段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。',
|
||
members: [
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
|
||
name: '曲丽丽',
|
||
},
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
|
||
name: '王昭君',
|
||
},
|
||
{
|
||
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
|
||
name: '董娜娜',
|
||
},
|
||
],
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeAccumulationList(count, current) {
|
||
const list = [];
|
||
for (let i = 0; i < count; i++) {
|
||
list.push({
|
||
id: i + 1 + (current-1)*count,
|
||
name: accumulationTitle[i % 8],
|
||
time: time[i % 3],
|
||
place: place[i % 3],
|
||
avatar: avatars[i % 8],
|
||
description: '聚点的详情介绍,限制在60个字数',
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeAccumulation(id) {
|
||
return {
|
||
id: id % 8,
|
||
title: accumulationTitle[id % 8],
|
||
time: time[id % 3],
|
||
place: place[id % 3],
|
||
avatar: avatars[id % 8],
|
||
range: [{"lng":104.048789,"lat":30.666366},{"lng":104.062731,"lat":30.668323},{"lng":104.052526,"lat":30.672267}],
|
||
description: '聚点的详情介绍,限制在60个字数',
|
||
like: false,
|
||
swiper: true,
|
||
createdDate: '2018-02-12',
|
||
startTime: '12:00',
|
||
endTime: '08:00',
|
||
now: 222,
|
||
yesterday: 33,
|
||
city: ["四川", "成都", "青羊区"],
|
||
}
|
||
}
|
||
|
||
export function fakePayList(count) {
|
||
const list = [];
|
||
for (let i = 0; i < count; i++) {
|
||
list.push({
|
||
id: i + 1,
|
||
pay: pay[i % 8],
|
||
time: payTime[i % 3],
|
||
sex: sex[i % 3],
|
||
phone: phone[i % 5],
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
const state = ['已激活','已作废','未激活'];
|
||
export function fakeVipCodeList(current, count) {
|
||
const list = [];
|
||
for (let i = 0; i < count; i++) {
|
||
list.push({
|
||
id: count*(current-1)+ i + 1,
|
||
codeNum: codeNum[i % 8],
|
||
createTime: payTime[i % 3],
|
||
batch: batch[i % 8],
|
||
timeOn: timeOn[i % 5],
|
||
account: timeOn[i % 5],
|
||
useDate: payTime[i % 5],
|
||
endDate: payTime[i % 5],
|
||
remark: '暂无备注',
|
||
canal: canal[i % 8],
|
||
state: state[i % 3],
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeSystemList(current, count) {
|
||
const list = [];
|
||
for (let i = 0; i < count; i++) {
|
||
list.push({
|
||
id: (current-1)*count + i + 1,
|
||
codeNum: codeNum[i % 8],
|
||
createTime: payTime[i % 3],
|
||
batch: batch[i % 8],
|
||
timeOn: timeOn[i % 5],
|
||
account: timeOn[i % 5],
|
||
useDate: payTime[i % 5],
|
||
endDate: payTime[i % 5],
|
||
remark: '暂无备注',
|
||
canal: canal[i % 8],
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeUserPhotoList(current, pageSize) {
|
||
const list = [];
|
||
for (let i = 0; i < pageSize; i++) {
|
||
list.push({
|
||
id: i + 1 + (current-1)*pageSize,
|
||
src: avatars2[i % 8],
|
||
width: 1,
|
||
height:1,
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeAuthorityList(current, pageSize) {
|
||
const type = ['FUNCTION', 'PAGE'];
|
||
const list = [];
|
||
for (let i = 0; i < pageSize; i++) {
|
||
list.push({
|
||
id: (current-1)*pageSize + i + 1,
|
||
name: `权限${(current-1)*pageSize + i + 1}`,
|
||
path: '/api/action/list',
|
||
type: type[i % 2],
|
||
createdDate: '2018-02-23',
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeDitchList(current, pageSize) {
|
||
const list = [];
|
||
for (let i = 0; i < pageSize; i++) {
|
||
list.push({
|
||
id: (current-1)*pageSize + i + 1,
|
||
name: `渠道${(current-1)*pageSize + i + 1}`,
|
||
phone: '13525478952',
|
||
createdTime: '2018/05/12 17:15:22',
|
||
remark: '备注信息',
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function fakeRoleList(current, pageSize) {
|
||
const list = [];
|
||
for (let i = 0; i < pageSize; i++) {
|
||
list.push({
|
||
id: (current-1)*pageSize + i + 1,
|
||
name: `权限${i+1}`,
|
||
path: '/api/action/list',
|
||
createdDate: '2018-02-23',
|
||
});
|
||
}
|
||
|
||
return list;
|
||
}
|
||
|
||
export function getAccumulationList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = req.body;
|
||
|
||
const pageSize = params.pageSize * 1 || 30;
|
||
const current = params.pageNo * 1 || 1;
|
||
|
||
const result = fakeAccumulationList(pageSize, current);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
recordsTotal: 312,
|
||
pageSize: pageSize,
|
||
page: current,
|
||
},
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
recordsTotal: 312,
|
||
pageSize: pageSize,
|
||
page: current,
|
||
},
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getFakeList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const count = params.count * 1 || 20;
|
||
|
||
const result = fakeList(count);
|
||
|
||
if (res && res.json) {
|
||
res.json(result);
|
||
} else {
|
||
return result;
|
||
}
|
||
}
|
||
|
||
export function getPayList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const count = params.count * 1 || 30;
|
||
|
||
const result = fakePayList(count);
|
||
|
||
if (res && res.json) {
|
||
res.json(result);
|
||
} else {
|
||
return result;
|
||
}
|
||
}
|
||
|
||
export function getNormalUserList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const count = params.pageSize * 1 || 30;
|
||
const current = params.current * 1 || 0;
|
||
|
||
const result = fakeNormalUserList(current, count);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 233,
|
||
pageSize: count,
|
||
}
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 233,
|
||
pageSize: count,
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getComsumerList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const count = params.pageSize * 1 || 30;
|
||
const current = params.current * 1 || 0;
|
||
|
||
const result = fakeComsumerList(current, count);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 233,
|
||
pageSize: count,
|
||
}
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 233,
|
||
pageSize: count,
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getVipCodeList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const count = params.pageSize * 1 || 20;
|
||
const current = params.current * 1 || 1;
|
||
|
||
const result = fakeVipCodeList(current, count);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 321,
|
||
pageSize: count,
|
||
}
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 321,
|
||
pageSize: count,
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getSystemList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const count = params.count * 1 || 20;
|
||
const current = params.current * 1 || 1;
|
||
|
||
const result = fakeSystemList(current, count);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
total: 128,
|
||
list: result,
|
||
status: 'ok',
|
||
});
|
||
} else {
|
||
return {
|
||
total: 128,
|
||
list: result,
|
||
status: 'ok',
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getUser(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
const params = parse(url, true).query;
|
||
|
||
const count = params.count * 1;
|
||
const id = params.id * 1;
|
||
|
||
const result = {
|
||
id: id,
|
||
state: '正常状态',
|
||
avatar: avatars[0],
|
||
title: titles[1],
|
||
phone: 18230232123,
|
||
sex: sex[1],
|
||
place: address[0],
|
||
regTime: payTime[0],
|
||
lastTime: payTime[0],
|
||
vip: false,
|
||
diamond: 20,
|
||
score: 100,
|
||
historyMatch: historyMatch[0],
|
||
nowMatch: nowMatch[2],
|
||
};
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
...result,
|
||
}
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
...result,
|
||
}
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getAccumulation(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const result = fakeAccumulation(params.id);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
};
|
||
}
|
||
}
|
||
|
||
|
||
export function getDitch(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
|
||
const result = {
|
||
id: params.id,
|
||
name: `渠道${params.id}`,
|
||
phone: '13525478952',
|
||
createdTime: '2018/05/12 17:15:22',
|
||
remark: '备注信息',
|
||
};
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getUserPhotoList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
const pageSize = params.pageSize*1 || 30;
|
||
const current = params.current*1 || 1;
|
||
|
||
const result = fakeUserPhotoList(current, pageSize);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getAuthorityList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = req.body;
|
||
const pageSize = params.pageSize;
|
||
const current = params.page;
|
||
|
||
const result = fakeAuthorityList(current, pageSize);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
recordsTotal: 131,
|
||
pageSize: pageSize,
|
||
},
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
recordsTotal: 131,
|
||
pageSize: pageSize,
|
||
},
|
||
};
|
||
}
|
||
}
|
||
export function getAllAuthorityList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = req.body;
|
||
const pageSize = 30;
|
||
const current = 1;
|
||
|
||
const result = fakeAuthorityList(current, pageSize);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
},
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
},
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getRoleList(req, res) {
|
||
const params = req.body;
|
||
const pageSize = params.pageSize;
|
||
const current = params.page;
|
||
const result = fakeRoleList(current, pageSize);
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
recordsTotal: 134,
|
||
pageSize: pageSize,
|
||
},
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
data: result,
|
||
recordsTotal: 134,
|
||
pageSize: pageSize,
|
||
},
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getDitchList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
|
||
const params = parse(url, true).query;
|
||
const pageSize = params.pageSize || 30;
|
||
const current = params.current || 1;
|
||
|
||
const result = fakeDitchList(current, pageSize);
|
||
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 134,
|
||
pageSize: pageSize,
|
||
},
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: {
|
||
list: result,
|
||
total: 134,
|
||
pageSize: pageSize,
|
||
},
|
||
};
|
||
}
|
||
}
|
||
|
||
export function getAuthorityPageList(req, res, u) {
|
||
let url = u;
|
||
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
|
||
url = req.url; // eslint-disable-line
|
||
}
|
||
const result = [
|
||
{
|
||
id: 0,
|
||
name: '首页',
|
||
icon: 'home',
|
||
path: 'home',
|
||
},
|
||
{
|
||
id: 1,
|
||
name: '审核管理',
|
||
icon: 'edit',
|
||
path: 'review',
|
||
children: [
|
||
{
|
||
id: 2,
|
||
name: '用户审核',
|
||
path: 'uesrReview',
|
||
children: [
|
||
{
|
||
id: 3,
|
||
name: '正常状态用户审核',
|
||
path: 'normalUserList',
|
||
},
|
||
{
|
||
id: 4,
|
||
name: '审核未通过用户',
|
||
path: 'failUserList',
|
||
},
|
||
],
|
||
},
|
||
{
|
||
id: 4,
|
||
name: '相册审核',
|
||
path: 'photoReview',
|
||
},
|
||
],
|
||
},
|
||
{
|
||
id: 6,
|
||
name: '用户管理',
|
||
icon: 'user-add',
|
||
path: 'comsumerList',
|
||
},
|
||
{
|
||
id: 7,
|
||
name: '标签管理',
|
||
icon: 'tags',
|
||
path: 'labelList',
|
||
},
|
||
{
|
||
id: 8,
|
||
name: '题库管理',
|
||
icon: 'file-text',
|
||
path: 'questionList',
|
||
},
|
||
{
|
||
id: 9,
|
||
name: '聚点管理',
|
||
icon: 'team',
|
||
path: 'accumulationList',
|
||
},
|
||
{
|
||
id: 10,
|
||
name: '消费管理',
|
||
icon: 'pay-circle',
|
||
path: 'payList',
|
||
},
|
||
{
|
||
id: 11,
|
||
name: 'VIP充值码管理',
|
||
icon: 'qrcode',
|
||
path: 'vipCodeList',
|
||
},
|
||
{
|
||
id: 12,
|
||
name: '钻石激活码管理',
|
||
icon: 'qrcode',
|
||
path: 'diamondCodeList',
|
||
},
|
||
{
|
||
id: 13,
|
||
name: '系统设置',
|
||
icon: 'setting',
|
||
path: 'system',
|
||
children: [
|
||
{
|
||
id: 14,
|
||
name: '系统操作日志',
|
||
path: 'log',
|
||
},
|
||
{
|
||
id: 15,
|
||
name: '管理员设置',
|
||
path: 'administrator',
|
||
},
|
||
{
|
||
id: 16,
|
||
name: '角色设置',
|
||
path: 'role',
|
||
},
|
||
{
|
||
id: 17,
|
||
name: '权限设置',
|
||
path: 'authority',
|
||
},
|
||
{
|
||
id: 18,
|
||
name: '系统配置',
|
||
path: 'configuration',
|
||
},
|
||
],
|
||
},
|
||
];
|
||
const params = parse(url, true).query;
|
||
const pageSize = params.pageSize || 30;
|
||
const current = params.current || 1;
|
||
if (res && res.json) {
|
||
res.json({
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
});
|
||
} else {
|
||
return {
|
||
c: 200,
|
||
m: '',
|
||
d: result,
|
||
};
|
||
}
|
||
}
|
||
export const getNotice = [
|
||
{
|
||
id: 'xxx1',
|
||
title: titles[0],
|
||
logo: avatars[0],
|
||
description: '那是一种内在的东西,他们到达不了,也无法触及的',
|
||
updatedAt: new Date(),
|
||
member: '科学搬砖组',
|
||
href: '',
|
||
memberLink: '',
|
||
},
|
||
{
|
||
id: 'xxx2',
|
||
title: titles[1],
|
||
logo: avatars[1],
|
||
description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
|
||
updatedAt: new Date('2017-07-24'),
|
||
member: '全组都是吴彦祖',
|
||
href: '',
|
||
memberLink: '',
|
||
},
|
||
{
|
||
id: 'xxx3',
|
||
title: titles[2],
|
||
logo: avatars[2],
|
||
description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
|
||
updatedAt: new Date(),
|
||
member: '中二少女团',
|
||
href: '',
|
||
memberLink: '',
|
||
},
|
||
{
|
||
id: 'xxx4',
|
||
title: titles[3],
|
||
logo: avatars[3],
|
||
description: '那时候我只会想自己想要什么,从不想自己拥有什么',
|
||
updatedAt: new Date('2017-07-23'),
|
||
member: '程序员日常',
|
||
href: '',
|
||
memberLink: '',
|
||
},
|
||
{
|
||
id: 'xxx5',
|
||
title: titles[4],
|
||
logo: avatars[4],
|
||
description: '凛冬将至',
|
||
updatedAt: new Date('2017-07-23'),
|
||
member: '高逼格设计天团',
|
||
href: '',
|
||
memberLink: '',
|
||
},
|
||
{
|
||
id: 'xxx6',
|
||
title: titles[5],
|
||
logo: avatars[5],
|
||
description: '生命就像一盒巧克力,结果往往出人意料',
|
||
updatedAt: new Date('2017-07-23'),
|
||
member: '骗你来学计算机',
|
||
href: '',
|
||
memberLink: '',
|
||
},
|
||
];
|
||
|
||
export const getActivities = [
|
||
{
|
||
id: 'trend-1',
|
||
updatedAt: new Date(),
|
||
user: {
|
||
name: '曲丽丽',
|
||
avatar: avatars2[0],
|
||
},
|
||
group: {
|
||
name: '高逼格设计天团',
|
||
link: 'http://github.com/',
|
||
},
|
||
project: {
|
||
name: '六月迭代',
|
||
link: 'http://github.com/',
|
||
},
|
||
template: '在 @{group} 新建项目 @{project}',
|
||
},
|
||
{
|
||
id: 'trend-2',
|
||
updatedAt: new Date(),
|
||
user: {
|
||
name: '付小小',
|
||
avatar: avatars2[1],
|
||
},
|
||
group: {
|
||
name: '高逼格设计天团',
|
||
link: 'http://github.com/',
|
||
},
|
||
project: {
|
||
name: '六月迭代',
|
||
link: 'http://github.com/',
|
||
},
|
||
template: '在 @{group} 新建项目 @{project}',
|
||
},
|
||
{
|
||
id: 'trend-3',
|
||
updatedAt: new Date(),
|
||
user: {
|
||
name: '林东东',
|
||
avatar: avatars2[2],
|
||
},
|
||
group: {
|
||
name: '中二少女团',
|
||
link: 'http://github.com/',
|
||
},
|
||
project: {
|
||
name: '六月迭代',
|
||
link: 'http://github.com/',
|
||
},
|
||
template: '在 @{group} 新建项目 @{project}',
|
||
},
|
||
{
|
||
id: 'trend-4',
|
||
updatedAt: new Date(),
|
||
user: {
|
||
name: '周星星',
|
||
avatar: avatars2[4],
|
||
},
|
||
project: {
|
||
name: '5 月日常迭代',
|
||
link: 'http://github.com/',
|
||
},
|
||
template: '将 @{project} 更新至已发布状态',
|
||
},
|
||
{
|
||
id: 'trend-5',
|
||
updatedAt: new Date(),
|
||
user: {
|
||
name: '朱偏右',
|
||
avatar: avatars2[3],
|
||
},
|
||
project: {
|
||
name: '工程效能',
|
||
link: 'http://github.com/',
|
||
},
|
||
comment: {
|
||
name: '留言',
|
||
link: 'http://github.com/',
|
||
},
|
||
template: '在 @{project} 发布了 @{comment}',
|
||
},
|
||
{
|
||
id: 'trend-6',
|
||
updatedAt: new Date(),
|
||
user: {
|
||
name: '乐哥',
|
||
avatar: avatars2[5],
|
||
},
|
||
group: {
|
||
name: '程序员日常',
|
||
link: 'http://github.com/',
|
||
},
|
||
project: {
|
||
name: '品牌迭代',
|
||
link: 'http://github.com/',
|
||
},
|
||
template: '在 @{group} 新建项目 @{project}',
|
||
},
|
||
];
|
||
|
||
export default {
|
||
getNotice,
|
||
getActivities,
|
||
getFakeList,
|
||
getNormalUserList,
|
||
getUser,
|
||
getAccumulationList,
|
||
getPayList,
|
||
getVipCodeList,
|
||
getAccumulation,
|
||
getSystemList,
|
||
getUserPhotoList,
|
||
getComsumerList,
|
||
getAuthorityList,
|
||
getAuthorityPageList,
|
||
};
|