Forráskód Böngészése

修改排序题的bug及修改富文本对应包的版本

秦鹏 3 éve
szülő
commit
c10c4a924f
2 módosított fájl, 33 hozzáadás és 28 törlés
  1. 3 3
      package.json
  2. 30 25
      src/components/Adult/preview/SentenceSortQP.vue

+ 3 - 3
package.json

@@ -14,7 +14,7 @@
         "test:ci": "npm run lint && npm run test:unit"
     },
     "dependencies": {
-        "@tinymce/tinymce-vue": "^3.2.8",
+        "@tinymce/tinymce-vue": "^3.2.2",
         "awe-dnd": "^0.3.4",
         "axios": "0.18.1",
         "core-js": "3.6.5",
@@ -29,7 +29,7 @@
         "nprogress": "0.2.0",
         "path-to-regexp": "2.4.0",
         "seededshuffle": "^0.2.0",
-        "tinymce": "^5.7.1",
+        "tinymce": "^5.3.1",
         "view-design": "^4.5.0",
         "vue": "2.6.10",
         "vue-element-utils": "^0.2.1",
@@ -80,4 +80,4 @@
         "npm": ">= 3.0.0"
     },
     "license": "MIT"
-}
+}

+ 30 - 25
src/components/Adult/preview/SentenceSortQP.vue

@@ -13,7 +13,6 @@
           :move="onMove"
           :options="{
             group: { name: 'itxst' + index, pull: 'clone' },
-            sort: true,
           }"
         >
           <transition-group>
@@ -41,6 +40,9 @@
             'px',
         }"
       >
+        <!-- 
+          :options="{ group: { name: 'itxst' + index, pull: false } }"
+       -->
         <draggable
           v-model="SortArr[index]"
           :group="'itxst' + index"
@@ -80,36 +82,39 @@ export default {
       drag: false,
       SortArr: [],
       moveId: null,
+      dragData: null,
     };
   },
   computed: {},
   watch: {},
   //方法集合
   methods: {
-    onStart() {
+    onStart(e, index) {
       this.drag = true;
+      this.dragData = JSON.parse(
+        JSON.stringify(this.curQue.option[index].detail.wordsList)
+      );
+      console.log(this.dragData);
     },
     //拖拽结束事件
     onEnd(e, index) {
       let _this = this;
       _this.drag = false;
       let newarr = [
-        ...new Set(
-          this.curQue.option[index].detail.wordsList.map((item) =>
-            JSON.stringify(item)
-          )
-        ),
+        ...new Set(this.SortArr[index].map((item) => JSON.stringify(item))),
       ];
       let arr = newarr.map((item) => JSON.parse(item));
+      this.curQue.option[index].detail.wordsList = JSON.parse(
+        JSON.stringify(this.dragData)
+      );
       //如果左边
-      if (arr.length == this.curQue.option[index].detail.wordsList.length) {
+      if (arr.length == this.SortArr[index].length) {
         return;
       }
-      this.curQue.option[index].detail.wordsList.splice(e.newDraggableIndex, 1);
+      this.SortArr[index].splice(e.newDraggableIndex, 1);
     },
-    onStart2(e) {
+    onStart2(e, index) {
       this.drag = true;
-      console.log(e);
     },
     //拖拽结束事件
     onEnd2(e, index) {
@@ -253,22 +258,22 @@ export default {
     }
   }
 }
-.NNPE-Big-Book-preview-green{
-    .sentenceSort {
-        .item-box{
-            b{
-                background: #24B99E;
-            }
-        }
+.NNPE-Big-Book-preview-green {
+  .sentenceSort {
+    .item-box {
+      b {
+        background: #24b99e;
+      }
     }
+  }
 }
-.NNPE-Big-Book-preview-brown{
-    .sentenceSort {
-        .item-box{
-            b{
-                background: #BD8865;
-            }
-        }
+.NNPE-Big-Book-preview-brown {
+  .sentenceSort {
+    .item-box {
+      b {
+        background: #bd8865;
+      }
     }
+  }
 }
 </style>