上传应答文件更改

This commit is contained in:
ygs
2025-07-23 15:24:12 +08:00
parent 354b7f3cad
commit 5b76717c10
2 changed files with 63 additions and 48 deletions

View File

@ -228,7 +228,10 @@ export default class ReactResumableJs extends React.Component {
// 更新文件队列表单
let strIndex = resumable.fileName.lastIndexOf(".")
let fileSuffix = resumable.fileName.substring(strIndex + 1, resumable.fileName.length)
if (this.props.fileAccept == ('.' + fileSuffix)) {
const allowedTypes = this.props.fileAccept.split(',').map(type => type.trim().toLowerCase());
// 判断文件后缀
// if (this.props.fileAccept == ('.' + fileSuffix)) {
if (allowedTypes.includes('.' + fileSuffix)) {
let _cache = this.state.fileList;
_cache.length = 0;
_cache.push({

View File

@ -273,7 +273,8 @@ const Index: React.FC<{}> = () => {
if (index == 'single') {
currentDate = val
setEndTime(new Date(val.endDate).getTime())
filetype = '.file'
// filetype = '.file'
filetype = '.rar,.zip,.doc,.docx,.xls,.xlsx,.pdf'
object = JSON.stringify(val)
path = '/' + val.createYear + '/' + val.tpId + '/' + val.sectionId + '/' + val.tdocId + '/uploadFile/' + val.tendererId
} else {
@ -346,21 +347,6 @@ const Index: React.FC<{}> = () => {
clearInterval(task);
} else {
if (switchBtn) {
getDecrypt(uuid).then((res) => {
if (res.code == 200) {
if (res.data.consumptionState == '2' || res.data.consumptionState == '4') {
if (res.data.stateMessage) {
message.error(res.data.stateMessage)
callback(cache.length - 1, res.data.stateMessage, 2);
} else {
message.error('验证错误,请刷新页面后重新上传!')
callback(cache.length - 1, "文件验证失败", 2);
}
switchBtn = false;
clearInterval(task);
return;
} else if (res.data.consumptionState == '3') {
message.success(res.data.stateMessage)
setTimeout(() => {
message.destroy()
}, 3000)
@ -369,11 +355,34 @@ const Index: React.FC<{}> = () => {
switchBtn = false;
clearInterval(task);
return;
} else {
callback(cache.length - 1, "文件验证中", test);
}
}
})
// getDecrypt(uuid).then((res) => {
// if (res.code == 200) {
// if (res.data.consumptionState == '2' || res.data.consumptionState == '4') {
// if (res.data.stateMessage) {
// message.error(res.data.stateMessage)
// callback(cache.length - 1, res.data.stateMessage, 2);
// } else {
// message.error('验证错误,请刷新页面后重新上传!')
// callback(cache.length - 1, "文件验证失败", 2);
// }
// switchBtn = false;
// clearInterval(task);
// return;
// } else if (res.data.consumptionState == '3') {
// message.success(res.data.stateMessage)
// setTimeout(() => {
// message.destroy()
// }, 3000)
// test = 100;
// callback(cache.length - 1, "文件验证成功", test);
// switchBtn = false;
// clearInterval(task);
// return;
// } else {
// callback(cache.length - 1, "文件验证中", test);
// }
// }
// })
}
}
}, 3000);
@ -416,7 +425,10 @@ const Index: React.FC<{}> = () => {
} else {
let strIndex = resumable.fileName.lastIndexOf(".")
let fileSuffix = resumable.fileName.substring(strIndex + 1, resumable.fileName.length)
if (('.' + fileSuffix) != fileT) {
// 判断文件类型
const fileTypes = fileT.split(',').map((type: string) => type.trim().toLowerCase());
// if (('.' + fileSuffix) != fileT) {
if (!fileTypes.includes('.' + fileSuffix)) {
message.error('请上传' + fileT + '类型的文件')
} else if (fileSuffix == 'file' && resumable.file.size > 200 * 1024 * 1024) {
message.error('文件最大为200MB')