text: import { find, assign } from 'lodash'
  import i18n from '@/i18n'
  
  const users = [
    { 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' }
  ]
  
  export default ({ service, request, serviceForMock, requestForMock, mock, faker, tools }) => ({
    /**
     * @description 登录
     * @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({}, i18n.t('views.system.login.errors.callback'))
        })
      // 接口请求
      return requestForMock({
        url: '/login',
        method: 'post',
        data
      })
    }
  })
  