From 40436544f55558d2c8d1c14c68cce79546c60dff Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 15 一月 2021 16:59:41 +0800
Subject: [PATCH] 2021-01-15

---
 src/templates/zshare/modalform/index.jsx             |    2 
 package-lock.json                                    |    6 +-
 src/mob/controller/index.jsx                         |    2 
 src/menu/stylecontroller/index.jsx                   |    2 
 src/tabviews/zshare/actionList/popupbutton/index.jsx |    2 
 src/components/editor/index.scss                     |    0 
 src/templates/zshare/formconfig.jsx                  |    9 ++++
 src/components/editor/index.jsx                      |   41 ++++++++++++++++++++
 src/tabviews/zshare/mutilform/index.jsx              |   12 ++++--
 src/mob/contupdate/index.jsx                         |    2 
 package.json                                         |    2 
 src/tabviews/zshare/fileupload/index.jsx             |   25 ++++++++++++
 src/menu/bgcontroller/index.jsx                      |    2 
 13 files changed, 92 insertions(+), 15 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index ed3e7c8..20b5512 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4201,9 +4201,9 @@
       }
     },
     "braft-extensions": {
-      "version": "0.1.0",
-      "resolved": "https://registry.npmjs.org/braft-extensions/-/braft-extensions-0.1.0.tgz",
-      "integrity": "sha512-i7/GjJY2FCJUKqdHiFeohasWQvY1BMK1BU4KGDZo+K+d3i55sIsiBmmRRDrOazDLWBVqYi1rBu2uqFQvxJu1jw==",
+      "version": "0.1.1",
+      "resolved": "https://registry.npmjs.org/braft-extensions/-/braft-extensions-0.1.1.tgz",
+      "integrity": "sha512-lmqGA6TIMqejQfeQ5NvqNsD+pbyqJjWPh6CMcRL2hKd+3yo5Oc9dv6uTWx+f8ICnxXJEs6LZHYOA58zcP2cnJQ==",
       "requires": {
         "@babel/runtime": "^7.0.0",
         "braft-convert": "^2.1.10",
diff --git a/package.json b/package.json
index a913b5b..0e71613 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
     "babel-plugin-named-asset-import": "^0.3.3",
     "babel-preset-react-app": "9.0.0",
     "braft-editor": "^2.3.9",
-    "braft-extensions": "^0.1.0",
+    "braft-extensions": "^0.1.1",
     "browserslist": "^4.13.0",
     "camelcase": "^5.2.0",
     "caniuse-lite": "^1.0.30001102",
diff --git a/src/components/editor/index.jsx b/src/components/editor/index.jsx
new file mode 100644
index 0000000..58bfb60
--- /dev/null
+++ b/src/components/editor/index.jsx
@@ -0,0 +1,41 @@
+import React, {Component} from 'react'
+import PropTypes from 'prop-types'
+import { is, fromJS } from 'immutable'
+import 'braft-editor/dist/index.css'
+import 'braft-extensions/dist/table.css'
+import BraftEditor from 'braft-editor'
+import Table from 'braft-extensions/dist/table'
+
+import './index.scss'
+
+BraftEditor.use(Table())
+
+class NormalEditor extends Component {
+  static propTpyes = {
+    card: PropTypes.object,  // 鏉$爜璁剧疆
+    value: PropTypes.any,    // 鏉$爜鍊�
+  }
+
+  shouldComponentUpdate (nextProps, nextState) {
+    return !is(fromJS(this.props), fromJS(nextProps))
+  }
+
+  handleEditorChange = () => {
+
+  }
+
+  submitContent = () => {
+
+  }
+
+  render() {
+
+    return (
+      <div className="normal-braft-editor">
+        <BraftEditor value={'<p></p>'} onChange={this.handleEditorChange} onSave={this.submitContent}/>
+      </div>
+    )
+  }
+}
+
+export default NormalEditor
\ No newline at end of file
diff --git a/src/components/editor/index.scss b/src/components/editor/index.scss
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/components/editor/index.scss
diff --git a/src/menu/bgcontroller/index.jsx b/src/menu/bgcontroller/index.jsx
index 6e525f2..bb8b043 100644
--- a/src/menu/bgcontroller/index.jsx
+++ b/src/menu/bgcontroller/index.jsx
@@ -116,7 +116,7 @@
             <ColorSketch value={backgroundColor} onChange={this.changeBackgroundColor} />
           </Form.Item>
           <Form.Item colon={false} label="鍥剧墖">
-            <FileUpload value={bgimages} maxFile={2} fileType="text" onChange={this.imgChange}/>
+            <FileUpload accept=".jpg,.png,.gif,.svg" value={bgimages} maxFile={2} fileType="text" onChange={this.imgChange}/>
             <Input placeholder="" value={backgroundImage} autoComplete="off" onChange={this.changeImage}/>
           </Form.Item>
         </Form>
diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx
index dd478b6..fff73bc 100644
--- a/src/menu/stylecontroller/index.jsx
+++ b/src/menu/stylecontroller/index.jsx
@@ -415,7 +415,7 @@
                     label={<Icon title="鑳屾櫙鍥剧墖" type="picture" />}
                     labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
                   >
-                    <FileUpload value={bgimages} maxFile={2} fileType="text" onChange={this.imgChange}/>
+                    <FileUpload accept=".jpg,.png,.gif,.svg" value={bgimages} maxFile={2} fileType="text" onChange={this.imgChange}/>
                     <Input placeholder="" value={backgroundImage} autoComplete="off" onChange={this.changeBackgroundImageInput} />
                   </Form.Item>
                 </Col> : null}
diff --git a/src/mob/controller/index.jsx b/src/mob/controller/index.jsx
index 104a1b0..603c459 100644
--- a/src/mob/controller/index.jsx
+++ b/src/mob/controller/index.jsx
@@ -375,7 +375,7 @@
                   label={<Icon title="鑳屾櫙鍥剧墖" type="picture" />}
                   labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} }
                 >
