2017-04-23 11:50:32 +00:00
|
|
|
import Mock from 'mockjs';
|
2017-05-15 09:56:45 +00:00
|
|
|
import { param2Obj } from 'utils';
|
2017-04-23 11:50:32 +00:00
|
|
|
|
|
|
|
const NameList = [];
|
|
|
|
const count = 100;
|
|
|
|
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
|
|
NameList.push(Mock.mock({
|
|
|
|
name: '@first'
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
NameList.push({ name: 'mockPan' })
|
|
|
|
|
|
|
|
export default {
|
|
|
|
searchUser: config => {
|
2017-05-15 09:56:45 +00:00
|
|
|
const { name } = param2Obj(config.url);
|
2017-04-23 11:50:32 +00:00
|
|
|
const mockNameList = NameList.filter(item => {
|
|
|
|
const lowerCaseName = item.name.toLowerCase()
|
|
|
|
if (name && lowerCaseName.indexOf(name.toLowerCase()) < 0) return false;
|
|
|
|
return true;
|
|
|
|
});
|
2017-05-15 09:56:45 +00:00
|
|
|
return { items: mockNameList }
|
2017-04-23 11:50:32 +00:00
|
|
|
}
|
|
|
|
};
|