authedUtil.js
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import * as fetch from './fetch';
import * as constants from '../redux/constants/Constants';
const SMS_CODE_PATH='/auth_api/sms/sms_codes'; //获取验证码
const REGISTER_PATH='/auth_api/uaa/tenants';//注册
const USER_LOGIN_PATH='/doLogin'; //用户登录
export const loadMyUserInfo=()=>{//获取用户信息
return fetch.post('/loadUserInfo',{}).then((data)=>{
if(data&&data.user_info&&data.user_info.oss){
window.oss=data.user_info.oss;
}else{
window.oss={
app_url : "https://oss.workai.com.cn",
bucket : "hro",
end_point : "oss-cn-beijing.aliyuncs.com",
public_bucket : "hropublic",
isDefault:true
}
}
return data;
});
}
export const getSmsCode=(data,options={}) =>{ //获取验证码
return fetch.post(SMS_CODE_PATH,data,options);
}
export const registerHro = (data,options={}) => { //注册接口
const url=REGISTER_PATH
return fetch.post(url,data,options);
}
export const userLogin =(data,options={})=>{ //登录接口
const url=USER_LOGIN_PATH
return fetch.post(url,data,options);
}
export const getResetSmsCode =(data,options={})=>{ //重置验证码
const url= SMS_CODE_PATH
return fetch.post(url,{...data},options);
}
//登录前重置密码
export const modifyPassword =(data,options={})=>{ //修改密码
const url='/auth_api/uaa/reset-pwd'
return fetch.post(url,data,options);
}
//登录后重置密码
export const modify_Password =(data,options={})=>{ //修改密码
const url='/api/uaa/reset-pwd'
return fetch.post(url,data,options);
}
export const getQuickLoginSmsCode =(data,options={})=>{ //重置验证码
const url= SMS_CODE_PATH
return fetch.post(url,{...data},options);
}
export const checkPerms = (perms = [], key, action) => {
let flag = false;
if (key && action) {
perms && perms.map((perm, i) => {
if (perm.module == key) {
perm.actions && perm.actions.map(d => {
if (d == action) {
flag = true
}
// else {
// flag = false
// }
})
}
});
} else if (key && !action) {
perms && perms.map((perm, i) => {
if (perm.module == key) {
flag = true;
}
});
}
return flag;
}
//申报操作权限查询
export const getPermission =(options={})=>{ //修改密码
const url='/api/persontax/operate-perm'
return fetch.get(url,options);
}