-                  <FileUpload value={bgimages} maxFile={2} fileType="text" onChange={this.imgChange}/>
+                  <FileUpload accept=".jpg,.png,.gif,.svg" value={bgimages} maxFile={2} fileType="text" onChange={this.imgChange}/>
                   <Input placeholder="" value={backgroundImage} autoComplete="off" onBlur={this.submitBackgroundImage} onPressEnter={this.submitBackgroundImage} onChange={this.changeBackgroundImageInput} />
                 </Form.Item>
               </Col>
diff --git a/src/mob/contupdate/index.jsx b/src/mob/contupdate/index.jsx
index 5076c1d..8ec6f08 100644
--- a/src/mob/contupdate/index.jsx
+++ b/src/mob/contupdate/index.jsx
@@ -110,7 +110,7 @@
         {deletable !== false ? <Icon type="delete" onClick={this.deleteElement} /> : null}
         <Popover content={
           <div>
-            {element.eleType === 'img' ? <FileUpload value={images} maxFile={1} fileType="text" onChange={this.imgChange}/> : null}
+            {element.eleType === 'img' ? <FileUpload accept=".jpg,.png,.gif,.svg" value={images} maxFile={1} fileType="text" onChange={this.imgChange}/> : null}
             {getFieldDecorator('content', {
               initialValue: element.content
             })(element.eleType !== 'textarea' ?
diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx
index 84db3ce..8baae5f 100644
--- a/src/tabviews/zshare/actionList/popupbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx
@@ -185,7 +185,7 @@
         <Modal
           className={'popview-modal ' + (btn.$type === 'CustomPage' ? 'custom-popview' : '')}
           title={btn.label}
-          width={'80vw'}
+          width={'85vw'}
           maskClosable={false}
           visible={this.state.visible}
           onCancel={this.popclose}
diff --git a/src/tabviews/zshare/fileupload/index.jsx b/src/tabviews/zshare/fileupload/index.jsx
index 7578173..925ef09 100644
--- a/src/tabviews/zshare/fileupload/index.jsx
+++ b/src/tabviews/zshare/fileupload/index.jsx
@@ -18,6 +18,7 @@
 class FileUpload extends Component {
   static propTpyes = {
     value: PropTypes.array,    // 鏂囦欢鏁扮粍
+    accept: PropTypes.any,     // 鏂囦欢鏍煎紡
     maxFile: PropTypes.any,    // 鏈�澶ф枃浠舵暟
     fileType: PropTypes.string // 鏂囦欢鏄剧ず绫诲瀷
   }
@@ -122,6 +123,27 @@
   }
 
   beforeUpload = (file) => {
+    const { accept } = this.props
+
+    if (accept && file.name) {
+      let types = accept.split(',')
+      let pass = false
+      types.forEach(type => {
+        if (new RegExp(type + '$', 'ig').test(file.name)) {
+          pass = true
+        }
+      })
+      
+      if (!pass) {
+        notification.warning({
+          top: 92,
+          message: '鏂囦欢鏍煎紡閿欒锛�',
+          duration: 5
+        })
+        return
+      }
+    }
+
     this.setState({
       showprogress: true,
       percent: 0
@@ -231,7 +253,7 @@
   }
 
   render() {
-    const { value, maxFile, fileType } = this.props
+    const { value, maxFile, fileType, accept } = this.props
     const { showprogress, percent } = this.state
 
     let uploadable = 'fileupload-form-container '
@@ -246,6 +268,7 @@
       listType: fileType,
       fileList: value,
       action: null,
+      accept: accept || '',
       method: 'post',
       multiple: false,
       onChange: this.onChange,
diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index fe4286e..ce1485e 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -8,15 +8,17 @@
 import options from '@/store/options.js'
 import { formRule } from '@/utils/option.js'
 import Utils from '@/utils/utils.js'
-import CustomSwitch from './customSwitch'
 import asyncComponent from '@/utils/asyncComponent'
-import CheckCard from './checkCard'
 import './index.scss'
 
-const {MonthPicker} = DatePicker
+const { MonthPicker } = DatePicker
 const { TextArea } = Input
+
+const CheckCard = asyncComponent(() => import('./checkCard'))
+const CustomSwitch = asyncComponent(() => import('./customSwitch'))
 const FileUpload = asyncComponent(() => import('../fileupload'))
 const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
+// const Editor = asyncComponent(() => import('@/components/editor'))
 
 class MainSearch extends Component {
   static propTpyes = {
@@ -1122,7 +1124,7 @@
                   }
                 ]
               })(
-                <FileUpload maxFile={item.maxfile} fileType={item.fileType || 'text'} />
+                <FileUpload accept={item.suffix} maxFile={item.maxfile} fileType={item.fileType || 'text'} />
               )}
             </Form.Item>
           </Col>
@@ -1341,6 +1343,7 @@
               return item
             })
           }
