Sfoglia il codice sorgente

增加全选功能

natasha 1 anno fa
parent
commit
1c4e2728a2
2 ha cambiato i file con 59 aggiunte e 18 eliminazioni
  1. 54 18
      src/components/Adult/Preview.vue
  2. 5 0
      src/components/Adult/preview/Ligature.vue

+ 54 - 18
src/components/Adult/Preview.vue

@@ -153,6 +153,7 @@
         {{ item.con }}
       </span>
     </div>
+    <el-checkbox v-if="previewType && previewType == 'previewCheck'" class="NNPE-Book-content-item-checkbox" :indeterminate="isIndeterminate" v-model="checkAllNPC" @change="handleCheckAllChangeNPC" style="margin:20px 0 0 10px">全选</el-checkbox>
     <div v-if="cur" class="NNPE-Book-content-inner">
       <div
         v-for="(item, index) in cur.cur_fn_data"
@@ -1055,6 +1056,8 @@ export default {
       judgeAnswersList: [],
       visiblePreviewDialog: false,
       titleChsFhList:[",", "”","。",":", "》", "?", "!", ";"],
+      checkAllNPC: false,
+      isIndeterminate: false
     };
   },
   computed: {},
@@ -1100,7 +1103,7 @@ export default {
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
-    console.log("2023-10-07");
+    console.log("2023-10-08");
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
@@ -1163,7 +1166,7 @@ export default {
     initContextData() {
       const _this = this;
       // _this.$root.isRecording = false;
-
+      _this.checkAllNPC = false
       _this.contextData = JSON.parse(JSON.stringify(_this.context));
       _this.queIndex = 0;
       _this.NNPENewWordList = [];
@@ -1484,31 +1487,50 @@ export default {
     submitPreviewGroupId() {
       return JSON.stringify(this.groupIndexList);
     },
-    forupdata(indexI) {
-      if (
-        this.groupIndexList
-          .toString()
-          .indexOf(this.cur.cur_fn_data[indexI].group_id.toString()) == -1
-      ) {
-        this.groupIndexList.push(this.cur.cur_fn_data[indexI].group_id);
-      } else {
-        this.groupIndexList.forEach((items, indexs) => {
-          if (
-            items.toString() == this.cur.cur_fn_data[indexI].group_id.toString()
-          ) {
-            this.groupIndexList.splice(indexs, 1);
-            return false;
-          }
-        });
+    forupdata(indexI,type) {
+      if(type==='all'){
+        this.groupIndexList = []
+        this.cur.cur_fn_data.forEach((item,index)=>{
+            this.groupIndexList.push(this.cur.cur_fn_data[index].group_id);
+        })
+      }else{
+        if (
+            this.groupIndexList
+            .toString()
+            .indexOf(this.cur.cur_fn_data[indexI].group_id.toString()) == -1
+        ) {
+            this.groupIndexList.push(this.cur.cur_fn_data[indexI].group_id);
+        } else {
+            this.groupIndexList.forEach((items, indexs) => {
+            if (
+                items.toString() == this.cur.cur_fn_data[indexI].group_id.toString()
+            ) {
+                this.groupIndexList.splice(indexs, 1);
+                return false;
+            }
+            });
+        }
       }
+      
       this.groupCheckList.forEach((item, index) => {
         this.groupCheckList[index] = false;
       });
+      if(type==='all'){
+
+      }else{
+        this.isIndeterminate = false
+      }
+      this.checkAllNPC = this.groupIndexList.length===this.cur.cur_fn_data.length
       this.cur.cur_fn_data.forEach((item, index) => {
         if (
           this.groupIndexList.toString().indexOf(item.group_id.toString()) > -1
         ) {
           this.groupCheckList[index] = true;
+          if(type==='all'){
+
+          }else{
+            this.isIndeterminate = true
+          }
         }
       });
       this.$forceUpdate();
@@ -1525,6 +1547,17 @@ export default {
       this.visiblePreviewDialog = true;
     //   this.submitUserAnswerNPC();
     },
+    handleCheckAllChangeNPC(val){
+        if(val){
+            this.forupdata('','all')
+        }else{
+            this.groupCheckList.forEach((item, index) => {
+                this.groupCheckList[index] = false;
+            });
+            this.groupIndexList = []
+            this.isIndeterminate = false;
+        }
+    }
   }, // 如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
@@ -1938,6 +1971,9 @@ export default {
 </style>
 <style lang="scss">
 .NNPE-Book-content-item-checkbox {
+  .el-checkbox__input.is-indeterminate .el-checkbox__inner::before{
+    top: 9px;
+  }
   .el-checkbox__inner {
     border: 2px solid #4a99ea;
     width: 24px;

+ 5 - 0
src/components/Adult/preview/Ligature.vue

@@ -46,6 +46,7 @@
                   v-if="
                     item.detail.wordsList.length > 0 || item.detail.sentence
                   "
+                  :style="{fontFamily:item.detail.sentence&&item.detail.wordsList.length===0&&/^[\u4e00-\u9fa5]/.test(item.detail.sentence)?'FZJCGFKTK':'',fontSize:item.detail.sentence&&item.detail.wordsList.length===0&&/^[\u4e00-\u9fa5]/.test(item.detail.sentence)?'20px':''}"
                 >
                   <!-- 大于0就说明分词了 -->
                   <template v-if="item.detail.wordsList.length > 0">
@@ -187,6 +188,7 @@
                   v-if="
                     item.detail.wordsList.length > 0 || item.detail.sentence
                   "
+                  :style="{fontFamily:item.detail.sentence&&item.detail.wordsList.length===0&&/^[\u4e00-\u9fa5]/.test(item.detail.sentence)?'FZJCGFKTK':'',fontSize:item.detail.sentence&&item.detail.wordsList.length===0&&/^[\u4e00-\u9fa5]/.test(item.detail.sentence)?'20px':''}"
                 >
                   <!-- 大于0就说明分词了 -->
                   <template v-if="item.detail.wordsList.length > 0">
@@ -976,6 +978,9 @@ export default {
             margin-right: 8px;
           }
           div {
+            font-size: 16px;
+            line-height: 150%;
+            color: #000000;
             img {
               max-width: 238px;
               height: 158px;