diff --git a/PC/InterFace.Dash/package-lock.json b/PC/InterFace.Dash/package-lock.json index eaa1212..b32b900 100644 --- a/PC/InterFace.Dash/package-lock.json +++ b/PC/InterFace.Dash/package-lock.json @@ -27,6 +27,7 @@ "moment": "^2.29.1", "normalize.css": "7.0.0", "nprogress": "0.2.0", + "oidc-client": "^1.11.5", "path-to-regexp": "2.4.0", "qs": "^6.10.3", "screenfull": "4.2.0", @@ -7416,6 +7417,11 @@ "node": "*" } }, + "node_modules/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, "node_modules/css": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", @@ -16024,6 +16030,35 @@ "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", "dev": true }, + "node_modules/oidc-client": { + "version": "1.11.5", + "resolved": "https://registry.npmmirror.com/oidc-client/-/oidc-client-1.11.5.tgz", + "integrity": "sha512-LcKrKC8Av0m/KD/4EFmo9Sg8fSQ+WFJWBrmtWd+tZkNn3WT/sQG3REmPANE9tzzhbjW6VkTNy4xhAXCfPApAOg==", + "dependencies": { + "acorn": "^7.4.1", + "base64-js": "^1.5.1", + "core-js": "^3.8.3", + "crypto-js": "^4.0.0", + "serialize-javascript": "^4.0.0" + } + }, + "node_modules/oidc-client/node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmmirror.com/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/oidc-client/node_modules/core-js": { + "version": "3.32.1", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.32.1.tgz", + "integrity": "sha512-lqufgNn9NLnESg5mQeYsxQP5w7wrViSj0jr/kv6ECQiByzQkrn1MKvV0L3acttpDqfQrHLwr2KCMgX5b8X+lyQ==", + "hasInstallScript": true + }, "node_modules/omelette": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/omelette/-/omelette-0.4.5.tgz", @@ -29520,6 +29555,11 @@ "randomfill": "^1.0.3" } }, + "crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, "css": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", @@ -36331,6 +36371,30 @@ "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", "dev": true }, + "oidc-client": { + "version": "1.11.5", + "resolved": "https://registry.npmmirror.com/oidc-client/-/oidc-client-1.11.5.tgz", + "integrity": "sha512-LcKrKC8Av0m/KD/4EFmo9Sg8fSQ+WFJWBrmtWd+tZkNn3WT/sQG3REmPANE9tzzhbjW6VkTNy4xhAXCfPApAOg==", + "requires": { + "acorn": "^7.4.1", + "base64-js": "^1.5.1", + "core-js": "^3.8.3", + "crypto-js": "^4.0.0", + "serialize-javascript": "^4.0.0" + }, + "dependencies": { + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmmirror.com/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==" + }, + "core-js": { + "version": "3.32.1", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.32.1.tgz", + "integrity": "sha512-lqufgNn9NLnESg5mQeYsxQP5w7wrViSj0jr/kv6ECQiByzQkrn1MKvV0L3acttpDqfQrHLwr2KCMgX5b8X+lyQ==" + } + } + }, "omelette": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/omelette/-/omelette-0.4.5.tgz", diff --git a/PC/InterFace.Dash/package.json b/PC/InterFace.Dash/package.json index 518f341..a74c05c 100644 --- a/PC/InterFace.Dash/package.json +++ b/PC/InterFace.Dash/package.json @@ -33,6 +33,7 @@ "moment": "^2.29.1", "normalize.css": "7.0.0", "nprogress": "0.2.0", + "oidc-client": "^1.11.5", "path-to-regexp": "2.4.0", "qs": "^6.10.3", "screenfull": "4.2.0", diff --git a/PC/InterFace.Dash/public/config.js b/PC/InterFace.Dash/public/config.js index f80aefc..7953eb4 100644 --- a/PC/InterFace.Dash/public/config.js +++ b/PC/InterFace.Dash/public/config.js @@ -15,6 +15,10 @@ window.SITE_CONFIG['appClientId'] = 'Z_App' window.SITE_CONFIG['appClientScope'] = 'Z' // 浏览器名称 window.SITE_CONFIG['browserTitle'] = '接口看板-QAD&WMS' +// 单点登录使用数据 +window.SITE_CONFIG['oidcLogin_url'] = 'http://dev.ccwin-in.com:60065', +window.SITE_CONFIG['oidcLogin_clientId'] = 'InterfaceDash_App' +window.SITE_CONFIG['oidcLogin_scopes'] = 'offline_access Z profile' // 隐藏的页面 window.SITE_CONFIG['menuHiddenConfig'] = [ 'AsnDet','PoDet','ReceiptDet','ReturnDet', diff --git a/PC/InterFace.Dash/src/App.vue b/PC/InterFace.Dash/src/App.vue index faca134..f3c545e 100644 --- a/PC/InterFace.Dash/src/App.vue +++ b/PC/InterFace.Dash/src/App.vue @@ -18,6 +18,11 @@ localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage']) localStorage.setItem('appClientId',window.SITE_CONFIG['appClientId']) localStorage.setItem('appClientScope',window.SITE_CONFIG['appClientScope']) localStorage.setItem('browserTitle',window.SITE_CONFIG['browserTitle']) +// 单点登录使用数据 +localStorage.setItem('oidcLogin_url',window.SITE_CONFIG['oidcLogin_url']) +localStorage.setItem('oidcLogin_clientId',window.SITE_CONFIG['oidcLogin_clientId']) +localStorage.setItem('oidcLogin_scopes',window.SITE_CONFIG['oidcLogin_scopes']) +// 隐藏菜单 localStorage.setItem('menuHiddenConfig',window.SITE_CONFIG['menuHiddenConfig']) // localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin']) diff --git a/PC/InterFace.Dash/src/api/wms-auth.js b/PC/InterFace.Dash/src/api/wms-auth.js index aa49b23..8f0bc2f 100644 --- a/PC/InterFace.Dash/src/api/wms-auth.js +++ b/PC/InterFace.Dash/src/api/wms-auth.js @@ -30,6 +30,15 @@ export function token(data) { }) } +// 获取用户信息(单点登录) +export function getUsersByToken(token) { + return request({ + url: localStorage.getItem('oidcLogin_url') + '/connect/userinfo', + method: 'get', + Token:token + }) +} + // 通过用户名获取用户信息 export function getUsersByUserName(name) { return request({ diff --git a/PC/InterFace.Dash/src/layout/components/Navbar.vue b/PC/InterFace.Dash/src/layout/components/Navbar.vue index 51236ad..6f12500 100644 --- a/PC/InterFace.Dash/src/layout/components/Navbar.vue +++ b/PC/InterFace.Dash/src/layout/components/Navbar.vue @@ -1,5 +1,5 @@