Ver Fonte

有分数时重新计算行宽

natasha há 1 semana atrás
pai
commit
17fec5eac4

+ 24 - 1
src/views/book/courseware/preview/components/new_word/NewWordPreview.vue

@@ -1939,8 +1939,31 @@ export default {
       handler(val) {
         if (val) {
           // 如果有录音评分数据
+          let totalWidth = document.querySelector('.newWord-preview').clientWidth;
+          this.width = `${totalWidth - (this.data.property.sn_display_mode === 'true' ? 15 : 0) - 1}`;
+          this.rowWidth = 0;
+          this.data.col_width.forEach((item, index) => {
+            if (
+              this.data.property.pinyin_position &&
+              (this.data.property.pinyin_position === 'top' || this.data.property.pinyin_position === 'bottom')
+            ) {
+              if (index < 2) {
+                this.rowWidth = this.rowWidth > Number(item.value) ? this.rowWidth : Number(item.value);
+              } else {
+                this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
+              }
+            } else {
+              this.rowWidth += this.colHasContent[index] ? Number(item.value) : 0;
+            }
+          });
+          this.rowWidth += 180;
+          if (!(this.data.property.is_enable_score && this.data.property.is_enable_score === 'false')) {
+            // 有评分按钮
+            this.rowWidth += 50;
+          }
+          this.rowWidth += 88; // 加上评分分数的宽度
           if (this.rowWidth < this.width - 2) {
-            this.rowWidth += 88;
+            this.rowWidth = this.width - 2;
           }
         }
       },