import axios from '@/libs/axios.js';

export const login = params => {
  return axios.request({
    url: `login`,
    method: 'post',
	data: params
  },true)
};
export const logout = params => {
  return axios.request({
    url: `logout`,
    data: params,
    method: 'get'
  })
};

// 验证是否登录过
export const checkLogin = () => {
  let token = getApp().globalData.token
  if (token&&token!='') {
    return axios.request({
      url: `checkToken`,
      method: 'get'
    })
  } else {
    return new Promise(resolve => {
      resolve({
        status: '9001',
        message: '系统未登录'
      });
    });
  }
};

// 获取登录用户信息
export const getUserInfo = params => {
  return axios.request({
    url: `customer/getDetail`,
    data: params,
    method: 'get'
  })
};
