From 137fb8ea6af2789b3238b22bac31d80bced41dfe Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 28 七月 2021 11:39:39 +0800 Subject: [PATCH] 2021-07-28 --- src/menu/components/card/cardcellcomponent/dragaction/card.jsx | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx index 96b6549..9ee5976 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx @@ -11,13 +11,18 @@ import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' - +import { resetStyle } from '@/utils/utils-custom.js' import './index.scss' const BarCode = asyncComponent(() => import('@/components/barcode')) const QrCode = asyncComponent(() => import('@/components/qrcode')) const Video = asyncComponent(() => import('@/components/video')) const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent')) +const PicRadio = { + '4:3': '75%', '3:2': '66.67%', '16:9': '56.25%', '2:1': '50%', '3:1': '33.33%', '4:1': '25%', + '5:1': '20%', '6:1': '16.67%', '7:1': '14.29%', '8:1': '12.5%', '9:1': '11.11%', + '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%' +} const Card = ({ id, parent, fields, card, moveCard, findCard, editCard, delCard, copyCard, changeStyle, updateMarks, doubleClickCard }) => { const originalIndex = findCard(id).index @@ -45,6 +50,17 @@ if (card.style) { _style = {...card.style, opacity: isDragging ? 0 : 1} + _style = resetStyle(_style) + } + if (card.eleType === 'picture' && card.maxWidth) { + _style.maxWidth = card.maxWidth + let left = _style.marginLeft && _style.marginLeft !== '0px' ? _style.marginLeft : 'auto' + let right = _style.marginRight && _style.marginRight !== '0px' ? _style.marginRight : 'auto' + _style.margin = (_style.marginTop || 0) + ' ' + right + ' ' + (_style.marginBottom || 0) + ' ' + left + delete _style.marginLeft + delete _style.marginRight + delete _style.marginTop + delete _style.marginBottom } const getContent = () => { @@ -85,12 +101,8 @@ _imagestyle.borderRadius = card.style.borderRadius } - if (card.lenWidRadio === '16:9') { - _imagestyle.paddingTop = '56.25%' - } else if (card.lenWidRadio === '3:2') { - _imagestyle.paddingTop = '66.67%' - } else if (card.lenWidRadio === '4:3') { - _imagestyle.paddingTop = '75%' + if (PicRadio[card.lenWidRadio]) { + _imagestyle.paddingTop = PicRadio[card.lenWidRadio] } else { _imagestyle.paddingTop = '100%' } @@ -146,7 +158,7 @@ <Icon className="copy" title="澶嶅埗" type="copy" onClick={() => copyCard(id)} /> <Icon className="close" title="鍒犻櫎" type="close" onClick={() => delCard(id)} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={() => changeStyle(id)} type="font-colors" /> - {['text', 'number', 'slider'].includes(card.eleType) ? <MarkColumn columns={fields} type={card.eleType} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } + {['text', 'number', 'slider', 'sequence'].includes(card.eleType) ? <MarkColumn columns={fields} type={card.eleType} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } </div> } trigger="hover"> <div ref={node => drag(drop(node))} className={'ant-col card-cell ant-col-' + card.width}> -- Gitblit v1.8.0