use launchUpload with reactComponent

This commit is contained in:
simba
2020-06-10 17:06:26 +08:00
parent 9e99a5f30a
commit 9a0f787484
2 changed files with 6 additions and 15 deletions
+3 -3
View File
@@ -430,7 +430,7 @@ export default class Matter extends BaseEntity {
}
//文件上传
httpUpload(successCallback?: any, failureCallback?: any, processCallback?: any) {
httpUpload(successCallback?: any, failureCallback?: any) {
let that = this;
//验证是否装填好
@@ -475,7 +475,7 @@ export default class Matter extends BaseEntity {
that.errorMessage = response;
that.clear();
that.defaultErrorHandler(response);
SafeUtil.safeCallback(failureCallback)(response);
SafeUtil.safeCallback(failureCallback)();
},
function () {
that.loading = false;
@@ -499,7 +499,7 @@ export default class Matter extends BaseEntity {
(deltaSize / (deltaTime / 1000)).toFixed(0)
);
}
SafeUtil.safeCallback(processCallback)();
that.updateUI();
}
);
}
+3 -12
View File
@@ -164,7 +164,7 @@ export default class List extends TankComponent<IProps, IState> {
};
launchUpload = (file: any) => {
const m = new Matter();
const m = new Matter(this);
m.dir = false;
m.puuid = this.matter.uuid!;
m.userUuid = this.user.uuid!;
@@ -180,21 +180,12 @@ export default class List extends TankComponent<IProps, IState> {
}
}
m.file = file;
m.httpUpload(
() => {
this.refresh();
},
() => {
this.updateUI();
},
() => {
this.updateUI();
}
() => this.refresh(),
() => this.updateUI()
);
this.uploadMatters.push(m);
this.updateUI();
};
share = () => {