chore: 🔨 分享文档链接按钮 (#224)

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
nsnail 2024-11-27 16:54:15 +08:00 committed by GitHub
parent e8b568426b
commit 440c7ffcb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 40 additions and 13 deletions

View File

@ -18,8 +18,14 @@
size="small"></el-button>
</template>
</el-popconfirm>
<el-button v-else v-loading="loading" :icon="item.icon" :title="item.title" @click="click(item, row, vue)" size="small"
>{{ item.title }}
<el-button
v-else
v-loading="loading"
:icon="item.icon"
:title="item.title"
:type="item.type"
@click="click(item, row, vue)"
size="small">
</el-button>
</template>
</el-button-group>

View File

@ -48,7 +48,7 @@
</div>
<div class="right-panel">
<el-button
@click="(this.dialog.save = { mode: 'add', data: { catalogId: this.catalogId } })"
@click="this.dialog.save = { mode: 'add', data: { catalogId: this.catalogId } }"
icon="el-icon-plus"
type="primary"></el-button>
<na-button-bulk-del :api="$API.sys_doc.bulkDeleteContent" :vue="this" />
@ -107,23 +107,30 @@
</el-table-column>
<na-col-operation
:buttons="
naColOperation.buttons.concat({
icon: 'el-icon-delete',
confirm: true,
title: '删除文档',
click: rowDel,
type: 'danger',
})
naColOperation.buttons.concat([
{
icon: 'el-icon-share',
click: share,
title: '删除文档',
},
{
icon: 'el-icon-delete',
confirm: true,
title: '删除文档',
click: rowDel,
type: 'danger',
},
])
"
:vue="this"
width="150" />
width="180" />
</sc-table>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
@closed="(dialog.save = null)"
@closed="dialog.save = null"
@mounted="$refs.saveDialog.open(dialog.save)"
@success="(data, mode) => table.handleUpdate($refs.table, data, mode)"
ref="saveDialog"></save-dialog>
@ -232,7 +239,21 @@ export default {
this.$refs.table.upData()
},
async share(row) {
const textarea = document.createElement('textarea')
textarea.readOnly = 'readonly'
textarea.style.position = 'absolute'
textarea.style.left = '-9999px'
textarea.value = window.location.origin + `/guest/view-doc/${row.id}`
document.body.appendChild(textarea)
textarea.select()
textarea.setSelectionRange(0, textarea.value.length)
const result = document.execCommand('Copy')
if (result) {
this.$message.success(this.$t('文档链接已复制'))
}
document.body.removeChild(textarea)
},
//
async rowDel(row) {
try {