You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
12 months ago
|
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: 'mock-Pan' })
|
||
|
|
||
|
export default [
|
||
|
// username search
|
||
|
{
|
||
|
url: '/vue-element-admin/search/user',
|
||
|
type: 'get',
|
||
|
response: config => {
|
||
|
const { name } = config.query
|
||
|
const mockNameList = NameList.filter(item => {
|
||
|
const lowerCaseName = item.name.toLowerCase()
|
||
|
return !(name && lowerCaseName.indexOf(name.toLowerCase()) < 0)
|
||
|
})
|
||
|
return {
|
||
|
code: 20000,
|
||
|
data: { items: mockNameList }
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
// transaction list
|
||
|
{
|
||
|
url: '/vue-element-admin/transaction/list',
|
||
|
type: 'get',
|
||
|
response: _ => {
|
||
|
return {
|
||
|
code: 20000,
|
||
|
data: {
|
||
|
total: 20,
|
||
|
'items|20': [{
|
||
|
order_no: '@guid()',
|
||
|
timestamp: +Mock.Random.date('T'),
|
||
|
username: '@name()',
|
||
|
price: '@float(1000, 15000, 0, 2)',
|
||
|
'status|1': ['success', 'pending']
|
||
|
}]
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|