Procházet zdrojové kódy

字体列表统一管理

dsy před 3 týdny
rodič
revize
df1bc4c667

+ 2 - 2
src/views/book/courseware/create/components/FullTextSettings.vue

@@ -145,9 +145,9 @@
 <script>
 import ColorPicker from '@/components/ColorPicker.vue';
 
-import { pinyinPositionList, fontList, fontSizeList, isEnable } from '@/views/book/courseware/data/common';
+import { pinyinPositionList, fontSizeList, isEnable } from '@/views/book/courseware/data/common';
 import { GetBookUnifiedAttrib } from '@/api/book';
-import { unified_attrib } from '@/common/data';
+import { fontList, unified_attrib } from '@/common/data';
 import { ToAuxiliaryColor } from '@/api/app';
 
 export default {

+ 2 - 1
src/views/book/courseware/create/components/question/fill/FillSetting.vue

@@ -114,7 +114,8 @@ import {
 } from '@/views/book/courseware/data/fill';
 
 import { GetTextToAudioConfParamList } from '@/api/app';
-import { speedRatioList, fontList } from '@/views/book/courseware/data/common';
+import { speedRatioList } from '@/views/book/courseware/data/common';
+import { fontList } from '@/common/data';
 
 export default {
   name: 'FillSetting',

+ 2 - 1
src/views/book/courseware/create/components/question/voice_matrix/VoiceMatrix.vue

@@ -138,7 +138,8 @@ import ResourcesOperate from '../../common/ResourcesOperate.vue';
 
 import { getVoiceMatrixData, getOption } from '@/views/book/courseware/data/voiceMatrix';
 import { GetStaticResources } from '@/api/app';
-import { fontList, fontSizeList } from '@/views/book/courseware/data/common';
+import { fontList } from '@/common/data';
+import { fontSizeList } from '@/views/book/courseware/data/common';
 import { getWordTimes } from '@/api/article';
 
 export default {

+ 0 - 10
src/views/book/courseware/data/common.js

@@ -128,16 +128,6 @@ export const audioGenerationMethodList = [
   },
 ];
 
-// 字体样式列表
-export const fontList = [
-  { label: '楷体', value: '楷体,微软雅黑' },
-  { label: '黑体', value: '黑体,微软雅黑' },
-  { label: '宋体', value: '宋体,微软雅黑' },
-  { label: 'Arial', value: 'Arial,Helvetica,sans-serif' },
-  { label: 'Times New Roman', value: 'Times New Roman,times,serif' },
-  { label: '拼音', value: 'League' },
-];
-
 // 字体大小列表
 export const fontSizeList = [
   '8pt',

+ 1 - 1
src/views/book/courseware/data/fill.js

@@ -1,3 +1,4 @@
+import { fontList } from '@/common/data';
 import {
   displayList,
   serialNumberTypeList,
@@ -6,7 +7,6 @@ import {
   switchOption,
   pinyinPositionList,
   serialNumberStyleList,
-  fontList,
 } from '@/views/book/courseware/data/common';
 
 export { arrangeTypeList, switchOption };

+ 11 - 28
src/views/book/courseware/data/input.js

@@ -1,5 +1,6 @@
 // 输入框组件
 
+import { fontList as sharedFontList } from '@/common/data';
 import { positionList } from './article';
 import { commonSetProperty, serialNumberStyleList } from './common';
 
@@ -31,33 +32,15 @@ export const inputStyleList = [
   },
 ];
 
-export const fontList = [
-  {
-    value: 'arial, helvetica, sans-serif',
-    label: 'Arial',
-    type: 'english',
-  },
-  {
-    value: 'League',
-    label: '拼音',
-    type: 'pinyin',
-  },
-  {
-    value: '楷体,微软雅黑',
-    label: '楷体',
-    type: 'chinese',
-  },
-  {
-    value: '黑体,微软雅黑',
-    label: '黑体',
-    type: 'chinese',
-  },
-  {
-    value: '宋体,微软雅黑',
-    label: '宋体',
-    type: 'chinese',
-  },
-];
+export const fontList = sharedFontList.map((font) => {
+  const value = font.value;
+  const type = value === 'League' ? 'pinyin' : value === 'Arial,Helvetica,sans-serif' ? 'english' : 'chinese';
+
+  return {
+    ...font,
+    type,
+  };
+});
 
 export const fontSizeList = [12, 14, 16, 18, 20, 22, 24, 26, 28, 30];
 
@@ -87,7 +70,7 @@ export function getInputProperty() {
     is_enable_auto_correct: true, // 自动修正
     model: modelList[0].value, // 模式
     input_style: inputStyleList[0].value, // 输入框样式
-    font: fontList[1].value, // 字体
+    font: fontList.find(({ type }) => type === 'pinyin')?.value || fontList[0].value, // 字体
     font_size: fontSizeList[3], // 字体大小
     text_align: textAlignList[0].value, // 文本对齐方式
     text_color: '#1d2129', // 文本颜色