From 39b3dad28ec6f3a582f14a1b2f0d6284695e2e4c Mon Sep 17 00:00:00 2001 From: Hai Liang Wang Date: Thu, 9 Sep 2021 10:27:45 +0800 Subject: [PATCH] https://github.com/chatopera/cskefu/issues/469 enable set a chatbox in login page --- .../cc/controller/LoginController.java | 36 ++++++++++++------- .../src/main/resources/application.properties | 3 +- .../src/main/resources/templates/login.pug | 6 ++-- docker-compose.yml | 3 +- sample.env | 3 +- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java b/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java index 82aed08f..954cad42 100644 --- a/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java +++ b/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java @@ -85,8 +85,26 @@ public class LoginController extends Handler { @Value("${tongji.baidu.sitekey}") private String tongjiBaiduSiteKey; - @Value("${notice.login.banner}") - private String noticeLoginBanner; + @Value("${extras.login.banner}") + private String extrasLoginBanner; + + @Value("${extras.login.chatbox}") + private String extrasLoginChatbox; + + + private void putViewExtras(final ModelAndView view) { + if (StringUtils.isNotBlank(extrasLoginBanner) && !StringUtils.equalsIgnoreCase(extrasLoginBanner, "off")) { + view.addObject("extrasLoginBanner", extrasLoginBanner); + } else { + view.addObject("extrasLoginBanner", "off"); + } + + if (StringUtils.isNotBlank(extrasLoginChatbox) && !StringUtils.equalsIgnoreCase(extrasLoginChatbox, "off")) { + view.addObject("extrasLoginChatbox", extrasLoginChatbox); + } else { + view.addObject("extrasLoginChatbox", "off"); + } + } /** * 登录页面 @@ -152,11 +170,7 @@ public class LoginController extends Handler { view.addObject("tongjiBaiduSiteKey", tongjiBaiduSiteKey); } - if (StringUtils.isNotBlank(noticeLoginBanner) && !StringUtils.equalsIgnoreCase(noticeLoginBanner, "off")) { - view.addObject("noticeLoginBanner", noticeLoginBanner); - } else { - view.addObject("noticeLoginBanner", "off"); - } + putViewExtras(view); return view; } @@ -238,11 +252,9 @@ public class LoginController extends Handler { if (StringUtils.isNotBlank(referer)) { view.addObject("referer", referer); } - if (StringUtils.isNotBlank(noticeLoginBanner) && !StringUtils.equalsIgnoreCase(noticeLoginBanner, "off")) { - view.addObject("noticeLoginBanner", noticeLoginBanner); - } else { - view.addObject("noticeLoginBanner", "off"); - } + + putViewExtras(view); + view.addObject("msg", "0"); } } diff --git a/contact-center/app/src/main/resources/application.properties b/contact-center/app/src/main/resources/application.properties index 4ea5b960..3fa9932b 100644 --- a/contact-center/app/src/main/resources/application.properties +++ b/contact-center/app/src/main/resources/application.properties @@ -228,4 +228,5 @@ channel.skype.crm= # Miscs ############################################## # 登陆页面公告 -notice.login.banner=商务洽谈、技术支持等联系方式查看 https://dwz.chatopera.com/A51h6m *本提示仅出现于演示环境 \ No newline at end of file +extras.login.banner=商务洽谈、技术支持等联系方式查看 https://dwz.chatopera.com/A51h6m *本提示仅出现于演示环境 +extras.login.chatbox=off \ No newline at end of file diff --git a/contact-center/app/src/main/resources/templates/login.pug b/contact-center/app/src/main/resources/templates/login.pug index 6f6c8b7c..2eec4b0d 100644 --- a/contact-center/app/src/main/resources/templates/login.pug +++ b/contact-center/app/src/main/resources/templates/login.pug @@ -14,6 +14,8 @@ html link(rel="stylesheet" href="/css/layui.css") link(rel="stylesheet" href="/css/login.css") link(rel="stylesheet" href="/css/flexboxgrid.min.css") + if extrasLoginChatbox != "off" + script(defer="true" src="#{extrasLoginChatbox}") script(src="/layui.js") script(language="javascript"). if ((window.frameElement && window.frameElement.id || '') != "") { @@ -54,9 +56,9 @@ html })(); } body.login - if noticeLoginBanner != "off" + if extrasLoginBanner != "off" div(style="width: 100%; height:50px; background-color: #2bd99e; padding-top: 0px;display: flex;") - p(style="color: white;margin: auto; font-size: 15px")= noticeLoginBanner + p(style="color: white;margin: auto; font-size: 15px")= extrasLoginBanner .login-box .login-logo a diff --git a/docker-compose.yml b/docker-compose.yml index 92c525da..12753735 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,7 +51,8 @@ services: - BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.3} - CSKEFU_SETTINGS_WEBIM_VISITOR_SEPARATE=true - TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder} - - NOTICE_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off} + - EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off} + - EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off} depends_on: - mysql - redis diff --git a/sample.env b/sample.env index 2f82aec9..633fc19c 100644 --- a/sample.env +++ b/sample.env @@ -29,4 +29,5 @@ BOT_THRESHOLD_FAQ_BEST_REPLY=0.8 BOT_THRESHOLD_FAQ_SUGG_REPLY=0.6 TONGJI_BAIDU_SITEKEY=placeholder -NOTICE_LOGIN_BANNER=商务洽谈、售后技术支持和云服务发票等 https://dwz.chatopera.com/A51h6m *本提示仅出现于演环境 \ No newline at end of file +EXTRAS_LOGIN_BANNER=商务洽谈、技术支持等联系方式查看 https://dwz.chatopera.com/A51h6m *本提示仅出现于演示环境 +EXTRAS_LOGIN_CHATBOX=https://oh-my.cskefu.com/im/0nhckh.html \ No newline at end of file