import request from '../utils/request'
import {codeProjectName,requestUrl} from '../config'

let hi_request=null;
if(window.HIVUI_SETTING&&window.HIVUI_SETTING.request){
  hi_request=window.HIVUI_SETTING.request;
}
function _request(opt){
  if(hi_request){
    return hi_request(opt);
  }else{
    return request(opt);
  }
}
const __base=(window.HIVUI_SETTING.serverUrl||codeProjectName);
//密码重置
export function resetpw(data) {
  return _request({
    url: __base + "/sys/user/forgot-pwd",
    method: 'post',
    data
  })
}
//获取验证码图片及ID
export function getCaptchaPic(data){
  return _request({
    url: __base+"/captcha/get",
    method: 'get',
    params:data,
    showError:false,
  })
}
//注册获取验证码
export function captcha(data) {
  return _request({
    url: __base+"/sms/captcha",
    method: 'post',
    data
  })
}
//用户注册
export function register(data) {
  return _request({
    url: __base+"/login/sso-reg",
    method: 'post',
    data
  })
}
//获取多岗列表
export function getBzList(param) {
  return _request({
    url: __base+"/sys/user/detail-list",
    method: 'post',
    data: param,
  })
}
//切换编制岗位
export function changeBz(param) {
  return _request({
    url: __base+"/sys/user/switch-bz",
    method: 'post',
    data: param,
  })
}
//获取后端项目配置参数
export function getProjectDefValue(param){
  return _request({
    url:__base+"/utils/getProjectDefValue",
    method: 'post',
    data: param,
  });
}

//授权页生成机器码
export function getMachineCode(data){
  return _request({
    url: __base+"/data/machinecode",
    method: 'get',
    params:data,
  })
}
// 上传证书
export function uploadCard(param) {
  return _request({
    url:__base+"/file/uploadcard",
    headers: {
      "Content-Type": "multipart/form-data"
    },
    method: 'post',
    data: param,
  })
}