import request from "@/utils/request";
import axios from "axios";

export function login(data) {
  return request({
    url: "/ecloud-user-center-dt/web/lgin/userLgin",
    method: "post",
    data
  });
}

export function getInfo(token) {
  return request({
    url: "/ecloud-user-center-dt/web/lgin/getUserRoleInfo",
    method: "get",
    params: { token }
  });
}

// 忘记密码获取短信验证码
export function forgetpaSms(data) {
  return request({
    url: "/ecloud-user-center/web/pwd/pwdSendSms"+data,
    method: "get",
  });
}
// 忘记密码
export function forgetpass(data) {
  return request({
    url: "/ecloud-user-center/web/pwd/forgetPwd",
    method: "post",
    data
  });
}
//这里采用传递executor函数到CancelToken的构造函数来创建cancel token
const CancelToken = axios.CancelToken;  

//文件上传证件 外部调用的请求方法
export function uploadData (data, _this) {
	return request({
		url: '/ecloud-upld-server/web/file/uploadFile/saveFile',
		method: 'post',
		data,
		cancelToken: new CancelToken(function executor(c) {
			_this.cancelAjax = c;
		}),
	})
};
// 文件预览
export function uploadCheck(data) {
  return request({
    url: "/ecloud-upld-server/web/file/uploadFile/loadFileById",
    method: "post",
    data
  });
}