mirror of https://github.com/openspug/spug
U 优化自定义发布申请数据上传体验
parent
d7a3e74db8
commit
52797d021e
|
@ -70,8 +70,6 @@ class Ext2Form extends React.Component {
|
||||||
handleUploadChange = (v) => {
|
handleUploadChange = (v) => {
|
||||||
if (v.fileList.length === 0) {
|
if (v.fileList.length === 0) {
|
||||||
this.setState({fileList: []})
|
this.setState({fileList: []})
|
||||||
} else {
|
|
||||||
this.setState({fileList: [v.file]})
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -81,7 +79,10 @@ class Ext2Form extends React.Component {
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
formData.append('deploy_id', store.record.deploy_id);
|
formData.append('deploy_id', store.record.deploy_id);
|
||||||
http.post('/api/deploy/request/upload/', formData)
|
http.post('/api/deploy/request/upload/', formData)
|
||||||
.then(res => file.path = res)
|
.then(res => {
|
||||||
|
file.path = res;
|
||||||
|
this.setState({fileList: [file]})
|
||||||
|
})
|
||||||
.finally(() => this.setState({uploading: false}))
|
.finally(() => this.setState({uploading: false}))
|
||||||
return false
|
return false
|
||||||
};
|
};
|
||||||
|
@ -113,7 +114,7 @@ class Ext2Form extends React.Component {
|
||||||
<Form.Item label="上传数据" help="通过数据传输动作来使用上传的文件。">
|
<Form.Item label="上传数据" help="通过数据传输动作来使用上传的文件。">
|
||||||
<Upload name="file" fileList={fileList} headers={{'X-Token': this.token}} beforeUpload={this.handleUpload}
|
<Upload name="file" fileList={fileList} headers={{'X-Token': this.token}} beforeUpload={this.handleUpload}
|
||||||
data={{deploy_id: info.deploy_id}} onChange={this.handleUploadChange}>
|
data={{deploy_id: info.deploy_id}} onChange={this.handleUploadChange}>
|
||||||
{fileList.length === 0 ? <Button loading={uploading}><Icon type="upload"/> 点击上传</Button> : null}
|
{fileList.length === 0 ? <Button loading={uploading} icon="upload">点击上传</Button> : null}
|
||||||
</Upload>
|
</Upload>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item required label="发布目标主机" help="通过点击主机名称自由选择本次发布的主机。">
|
<Form.Item required label="发布目标主机" help="通过点击主机名称自由选择本次发布的主机。">
|
||||||
|
|
Loading…
Reference in New Issue