fe-drone-ci/mock/remoteSearch.js

23 lines
493 B
JavaScript
Raw Normal View History

2017-08-22 07:43:34 +00:00
import Mock from 'mockjs'
2017-04-23 11:50:32 +00:00
2017-08-22 07:43:34 +00:00
const NameList = []
const count = 100
2017-04-23 11:50:32 +00:00
for (let i = 0; i < count; i++) {
NameList.push(Mock.mock({
name: '@first'
2017-08-22 07:43:34 +00:00
}))
2017-04-23 11:50:32 +00:00
}
NameList.push({ name: 'mockPan' })
export default {
'/search/user': config => {
const { name } = config.query
2017-04-23 11:50:32 +00:00
const mockNameList = NameList.filter(item => {
const lowerCaseName = item.name.toLowerCase()
return !(name && lowerCaseName.indexOf(name.toLowerCase()) < 0)
2017-08-22 07:43:34 +00:00
})
2017-05-15 09:56:45 +00:00
return { items: mockNameList }
2017-04-23 11:50:32 +00:00
}
2017-08-22 07:43:34 +00:00
}