forked from github/dataease
fix(仪表板): 钉钉内打开分享链接Title显示问题
This commit is contained in:
parent
cea7b58a0c
commit
7b5a00f257
@ -5,6 +5,8 @@ import { uiLoadApi } from '@/api/login'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import colorFunctions from 'less/lib/less/functions/color.js'
|
||||
import colorTree from 'less/lib/less/tree/color.js'
|
||||
import { setTitle } from '@/utils/utils'
|
||||
|
||||
const basePath = import.meta.env.VITE_API_BASEPATH
|
||||
const baseUrl = basePath + '/appearance/image/'
|
||||
import { isBtnShow } from '@/utils/utils'
|
||||
@ -312,8 +314,10 @@ export const useAppearanceStore = defineStore('appearanceStore', {
|
||||
if (isDataEaseBi) return
|
||||
if (this.name) {
|
||||
document.title = this.name
|
||||
setTitle(this.name)
|
||||
} else {
|
||||
document.title = 'DataEase'
|
||||
setTitle('DataEase')
|
||||
}
|
||||
const link = document.querySelector('link[rel="icon"]')
|
||||
if (link) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { BusiTreeNode } from '@/models/tree/TreeNode'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { loadScript } from '@/utils/RemoteJs'
|
||||
|
||||
const { wsCache } = useCache()
|
||||
export function deepCopy(target) {
|
||||
@ -135,6 +136,35 @@ export function isMobile() {
|
||||
)
|
||||
}
|
||||
|
||||
export const isDingTalk = window.navigator.userAgent.toLowerCase().includes('dingtalk')
|
||||
|
||||
export const setTitle = (title?: string) => {
|
||||
if (!isDingTalk) {
|
||||
document.title = title || 'DataEase'
|
||||
return
|
||||
}
|
||||
const jsUrl = 'https://g.alicdn.com/dingding/dingtalk-jsapi/3.0.25/dingtalk.open.js'
|
||||
const jsId = 'fit2cloud-dataease-v2-platform-client-dingtalk'
|
||||
if (window['dd'] && window['dd'].biz?.navigation?.setTitle) {
|
||||
window['dd'].biz.navigation.setTitle({
|
||||
title: title
|
||||
})
|
||||
return
|
||||
}
|
||||
const awaitMethod = loadScript(jsUrl, jsId)
|
||||
awaitMethod
|
||||
.then(() => {
|
||||
window['dd'].ready(() => {
|
||||
window['dd'].biz.navigation.setTitle({
|
||||
title: title
|
||||
})
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
document.title = title || 'DataEase'
|
||||
})
|
||||
}
|
||||
|
||||
export function isTablet() {
|
||||
const userAgent = navigator.userAgent
|
||||
const tabletRegex = /iPad|Silk|Galaxy Tab|PlayBook|BlackBerry|(tablet|ipad|playbook)/i
|
||||
|
@ -15,6 +15,8 @@ import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { downloadCanvas2 } from '@/utils/imgUtils'
|
||||
import { setTitle } from '@/utils/utils'
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const { t } = useI18n()
|
||||
const embeddedStore = useEmbedded()
|
||||
@ -116,6 +118,7 @@ const loadCanvasDataAsync = async (dvId, dvType) => {
|
||||
if (props.publicLinkStatus) {
|
||||
// 设置浏览器title为当前仪表板名称
|
||||
document.title = dvInfo.name
|
||||
setTitle(dvInfo.name)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -12,6 +12,7 @@ import { useEmbedded } from '@/store/modules/embedded'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { XpackComponent } from '@/components/plugin'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { setTitle } from '@/utils/utils'
|
||||
|
||||
const dvMainStore = dvMainStoreWithOut()
|
||||
const { t } = useI18n()
|
||||
@ -115,6 +116,7 @@ const loadCanvasDataAsync = async (dvId, dvType) => {
|
||||
if (props.publicLinkStatus) {
|
||||
// 设置浏览器title为当前仪表板名称
|
||||
document.title = dvInfo.name
|
||||
setTitle(dvInfo.name)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user