Sfoglia il codice sorgente

标签没有对应字段,不跟随样式调整调整

zq 1 settimana fa
parent
commit
8ab39dc164

+ 2 - 51
src/views/book/courseware/create/components/base/label/Label.vue

@@ -18,7 +18,7 @@
               v-else
               :key="'tag-' + i"
               closable
-              :style="getTagStyle(tag)"
+              :style="{ color: tag.color }"
               class="dynamic-tag"
               @close="handleClose(i)"
               @dblclick.native="handleEdit(i)"
@@ -406,55 +406,6 @@ export default {
           console.error(e);
         });
     },
-    // 样式调整
-    getTagStyle(tag) {
-      const style = { color: tag.color };
-
-      if (this.data.unified_attrib) {
-        if (this.data.unified_attrib.font_size) {
-          style['font-size'] = this.data.unified_attrib.font_size;
-        }
-        if (this.data.unified_attrib.font) {
-          style['font-family'] = this.data.unified_attrib.font;
-        }
-        // if (this.data.unified_attrib.text_color) {
-        //   style['color'] = this.data.unified_attrib.text_color;
-        // }
-        // if (this.data.unified_attrib.line_height) {
-        //   style['line-height'] = this.data.unified_attrib.line_height;
-        // }
-        if (this.data.unified_attrib.font_weight) {
-          style['font-weight'] = this.data.unified_attrib.font_weight;
-        }
-      }
-
-      return style;
-    },
-    setRichFormat(type, val) {
-      if (!this.data.unified_attrib) {
-        this.$set(this.data, 'unified_attrib', {});
-      }
-
-      switch (type) {
-        case 'fontSize':
-          this.$set(this.data.unified_attrib, 'font_size', val);
-          break;
-        case 'fontFamily':
-          this.$set(this.data.unified_attrib, 'font', val);
-          break;
-        // case 'color':
-        //   this.$set(this.data.unified_attrib, 'text_color', val);
-        //   break;
-        // case 'lineHeight':
-        //   this.$set(this.data.unified_attrib, 'line_height', parseFloat(val));
-        //   break;
-        case 'bold':
-          this.$set(this.data.unified_attrib, 'font_weight', val ? 'bold' : 'normal');
-          break;
-        default:
-          break;
-      }
-    },
   },
 };
 </script>
@@ -468,7 +419,7 @@ export default {
   :deep .el-tag {
     height: 32px;
     padding: 0 10px;
-    line-height: 31px;
+    line-height: 30px;
     color: var(--color1);
     background-color: #fff;
     border-color: var(--color1);

+ 2 - 26
src/views/book/courseware/preview/components/label/LabelPreview.vue

@@ -2,7 +2,7 @@
   <div class="label-preview" :style="getAreaStyle()">
     <SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
     <div class="main">
-      <el-tag v-for="(tag, i) in data.dynamicTags" :key="i" size="medium" :style="getTagStyle(tag)">
+      <el-tag v-for="(tag, i) in data.dynamicTags" :key="i" size="medium" :style="{ color: tag.color }">
         <span v-if="'ZH' == getLang()">
           {{ convertText(tag.name) }}
         </span>
@@ -29,31 +29,7 @@ export default {
       data: getLabelData(),
     };
   },
-  methods: {
-    getTagStyle(tag) {
-      const style = { color: tag.color };
-
-      if (this.data.unified_attrib) {
-        if (this.data.unified_attrib.font_size) {
-          style['font-size'] = this.data.unified_attrib.font_size;
-        }
-        if (this.data.unified_attrib.font) {
-          style['font-family'] = this.data.unified_attrib.font;
-        }
-        // if (this.data.unified_attrib.text_color) {
-        //   style['color'] = this.data.unified_attrib.text_color;
-        // }
-        // if (this.data.unified_attrib.line_height) {
-        //   style['line-height'] = this.data.unified_attrib.line_height;
-        // }
-        if (this.data.unified_attrib.font_weight) {
-          style['font-weight'] = this.data.unified_attrib.font_weight;
-        }
-      }
-
-      return style;
-    },
-  },
+  methods: {},
 };
 </script>