import { imgMap, getUrlParams } from './utils'; export function fakeList(count) { const titles = [ 'Vue', 'Ant Design Pro', 'Bootstrap', 'Angular', 'Ant Design', 'React', 'Alipay', 'Ant Design Mobile', ]; const avatars = [ 'https://gw.alipayobjects.com/zos/rmsportal/hYjIZrUoBfNxOAYBVDfc.png', // 凤蝶 'https://gw.alipayobjects.com/zos/rmsportal/HHWPIzPLCLYmVuPivyiA.png', // 云雀 'https://gw.alipayobjects.com/zos/rmsportal/irqByKtOdKfDojxIWTXF.png', // Basement 'https://gw.alipayobjects.com/zos/rmsportal/VcmdbCBcwPTGYgbYeMzX.png', // DesignLab ]; const covers = [ 'https://gw.alipayobjects.com/zos/rmsportal/HrxcVbrKnCJOZvtzSqjN.png', 'https://gw.alipayobjects.com/zos/rmsportal/alaPpKWajEbIYEUvvVNf.png', 'https://gw.alipayobjects.com/zos/rmsportal/RLwlKSYGSXGHuWSojyvp.png', 'https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png', ]; const desc = [ '那是一种内在的东西, 他们到达不了,也无法触及的', '希望是一个好东西,也许是最好的,好东西是不会消亡的', '生命就像一盒巧克力,结果往往出人意料', '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆', '那时候我只会想自己想要什么,从不想自己拥有什么', ]; const user = [ '付小小', '曲丽丽', '林东东', '周星星', '吴加好', '朱偏右', '鱼酱', '乐哥', '谭小仪', '仲尼', ]; 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 % 4], cover: (i / 4) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)], status: ['active', 'exception', 'normal'][i % 3], percent: Math.ceil(Math.random() * 50) + 50, logo: ['https://gw.alipayobjects.com/zos/rmsportal/KoJjkdbuTFxzJmmjuDVR.png', 'https://gw.alipayobjects.com/zos/rmsportal/UxGORCvEXJEsxOfEKZiA.png'][i % 2], 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: '段落示意:蚂蚁金服设计平台 design.alipay.com,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 design.alipay.com,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。', 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 getFakeList(req, res, u) { let url = u; if (!url || Object.prototype.toString.call(url) !== '[object String]') { url = req.url; // eslint-disable-line } const params = getUrlParams(url); const count = (params.count * 1) || 20; const result = fakeList(count); if (res && res.json) { res.json(result); } else { return result; } } export const getNotice = [ { id: 'xxx1', title: 'Vue', logo: imgMap.b, description: '那是一种内在的东西, 他们到达不了,也无法触及的', updatedAt: new Date(), member: '科学搬砖组', href: '', memberLink: '', }, { id: 'xxx2', title: 'Angular', logo: imgMap.c, description: '希望是一个好东西,也许是最好的,好东西是不会消亡的', updatedAt: new Date('2017-07-24 11:00:00'), member: '全组都是吴彦祖', href: '', memberLink: '', }, { id: 'xxx3', title: 'React', logo: imgMap.a, description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆', updatedAt: new Date(), member: '中二少女团', href: '', memberLink: '', }, { id: 'xxx4', title: 'Ant Design', logo: imgMap.a, description: '那时候我只会想自己想要什么,从不想自己拥有什么', updatedAt: new Date('2017-07-23 06:23:00'), member: '程序员日常', href: '', memberLink: '', }, { id: 'xxx5', title: 'Ant Design Mobile', logo: imgMap.b, description: '凛冬将至', updatedAt: new Date('2017-07-23 06:23:00'), member: '高逼格设计天团', href: '', memberLink: '', }, { id: 'xxx6', title: 'Ant Motion', logo: imgMap.c, description: '生命就像一盒巧克力,结果往往出人意料', updatedAt: new Date('2017-07-23 06:23:00'), member: '骗你来学计算机', href: '', memberLink: '', }, ]; export const getActivities = [ { id: 'trend-1', updatedAt: new Date(), user: { name: '林东东', avatar: imgMap.a, }, group: { name: '高逼格设计天团', link: 'http://github.com/', }, project: { name: '六月迭代', link: 'http://github.com/', }, template: '在 @{group} 新建项目 @{project}', }, { id: 'trend-2', updatedAt: new Date(), user: { name: '付小小', avatar: imgMap.c, }, group: { name: '高逼格设计天团', link: 'http://github.com/', }, project: { name: '六月迭代', link: 'http://github.com/', }, template: '在 @{group} 新建项目 @{project}', }, { id: 'trend-3', updatedAt: new Date(), user: { name: '曲丽丽', avatar: imgMap.b, }, group: { name: '中二少女团', link: 'http://github.com/', }, project: { name: '六月迭代', link: 'http://github.com/', }, template: '在 @{group} 新建项目 @{project}', }, { id: 'trend-4', updatedAt: new Date(), user: { name: '周星星', avatar: imgMap.c, }, project: { name: '5 月日常迭代', link: 'http://github.com/', }, template: '将 @{project} 更新至已发布状态', }, { id: 'trend-5', updatedAt: new Date(), user: { name: '朱偏右', avatar: imgMap.a, }, project: { name: '工程效能', link: 'http://github.com/', }, comment: { name: '留言', link: 'http://github.com/', }, template: '在 @{project} 发布了 @{comment}', }, { id: 'trend-6', updatedAt: new Date(), user: { name: '乐哥', avatar: imgMap.d, }, group: { name: '程序员日常', link: 'http://github.com/', }, project: { name: '品牌迭代', link: 'http://github.com/', }, template: '在 @{group} 新建项目 @{project}', }, ]; export default { getNotice, getActivities, getFakeList, };