Commit 0bf63802 authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

Remove hardcoded

parent 233b4fb7
import { parse } from 'url';
const titles = [ const titles = [
'Alipay', 'Alipay',
'Angular', 'Angular',
...@@ -69,7 +67,7 @@ export function fakeList(count) { ...@@ -69,7 +67,7 @@ export function fakeList(count) {
owner: user[i % 10], owner: user[i % 10],
title: titles[i % 8], title: titles[i % 8],
avatar: avatars[i % 8], avatar: avatars[i % 8],
cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - i % 4], cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)],
status: ['active', 'exception', 'normal'][i % 3], status: ['active', 'exception', 'normal'][i % 3],
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
...@@ -111,13 +109,8 @@ export function fakeList(count) { ...@@ -111,13 +109,8 @@ export function fakeList(count) {
let sourceData; let sourceData;
export function getFakeList(req, res, u) { export function getFakeList(req, res) {
let url = u; const params = req.query;
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 count = params.count * 1 || 20;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment