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 = [
|
||||
{ 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: 'user1', password: 'user1', uuid: 'user1-uuid', name: 'User1' }
|
||||
]
|
||||
|
@ -12,20 +12,7 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||
* @param {Object} data 登录携带的信息
|
||||
*/
|
||||
SYS_USER_LOGIN (data = {}) {
|
||||
// 模拟数据
|
||||
mock
|
||||
.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
|
||||
})
|
||||
const currentUser = users.find(f => f.username === data.username)
|
||||
return assign({}, currentUser, { token: faker.random.uuid() })
|
||||
}
|
||||
})
|
||||
|
|
|
@ -41,5 +41,5 @@ export const menuAside = supplementPath([
|
|||
// ]
|
||||
// }
|
||||
{ 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: {
|
||||
username: 'admin',
|
||||
password: '123456'
|
||||
password: 'admin'
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
|
|
Loading…
Reference in New Issue