Commit f5bdc007 authored by lxd's avatar lxd

feat: 文件上传

parent 13fcdac8
......@@ -12,12 +12,12 @@ export function renderModal() {
];
}
export function detailsModal() {
export function detailsModal(filePath) {
return [
<Button type="primary" key="cancel" onClick={() => this.handleCancel()}>
取消
</Button>,
<Button type="primary" onClick={() => this.handleDownload()} key="down">
<Button type="primary" href={filePath} target="_blank" key="down">
下载
</Button>,
];
......
......@@ -42,13 +42,6 @@ class toExamine extends Component {
});
};
handleDownload = () => {
const {
toExamineData: { url },
} = this.props;
window.open(url);
};
render() {
const {
form: { getFieldDecorator },
......@@ -63,7 +56,7 @@ class toExamine extends Component {
title={status === 1 ? '上传发票' : '查看发票'}
visible={visible}
onCancel={() => this.handleCancel()}
footer={status === 1 ? renderModal.call(this) : detailsModal.call(this)}
footer={status === 1 ? renderModal.call(this) : detailsModal.call(this, filePath)}
className={styles.textArea}
>
<Form className="login-form" {...formItemLayout}>
......
......@@ -54,7 +54,8 @@ class PicturesWall extends React.Component {
return;
}
const vm = this;
const observable = qiniu.upload(file, null, token);
const name = file.name + file.uid;
const observable = qiniu.upload(file, file.name, token);
const observer = {
next() {
// ...
......@@ -65,7 +66,7 @@ class PicturesWall extends React.Component {
},
complete(res) {
const comFile = file;
const url = `${qiniuHost}/${res.hash}`;
const url = `${qiniuHost}/${res.key}`;
comFile.url = url;
const list = vm.state.fileList;
list.push({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment