fix(嵌入式): 上传自定义字体,在添加了 content-path 路径的情况下,div 嵌入数据大屏会提示字体请求不到

This commit is contained in:
dataeaseShu 2024-11-26 14:15:42 +08:00
parent ce7cac0d4f
commit a254cffade

View File

@ -5,8 +5,10 @@ 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 { useEmbedded } from '@/store/modules/embedded'
import { setTitle } from '@/utils/utils'
const embeddedStore = useEmbedded()
const basePath = import.meta.env.VITE_API_BASEPATH
const baseUrl = basePath + '/appearance/image/'
import { isBtnShow } from '@/utils/utils'
@ -172,7 +174,9 @@ export const useAppearanceStore = defineStore('appearanceStore', {
}
fontStyleElement.innerHTML = `@font-face {
font-family: '${name}';
src: url(${basePath}/typeface/download/${currentFont.fileTransName});
src: url(${
embeddedStore.baseUrl ? embeddedStore.baseUrl : basePath
}/typeface/download/${currentFont.fileTransName});
font-weight: normal;
font-style: normal;
}`