fe-drone-ci/src/mock/remoteSearch.js

30 lines
640 B
JavaScript
Raw Normal View History

2017-04-23 11:50:32 +00:00
import Mock from 'mockjs';
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 => {
const { name } = config.params;
const mockNameList = NameList.filter(item => {
const lowerCaseName = item.name.toLowerCase()
if (name && lowerCaseName.indexOf(name.toLowerCase()) < 0) return false;
return true;
});
return new Promise(resolve => {
setTimeout(() => {
resolve([200, {
items: mockNameList
}]);
}, 100);
})
}
};