forked from github/dataease
Merge pull request #10694 from dataease/pr@dev-v2@fix_share_ticket_uuid
fix(仪表板): 分享链接ticket设置链接没有实时更新
This commit is contained in:
commit
b03a8f0441
@ -42,7 +42,7 @@
|
||||
:disabled="!linkCustom"
|
||||
@blur="finishEditUuid"
|
||||
>
|
||||
<template #prefix>
|
||||
<template v-if="!linkCustom" #prefix>
|
||||
{{ formatLinkBase() }}
|
||||
</template>
|
||||
</el-input>
|
||||
@ -122,7 +122,6 @@
|
||||
</div>
|
||||
<div v-if="shareEnable && showTicket" class="share-ticket-container">
|
||||
<share-ticket
|
||||
:link-url="linkAddr"
|
||||
:uuid="state.detailInfo.uuid"
|
||||
:resource-id="props.resourceId"
|
||||
:ticket-require="state.detailInfo.ticketRequire"
|
||||
|
@ -156,11 +156,14 @@ import { useI18n } from '@/hooks/web/useI18n'
|
||||
import request from '@/config/axios'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
|
||||
import useClipboard from 'vue-clipboard3'
|
||||
import { useEmbedded } from '@/store/modules/embedded'
|
||||
import { SHARE_BASE } from './option'
|
||||
|
||||
const embeddedStore = useEmbedded()
|
||||
const { toClipboard } = useClipboard()
|
||||
const { t } = useI18n()
|
||||
const props = defineProps({
|
||||
linkUrl: propTypes.string.def(null),
|
||||
uuid: propTypes.string.def(null),
|
||||
uuid: propTypes.string.def(''),
|
||||
resourceId: propTypes.string.def(null),
|
||||
ticketRequire: propTypes.bool
|
||||
})
|
||||
@ -234,9 +237,21 @@ const addRow = () => {
|
||||
state.tableData.splice(0, 0, row)
|
||||
})
|
||||
}
|
||||
|
||||
const formatLinkAddr = () => {
|
||||
return formatLinkBase() + props.uuid
|
||||
}
|
||||
const formatLinkBase = () => {
|
||||
let prefix = '/'
|
||||
if (embeddedStore.baseUrl) {
|
||||
prefix = embeddedStore.baseUrl + '#'
|
||||
} else {
|
||||
const href = window.location.href
|
||||
prefix = href.substring(0, href.indexOf('#') + 1)
|
||||
}
|
||||
return prefix + SHARE_BASE
|
||||
}
|
||||
const copyTicket = async ticket => {
|
||||
const url = `${props.linkUrl}?ticket=${ticket}`
|
||||
const url = `${formatLinkAddr()}?ticket=${ticket}`
|
||||
try {
|
||||
await toClipboard(url)
|
||||
ElMessage.success(t('common.copy_success'))
|
||||
|
@ -123,7 +123,6 @@
|
||||
</div>
|
||||
<div v-if="shareEnable && showTicket" class="share-ticket-container">
|
||||
<share-ticket
|
||||
:link-url="linkAddr"
|
||||
:uuid="state.detailInfo.uuid"
|
||||
:resource-id="props.resourceId"
|
||||
:ticket-require="state.detailInfo.ticketRequire"
|
||||
|
Loading…
Reference in New Issue
Block a user