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

fix: fix login api

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