mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: Assistant dynamic load
This commit is contained in:
@@ -31,7 +31,8 @@
|
||||
"re_upload": "重新上传",
|
||||
"not_exceed_50mb": "支持 XLS、XLSX、CSV 格式,文件大小不超过 50MB",
|
||||
"reset_password": "重置密码",
|
||||
"password_reset_successful": "重置密码成功"
|
||||
"password_reset_successful": "重置密码成功",
|
||||
"or": "或者"
|
||||
},
|
||||
"dashboard": {
|
||||
"add_success": "添加成功",
|
||||
|
||||
@@ -353,6 +353,7 @@ const btnSelect = ref('d')
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const scriptElement = ref('')
|
||||
const jsCodeElement = ref('')
|
||||
const handleEmbedded = (row: any) => {
|
||||
dialogVisible.value = true
|
||||
const { origin, pathname } = window.location
|
||||
@@ -363,6 +364,25 @@ const handleEmbedded = (row: any) => {
|
||||
src="${origin + pathname}assistant.js?id=${row.id}"k-*g-#/scriptk-*`
|
||||
.replaceAll('g-#', '<')
|
||||
.replaceAll('k-*', '>')
|
||||
|
||||
jsCodeElement.value = `(function(){
|
||||
const script = document.createElement('script');
|
||||
script.defer = true;
|
||||
script.async = true;
|
||||
script.src = "${origin + pathname}assistant.js?id=${row.id}";
|
||||
script.id = "sqlbot-assistant-float-script-${row.id}";
|
||||
document.head.appendChild(script);
|
||||
})()`
|
||||
}
|
||||
const copyJsCode = () => {
|
||||
navigator.clipboard
|
||||
.writeText(jsCodeElement.value)
|
||||
.then(function () {
|
||||
ElMessage.success(t('embedded.copy_successful'))
|
||||
})
|
||||
.catch(function () {
|
||||
ElMessage.error(t('embedded.copy_successful'))
|
||||
})
|
||||
}
|
||||
const copyCode = () => {
|
||||
navigator.clipboard
|
||||
@@ -774,6 +794,19 @@ const saveHandler = () => {
|
||||
{{ scriptElement }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="code">
|
||||
<div class="copy">
|
||||
{{ $t('common.or') }}
|
||||
<el-icon size="16" @click="copyJsCode">
|
||||
<icon_copy_outlined></icon_copy_outlined>
|
||||
</el-icon>
|
||||
</div>
|
||||
|
||||
<div class="script">
|
||||
{{ jsCodeElement }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-drawer
|
||||
|
||||
Reference in New Issue
Block a user