From 58a9b6454a624b0588a191725ab8b9ed334e1217 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 15 Mar 2024 15:21:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=9A=94=E7=A6=BBscope,=E4=BF=AE=E6=94=B9tip=E4=B8=BA=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/application/template/embed.js | 21 ++++++++++++--------- ui/public/embeb.js | 23 +++++++++++++---------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/apps/application/template/embed.js b/apps/application/template/embed.js index 6eecc4dc8..2d671b63b 100644 --- a/apps/application/template/embed.js +++ b/apps/application/template/embed.js @@ -54,7 +54,7 @@ const getChatContainerHtml=(protocol,host,token)=>{
-
+
` @@ -111,10 +111,12 @@ const initChat=(root)=>{ * 第一次进来的引导提示 */ function initMaxkb(){ - initMaxkbStyle() + const maxkb=document.createElement('div') const root=document.createElement('div') root.id="maxkb" - document.body.appendChild(root) + initMaxkbStyle(maxkb) + maxkb.appendChild(root) + document.body.appendChild(maxkb) const maxkbMaskTip=localStorage.getItem('maxkbMaskTip') if(maxkbMaskTip==null){ initGuide(root) @@ -124,10 +126,11 @@ function initMaxkb(){ // 初始化全局样式 -function initMaxkbStyle(){ +function initMaxkbStyle(root){ style=document.createElement('style') style.type='text/css' - style.innerText= `/* 放大 */ + style.innerText= ` + @scope {/* 放大 */ #maxkb .enlarge { width: 50%!important; height: 100%!important; @@ -165,7 +168,7 @@ function initMaxkbStyle(){ z-index: 1000; } #maxkb .tips { - position: absolute; + position: fixed; bottom: 30px; right: 60px; padding: 22px 24px 24px; @@ -244,7 +247,7 @@ function initMaxkbStyle(){ box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.10); position: fixed;bottom: 20px;right: 45px;overflow: hidden; } - #maxkb #chat_container .close{ + #maxkb #chat_container .chat_close{ position: absolute; top: 15px; right: 10px; @@ -281,8 +284,8 @@ function initMaxkbStyle(){ to { height: 600px; } - }` - document.head.appendChild(style) + }}` + root.appendChild(style) } function embedChatbot() { diff --git a/ui/public/embeb.js b/ui/public/embeb.js index 722fb1ab3..54f648cae 100644 --- a/ui/public/embeb.js +++ b/ui/public/embeb.js @@ -27,7 +27,7 @@ const guideHtml=`
` const chatButtonHtml= -`
+`
@@ -62,7 +62,7 @@ const getChatContainerHtml=(protocol,host,token)=>{
-
+
` @@ -119,10 +119,12 @@ const initChat=(root)=>{ * 第一次进来的引导提示 */ function initMaxkb(){ - initMaxkbStyle() + const maxkb=document.createElement('div') const root=document.createElement('div') root.id="maxkb" - document.body.appendChild(root) + initMaxkbStyle(maxkb) + maxkb.appendChild(root) + document.body.appendChild(maxkb) const maxkbMaskTip=localStorage.getItem('maxkbMaskTip') if(maxkbMaskTip==null){ initGuide(root) @@ -132,10 +134,11 @@ function initMaxkb(){ // 初始化全局样式 -function initMaxkbStyle(){ +function initMaxkbStyle(root){ style=document.createElement('style') style.type='text/css' - style.innerText= `/* 放大 */ + style.innerText= ` + @scope {/* 放大 */ #maxkb .enlarge { width: 50%!important; height: 100%!important; @@ -173,7 +176,7 @@ function initMaxkbStyle(){ z-index: 1000; } #maxkb .tips { - position: absolute; + position: fixed; bottom: 30px; right: 60px; padding: 22px 24px 24px; @@ -252,7 +255,7 @@ function initMaxkbStyle(){ box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.10); position: fixed;bottom: 20px;right: 45px;overflow: hidden; } - #maxkb #chat_container .close{ + #maxkb #chat_container .chat_close{ position: absolute; top: 15px; right: 10px; @@ -289,8 +292,8 @@ function initMaxkbStyle(){ to { height: 600px; } - }` - document.head.appendChild(style) + }}` + root.appendChild(style) } function embedChatbot() {