login.js 1018 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
import api from './index'
import { axios } from '@/utils/request'

/**
 * login func
 * parameter: {
 *     username: '',
 *     password: '',
 *     remember_me: true,
 *     captcha: '12345'
 * }
 * @param parameter
 * @returns {*}
 */
export function login(parameter) {
  return axios({
    url: '/sys/login',
    method: 'post',
    data: parameter
  })
}

23 24 25 26 27 28 29 30
export function phoneLogin(parameter) {
  return axios({
    url: '/sys/phoneLogin',
    method: 'post',
    data: parameter
  })
}

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
export function getSmsCaptcha(parameter) {
  return axios({
    url: api.SendSms,
    method: 'post',
    data: parameter
  })
}

export function getInfo() {
  return axios({
    url: '/api/user/info',
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

49
export function logout(logoutToken) {
50
  return axios({
51
    url: '/sys/logout',
52 53
    method: 'post',
    headers: {
54 55
      'Content-Type': 'application/json;charset=UTF-8',
      'X-Access-Token':  logoutToken
56 57 58
    }
  })
}