import axios from "axios"; import wfc from "../wfc/client/wfc"; import Config from "../config"; let isDev=true if(location.host.indexOf('te')>-1||location.host.indexOf('localhost')>-1){ isDev=true }else{ isDev=false } const v3BaseUrl=isDev ? "https://v5qy.te.baibaodun.com.cn" : "https://v5qy.baibaodun.cn"; const commonBaseUrl = isDev ? "https://identify.test.bcxin.com.cn" : "https://identify.bcxin.com.cn"; console.log('token',location.href) console.log('667',new URLSearchParams(location.hash.split('?')[1]).get('token')) //获取url传递token参数 var token; if(location.href.includes('token')){ token=new URLSearchParams(location.hash.split('?')[1]).get('token') localStorage.setItem('token',token) } // 获取智能人事v3接口的用户详细信息接口 export function getMyUserInfoApi() { return new Promise((resolve,reject)=>{ console.log('55',localStorage.getItem('token')) axios({ method:'get', url:v3BaseUrl + '/v3/tenant/users/current/detail', headers: { 'Content-Type' : 'application/json',// 默认值 'Authorization' : "Bearer " + localStorage.getItem('token'), }, data: {}, }).then(response=>{ console.log('response',response) resolve(response.data.data) }).catch(e=>{ console.log(e) }) }) } // 获取 im登录的token export function wfcTokenLoginApi(userInfo) { return new Promise((resolve,reject)=>{ axios({ method:'post', url:commonBaseUrl + '/identify/api/yehuo/get/token', headers: { 'Content-Type' : 'application/json',// 默认值 },/* */ data: { userId : userInfo.imIdentity||'', clientId : wfc.getClientId(), platform : Config.getWFCPlatform(), idNumber : userInfo.credential.number||'', displayName : userInfo.name||'', mobile : userInfo.telephone||'' }, }).then(response=>{ console.log('response',response) resolve(response.data.data) }).catch(e=>{ console.log(e) }) }) }