| | |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, Tooltip, InputNumber, notification } from 'antd' |
| | | |
| | | import { formRule } from '@/utils/option.js' |
| | | import FileUpload from '@/tabviews/zshare/fileupload' |
| | | import ColorSketch from '@/mob/colorsketch' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) |
| | | |
| | | const cardTypeOptions = { |
| | | sequence: ['eleType', 'width'], |
| | | text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link'], |
| | | number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix'], |
| | | picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'link'], |
| | | video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay'], |
| | | video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop'], |
| | | icon: ['eleType', 'icon', 'datatype', 'width'], |
| | | slider: ['eleType', 'datatype', 'width', 'color', 'maxValue'], |
| | | splitline: ['eleType', 'color', 'width', 'borderWidth'], |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'file') { |
| | | let filelist = [] |
| | | if (item.initVal) { |
| | | filelist = [{ |
| | | uid: `1`, |
| | | name: item.initVal.slice(item.initVal.lastIndexOf('/') + 1), |
| | | status: 'done', |
| | | url: item.initVal, |
| | | origin: true |
| | | }] |
| | | } |
| | | |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: filelist, |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <FileUpload accept=".jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp,.mp4,.webm,.ogg" maxFile={item.maxfile} fileType={'text'} /> |
| | | <SourceComponent type={this.state.eleType} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | if (!err) { |
| | | values.uuid = this.props.card.uuid |
| | | values.marks = this.props.card.marks || null |
| | | |
| | | if (values.url) { |
| | | if (values.url.length > 0) { |
| | | if (values.url[0].origin && values.url[0].url) { |
| | | values.url = values.url[0].url |
| | | } else if (!values.url[0].origin && values.url[0].status === 'done' && values.url[0].response) { |
| | | values.url = values.url[0].response |
| | | } else { |
| | | values.url = '' |
| | | } |
| | | } else { |
| | | values.url = '' |
| | | } |
| | | } |
| | | |
| | | if (values.eleType === 'picture' && values.datatype === 'static' && !values.url) { |
| | | notification.warning({ |