king
2024-06-28 c8804ceb1fe2dea76f9949c5ea04423876ee2c81
src/pc/menushell/card.jsx
@@ -29,8 +29,11 @@
const Balcony = asyncComponent(() => import('@/menu/components/card/balcony'))
const CustomChart = asyncComponent(() => import('@/menu/components/chart/chart-custom'))
const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline'))
const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6'))
const Iframe = asyncComponent(() => import('@/menu/components/iframe'))
const DoubleDataCard = asyncComponent(() => import('@/menu/components/card/double-data-card'))
const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => {
const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => {
  const originalIndex = findCard(id).index
  const [{ isDragging }, drag] = useDrag({
    item: { type: 'menu', id, originalIndex },
@@ -66,24 +69,11 @@
  if (card.style && card.style.clear === 'left') {
    style.clear = 'left'
  } else if (card.style && card.style.clear === 'right') {
    style.float = 'right'
  }
  
  let col = ' ant-col ant-col-' + (card.width || 24)
  if (card.type === 'login') {
    let height = ''
    if (card.wrap && card.wrap.height) {
      // scaleview
      height = card.wrap.height.replace(/\d+vw/ig, (word) => {
        return parseFloat(word) * (window.GLOB.winWidth || 420) / 100 + 'px'
        // return parseFloat(word) * 350 / 100 + 'px'
      }).replace(/\d+vh/ig, (word) => {
        return parseFloat(word) * (window.GLOB.winHeight || 738) / 100 + 'px'
        // return parseFloat(word) * 615 / 100 + 'px'
      })
    }
    style.minHeight = height
  }
  const getCardComponent = () => {
    if (card.type === 'bar' || card.type === 'line') {
@@ -112,6 +102,8 @@
      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 === 'card' && card.subtype === 'dualdatacard') {
      return (<DoubleDataCard 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') {
@@ -123,7 +115,7 @@
    } else if (card.type === 'table' && card.subtype === 'editable') {
      return (<EditTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>)
    } else if (card.type === 'group' && card.subtype === 'normalgroup') {
      return (<NormalGroup group={card} updateConfig={updateConfig} deletecomponent={delCard}/>)
      return (<NormalGroup group={card} updateConfig={updateConfig} unGroup={unGroup} deletecomponent={delCard}/>)
    } else if (card.type === 'editor') {
      return (<BraftEditor card={card} updateConfig={updateConfig} deletecomponent={delCard}/>)
    } else if (card.type === 'code') {
@@ -136,6 +128,10 @@
      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 === 'antvG6') {
      return (<AntvG6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>)
    } else if (card.type === 'iframe') {
      return (<Iframe card={card} updateConfig={updateConfig} deletecomponent={delCard}/>)
    }
  }