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() {