diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts
index 0b7898d796..c75f0b5a81 100644
--- a/core/core-frontend/src/locales/zh-CN.ts
+++ b/core/core-frontend/src/locales/zh-CN.ts
@@ -2269,7 +2269,10 @@ export default {
you_can_type_here: '可以在这里输入其他内容'
},
link_ticket: {
- require: 'Ticket 必填'
+ require: '必选',
+ back: '返回公共链接设置页面',
+ refresh: '刷新',
+ time_tips: '单位: 分钟,范围: [0-1440],0代表无期限,自首次使用ticket访问开始'
},
pblink: {
key_pwd: '请输入密码打开链接',
diff --git a/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue b/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue
index add5e237ce..b2bf88b1a3 100644
--- a/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue
+++ b/core/core-frontend/src/views/data-visualization/PreviewCanvas.vue
@@ -11,7 +11,7 @@ import { ElMessage } from 'element-plus-secondary'
import { useEmbedded } from '@/store/modules/embedded'
import { useI18n } from '@/hooks/web/useI18n'
import { XpackComponent } from '@/components/plugin'
-
+import { propTypes } from '@/utils/propTypes'
const dvMainStore = dvMainStoreWithOut()
const { t } = useI18n()
const embeddedStore = useEmbedded()
@@ -32,7 +32,8 @@ const props = defineProps({
isSelector: {
type: Boolean,
default: false
- }
+ },
+ ticketArgs: propTypes.string.def(null)
})
const loadCanvasDataAsync = async (dvId, dvType) => {
@@ -57,6 +58,14 @@ const loadCanvasDataAsync = async (dvId, dvType) => {
}
}
+ let argsObject = null
+ try {
+ argsObject = JSON.parse(props.ticketArgs)
+ } catch (error) {
+ console.error(error)
+ }
+ const hasTicketArgs = argsObject && Object.keys(argsObject)
+
// 添加外部参数
let attachParam
await getOuterParamsInfo(dvId).then(rsp => {
@@ -65,9 +74,14 @@ const loadCanvasDataAsync = async (dvId, dvType) => {
// 外部参数(iframe 或者 iframe嵌入)
const attachParamsEncode = router.currentRoute.value.query.attachParams
- if (attachParamsEncode) {
+ if (attachParamsEncode || hasTicketArgs) {
try {
- attachParam = JSON.parse(Base64.decode(decodeURIComponent(attachParamsEncode)))
+ if (attachParam) {
+ attachParam = JSON.parse(Base64.decode(decodeURIComponent(attachParamsEncode)))
+ }
+ if (hasTicketArgs) {
+ attachParam = Object.assign({}, attachParam, argsObject)
+ }
} catch (e) {
console.error(e)
ElMessage.error(t('visualization.outer_param_decode_error'))
diff --git a/core/core-frontend/src/views/share/link/ShareProxy.ts b/core/core-frontend/src/views/share/link/ShareProxy.ts
index bb5041b201..66cf7af9e6 100644
--- a/core/core-frontend/src/views/share/link/ShareProxy.ts
+++ b/core/core-frontend/src/views/share/link/ShareProxy.ts
@@ -2,6 +2,12 @@ import request from '@/config/axios'
import { useCache } from '@/hooks/web/useCache'
import { isInIframe } from '@/utils/utils'
const { wsCache } = useCache()
+
+export interface TicketValidVO {
+ ticketValid: boolean
+ ticketExp: boolean
+ args: string
+}
export interface ProxyInfo {
resourceId: string
uid: string
@@ -9,17 +15,36 @@ export interface ProxyInfo {
pwdValid?: boolean
type: string
inIframeError: boolean
+ ticketValidVO: TicketValidVO
}
class ShareProxy {
uuid: string
constructor() {
this.uuid = ''
}
+ getTicket() {
+ const curLocation = window.location.href
+ const pmIndex = curLocation.lastIndexOf('?')
+ if (pmIndex == -1) {
+ return null
+ }
+ const searchText = curLocation.substring(pmIndex + 1)
+ const regex = /([^&=]+)=([^&]*)/g
+ let m
+ while ((m = regex.exec(searchText)) !== null) {
+ const key = decodeURIComponent(m[1])
+ if (key === 'ticket') {
+ return decodeURIComponent(m[2])
+ }
+ }
+ return null
+ }
setUuid() {
const curLocation = window.location.href
+ const pmIndex = curLocation.lastIndexOf('?')
const uuidObj = curLocation.substring(
curLocation.lastIndexOf('de-link/') + 8,
- curLocation.lastIndexOf('?') > 0 ? curLocation.lastIndexOf('?') : curLocation.length
+ pmIndex > 0 ? pmIndex : curLocation.length
)
this.uuid = uuidObj
}
@@ -31,7 +56,8 @@ class ShareProxy {
const uuid = this.uuid
const url = '/share/proxyInfo'
const inIframe = isInIframe()
- const param = { uuid, ciphertext: null, inIframe }
+ const ticket = this.getTicket()
+ const param = { uuid, ciphertext: null, inIframe, ticket }
const ciphertext = wsCache.get(`link-${uuid}`)
if (ciphertext) {
param['ciphertext'] = ciphertext
diff --git a/core/core-frontend/src/views/share/link/TicketError.vue b/core/core-frontend/src/views/share/link/TicketError.vue
new file mode 100644
index 0000000000..28170d443b
--- /dev/null
+++ b/core/core-frontend/src/views/share/link/TicketError.vue
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/core/core-frontend/src/views/share/link/index.vue b/core/core-frontend/src/views/share/link/index.vue
index 57b591e575..a230deb9ae 100644
--- a/core/core-frontend/src/views/share/link/index.vue
+++ b/core/core-frontend/src/views/share/link/index.vue
@@ -4,28 +4,40 @@
+