import request from '@/utils/request'

// 登录方法
export function login(data) {
  return request({
    url: '/auth/login', // login
    headers: {
      isToken: false,
      isForm: false
      // 'Content-Type': 'application/x-www-form-urlencoded'
    },
    method: 'post',
    data
  })
}
// 退出方法
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/system/user/getInfo',
    method: 'get'
  })
}

// 通过userId用户详细信息
export function getInfoByUserId() {
  return request({
    url: '/system/user/'+uni.getStorageSync('userId'),
    method: 'get'
  })
}


// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

//忘记密码-重置密码
export function resetForgetPwdApi(data) {
  return request({
    url: '/smart-canteen/custInfo/forget/password',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

// 获取短信验证码
export function getTextCode(data) {
  return request({
    url: '/auth/getPhoneCode',
	method: 'post',
    headers: {
      isToken: false
    },
    timeout: 20000,
	data
  })
}