| | |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | let Url = '/Upload' |
| | | if (process.env.NODE_ENV === 'production') { |
| | | Url = document.location.origin + '/' + window.GLOB.service + 'zh-CN/Home/Upload' |
| | | } |
| | | // let Url = '/Upload' |
| | | // if (process.env.NODE_ENV === 'production') { |
| | | // Url = document.location.origin + '/' + window.GLOB.service + 'zh-CN/Home/Upload' |
| | | // } |
| | | |
| | | let service = '' |
| | | if (process.env.NODE_ENV === 'production') { |
| | |
| | | } |
| | | |
| | | state = { |
| | | baseUrl: Url, |
| | | percent: 0, |
| | | showprogress: false |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | getExtraData = () => { |
| | | return { |
| | | RootPath: 'Content/images/upload/' |
| | | } |
| | | } |
| | | // getExtraData = () => { |
| | | // return { |
| | | // RootPath: 'Content/images/upload/' |
| | | // } |
| | | // } |
| | | |
| | | shardupload = (params) => { |
| | | let param = params.chunks.shift() |
| | |
| | | |
| | | render() { |
| | | const { value, maxFile, fileType } = this.props |
| | | const { showprogress, percent, baseUrl } = this.state |
| | | const { showprogress, percent } = this.state |
| | | |
| | | let uploadable = '' |
| | | let uploadable = 'fileupload-form-container ' |
| | | |
| | | if (maxFile && maxFile > 0 && value && value.length >= maxFile) { |
| | | uploadable = 'limit-fileupload' |
| | | uploadable += 'limit-fileupload' |
| | | } |
| | | |
| | | const props = { |
| | |
| | | disabled: showprogress, |
| | | listType: fileType, |
| | | fileList: value, |
| | | action: baseUrl, |
| | | action: null, |
| | | method: 'post', |
| | | multiple: false, |
| | | onChange: this.onChange, |
| | | onRemove: this.onRemove, |
| | | data: this.getExtraData, |
| | | // data: this.getExtraData, |
| | | beforeUpload: this.beforeUpload, |
| | | className: uploadable |
| | | } |