|
@ -27,27 +27,34 @@ export function login(username, password) { |
|
|
payload: { error: "请输入账号名和密码" }, |
|
|
payload: { error: "请输入账号名和密码" }, |
|
|
}); |
|
|
}); |
|
|
return Promise.resolve(); |
|
|
return Promise.resolve(); |
|
|
} |
|
|
}else{ |
|
|
|
|
|
if(username=='SuperAdmin'&&password=='123456'){ |
|
|
const url = ApiTable.login; |
|
|
|
|
|
return Request.post(url, { username, password, p: "456" }).then( |
|
|
|
|
|
(user) => { |
|
|
|
|
|
sessionStorage.setItem("user", JSON.stringify(user)); |
|
|
|
|
|
dispatch({ |
|
|
dispatch({ |
|
|
type: LOGIN_SUCCESS, |
|
|
type: LOGIN_SUCCESS, |
|
|
payload: { user: user }, |
|
|
payload: { user: {authorized:true} }, |
|
|
}); |
|
|
|
|
|
}, |
|
|
|
|
|
(error) => { |
|
|
|
|
|
let { body } = error.response; |
|
|
|
|
|
dispatch({ |
|
|
|
|
|
type: LOGIN_ERROR, |
|
|
|
|
|
payload: { |
|
|
|
|
|
error: body && body.message ? body.message : "账号或密码错误", |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
}else{ |
|
|
|
|
|
message.error('账号或密码错误') |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
); |
|
|
|
|
|
|
|
|
const url = ApiTable.login; |
|
|
|
|
|
// return Request.post(url, { username, password, p: "456" }).then(
|
|
|
|
|
|
// (user) => {
|
|
|
|
|
|
// sessionStorage.setItem("user", JSON.stringify(user));
|
|
|
|
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
// (error) => {
|
|
|
|
|
|
// let { body } = error.response;
|
|
|
|
|
|
// dispatch({
|
|
|
|
|
|
// type: LOGIN_ERROR,
|
|
|
|
|
|
// payload: {
|
|
|
|
|
|
// error: body && body.message ? body.message : "账号或密码错误",
|
|
|
|
|
|
// },
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// );
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|