diff --git a/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java b/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java index 54b4b6a9c8..24a9d13db0 100644 --- a/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java +++ b/core/core-backend/src/main/java/io/dataease/font/manage/FontManage.java @@ -114,7 +114,7 @@ public class FontManage { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("file_trans_name", file); List coreFonts = coreFontMapper.selectList(queryWrapper); - if (CollectionUtils.isNotEmpty(coreFonts)) { + if (CollectionUtils.isEmpty(coreFonts)) { DEException.throwException("不存在的字库文件"); } diff --git a/core/core-backend/src/main/resources/db/migration/V2.10__ddl.sql b/core/core-backend/src/main/resources/db/migration/V2.10__ddl.sql index cc7d1370b4..0edcbab71d 100644 --- a/core/core-backend/src/main/resources/db/migration/V2.10__ddl.sql +++ b/core/core-backend/src/main/resources/db/migration/V2.10__ddl.sql @@ -86,3 +86,5 @@ CREATE TABLE `core_font` ); ALTER TABLE `core_font` ADD COLUMN `size` DOUBLE NULL AFTER `is_BuiltIn`; ALTER TABLE `core_font` ADD COLUMN `size_type` varchar(255) NULL AFTER `size`; +INSERT INTO `core_font` (`id`, `name`, `is_default`, `update_time`, `is_BuiltIn`) VALUES ('1', 'PingFang', '1', '0', '1'); + diff --git a/core/core-frontend/src/store/modules/appearance.ts b/core/core-frontend/src/store/modules/appearance.ts index 08d729a7a8..c053de6e7b 100644 --- a/core/core-frontend/src/store/modules/appearance.ts +++ b/core/core-frontend/src/store/modules/appearance.ts @@ -170,7 +170,7 @@ export const useAppearanceStore = defineStore('appearanceStore', { } fontStyleElement.innerHTML = `@font-face { font-family: '${name}'; - src: url(${basePath}/typeface/download/${currentFont.id}); + src: url(${basePath}/typeface/download/${currentFont.fileTransName}); font-weight: normal; font-style: normal; }` @@ -205,7 +205,7 @@ export const useAppearanceStore = defineStore('appearanceStore', { } defaultFont().then(res => { const [font] = res || [] - setDefaultFont(`${basePath}/typeface/download/${font?.id}`, font?.name) + setDefaultFont(`${basePath}/typeface/download/${font?.fileTransName}`, font?.name) function setDefaultFont(url, name) { if (!name) return let fontStyleElement = document.querySelector('#de-custom_font') diff --git a/core/core-frontend/src/views/system/font/index.vue b/core/core-frontend/src/views/system/font/index.vue index c12b82a8bd..3e101b9cdd 100644 --- a/core/core-frontend/src/views/system/font/index.vue +++ b/core/core-frontend/src/views/system/font/index.vue @@ -55,6 +55,7 @@ const setToDefault = item => { .then(() => { ElMessage.success('设置成功') getDefaultFont() + listFont() }) .finally(() => { loading.value = false @@ -81,7 +82,7 @@ const setDefaultFont = (url, name) => { const getDefaultFont = () => { defaultFont().then(res => { const [font] = res || [] - setDefaultFont(`${basePath}/typeface/download/${font?.id}`, font?.name) + setDefaultFont(`${basePath}/typeface/download/${font?.fileTransName}`, font?.name) }) } const uploadFilish = () => {