From 37a134bd23ec4b227a0e010b08a1a89c2bbaaa0d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 03 十一月 2020 17:10:14 +0800
Subject: [PATCH] 2020-11-03

---
 src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx b/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx
index 3fb2a8b..ddd5807 100644
--- a/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx
+++ b/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx
@@ -8,7 +8,7 @@
 
 const { MonthPicker, WeekPicker, RangePicker } = DatePicker
 
-const Card = ({ id, card, moveCard, copyCard, findCard, editCard, delCard, hasDrop }) => {
+const Card = ({ id, card, moveCard, copyCard, findCard, editCard, delCard }) => {
   const originalIndex = findCard(id).index
   const [{ isDragging }, drag] = useDrag({
     item: { type: 'search', id, originalIndex },
@@ -20,17 +20,15 @@
     accept: 'search',
     canDrop: () => true,
     drop: (item) => {
-      if (!item.hasOwnProperty('originalIndex')) {
-        hasDrop(card)
-      }
-    },
-    hover({ id: draggedId }) {
-      if (!draggedId) return
-      if (draggedId !== id) {
+      const { id: draggedId, originalIndex } = item
+      
+      if (originalIndex === undefined) {
+        item.dropTargetId = id
+      } else if (draggedId && draggedId !== id) {
         const { index: overIndex } = findCard(id)
         moveCard(draggedId, overIndex)
       }
-    },
+    }
   })
   const opacity = isDragging ? 0 : 1
 

--
Gitblit v1.8.0