上传代码
This commit is contained in:
@ -63,19 +63,19 @@ const Loading: React.FC<{}> = () => {
|
||||
}
|
||||
//跳转
|
||||
const redirect = async (userData: any, url: string, extra: any) => {
|
||||
const roleCode = getURLInformation('roleCode');
|
||||
if (isNotEmpty(roleCode)) {
|
||||
const authIndex = userData.authorityList.findIndex((ite: any) => ite.roleCode == roleCode);
|
||||
if (authIndex != -1) {
|
||||
setUserData(userData, userData.authorityList[authIndex].roleCode, userData.authorityList[authIndex])//角色信息存储
|
||||
} else {
|
||||
setUserData(userData, userData.authorityList[0].roleCode, userData.authorityList[0]);
|
||||
error('402');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// const roleCode = getURLInformation('roleCode');
|
||||
// if (isNotEmpty(roleCode)) {
|
||||
// const authIndex = userData.authorityList.findIndex((ite: any) => ite.roleCode == roleCode);
|
||||
// if (authIndex != -1) {
|
||||
// setUserData(userData, userData.authorityList[authIndex].roleCode, userData.authorityList[authIndex])//角色信息存储
|
||||
// } else {
|
||||
// setUserData(userData, userData.authorityList[0].roleCode, userData.authorityList[0]);
|
||||
// error('402');
|
||||
// return;
|
||||
// }
|
||||
// } else {
|
||||
setUserData(userData, userData.authorityList[0].roleCode, userData.authorityList[0]);
|
||||
}
|
||||
// }
|
||||
await setDict();//存字典
|
||||
setTimeout(() => {
|
||||
history.push({
|
||||
@ -89,43 +89,185 @@ const Loading: React.FC<{}> = () => {
|
||||
|
||||
//获取用户信息
|
||||
async function getUserData(token: string, url: string, extra: any, status: number) {
|
||||
await fgetUserMsg(token).then(async res => {
|
||||
if (res) {
|
||||
if (res?.userType == null) {
|
||||
error('401');
|
||||
} else {
|
||||
if (res?.authorityList == null || res?.authorityList?.length == 0) {
|
||||
if (url == 'ExamineAndApprove/Announcement' ||
|
||||
url == 'ExamineAndApprove/ChangeTheAnnouncement' ||
|
||||
url == 'ExamineAndApprove/Publicity' ||
|
||||
url == 'ExamineAndApprove/InvitationLetter' ||
|
||||
url == 'ExamineAndApprove/ExternalReference' ||
|
||||
url == 'ExamineAndApprove/FailureAnnouncement') {
|
||||
let newAuthority: any[] = []
|
||||
newAuthority.push({
|
||||
authorities: [null, "system:user:test", "system:user:test", "system:user:test", "system:user:test", null, null],
|
||||
roleCode: "ebtp-unicom-default",
|
||||
roleId: "20004",
|
||||
roleName: "联通普通用户",
|
||||
roleScope: "EBTP"
|
||||
})
|
||||
res.authorityList = [...newAuthority];
|
||||
await redirect(res, url, extra);
|
||||
} else {
|
||||
if (status == 0) {
|
||||
await refreshUserData(res?.userType, token, url, extra);
|
||||
} else {
|
||||
error('401');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await redirect(res, url, extra);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
message.error("登录信息有误,请重新登录")
|
||||
const res = {
|
||||
"userId": "ex-linjp29",
|
||||
"lastName": null,
|
||||
"firstName": null,
|
||||
"fullName": "林剑萍",
|
||||
"emailAddress": null,
|
||||
"loginName": "ex-linjp29",
|
||||
"mobilePhone": null,
|
||||
"officePhone": null,
|
||||
"sex": null,
|
||||
"employeeCategory": null,
|
||||
"userType": "1",
|
||||
"dateOfBirth": null,
|
||||
"age": null,
|
||||
"employeeNumber": "1743164896",
|
||||
"nationalityId": null,
|
||||
"nationality": null,
|
||||
"nationalIdentifier": null,
|
||||
"supervisorId": null,
|
||||
"organizationId": "101058278",
|
||||
"organizationName": "湖北信通通信有限公司",
|
||||
"orgCategory": null,
|
||||
"deptId": "101058278",
|
||||
"deptName": "湖北信通通信有限公司",
|
||||
"roleIds": null,
|
||||
"bussiGroupId": null,
|
||||
"positionId": null,
|
||||
"currentRoleCode": "undefined",
|
||||
"province": null,
|
||||
"authorityList": [
|
||||
{
|
||||
"roleId": "000009",
|
||||
"roleName": "代理机构业务经理",
|
||||
"roleCode": "ebtp-agency-project-manager",
|
||||
"roleScope": "EBTP",
|
||||
"authorities": [
|
||||
"ebtp-agency-project-manager",
|
||||
null,
|
||||
"ebtp-agency-project-manager",
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-supplier,ebtp-agency-admin",
|
||||
"ebtp-agency-project-manager",
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-supplier,ebtp-agency-admin",
|
||||
"ebtp-agency-project-manager",
|
||||
"ebtp-agency-project-manager",
|
||||
null,
|
||||
"ebtp-agency-project-manager",
|
||||
null,
|
||||
"ebtp-agency-project-manager",
|
||||
"ebtp-agency-project-manager",
|
||||
null,
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-agency-admin",
|
||||
null,
|
||||
null,
|
||||
"ebtp-agency-admin",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"ebtp-agency-project-manager",
|
||||
"ebtp-agency-project-manager,ebtp-purchase",
|
||||
"ebtp-agency-project-manager,ebtp-purchase",
|
||||
"ebtp-agency-project-manager,ebtp-purchase",
|
||||
"ebtp-agency-project-manager,ebtp-purchase",
|
||||
"ebtp-agency-project-manager,ebtp-purchase",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-supplier",
|
||||
"ebtp-agency-project-manager,ebtp-supplier",
|
||||
"ebtp-agency-project-manager",
|
||||
"ebtp-agency-project-manager",
|
||||
null
|
||||
]
|
||||
},
|
||||
{
|
||||
"roleId": "000006",
|
||||
"roleName": "供应商",
|
||||
"roleCode": "ebtp-supplier",
|
||||
"roleScope": "EBTP",
|
||||
"authorities": [
|
||||
"system:user:test",
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-supplier,ebtp-agency-admin",
|
||||
"system:user:test",
|
||||
"ebtp-agency-project-manager",
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-supplier,ebtp-agency-admin",
|
||||
"ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
"system:user:test",
|
||||
"system:user:test",
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-agency-admin",
|
||||
"ebtp-supplier",
|
||||
"system:user:test",
|
||||
"ebtp-supplier",
|
||||
"system:user:test",
|
||||
"ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"ebtp-agency-project-manager,ebtp-expert,ebtp-supplier",
|
||||
"ebtp-agency-project-manager,ebtp-supplier",
|
||||
"ebtp-supplier",
|
||||
"system:user:test",
|
||||
"system:user:test",
|
||||
"system:user:test",
|
||||
"ebtp-agency-project-manager",
|
||||
"system:user:test"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
if (res?.authorityList == null || res?.authorityList?.length == 0) {
|
||||
if (url == 'ExamineAndApprove/Announcement' ||
|
||||
url == 'ExamineAndApprove/ChangeTheAnnouncement' ||
|
||||
url == 'ExamineAndApprove/Publicity' ||
|
||||
url == 'ExamineAndApprove/InvitationLetter' ||
|
||||
url == 'ExamineAndApprove/ExternalReference' ||
|
||||
url == 'ExamineAndApprove/FailureAnnouncement') {
|
||||
let newAuthority: any[] = []
|
||||
newAuthority.push({
|
||||
authorities: [null, "system:user:test", "system:user:test", "system:user:test", "system:user:test", null, null],
|
||||
roleCode: "ebtp-unicom-default",
|
||||
roleId: "20004",
|
||||
roleName: "联通普通用户",
|
||||
roleScope: "EBTP"
|
||||
})
|
||||
res.authorityList = [...newAuthority];
|
||||
await redirect(res, url, extra);
|
||||
}
|
||||
})
|
||||
}else {
|
||||
await redirect(res, url, extra);
|
||||
}
|
||||
// await fgetUserMsg(token).then(async res => {
|
||||
// if (res) {
|
||||
// if (res?.userType == null) {
|
||||
// error('401');
|
||||
// } else {
|
||||
// if (res?.authorityList == null || res?.authorityList?.length == 0) {
|
||||
// if (url == 'ExamineAndApprove/Announcement' ||
|
||||
// url == 'ExamineAndApprove/ChangeTheAnnouncement' ||
|
||||
// url == 'ExamineAndApprove/Publicity' ||
|
||||
// url == 'ExamineAndApprove/InvitationLetter' ||
|
||||
// url == 'ExamineAndApprove/ExternalReference' ||
|
||||
// url == 'ExamineAndApprove/FailureAnnouncement') {
|
||||
// let newAuthority: any[] = []
|
||||
// newAuthority.push({
|
||||
// authorities: [null, "system:user:test", "system:user:test", "system:user:test", "system:user:test", null, null],
|
||||
// roleCode: "ebtp-unicom-default",
|
||||
// roleId: "20004",
|
||||
// roleName: "联通普通用户",
|
||||
// roleScope: "EBTP"
|
||||
// })
|
||||
// res.authorityList = [...newAuthority];
|
||||
// await redirect(res, url, extra);
|
||||
// } else {
|
||||
// if (status == 0) {
|
||||
// await refreshUserData(res?.userType, token, url, extra);
|
||||
// } else {
|
||||
// error('401');
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// await redirect(res, url, extra);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// message.error("登录信息有误,请重新登录")
|
||||
// }
|
||||
// })
|
||||
}
|
||||
//通过code取token
|
||||
async function getToken(code: string, data: any) {
|
||||
@ -189,4 +331,4 @@ const Loading: React.FC<{}> = () => {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default Loading;
|
||||
export default Loading;
|
||||
|
@ -198,7 +198,7 @@ const Index: React.FC<{}> = () => {
|
||||
const genRandomString = (len: number) => {
|
||||
const text = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const rdmIndex = (text: string | any[]) => Math.random() * text.length | 0;
|
||||
let rdmString = '';
|
||||
let rdmString = '';
|
||||
for(; rdmString.length < len; rdmString += text.charAt(rdmIndex(text)));
|
||||
return rdmString;
|
||||
}
|
||||
@ -213,13 +213,13 @@ const Index: React.FC<{}> = () => {
|
||||
setImgUrl(url);
|
||||
}
|
||||
|
||||
|
||||
|
||||
const login = (val: any) => {
|
||||
let captcha = form.getFieldValue("captcha");
|
||||
if(captcha==undefined||captcha==null||captcha==""){
|
||||
message.error('请输入验证码!');
|
||||
return;
|
||||
}
|
||||
// if(captcha==undefined||captcha==null||captcha==""){
|
||||
// message.error('请输入验证码!');
|
||||
// return;
|
||||
// }
|
||||
/*
|
||||
testLogin({ userName: val.loginName, password: val.psw,captcha:captcha,tmpToken:tmpToken }).then(res => {
|
||||
if(res?.success){
|
||||
@ -256,7 +256,7 @@ const Index: React.FC<{}> = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -105,22 +105,22 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
disSet(true);
|
||||
await CooperfakeAccountLogin({ ...values }).then((res) => {
|
||||
if (res?.success) {
|
||||
if (moment(res?.data?.expiration).diff(moment(), 'hours') < remainingTime) {
|
||||
refreshToken(res?.data)
|
||||
} else {
|
||||
sessionStorage.setItem('Authorization', res?.data?.value);
|
||||
// disSet(true);
|
||||
// await CooperfakeAccountLogin({ ...values }).then((res) => {
|
||||
// if (res?.success) {
|
||||
// if (moment(res?.data?.expiration).diff(moment(), 'hours') < remainingTime) {
|
||||
// refreshToken(res?.data)
|
||||
// } else {
|
||||
sessionStorage.setItem('Authorization', "2ecb7a57-61ed-4406-9063-5d85a26a18eb");
|
||||
// sessionStorage.setItem('refreshToken', res?.data?.refreshToken.value);
|
||||
sessionStorage.setItem('scope', res?.data?.scope);
|
||||
sessionStorage.setItem('scope', "all");
|
||||
history.push('/redirect');
|
||||
}
|
||||
}
|
||||
changeCaptcha();
|
||||
}).finally(() => {
|
||||
disSet(false);
|
||||
});
|
||||
// }
|
||||
// }
|
||||
// changeCaptcha();
|
||||
// }).finally(() => {
|
||||
// disSet(false);
|
||||
// });
|
||||
}
|
||||
};
|
||||
|
||||
@ -212,18 +212,20 @@ const Login: React.FC<LoginProps> = (props) => {
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
)
|
||||
: (
|
||||
<Row>
|
||||
<Col span={12}>
|
||||
<Form.Item name="captcha" rules={[{ required: true, message: '请输入验证码' }]}>
|
||||
<Input size='large' placeholder="验证码" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12} style={{ lineHeight: '33.11px' }}>
|
||||
<Image src={imgUrl} preview={false} onClick={() => changeCaptcha()} />
|
||||
</Col>
|
||||
{/*<Col span={12}>*/}
|
||||
{/* <Form.Item name="captcha" rules={[{ required: true, message: '请输入验证码' }]}>*/}
|
||||
{/* <Input size='large' placeholder="验证码" />*/}
|
||||
{/* </Form.Item>*/}
|
||||
{/*</Col>*/}
|
||||
{/*<Col span={12} style={{ lineHeight: '33.11px' }}>*/}
|
||||
{/* <Image src={imgUrl} preview={false} onClick={() => changeCaptcha()} />*/}
|
||||
{/*</Col>*/}
|
||||
</Row>
|
||||
)}
|
||||
)
|
||||
}
|
||||
</Tab>
|
||||
<Submit loading={submitting} disabled={dis}>
|
||||
登录
|
||||
|
Reference in New Issue
Block a user