king
2020-11-03 37a134bd23ec4b227a0e010b08a1a89c2bbaaa0d
src/templates/sharecomponent/searchcomponent/dragsearch/index.jsx
@@ -8,8 +8,6 @@
import './index.scss'
const Container = ({list, placeholder, handleList, handleMenu, deleteMenu }) => {
  let target = null
  const [cards, setCards] = useState(list)
  const moveCard = (id, atIndex) => {
    const { card, index } = findCard(id)
@@ -75,10 +73,6 @@
    handleList(_cards, copycard)
  }
  const hasDrop = (item) => {
    target = item
  }
  const [, drop] = useDrop({
    accept: 'search',
    drop(item) {
@@ -113,20 +107,19 @@
      
      newcard.match = _match
      
      let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
      if (target) {
        targetId = target.uuid
      let targetId = ''
      if (item.dropTargetId) {
        targetId = item.dropTargetId
        delete item.dropTargetId
      } else if (cards.length > 0) {
        targetId = cards[cards.length - 1].uuid
      }
      const { index: overIndex } = findCard(`${targetId}`)
      let targetIndex = overIndex
      targetIndex++
      const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
      const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] })
      handleList(_cards, newcard)
      target = null
    }
  })
@@ -142,7 +135,6 @@
            editCard={editCard}
            delCard={delCard}
            findCard={findCard}
            hasDrop={hasDrop}
          />
        </Col>
      ))}