Merge pull request #6807 from dataease/pr@dev-v2_dzz

Pr@dev v2 dzz
This commit is contained in:
dataeaseShu 2023-11-23 10:19:26 +08:00 committed by GitHub
commit bdecb41032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -12,7 +12,7 @@ const formatterUrl = <T extends Node>(node: T, prefix: string) => {
url = node.src url = node.src
} }
if (url.includes(suffix)) { if (url.includes(suffix) || url.includes('dataease-private')) {
const currentUrlprefix = new URL(url).origin const currentUrlprefix = new URL(url).origin
const newUrl = url.replace(currentUrlprefix, prefix) const newUrl = url.replace(currentUrlprefix, prefix)
if (node instanceof HTMLLinkElement) { if (node instanceof HTMLLinkElement) {

View File

@ -10,19 +10,24 @@ const { canvasStyleData, componentData, canvasViewInfo, canvasViewDataInfo, dvIn
storeToRefs(dvMainStore) storeToRefs(dvMainStore)
const basePath = import.meta.env.VITE_API_BASEPATH const basePath = import.meta.env.VITE_API_BASEPATH
export function formatterUrl(url: string) {
return url.replace('//de2api', '/de2api')
}
export function imgUrlTrans(url) { export function imgUrlTrans(url) {
if (url) { if (url) {
if (typeof url === 'string' && url.indexOf('static-resource') > -1) { if (typeof url === 'string' && url.indexOf('static-resource') > -1) {
const rawUrl = url const rawUrl = url
? (basePath.endsWith('/') ? basePath.substring(0, basePath.length - 1) : basePath) + url ? (basePath.endsWith('/') ? basePath.substring(0, basePath.length - 1) : basePath) + url
: null : null
return window.DataEaseBi return formatterUrl(
? `${window.DataEaseBi.baseUrl}${ window.DataEaseBi
rawUrl.startsWith('/api') ? rawUrl.slice(5) : rawUrl ? `${window.DataEaseBi.baseUrl}${
}`.replace('com//', 'com/') rawUrl.startsWith('/api') ? rawUrl.slice(5) : rawUrl
: rawUrl }`.replace('com//', 'com/')
: rawUrl
)
} else { } else {
return url.replace('com//', 'com/') return formatterUrl(url.replace('com//', 'com/'))
} }
} }
} }