Commit 6b83c760 authored by 张烨's avatar 张烨

fix: fix login api

parent b1d50659
......@@ -32,11 +32,12 @@ const Login = props => {
const { userName: loginName, password } = values;
OMSLogin(loginName, password)
.then(result => {
// login({ loginName, password }).then(result => {
console.log(result);
if (result.success === true && result.pass === true) {
const { userMode } = result;
// localStorage.setItem('userMode', userMode);
const {
data: { pass, userMode, token },
msg,
} = result;
if (pass === true) {
localStorage.setItem('token', token?.access_token);
setUserMode(userMode);
if (userMode === USER_MODE.ADMIN || userMode === USER_MODE.SUPER) {
const authority = [AUTHORITY.LOGIN, AUTHORITY[userMode]];
......@@ -52,11 +53,14 @@ const Login = props => {
}
} else {
notification.warning({
message: '没有权限!',
message: msg || '没有权限!',
});
}
})
.then(e => {
notification.error({
message: e.message || '没有权限!',
});
console.error(e);
});
};
......
......@@ -118,6 +118,7 @@ const defaultKeyMap = ({ hasIntegerate }) => ({
theme: {
label: '系统皮肤',
formType: ITEM_TYPE.SINGLE_RADIO,
initialValue: 'a',
options: [
{
value: 'a',
......
......@@ -6,8 +6,9 @@ export const getUserInfo = param => get('/cityinterface/getUserinfo', param);
export const login = param =>
get(`${CITY_SERVICE}/OMS.svc/L_GetCheckUser`, param);
export const OMSLogin = (loginName, password) =>
post(`${PUBLISH_SERVICE}/OMSLogin`, {
UserName: loginName,
PassWord: password, // sha(password).toUpperCase(),
});
export const OMSLogin = (loginName, password) => {
const formData = new FormData();
formData.append('userName', loginName);
formData.append('password', password);
return post(`${PUBLISH_SERVICE}/OMSLogin`, formData);
};
......@@ -21,7 +21,7 @@ export const getOneOUUserListNew = OUID =>
get(`${PUBLISH_SERVICE}/UserCenter/GroupUserList`, {
_version: 9999,
_dc: new Date().getTime(),
GroupId: OUID,
groupId: OUID,
});
/**
......
......@@ -24,9 +24,12 @@ const getMatchedConfig = requestConfig => {
return null;
}
};
axios.defaults.withCredentials = false
axios.interceptors.request.use( function (request){
request.headers.token = 'token123'
const token = localStorage.getItem('token')
if(token){
request.headers.token = token
}
return request
}, function (error) {
// Any status codes that falls outside the range of 2xx cause this function to trigger
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment