import axios from '@/utils/axios'

export default {
  /**
   * 获取用户信息
   */
  getUserinfo(params) {
    return axios.get('/v2/oauth2/userinfo')
  },
  /**
   * 获取权限
   */
  getPermissions() {
    return axios.get('/v2/oauth2/permissions')
  },
  /**
   * 刷新令牌
   */
  refreshToken(params) {
    return axios.get('/v2/oauth2/refreshToken', { params, loading: false })
  },
  /**
   * 获取令牌
   */
  getToken(params) {
    return axios.get('/v2/oauth2/token', { params, loading: false })
  },
  /**
   * 获取验证码
   */
  getVerifyCode() {
    return axios.get('/v2/oauth2/verifyCode')
  },
  /**
   * 系统登录
   */
  doLogin(params) {
    return axios({
      url: '/v2/oauth2/token',
      method: 'post',
      params: params
    })
  },
  /**
   * 退出登录
   */
  logout() {
    return axios.post('/v2/oauth2/logout')
  },
  /**
   * 修改密码
   */
  changePwd(params) {
    return axios({
      url: '/permission/api/personnel/changePwd',
      method: 'post',
      params: params
    })
  }
}
