From 2e2384bb96792ea5c87d7fd31f5ef493dcafef84 Mon Sep 17 00:00:00 2001
From: user1 <10901603+no-distractions1@user.noreply.gitee.com>
Date: 星期二, 25 六月 2024 17:26:52 +0800
Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout

---
 src/components/dragQuestion/index.vue |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/components/dragQuestion/index.vue b/src/components/dragQuestion/index.vue
index f8e81da..13fe8dc 100644
--- a/src/components/dragQuestion/index.vue
+++ b/src/components/dragQuestion/index.vue
@@ -193,6 +193,8 @@
       maxX: null,
       maxY: null,
       spaceList: [],
+      submitState:false,
+      isLift:false
     };
   },
   mounted() {
@@ -204,11 +206,13 @@
     // 3.闄愬埗榧犳爣鏉惧紑瑕佸湪绌烘牸鐨勮寖鍥村唴
     mousedown(e) {
       e.preventDefault();
+      if(this.submitState) return false
+      this.isLift = false
       console.log("榧犳爣鎸変笅", e);
       this.moveDom = e.toElement;
       this.parentDom = this.getParentWithClass(e.toElement, "question-box");
       this.questionIndex = this.parentDom.getAttribute("num");
-      this.getSpaceInfo(this.parentDom);
+      if(!this.spaceList.length) this.getSpaceInfo(this.parentDom);
       const parentInfo = this.parentDom.getBoundingClientRect();
       this.parentX = parentInfo.x;
       this.parentY = parentInfo.y;
@@ -236,6 +240,8 @@
               e.y >= item.minY &&
               e.y <= item.maxY
             ) {
+              if(!this.isLift) return false
+              this.spaceList = this.spaceList.filter(citem => citem !== item)
               this.$set(
                 this.drageQuestion[this.questionIndex].userAnswer,
                 index,
@@ -245,6 +251,7 @@
                 }
               );
               this.moveDom.style.display = "none";
+              this.moveDom = null;
             }
           }
         }
@@ -253,8 +260,11 @@
     // 榧犳爣鎶捣
     mouseup(e) {
       if (this.moveDom) {
-        this.moveDom = null;
+        // this.moveDom = null;
+        
       }
+      this.isLift = true
+    
     },
     // 鑾峰彇棰樼洰绌烘牸鍧愭爣
     getSpaceInfo(parentDom) {
@@ -263,10 +273,10 @@
       for (let index = 0; index < list.length; index++) {
         const itemInfo = list[index].getBoundingClientRect();
         arr.push({
-          minX: itemInfo.x,
-          maxX: itemInfo.x + itemInfo.width,
-          minY: itemInfo.y,
-          maxY: itemInfo.y + itemInfo.height,
+          minX: itemInfo.x -10,
+          maxX: itemInfo.x + itemInfo.width + 10,
+          minY: itemInfo.y - 2 ,
+          maxY: itemInfo.y + itemInfo.height + 2,
         });
       }
       this.spaceList = arr;
@@ -298,6 +308,7 @@
     },
     // 鎻愪氦
     submitData() {
+      this.submitState = true
       let arr = [];
       const data = this.drageQuestion;
       for (let index = 0; index < data.length; index++) {
@@ -306,13 +317,13 @@
           let citem = item.userAnswer[cindex];
           arr[cindex] = citem.value
         }
-        item.isRight = arr == item.answer
+        item.isRight = JSON.stringify(arr)  == JSON.stringify(item.answer)
         item.isComplete = true
       }
-      
       console.log(arr,this.drageQuestion[0]);
     },
     redio() {
+      this.submitState = false
       localStorage.removeItem(
         this.config.activeBook.name + "-drag-" + this.page
       );
@@ -396,6 +407,7 @@
   text-align: center;
   min-width: 60px !important;
   min-height: 15px !important;
+  text-indent: 0em;
 }
 .option-box {
   display: flex;
@@ -405,10 +417,12 @@
   cursor: pointer;
 }
 .stem {
+  text-indent: 2em;
   line-height: 2em;
 }
 .drag-bottom-btn {
   width: 100%;
+  margin-top: 40px;
   display: flex;
   flex-wrap: wrap;
   justify-content: center;
@@ -420,7 +434,7 @@
 }
 .analysis {
   margin: 20px 0;
-  width: 94%;
+  width: 100%;
   // margin-left: 12px;
 }
 .judge-icon {
@@ -463,9 +477,8 @@
           text-align: left;
           display: flex;
           span:nth-child(1) {
-            display: inline-block;
             text-indent: 0;
-            width: 82px;
+            width: 100px;
           }
         }
         .correctBox {
@@ -485,7 +498,7 @@
           color: #ee1818;
           span {
             height: min-content;
-            width: 100px;
+            width: 115px;
           }
           .errorBox {
             width: 100px;

--
Gitblit v1.9.1