@@ -7,6 +7,7 @@ import EmptyBackground from '@/views/dashboard/common/EmptyBackground.vue'
77import icon_database_colorful from ' @/assets/embedded/icon_database_colorful.png'
88import icon_web_site_colorful from ' @/assets/embedded/icon_web-site_colorful.png'
99import floating_window from ' @/assets/embedded/window.png'
10+ import full_window from ' @/assets/embedded/Card.png'
1011import icon_edit_outlined from ' @/assets/svg/icon_edit_outlined.svg'
1112import icon_delete from ' @/assets/svg/icon_delete.svg'
1213import icon_copy_outlined from ' @/assets/embedded/icon_copy_outlined.svg'
@@ -43,6 +44,7 @@ const urlFormRef = ref()
4344const certificateFormRef = ref ()
4445const dialogTitle = ref (' ' )
4546const drawerTitle = ref (' ' )
47+ const activeMode = ref (' full' )
4648
4749const embeddedList = ref <any []>([])
4850const systemCredentials = [' localStorage' , ' custom' , ' cookie' , ' sessionStorage' ]
@@ -374,6 +376,7 @@ const saveEmbedded = () => {
374376const dialogVisible = ref (false )
375377const scriptElement = ref (' ' )
376378const jsCodeElement = ref (' ' )
379+ const jsCodeElementFull = ref (' ' )
377380const handleEmbedded = (row : any ) => {
378381 dialogVisible .value = true
379382 const { origin, pathname } = window .location
@@ -393,6 +396,19 @@ const handleEmbedded = (row: any) => {
393396 script.id = "sqlbot-assistant-float-script-${row .id }";
394397 document.head.appendChild(script);
395398 })() `
399+
400+ jsCodeElementFull .value = ` (function(){
401+ const script = document.createElement('script');
402+ script.defer = true;
403+ script.async = true;
404+ script.src = "${origin + pathname }xpack_static/sqlbot-embedded-dynamic.umd.js";
405+ document.head.appendChild(script);
406+ })()
407+
408+ sqlbot_embedded_handler.mounted('.copilot', {
409+ "embeddedId": "${row .id }",
410+ "online": true
411+ }) `
396412}
397413const copyJsCode = () => {
398414 copy (jsCodeElement .value )
@@ -403,6 +419,16 @@ const copyJsCode = () => {
403419 ElMessage .error (t (' embedded.copy_successful' ))
404420 })
405421}
422+
423+ const copyJsCodeFull = () => {
424+ copy (jsCodeElementFull .value )
425+ .then (function () {
426+ ElMessage .success (t (' embedded.copy_successful' ))
427+ })
428+ .catch (function () {
429+ ElMessage .error (t (' embedded.copy_successful' ))
430+ })
431+ }
406432const copyCode = () => {
407433 copy (scriptElement .value )
408434 .then (function () {
@@ -836,37 +862,70 @@ const saveHandler = () => {
836862 modal-class =" embed-third_party"
837863 >
838864 <div class =" floating-window" >
839- <div class =" floating" >
840- <div class =" title" >{{ $t('embedded.floating_window_mode') }}</div >
841- <img :src =" floating_window" width =" 180px" height =" 120px" alt =" " />
842- </div >
843- <div class =" code" >
844- <div class =" copy" >
845- {{ $t('embedded.code_to_embed') }}
846- <el-tooltip effect =" dark" :content =" t('datasource.copy')" placement =" top" >
847- <el-icon size =" 16" @click =" copyCode" >
848- <icon _copy_outlined ></icon _copy_outlined >
849- </el-icon >
850- </el-tooltip >
865+ <div class =" mode" >
866+ <div
867+ class =" floating"
868+ :class =" activeMode === 'full' && 'active'"
869+ @click =" activeMode = 'full'"
870+ >
871+ <div class =" title" >{{ $t('professional.full_screen_mode') }}</div >
872+ <img :src =" full_window" width =" 180px" height =" 120px" alt =" " />
851873 </div >
852-
853- <div class =" script" >
854- {{ scriptElement }}
874+ <div
875+ class =" floating"
876+ :class =" activeMode === 'floating' && 'active'"
877+ @click =" activeMode = 'floating'"
878+ >
879+ <div class =" title" >{{ $t('embedded.floating_window_mode') }}</div >
880+ <img :src =" floating_window" width =" 180px" height =" 120px" alt =" " />
855881 </div >
856882 </div >
883+ <div v-if =" activeMode === 'floating'" class =" code-bg" >
884+ <div class =" code" >
885+ <div class =" copy" >
886+ {{ $t('embedded.code_to_embed') }}
887+ <el-tooltip effect =" dark" :content =" t('datasource.copy')" placement =" top" >
888+ <el-icon size =" 16" @click =" copyCode" >
889+ <icon _copy_outlined ></icon _copy_outlined >
890+ </el-icon >
891+ </el-tooltip >
892+ </div >
857893
858- <div class =" code" >
859- <div class =" copy" >
860- {{ $t('common.or') }}
861- <el-tooltip effect =" dark" :content =" t('datasource.copy')" placement =" top" >
862- <el-icon size =" 16" @click =" copyJsCode" >
863- <icon _copy_outlined ></icon _copy_outlined >
864- </el-icon >
865- </el-tooltip >
894+ <div class =" script" >
895+ {{ scriptElement }}
896+ </div >
866897 </div >
898+ <div class =" line" ></div >
899+
900+ <div class =" code" >
901+ <div class =" copy" >
902+ {{ $t('professional.code_for_debugging') }}
903+ <el-tooltip effect =" dark" :content =" t('datasource.copy')" placement =" top" >
904+ <el-icon size =" 16" @click =" copyJsCode" >
905+ <icon _copy_outlined ></icon _copy_outlined >
906+ </el-icon >
907+ </el-tooltip >
908+ </div >
867909
868- <div class =" script" >
869- {{ jsCodeElement }}
910+ <div class =" script" >
911+ {{ jsCodeElement }}
912+ </div >
913+ </div >
914+ </div >
915+ <div v-else class =" code-bg" >
916+ <div class =" code" >
917+ <div class =" copy" >
918+ {{ $t('embedded.code_to_embed') }}
919+ <el-tooltip effect =" dark" :content =" t('datasource.copy')" placement =" top" >
920+ <el-icon size =" 16" @click =" copyJsCodeFull" >
921+ <icon _copy_outlined ></icon _copy_outlined >
922+ </el-icon >
923+ </el-tooltip >
924+ </div >
925+
926+ <div class =" script" >
927+ {{ jsCodeElementFull }}
928+ </div >
870929 </div >
871930 </div >
872931 </div >
@@ -1197,25 +1256,52 @@ const saveHandler = () => {
11971256
11981257.embed-third_party {
11991258 .floating-window {
1200- border : 1px solid #dee0e3 ;
12011259 width : 552px ;
1202- height : 431px ;
1203- opacity : 1 ;
1204- border-radius : 4px ;
1260+ .mode {
1261+ display : flex ;
1262+ align-items : center ;
1263+ justify-content : space-between ;
1264+ }
1265+
1266+ .code-bg {
1267+ background : #f5f6f7 ;
1268+ border-radius : 6px ;
1269+ overflow : hidden ;
1270+ margin-top : 16px ;
1271+ }
12051272
12061273 .floating {
12071274 padding : 16px ;
12081275 padding-bottom : 0 ;
1276+ border-radius : 6px ;
1277+ border : 1px solid #dee0e3 ;
1278+ cursor : pointer ;
1279+ width : 268px ;
1280+ height : 182px ;
1281+ display : flex ;
1282+ align-items : center ;
1283+ flex-direction : column ;
1284+
12091285 .title {
12101286 font-weight : 500 ;
12111287 font-size : 14px ;
12121288 line-height : 22px ;
1213- margin-bottom : 16 px ;
1289+ margin-bottom : 8 px ;
12141290 }
1291+
1292+ & .active {
1293+ background : var (--ed-color-primary-1a , #1cba901a );
1294+ border-color : var (--ed-color-primary , #1cba90 );
1295+ }
1296+ }
1297+ .line {
1298+ background-color : #1f232926 ;
1299+ width : calc (100% - 32px );
1300+ height : 1px ;
1301+ margin-left : 16px ;
12151302 }
12161303
12171304 .code {
1218- border-top : 1px solid #1f232926 ;
12191305 padding : 16px ;
12201306 .copy {
12211307 display : flex ;
0 commit comments