From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 01 九月 2021 10:31:45 +0800
Subject: [PATCH] 2021-09-01

---
 src/components/editor/index.jsx |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/components/editor/index.jsx b/src/components/editor/index.jsx
index 2c0bd2b..e18f2b8 100644
--- a/src/components/editor/index.jsx
+++ b/src/components/editor/index.jsx
@@ -23,8 +23,8 @@
 
 class NormalEditor extends Component {
   static propTpyes = {
-    Item: PropTypes.object,     // 琛ㄥ崟鍏冪礌
-    onChange: PropTypes.func,   // 琛ㄥ崟鏇存柊
+    config: PropTypes.object,
+    onChange: PropTypes.func
   }
 
   state = {
@@ -33,19 +33,22 @@
   }
 
   UNSAFE_componentWillMount () {
+    const { config, defaultValue } = this.props
     let initVal = null
     let encryption = 'false'
 
-    if (this.props['data-__meta']) {
-      initVal = this.props['data-__meta'].initialValue || null
+    if (config && config.initval) {
+      initVal = config.initval
+    } else if (defaultValue) {
+      initVal = defaultValue
     }
 
-    if (this.props.Item && this.props.Item.encryption === 'true') {
+    if (config && config.encryption === 'true') {
       encryption = 'true'
       if (initVal) {
         try {
           initVal = window.decodeURIComponent(window.atob(initVal))
-        } catch {
+        } catch (e) {
           initVal = this.props['data-__meta'].initialValue || null
         }
       }
@@ -69,7 +72,7 @@
       if (encryption === 'true') {
         try {
           val = window.btoa(window.encodeURIComponent(val))
-        } catch {
+        } catch (e) {
           val = editorState.toHTML()
         }
       }
@@ -90,6 +93,7 @@
     form.append('fileExt', params.file.fileType)
     form.append('shardingCnt', _param.chunks)
     form.append('shardingNo', _param.chunk)
+    form.append('LoginUID', sessionStorage.getItem('LoginUID') || '')
 
     Api.getLargeFileUpload(form).then(res => {
       if (res.status) {

--
Gitblit v1.8.0