Files
learning-system-mobile/api/boe/userbasic.js
2023-08-02 15:36:46 +08:00

112 lines
2.4 KiB
JavaScript

/**对应用户中心新的接口*/
import ajax from '@/api/boe/boeUserbasic.js'
/**
* 获取用户的组织机构
* organization_id
*/
const userParentOrg = function() {
return ajax.post('/org/userParentOrg',{});
}
//https://u-pre.boe.com/userbasic/org/list
/**
* 根据关键字查询机构
*/
const findOrgsByKeyword = function(keyword) {
return ajax.postJson('/org/list',{keyword});
}
const findOrgTreeByOrgId = function(orgId) {
return ajax.postJson('/org/childOrgs',{orgId});
}
const getOrgInfo = function(orgId) {
return ajax.postJson('/org/info',{orgId});
}
/**根据用户id获取用户的信息*/
const getUserInfoById = function(id) {
return ajax.postJson('/user/list',{id});
}
/**
* https://u-pre.boe.com/userbasic/audience/userAudiences
* 获取当前用户受众信息
*/
const getUserCrowds = function() {
return new Promise(function(resolve, reject){
});
//return ajax.postJson('/audience/userAudiences',{});
}
/**
* 获取hrbp数据
*/
const getOrgHrbpInfo = function(orgId) {
return ajax.postJson('/org/orgHrbpInfo',{orgId});
}
/**
* 修改密码
* {newPassword:'',oldPassword:''}
*/
const modifyPassword = function(data) {
return ajax.postJson('/user/resetPassword',data);
}
/**获取加入的受众的id集合*/
const getInAudienceIds = function(userId) {
//加入缓存处理
let localKey="user_"+userId+"_gids";
//let hasIds=sessionStorage.getItem(localKey);
return new Promise(function(resolve, reject){
ajax.post('/audience/audienceByUser',{}).then(res=>{
if(res.status==200){
resolve(res.result);
}else{
console.log('未获取人员的受众权限id');
reject([]);
}
});
});
// return ajax.post(baseURL,'/audience/audienceByUser',{});
}
/**
* 更新用户信息,当前只是列新三个信息,根据aid来更新
* aid
* avatar
* sign
*/
const updateUser = function(data) {
return ajax.postJson('/user/updateUserMessage',data);
}
/**退出*/
const logout = function() {
let plat='h5';
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i) == "micromessenger") {
plat='wechat';
}
return ajax.postJson('/logout',{"from":plat});
}
export default {
userParentOrg,
findOrgsByKeyword,
getOrgInfo,
findOrgTreeByOrgId,
getUserInfoById,
getUserCrowds,
getOrgHrbpInfo,
modifyPassword,
getInAudienceIds,
updateUser,
logout
}