2017-08-22 07:43:34 +00:00
|
|
|
import Mock from 'mockjs'
|
|
|
|
import { param2Obj } from 'utils'
|
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 {
|
|
|
|
searchUser: config => {
|
2017-08-22 07:43:34 +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()
|
2017-08-22 07:43:34 +00:00
|
|
|
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
|
|
|
}
|
2017-08-22 07:43:34 +00:00
|
|
|
}
|