| | |
| | | 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 |
| | |
| | | |
| | | 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 = () => { |
| | |
| | | _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%' |
| | | } |
| | |
| | | <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}> |