From d62c168d0656fac4242581609c3c5c0d88cf6a48 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 29 一月 2021 18:03:47 +0800 Subject: [PATCH] 2021-01-29 --- src/menu/components/card/cardcellcomponent/elementform/index.jsx | 37 +++++++------------------------------ 1 files changed, 7 insertions(+), 30 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 4f1819e..7ffdfb7 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -4,16 +4,18 @@ 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'], @@ -356,22 +358,11 @@ </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, @@ -379,7 +370,7 @@ } ] })( - <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> @@ -396,20 +387,6 @@ 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({ -- Gitblit v1.8.0