From b6cbfb08b51e87e6eac995be8e7751815715e6a1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 29 三月 2022 15:36:21 +0800 Subject: [PATCH] 2022-03-29 --- src/menu/menushell/card.jsx | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/menu/menushell/card.jsx b/src/menu/menushell/card.jsx index 6f30721..2331154 100644 --- a/src/menu/menushell/card.jsx +++ b/src/menu/menushell/card.jsx @@ -25,11 +25,13 @@ const BraftEditor = asyncComponent(() => import('@/menu/components/editor/braft-editor')) const CodeSandbox = asyncComponent(() => import('@/menu/components/code/sandbox')) const CustomChart = asyncComponent(() => import('@/menu/components/chart/chart-custom')) +const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) +const Voucher = asyncComponent(() => import('@/menu/components/module/voucher')) const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ - item: { type: 'menu', id, originalIndex, floor: card.floor }, + item: { type: 'menu', id, originalIndex }, collect: monitor => ({ isDragging: monitor.isDragging(), }), @@ -38,10 +40,10 @@ accept: 'menu', canDrop: () => true, drop: (item) => { - const { id: draggedId, originalIndex, floor } = item + const { id: draggedId, originalIndex } = item if (originalIndex === undefined) { item.dropTargetId = id - } else if (draggedId && floor === card.floor) { + } else if (draggedId) { if (draggedId === id) return const { index: originIndex } = findCard(draggedId) @@ -60,7 +62,11 @@ } const getCardComponent = () => { - if (card.type === 'bar' || card.type === 'line') { + if (card.type === 'card' && card.subtype === 'datacard') { + return (<DataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'card' && card.subtype === 'propcard') { + return (<PropCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'bar' || card.type === 'line') { return (<AntvBar card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'search') { return (<MainSearch card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) @@ -78,10 +84,6 @@ return (<TabForm card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'tabs') { return (<AntvTabs tabs={card} updateConfig={updateConfig} deletecomponent={delCard}/>) - } else if (card.type === 'card' && card.subtype === 'datacard') { - return (<DataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) - } else if (card.type === 'card' && card.subtype === 'propcard') { - return (<PropCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'carousel' && card.subtype === 'datacard') { return (<CarouselDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'carousel' && card.subtype === 'propcard') { @@ -100,8 +102,12 @@ return (<CodeSandbox card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'balcony') { return (<Balcony card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'timeline') { + return (<Timeline card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'chart') { return (<CustomChart card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'module' && card.subtype === 'voucher') { + return (<Voucher card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } return ( -- Gitblit v1.8.0