From 0eb129a9beddbb86ae74d7106a8e60823206b8d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 14 十二月 2023 11:29:15 +0800
Subject: [PATCH] 2023-12-14

---
 src/tabviews/zshare/fileupload/index.jsx |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/tabviews/zshare/fileupload/index.jsx b/src/tabviews/zshare/fileupload/index.jsx
index 704ea1e..ebf75f0 100644
--- a/src/tabviews/zshare/fileupload/index.jsx
+++ b/src/tabviews/zshare/fileupload/index.jsx
@@ -12,8 +12,9 @@
 
 class FileUpload extends Component {
   static propTpyes = {
-    config: PropTypes.object,  // 琛ㄥ崟淇℃伅
-    onChange: PropTypes.func,  // 琛ㄥ崟鍙樺寲
+    data: PropTypes.any,
+    config: PropTypes.object,
+    onChange: PropTypes.func,
   }
 
   state = {
@@ -31,7 +32,7 @@
   }
 
   UNSAFE_componentWillMount () {
-    const { config } = this.props
+    const { config, data } = this.props
 
     let filelist = []
     if (config.initval) {
@@ -56,6 +57,12 @@
           })
         } catch (e) {
           filelist = []
+        }
+
+        if (data && config.subFields && config.subFields.length === 1 && filelist.length === 1) {
+          if (data[config.subFields[0].field]) {
+            filelist[0].name = data[config.subFields[0].field]
+          }
         }
       }
     }
@@ -270,7 +277,7 @@
       percent: 0
     })
 
-    let file_name = file.name.replace(/\.{1}[^.]*$/ig, '')
+    let file_name = file.name
 
     if (compress === 'true' || compress === 'base64') {
       let reader = new FileReader()

--
Gitblit v1.8.0