From 26d0fa42ea8c63a87e8ef93d0915f75f46fb1f9c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 24 三月 2022 11:09:53 +0800
Subject: [PATCH] 2022-03-24

---
 src/menu/components/share/sourcecomponent/inputform/index.jsx |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/menu/components/share/sourcecomponent/inputform/index.jsx b/src/menu/components/share/sourcecomponent/inputform/index.jsx
index 0312024..729dda2 100644
--- a/src/menu/components/share/sourcecomponent/inputform/index.jsx
+++ b/src/menu/components/share/sourcecomponent/inputform/index.jsx
@@ -2,6 +2,7 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { Input, Form, Row, Col, Pagination, Empty, Button, Modal, notification } from 'antd'
+import { PlusOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -27,7 +28,6 @@
     originlist: [],
     list: [],
     pagelist: [],
-    fileList: [],
     searchKey: '',
     pageSize: 12,
     pageIndex: 1,
@@ -49,7 +49,7 @@
       if (_form && _form.focus) {
         _form.focus()
       }
-    } catch {}
+    } catch (e) {}
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -64,14 +64,14 @@
       let videos = sessionStorage.getItem('app_videos')
       try {
         originlist = JSON.parse(videos)
-      } catch {
+      } catch (e) {
         originlist = []
       }
     } else {
       let pictures = sessionStorage.getItem('app_pictures')
       try {
         originlist = JSON.parse(pictures)
-      } catch {
+      } catch (e) {
         originlist = []
       }
     }
@@ -79,7 +79,7 @@
     let list = originlist
     let pagelist = list.filter((item, index) => index < this.state.pageSize)
 
-    this.setState({originlist, list, url: '', searchKey: '', pageIndex: 1, fileList: [], pagelist})
+    this.setState({originlist, list, url: '', searchKey: '', pageIndex: 1, pagelist})
   }
 
   changeSearch = () => {
@@ -100,12 +100,8 @@
     this.setState({pageIndex: page, pagelist})
   }
 
-  changeFile = (vals) => {
-    this.setState({fileList: vals})
-
-    if (vals && vals[0] && vals[0].status === 'done' && vals[0].response) {
-      this.setState({url: vals[0].response})
-    }
+  changeFile = (val) => {
+    this.setState({url: val})
   }
 
   selectItem = (item) => {
@@ -162,7 +158,7 @@
 
   render () {
     const { type, keyword } = this.props
-    const { list, url, pagelist, fileList, searchKey, pageIndex, pageSize, selectId, editvisible, card } = this.state
+    const { list, url, pagelist, searchKey, pageIndex, pageSize, selectId, editvisible, card } = this.state
     
     return (
       <div className="mk-source-pop-wrap">
@@ -170,12 +166,17 @@
           <TextArea id="source-input" value={url} rows={4} onChange={this.changeValue}/>
         </Form.Item> : null}
         {keyword === 'upload' ? <Form.Item label="涓婁紶" labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={{xs: { span: 24 }, sm: { span: 20 }}}>
-          <FileUpload value={fileList} onChange={this.changeFile} accept={type === 'video' ? '.mp4,.webm,.ogg' : '.jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp'} maxFile={1} fileType={type === 'video' ? 'text' : 'picture'} />
+          <FileUpload config={{
+            initval: '',
+            suffix: type === 'video' ? '.mp4,.webm,.ogg' : '.jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp,.ico',
+            maxfile: 1,
+            fileType: type === 'video' ? 'text' : 'picture'
+          }} onChange={this.changeFile} />
         </Form.Item> : null}
         {keyword === 'system' ?
           <Search value={searchKey} placeholder="" onChange={(e) => this.setState({searchKey: e.target.value})} onSearch={this.changeSearch} enterButton/> : null}
-        {keyword === 'system' ? <Button className="picture-plus mk-green" icon="plus" onClick={() => this.handleSource({typecharone: type})}>
-          娣诲姞
+        {keyword === 'system' ? <Button className="picture-plus mk-green" onClick={() => this.handleSource({typecharone: type})}>
+          <PlusOutlined /> 娣诲姞
         </Button> : null}
         {keyword === 'system' && list.length ?
           <Row gutter={16} style={{minHeight: '250px'}}>

--
Gitblit v1.8.0