+
           resolve(search)
         } else {
           reject(err)
@@ -1370,6 +1373,7 @@
     return (
       <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="main-form-box">
         <Row className={'cols' + cols} gutter={24}>{this.getFields()}</Row>
+        {/* <Editor /> */}
       </Form>
     )
   }
diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index 4fa1db2..65a1932 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -2318,6 +2318,15 @@
       }]
     },
     {
+      type: 'text',
+      key: 'suffix',
+      label: '鍚庣紑鍚�',
+      tooltip: '鍙互涓婁紶鏂囦欢鐨勫悗缂�鍚嶏紝澶氫釜绫诲瀷鐢ㄩ�楀彿鍒嗛殧锛岀┖鍊兼椂涓嶆牎楠屻��',
+      initVal: card.suffix || '',
+      required: false,
+      readonly: false
+    },
+    {
       type: 'radio',
       key: 'encryption',
       label: '鍔犲瘑浼犺緭',
diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index 31e444f..1b9b8cf 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -22,7 +22,7 @@
   checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'linkSubField', 'fieldlength', 'display', 'tooltip', 'width', 'multiple'],
   multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'entireLine', 'tooltip'],
   link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkField', 'entireLine', 'tooltip', 'emptyText', 'enter'],
-  fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'entireLine', 'tooltip'],
+  fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'entireLine', 'tooltip', 'suffix'],
   switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'entireLine', 'tooltip'],
   date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'],
   datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'],

--
Gitblit v1.8.0