限制图片大小

This commit is contained in:
姜棚 2022-01-24 17:59:35 +08:00
parent 7497c203f1
commit 074ef8f1cf
6 changed files with 14 additions and 1 deletions

View File

@ -1345,6 +1345,7 @@ export default class acclist extends React.Component{
className="td-image-upload-demo" className="td-image-upload-demo"
maxSize={5 * 1024 * 1024} maxSize={5 * 1024 * 1024}
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
onChange={(e)=>{this.onUploadChange1(e,rowData)}} onChange={(e)=>{this.onUploadChange1(e,rowData)}}
onUpload={this.onUpload} onUpload={this.onUpload}
defaultFileList={[{'src':rowData.show_url}]} defaultFileList={[{'src':rowData.show_url}]}
@ -1363,6 +1364,7 @@ export default class acclist extends React.Component{
onUpload={this.onUpload} onUpload={this.onUpload}
defaultFileList={ rowData.describe_url ? [{'src':rowData.describe_url}] : null} defaultFileList={ rowData.describe_url ? [{'src':rowData.describe_url}] : null}
value={rowData.describe_url} value={rowData.describe_url}
onError={this.onUploadError}
/> />
} }
if(com == "edit") if(com == "edit")

View File

@ -635,7 +635,7 @@ componentDidMount() {
maxSize={2 * 1024 * 1024} maxSize={2 * 1024 * 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
onChange={(e)=>{this.onUploadChange(e)}} onChange={(e)=>{this.onUploadChange(e)}}
onUpload={this.onUpload} onUpload={this.onUpload}
fileList={this.state.model.show_url ? [{'src':this.state.model.show_url}] : null} fileList={this.state.model.show_url ? [{'src':this.state.model.show_url}] : null}
@ -652,6 +652,7 @@ componentDidMount() {
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={9} maxAmount={9}
sortable sortable
onError={this.onUploadError}
defaultFileList={this.state.model.describe_url } defaultFileList={this.state.model.describe_url }
multiple multiple
onChange={(e)=>{this.onUploadChange3(e)}} onChange={(e)=>{this.onUploadChange3(e)}}
@ -664,6 +665,7 @@ componentDidMount() {
maxSize={2 * 1024 * 1024} maxSize={2 * 1024 * 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
fileList={this.state.model.detail_url ? [{'src':this.state.model.detail_url}] : null} fileList={this.state.model.detail_url ? [{'src':this.state.model.detail_url}] : null}
onChange={(e)=>{this.onUploadChange2(e)}} onChange={(e)=>{this.onUploadChange2(e)}}
/> />

View File

@ -530,6 +530,7 @@ export default class adduserinfo extends React.Component{
maxSize={2 * 1024 * 1024} maxSize={2 * 1024 * 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
onChange={(e)=>{this.onUploadChange(e)}} onChange={(e)=>{this.onUploadChange(e)}}
fileList={this.state.model.show_url ? [{'src':this.state.model.show_url}] : null} fileList={this.state.model.show_url ? [{'src':this.state.model.show_url}] : null}
value={this.state.model.show_url} value={this.state.model.show_url}
@ -542,6 +543,7 @@ export default class adduserinfo extends React.Component{
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={9} maxAmount={9}
sortable sortable
onError={this.onUploadError}
defaultFileList={this.state.model.describe_url } defaultFileList={this.state.model.describe_url }
multiple multiple
onUpload={this.onUpload} onUpload={this.onUpload}
@ -555,6 +557,7 @@ export default class adduserinfo extends React.Component{
maxSize={5 * 1024 * 1024} maxSize={5 * 1024 * 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
fileList={this.state.model.detail_url ? [{'src':this.state.model.detail_url}] : null} fileList={this.state.model.detail_url ? [{'src':this.state.model.detail_url}] : null}
onUpload={this.onUpload} onUpload={this.onUpload}
onChange={(e)=>{this.onUploadChange2(e)}} onChange={(e)=>{this.onUploadChange2(e)}}

View File

@ -260,6 +260,7 @@ export default class edittemplate extends React.Component{
sortable sortable
tips="单张图片不超过 5M" tips="单张图片不超过 5M"
onChange={(e)=>{this.onUploadChange(e)} } onChange={(e)=>{this.onUploadChange(e)} }
onError={this.onUploadError}
onUpload={this.onUpload} onUpload={this.onUpload}
defaultFileList={ this.state.model.top_image ? [{'src':this.state.model.top_image}] : null } defaultFileList={ this.state.model.top_image ? [{'src':this.state.model.top_image}] : null }
onError={this.onUploadError} onError={this.onUploadError}

View File

@ -308,6 +308,7 @@ export default class adduserinfo extends React.Component{
className="zent-image-upload-demo" className="zent-image-upload-demo"
maxSize={2 * 1024 * 1024} maxSize={2 * 1024 * 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
onError={this.onUploadError}
maxAmount={1} maxAmount={1}
onChange={(e)=>{this.onUploadChange(e)}} onChange={(e)=>{this.onUploadChange(e)}}
onUpload={this.onUpload} onUpload={this.onUpload}
@ -320,6 +321,7 @@ export default class adduserinfo extends React.Component{
maxSize={2 * 1024* 1024} maxSize={2 * 1024* 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
onChange={(e)=>{this.onUploadChange1(e)}} onChange={(e)=>{this.onUploadChange1(e)}}
onUpload={this.onUpload} onUpload={this.onUpload}
value={this.state.model.describe_url} value={this.state.model.describe_url}

View File

@ -583,6 +583,7 @@ export default class adduserinfo extends React.Component{
maxSize={5 * 1024 * 1024} maxSize={5 * 1024 * 1024}
tips="建议尺寸 30*30图片不超过 20KB" tips="建议尺寸 30*30图片不超过 20KB"
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
onChange={(e)=>{this.onUploadChange(e)}} onChange={(e)=>{this.onUploadChange(e)}}
fileList={this.state.model.show_url ? [{'src':this.state.model.show_url}] : null} fileList={this.state.model.show_url ? [{'src':this.state.model.show_url}] : null}
@ -599,6 +600,7 @@ export default class adduserinfo extends React.Component{
maxSize={2 * 1024 * 1024} maxSize={2 * 1024 * 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={9} maxAmount={9}
onError={this.onUploadError}
onChange={(e)=>{this.onUploadChange3(e)}} onChange={(e)=>{this.onUploadChange3(e)}}
sortable sortable
defaultFileList={this.state.model.describe_url } defaultFileList={this.state.model.describe_url }
@ -614,6 +616,7 @@ export default class adduserinfo extends React.Component{
maxSize={2 * 1024 * 1024} maxSize={2 * 1024 * 1024}
tips="图片不超过 2M" tips="图片不超过 2M"
maxAmount={1} maxAmount={1}
onError={this.onUploadError}
fileList={this.state.model.detail_url ? [{'src':this.state.model.detail_url}] : null} fileList={this.state.model.detail_url ? [{'src':this.state.model.detail_url}] : null}
onUpload={this.onUpload} onUpload={this.onUpload}
onChange={(e)=>{this.onUploadChange2(e)}} onChange={(e)=>{this.onUploadChange2(e)}}