king
2023-08-17 c7aece35a62b6e91fd98a625bf0e53f64bfbd18d
src/components/editor/index.jsx
@@ -14,17 +14,10 @@
BraftEditor.use(Table())
let service = ''
if (process.env.NODE_ENV === 'production') {
  service = document.location.origin + '/' + window.GLOB.service
} else {
  service = window.GLOB.location + '/' + window.GLOB.service
}
class NormalEditor extends Component {
  static propTpyes = {
    Item: PropTypes.object,     // 表单元素
    onChange: PropTypes.func,   // 表单更新
    config: PropTypes.object,
    onChange: PropTypes.func
  }
  state = {
@@ -33,21 +26,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 +65,7 @@
      if (encryption === 'true') {
        try {
          val = window.btoa(window.encodeURIComponent(val))
        } catch {
        } catch (e) {
          val = editorState.toHTML()
        }
      }
@@ -86,13 +80,14 @@
    form.append('file', _param.binary)
    form.append('fileMd5', params.file.fileMd5)
    form.append('shardingMd5', _param.chunkMd5)
    form.append('baseDomain', service)
    form.append('baseDomain', window.GLOB.baseurl)
    form.append('rootPath', 'Content/images/upload/')
    form.append('fileName', params.file.fileName)
    form.append('fileExt', params.file.fileType)
    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) {