From a1122897f8d8a38e72c3411401a0822fae911418 Mon Sep 17 00:00:00 2001 From: sunyu Date: Mon, 14 Apr 2025 09:18:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/proxy.ts | 44 +++- src/layouts/BasicLayout.tsx | 339 ++++++++++++++++++++++++++- src/pages/LoadingPage/index.tsx | 240 +++++++++++++++---- src/pages/Login/index.tsx | 14 +- src/pages/usercooper/login/index.tsx | 50 ++-- 5 files changed, 586 insertions(+), 101 deletions(-) diff --git a/config/proxy.ts b/config/proxy.ts index eb18b90..622f4b9 100644 --- a/config/proxy.ts +++ b/config/proxy.ts @@ -6,27 +6,49 @@ export default { // pathRewrite: { '^': '' }, // }, '/api/*': { - target: 'http://10.242.37.148:18022',//连接天宫的ng + // target: 'http://10.242.37.148:18022',//连接天宫的ng + target: 'http://localhost:3000',//连接天宫的ng changeOrigin: true, pathRewrite: { '^': '' }, }, }, UAT: { + '/api/core-service-ebtp-userinfo': { + target: 'http://localhost:18023', + changeOrigin: true, + pathRewrite: { '/api/core-service-ebtp-userinfo': '' }, + }, + '/api/biz-service-ebtp-bid': { + target: 'http://localhost:18003', + changeOrigin: true, + pathRewrite: { 'biz-service-ebtp-bid': '' }, + }, + '/api/biz-service-ebtp-extend': { + target: 'http://localhost:18018', + changeOrigin: true, + pathRewrite: { '/api/biz-service-ebtp-extend': '' }, + }, + '/api/biz-service-ebtp-project': { + target: 'http://localhost:18012', + changeOrigin: true, + pathRewrite: { '/api/biz-service-ebtp-project': '' }, + }, // '/api/wfap/v1/audit/bill/find/by/procid': { // target: 'http://10.242.31.158:8891/',//审批单 uat环境自动审批,暂时用不到 // changeOrigin: true, // pathRewrite: { '^': '' }, // }, - '/living/api/*': { - target: 'https://ai.cubigdata.cn:5001',//连接天宫的ng - changeOrigin: true, - pathRewrite: { '/living/api': '' }, - }, - '/api/*': { - target: 'http://10.242.31.158:18022',//连接天宫的ng - changeOrigin: true, - pathRewrite: { '^': '' }, - }, + // '/living/api/*': { + // // target: 'https://ai.cubigdata.cn:5001',//连接天宫的ng + // target: 'http://localhost:3000',//连接天宫的ng + // changeOrigin: true, + // pathRewrite: { '/living/api': '' }, + // }, + // '/api/*': { + // target: 'http://10.242.31.158:18022',//连接天宫的ng + // changeOrigin: true, + // pathRewrite: { '^': '' }, + // }, // '/doc/v1.0/*': { // target: 'http://10.242.31.158:8806',//连接天宫的ng // changeOrigin: true, diff --git a/src/layouts/BasicLayout.tsx b/src/layouts/BasicLayout.tsx index 8a26b1f..5c8337b 100644 --- a/src/layouts/BasicLayout.tsx +++ b/src/layouts/BasicLayout.tsx @@ -109,17 +109,336 @@ const BasicLayout: React.FC = (props) => { const userData: any = getSessionUserData();//当前登录人信息 useEffect(() => { if (getSessionRoleData()?.roleId) { - let params = { - roleIdList: [getSessionRoleData()?.roleId] + // let params = { + // roleIdList: [getSessionRoleData()?.roleId] + // } + const res = { + "code": "1", + "success": true, + "message": "操作成功", + "data": [ + { + "menuId": "2", + "path": "", + "name": "我的工作台", + "icon": "DesktopOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/workbench/files", + "name": "共享文档下载", + "frame": "N" + }, + { + "path": "/SystemMessage/message", + "name": "系统消息", + "frame": "N" + }, + { + "path": "/api/auth/oauth/authorize?response_type\u003dcode\u0026client_id\u003d3FjMVIzt\u0026redirect_uri\u003dhttps://10.242.31.158:18023/Expertlibraryworkbench/MyExpertHome/Extract?proxyCompanyNo\u003d{organizationId}\u0026sign\u003dprocure\u0026urlSign\u003dSubagenT\u0026mall3_token\u003d{mall3_token}", + "name": "代理机构信息管理", + "frame": "S" + }, + { + "path": "/api/auth/oauth/authorize?response_type\u003dcode\u0026client_id\u003dCOsHJydx\u0026redirect_uri\u003dhttps://uat-uscm.chinaunicom.cn:8631/redirect?page\u003dcustomerservice/support/conversation/index\u0026mall3_token\u003d{mall3_token}", + "name": "我的客服", + "frame": "S" + }, + { + "path": "/Lowcode/LowcodeRedirect", + "name": "我的服务单", + "frame": "Y" + }, + { + "path": "/api/auth/oauth/authorize?response_type\u003dcode\u0026client_id\u003ds3FXwGQh\u0026redirect_uri\u003dhttps://uat-uscm.chinaunicom.cn:18024/supplierInfo/redirect?page\u003d/supplier-info-ordinary\u0026mall3_token\u003d{mall3_token}", + "name": "智企查", + "frame": "S" + } + ], + "feignFlag": null + }, + { + "menuId": "3", + "path": "", + "name": "通知公告", + "icon": "NotificationOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/notice/noticeList", + "name": "通知公告查看", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "41", + "path": "", + "name": "分派项目管理", + "icon": "BookOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/Project/EntrustAssign/Operator", + "name": "分派给我的项目", + "frame": "N" + }, + { + "path": "/Project/EntrustWithdraw", + "name": "委托撤回记录", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1000001", + "path": "", + "name": "招标项目管理", + "icon": "ProfileOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/Bid/Manage", + "name": "项目管理", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1000006", + "path": "Negotiation", + "name": "谈判项目管理", + "icon": "CommentOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/Negotiation/Manage", + "name": "项目管理", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1843567845937700866", + "path": "DirectProc", + "name": "直接采购管理", + "icon": "SelectOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/DirectProc/Manage", + "name": "项目管理", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "100009", + "path": "ComparisonProc", + "name": "询比采购管理", + "icon": "PartitionOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/ComparisonProc/Manage", + "name": "项目管理", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1000008", + "path": "Inquiry", + "name": "询价项目管理", + "icon": "ProjectOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/Inquiry/Manage", + "name": "项目管理", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1000007", + "path": "Recruit", + "name": "招募项目管理", + "icon": "MacCommandOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/Recruit/Manage", + "name": "项目管理", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "11111111", + "path": "Finance", + "name": "财务管理", + "icon": "PayCircleOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/Finance/ProjectManager/RevenueRecognition", + "name": "招标收入确认", + "frame": "N" + }, + { + "path": "/Finance/EnsureAmount", + "name": "投标保证金查询", + "frame": "N" + }, + { + "path": "/Finance/EnsureAmountRefund", + "name": "保证金退还", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "11", + "path": "Invoice", + "name": "发票管理", + "icon": "WalletOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/Invoice/Manager", + "name": "发票列表", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1565509326829727746", + "path": "ExpertManage", + "name": "专家管理", + "icon": "IdcardOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/api/auth/oauth/authorize?response_type\u003dcode\u0026client_id\u003d3FjMVIzt\u0026redirect_uri\u003dhttps://10.242.31.158:18023/Expertlibraryworkbench/MyExpertHome/Extract?proxyCompanyNo\u003d{organizationId}\u0026sign\u003dprocure\u0026mall3_token\u003d{mall3_token}", + "name": "专家抽取", + "frame": "S" + }, + { + "path": "/api/auth/oauth/authorize?response_type\u003dcode\u0026client_id\u003d3FjMVIzt\u0026redirect_uri\u003dhttps://10.242.31.158:18023/Expertlibraryworkbench/MyExpertHome/Extract?proxyCompanyNo\u003d{organizationId}\u0026sign\u003dprocure\u0026urlSign\u003dEvaluate\u0026mall3_token\u003d{mall3_token}", + "name": "专家评价", + "frame": "S" + }, + { + "path": "/ExpertInfo/ExpertInformationManage", + "name": "专家信息管理", + "frame": "N" + }, + { + "path": "/ExpertInfo/ExpertExtractionAvoidance", + "name": "专家抽取回避", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1565574276328947714", + "path": "VideoMonitor", + "name": "视频监控查询", + "icon": "PlaySquareOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/HistoryVideo", + "name": "历史视频上传列表", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1722061270189662209", + "path": "PurchaseReOffer", + "name": "采购复盘与检查", + "icon": "BookOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/PurchaseReOffer", + "name": "采购复盘与检查表", + "frame": "N" + } + ], + "feignFlag": null + }, + { + "menuId": "1767358998249476098", + "path": "UnbalancedBid", + "name": "不均衡报价分析", + "icon": "BookOutlined", + "menuScope": "EBTP", + "menuOu": null, + "isTop": 0, + "children": [ + { + "path": "/UnbalancedBidList", + "name": "不均衡报价分析表", + "frame": "N" + } + ], + "feignFlag": null + } + ] } - getMenu(params).then(res => { - if (res.code == 1) { - setMenuData(res.data || []) - setmenuShow(true) - } else { - message.error("数据错误请联系管理员") - } - }) + setMenuData( res.data || []) + setmenuShow(true) + // getMenu(params).then(res => { + // if (res.code == 1) { + // setMenuData(res.data || []) + // setmenuShow(true) + // } else { + // message.error("数据错误请联系管理员") + // } + // }) } }, []); diff --git a/src/pages/LoadingPage/index.tsx b/src/pages/LoadingPage/index.tsx index b381bb8..deee6f5 100644 --- a/src/pages/LoadingPage/index.tsx +++ b/src/pages/LoadingPage/index.tsx @@ -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<{}> = () => { ); } -export default Loading; \ No newline at end of file +export default Loading; diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index ee5bc6e..8b464f7 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -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(() => { diff --git a/src/pages/usercooper/login/index.tsx b/src/pages/usercooper/login/index.tsx index 931fe66..e7da4d0 100644 --- a/src/pages/usercooper/login/index.tsx +++ b/src/pages/usercooper/login/index.tsx @@ -105,22 +105,22 @@ const Login: React.FC = (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 = (props) => { ]} /> - ) : ( + ) + : ( - - - - - - - changeCaptcha()} /> - + {/**/} + {/* */} + {/* */} + {/* */} + {/**/} + {/**/} + {/* changeCaptcha()} />*/} + {/**/} - )} + ) + } 登录