From d59f518f466274b2caeb2e01c10c92deafe7c93b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 09 二月 2022 11:48:29 +0800 Subject: [PATCH] 2022-02-09 --- src/components/editor/index.jsx | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/editor/index.jsx b/src/components/editor/index.jsx index f4d856c..dae66f6 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,21 +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 - } else if (this.props.defaultValue) { - initVal = this.props.defaultValue || 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 } } @@ -71,7 +72,7 @@ if (encryption === 'true') { try { val = window.btoa(window.encodeURIComponent(val)) - } catch { + } catch (e) { val = editorState.toHTML() } } @@ -93,6 +94,7 @@ form.append('shardingCnt', _param.chunks) form.append('shardingNo', _param.chunk) form.append('LoginUID', sessionStorage.getItem('LoginUID') || '') + form.append('UserID', sessionStorage.getItem('UserID') || '') Api.getLargeFileUpload(form).then(res => { if (res.status) { -- Gitblit v1.8.0