From 316877c1d9e5b6d92334f30b03d97d7e833cd934 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 二月 2021 16:01:57 +0800
Subject: [PATCH] 2021-02-02

---
 src/menu/components/card/cardcellcomponent/elementform/index.jsx |   60 ++++++++++++++++++++----------------------------------------
 1 files changed, 20 insertions(+), 40 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
index 16aca5c..f3507e3 100644
--- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -1,19 +1,21 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Input, Select, Icon, Radio, Tooltip, InputNumber, notification } from 'antd'
+import { Form, Row, Col, Input, Select, Icon, Radio, Tooltip, InputNumber } 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'],
@@ -38,7 +40,6 @@
     link: ''
   }
 
-  
   UNSAFE_componentWillMount () {
     const { card, config } = this.props
     let _options = this.getOptions(card.eleType, card.datatype, card.link)
@@ -74,6 +75,8 @@
           } else if (card.eleType === 'number') {
             item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD')
           }
+        } else if (item.key === 'url') {
+          item.required = card.eleType !== 'qrcode'
         }
         if (item.key === 'linkurl') {
           item.type = card.link === 'dynamic' ? 'select' : 'text'
@@ -155,6 +158,8 @@
           } else if (value === 'number') {
             item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD')
           }
+        } else if (item.key === 'url') {
+          item.required = value !== 'qrcode'
         }
 
         return item
@@ -356,22 +361,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 +373,7 @@
                   }
                 ]
               })(
-                <FileUpload maxFile={item.maxfile} fileType={'text'} />
+                <SourceComponent type={this.state.eleType} />
               )}
             </Form.Item>
           </Col>
@@ -397,28 +391,14 @@
           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({
-              top: 92,
-              message: '灏氭湭娣诲姞鍥剧墖鎴栧浘鐗囦笂浼犲け璐ワ紝璇烽噸鏂版坊鍔狅紒',
-              duration: 5
-            })
-            return
-          }
+          // if (values.eleType === 'picture' && values.datatype === 'static' && !values.url) {
+          //   notification.warning({
+          //     top: 92,
+          //     message: '灏氭湭娣诲姞鍥剧墖鎴栧浘鐗囦笂浼犲け璐ワ紝璇烽噸鏂版坊鍔狅紒',
+          //     duration: 5
+          //   })
+          //   return
+          // }
 
           resolve(values)
         } else {

--
Gitblit v1.8.0