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);
const baseLoginUrl = window.HIVUI_SETTING.login||(__base+"/login/sso-login");

export function baseLogin(param) {
  return _request({
    url: baseLoginUrl,
    method: 'post',
    data: param,
  })
}
export function getScanQrCode(url,param) {
  return _request({
    url: url?url:__base+"/qr/sso-qr",
    method: 'post',
    data: param,
    // url: "https://e52.hieap.cn/qr/sso-qr?pn=fdszh/0000221",
    responseType:"arraybuffer"
  })
}
export function adminUnlock(param) {
  return _request({
    url: __base+"/login/unlock",
    method: 'post',
    data: param,
  })
}