import request from '@/utils/request'

export function loginByUsername(username, password) {
  const data = {
    username,
    password
  }
  return request({
    url: '/login/login',
    method: 'post',
    data
  })
}

/*根据工号查询用户信息*/
export function loginByEno(employeNo) {
  const data = {
    employeNo
  }
  return request({
    url: '/login/loginByEno',
    method: 'post',
    data
  })
}

export function loginByCode(code) {
  const data = {
    code
  }
  return request({
    url: '/oauthCtl/loginByCode',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/login/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: '/admin/info',
    method: 'get',
    params: { token }
  })
}

export function getUserMenu(token) {
  return request({
    url: '/role/selectAdminMenu',
    method: 'post',
    params: { token }
  })
}

