From f59fbed46f49c7edc9ca67f2c91eb36c10867cb4 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 15 Dec 2022 16:05:02 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E7=99=BB=E5=BD=95):=20=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0=E5=86=85=E5=85=8D=E7=99=BB=E8=BF=9B?= =?UTF-8?q?=E5=85=A5DE=E9=9A=90=E8=97=8F=E7=99=BB=E5=BD=95=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/plugins/server/XDingtalkServer.java | 5 +++++ .../java/io/dataease/plugins/server/XLarkServer.java | 5 +++++ frontend/src/layout/components/Topbar.vue | 12 +++++++++--- frontend/src/utils/index.js | 8 ++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java b/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java index 8ef0b84ecb..3105858c62 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XDingtalkServer.java @@ -115,6 +115,11 @@ public class XDingtalkServer { DeLogUtils.save(SysLogConstants.OPERATE_TYPE.LOGIN, SysLogConstants.SOURCE_TYPE.USER, sysUserEntity.getUserId(), null, null, null); Cookie cookie_token = new Cookie("Authorization", token); + if (withoutLogin) { + Cookie platformCookie = new Cookie("inOtherPlatform", "true"); + platformCookie.setPath("/"); + response.addCookie(platformCookie); + } cookie_token.setPath("/"); response.addCookie(cookie_token); diff --git a/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java b/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java index 9233abde28..9651776b56 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XLarkServer.java @@ -141,6 +141,11 @@ public class XLarkServer { cookie_token.setPath("/"); response.addCookie(cookie_token); + if (withoutLogin) { + Cookie platformCookie = new Cookie("inOtherPlatform", "true"); + platformCookie.setPath("/"); + response.addCookie(platformCookie); + } } catch (Exception e) { String msg = e.getMessage(); diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 4923c01a43..0eca5b451d 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -85,7 +85,10 @@ {{ $t('commons.ukey_title') }} - + {{ $t('user.change_password') }} @@ -93,6 +96,7 @@ {{ $t('commons.about_us') }} @@ -132,8 +136,7 @@ import { getSysUI } from '@/utils/auth' import { pluginLoaded } from '@/api/user' import { initTheme } from '@/utils/ThemeUtil' import TemplateMarket from '@/views/panel/templateMarket' -import { changeFavicon } from '@/utils/index' - +import { changeFavicon, inOtherPlatform } from '@/utils/index' export default { name: 'Topbar', components: { @@ -225,6 +228,9 @@ export default { sidebar() { return this.$store.state.app.sidebar }, + isOtherPlatform() { + return inOtherPlatform() + }, ...mapGetters([ 'avatar', 'permission_routes', diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js index 01dd7eb895..cc19716828 100644 --- a/frontend/src/utils/index.js +++ b/frontend/src/utils/index.js @@ -344,3 +344,11 @@ export const mergeCustomSortOption = (customSortList, sourceList) => { const result = [...customSortList, ...sourceList] return [...new Set(result)] } + +export const inOtherPlatform = () => { + const cookieStr = Cookies.get('inOtherPlatform') + if (cookieStr && cookieStr === 'true') { + return true + } + return false +}