From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 26 四月 2022 19:23:18 +0800 Subject: [PATCH] 2022-04-26 --- src/menu/menushell/card.jsx | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/menu/menushell/card.jsx b/src/menu/menushell/card.jsx index 8195ed1..2331154 100644 --- a/src/menu/menushell/card.jsx +++ b/src/menu/menushell/card.jsx @@ -24,11 +24,14 @@ const NormalGroup = asyncComponent(() => import('@/menu/components/group/normal-group')) 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(), }), @@ -37,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) @@ -59,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}/>) @@ -77,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') { @@ -99,6 +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