| | |
| | | import BraftEditor from 'braft-editor' |
| | | import 'braft-editor/dist/index.css' |
| | | import 'braft-extensions/dist/table.css' |
| | | import 'braft-editor/dist/output.css' |
| | | // import 'braft-editor/dist/output.css' |
| | | import Table from 'braft-extensions/dist/table' |
| | | import SparkMD5 from 'spark-md5' |
| | | import moment from 'moment' |
| | |
| | | |
| | | class NormalEditor extends Component { |
| | | static propTpyes = { |
| | | card: PropTypes.object, // 条码设置 |
| | | value: PropTypes.any, // 条码值 |
| | | config: PropTypes.object, |
| | | onChange: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | editorState: '' |
| | | editorState: '', |
| | | encryption: 'false', |
| | | } |
| | | |
| | | 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 (config && config.encryption === 'true') { |
| | | encryption = 'true' |
| | | if (initVal) { |
| | | try { |
| | | initVal = window.decodeURIComponent(window.atob(initVal)) |
| | | } catch (e) { |
| | | initVal = this.props['data-__meta'].initialValue || null |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.setState({editorState: BraftEditor.createEditorState(initVal)}) |
| | | this.setState({ |
| | | editorState: BraftEditor.createEditorState(initVal), |
| | | encryption |
| | | }) |
| | | } |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | handleEditorChange = (editorState) => { |
| | | const { encryption } = this.state |
| | | |
| | | this.setState({ editorState }) |
| | | if (this.props.onChange) { |
| | | this.props.onChange(editorState.toHTML()) |
| | | let val = editorState.toHTML() |
| | | if (encryption === 'true') { |
| | | try { |
| | | val = window.btoa(window.encodeURIComponent(val)) |
| | | } catch (e) { |
| | | val = editorState.toHTML() |
| | | } |
| | | } |
| | | this.props.onChange(val) |
| | | } |
| | | } |
| | | |
| | |
| | | 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) { |