fix: 登录异常
This commit is contained in:
parent
b8c5d4e325
commit
45515d9468
|
@ -1,7 +1,7 @@
|
||||||
import { find, assign } from 'lodash'
|
import { assign } from 'lodash'
|
||||||
|
|
||||||
const users = [
|
const users = [
|
||||||
{ username: 'admin', password: '123456', uuid: 'admin-uuid', name: 'Admin' },
|
{ username: 'admin', password: 'admin', uuid: 'admin-uuid', name: 'Admin' },
|
||||||
{ username: 'editor', password: 'editor', uuid: 'editor-uuid', name: 'Editor' },
|
{ username: 'editor', password: 'editor', uuid: 'editor-uuid', name: 'Editor' },
|
||||||
{ username: 'user1', password: 'user1', uuid: 'user1-uuid', name: 'User1' }
|
{ username: 'user1', password: 'user1', uuid: 'user1-uuid', name: 'User1' }
|
||||||
]
|
]
|
||||||
|
@ -12,20 +12,7 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
||||||
* @param {Object} data 登录携带的信息
|
* @param {Object} data 登录携带的信息
|
||||||
*/
|
*/
|
||||||
SYS_USER_LOGIN (data = {}) {
|
SYS_USER_LOGIN (data = {}) {
|
||||||
// 模拟数据
|
const currentUser = users.find(f => f.username === data.username)
|
||||||
mock
|
return assign({}, currentUser, { token: faker.random.uuid() })
|
||||||
.onAny('/login')
|
|
||||||
.reply(config => {
|
|
||||||
const user = find(users, tools.parse(config.data))
|
|
||||||
return user
|
|
||||||
? tools.responseSuccess(assign({}, user, { token: faker.random.uuid() }))
|
|
||||||
: tools.responseError({}, '账号或密码不正确')
|
|
||||||
})
|
|
||||||
// 接口请求
|
|
||||||
return requestForMock({
|
|
||||||
url: '/login',
|
|
||||||
method: 'post',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,5 +41,5 @@ export const menuAside = supplementPath([
|
||||||
// ]
|
// ]
|
||||||
// }
|
// }
|
||||||
{ path: '/resolveRecord', title: '解析记录', icon: 'fa-solid fa-compass' },
|
{ path: '/resolveRecord', title: '解析记录', icon: 'fa-solid fa-compass' },
|
||||||
{ path: '/versionRecord', title: '版本记录', icon: 'fa-solid fa-compass' },
|
{ path: '/versionRecord', title: '版本记录', icon: 'fa-solid fa-compass' }
|
||||||
])
|
])
|
||||||
|
|
|
@ -95,7 +95,7 @@ export default {
|
||||||
// 表单
|
// 表单
|
||||||
formLogin: {
|
formLogin: {
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
password: '123456'
|
password: 'admin'
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
|
|
Loading…
Reference in New Issue