king
2022-08-06 cbeffcc0902631909c0373f274752a97ddaf2d4e
src/tabviews/zshare/mutilform/mkTextArea/index.jsx
@@ -1,9 +1,9 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Input } from 'antd'
import md5 from 'md5'
import MKEmitter from '@/utils/events.js'
import './index.scss'
const { TextArea } = Input
@@ -30,10 +30,12 @@
      if (_value) {
        try {
          _value = window.decodeURIComponent(window.atob(_value))
        } catch {
        } catch (e) {
          _value = config.initval
        }
      }
    } else if (config.encryption === 'md5') {
      encryption = 'md5'
    }
    
    this.setState({
@@ -59,6 +61,23 @@
      this.inputRef.current.focus()
    } else if (type === 'input') {
      this.setState({value})
      let _val = value
      if (this.state.encryption === 'true') {
        try {
          _val = window.btoa(window.encodeURIComponent(_val))
        } catch (e) {
          _val = value
        }
        this.props.onChange(_val)
      } else if (this.state.encryption === 'md5') {
        _val = _val + ''
        _val = md5(_val.toLowerCase())
        _val = _val.toUpperCase()
        this.props.onChange(_val)
      } else {
        this.props.onChange(_val, true)
      }
    }
  }
@@ -72,10 +91,14 @@
    if (encryption === 'true') {
      try {
        _val = window.btoa(window.encodeURIComponent(_val))
      } catch {
      } catch (e) {
        _val = val
      }
    } else if (encryption === 'md5') {
      _val = md5(_val.toLowerCase())
      _val = _val.toUpperCase()
    }
    this.props.onChange(_val)
  }