From 6927ec1370e6b492aa662764619de2fddf2cd9ba Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Thu, 19 Jan 2023 13:02:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1):=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E5=86=85?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.tapd.cn/55578866/prong/stories/view/1155578866001010956 --- .../dataease/plugins/server/XWecomServer.java | 15 ++++++ frontend/src/api/user.js | 7 +++ frontend/src/views/DeAutoLogin.vue | 54 ++++++++++++++++++- 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java b/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java index 5b288b0aa8..79fd7d769e 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XWecomServer.java @@ -81,8 +81,17 @@ public class XWecomServer { return wecomXpackService.getQrParam(); } + @GetMapping("/callBackWithoutLogin") + public ModelAndView callBackWithoutLogin(@RequestParam("code") String code,@RequestParam("state") String state) { + return privateCallBack(code, state, true); + } + @GetMapping("/callBack") public ModelAndView callBack(@RequestParam("code") String code, @RequestParam("state") String state) { + return privateCallBack(code, state, false); + } + + private ModelAndView privateCallBack(String code, String state, Boolean withoutLogin) { ModelAndView modelAndView = new ModelAndView("redirect:/"); HttpServletResponse response = ServletUtils.response(); WecomXpackService wecomXpackService = null; @@ -123,6 +132,12 @@ public class XWecomServer { Cookie cookie_token = new Cookie("Authorization", token); cookie_token.setPath("/"); + if (withoutLogin) { + Cookie platformCookie = new Cookie("inOtherPlatform", "true"); + platformCookie.setPath("/"); + response.addCookie(platformCookie); + } + response.addCookie(cookie_token); } catch (Exception e) { diff --git a/frontend/src/api/user.js b/frontend/src/api/user.js index 57e03c64c3..587b472952 100644 --- a/frontend/src/api/user.js +++ b/frontend/src/api/user.js @@ -116,6 +116,13 @@ export function wecomStatus() { }) } +export function wecomQrParams() { + return request({ + url: '/plugin/wecom/getQrParam', + method: 'post' + }) +} + export function dingtalkStatus() { return request({ url: '/api/auth/isOpenDingtalk', diff --git a/frontend/src/views/DeAutoLogin.vue b/frontend/src/views/DeAutoLogin.vue index 1f7495e24d..f09f646744 100644 --- a/frontend/src/views/DeAutoLogin.vue +++ b/frontend/src/views/DeAutoLogin.vue @@ -23,6 +23,15 @@ component-name="LKSWithoutLogin" /> + + + + + + + +