fix: 字库设置

This commit is contained in:
taojinlong 2024-08-28 17:52:40 +08:00
parent 08a6b2676b
commit 558c0762f5
4 changed files with 7 additions and 4 deletions

View File

@ -114,7 +114,7 @@ public class FontManage {
QueryWrapper<CoreFont> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("file_trans_name", file);
List<CoreFont> coreFonts = coreFontMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(coreFonts)) {
if (CollectionUtils.isEmpty(coreFonts)) {
DEException.throwException("不存在的字库文件");
}

View File

@ -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');

View File

@ -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')

View File

@ -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 = () => {