JLBA202505130001_关于吉林银行新建AI智能培训系统的需求_上传失败信息提示
This commit is contained in:
+4
-4
@@ -25,20 +25,20 @@ export const uploadFile = (file, data) => {
|
||||
name: 'file',
|
||||
formData: data,
|
||||
success(result) {
|
||||
console.log('result', result);
|
||||
try {
|
||||
const res = JSON.parse(result.data);
|
||||
if (res.rtnCode === '0000') {
|
||||
resolve(res.body);
|
||||
} else {
|
||||
reject(new Error(res.msg));
|
||||
reject(res.message);
|
||||
}
|
||||
} catch (error) {
|
||||
reject(new Error('Failed to parse response'));
|
||||
reject('上传失败!');
|
||||
}
|
||||
},
|
||||
fail(error) {
|
||||
console.log('error', error);
|
||||
reject(new Error('Upload failed'));
|
||||
reject('上传失败!');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,14 +113,12 @@
|
||||
}) => {
|
||||
const valid = tempFilePaths.every(url => {
|
||||
if (props.fileType.length === 0) return true;
|
||||
console.log(url);
|
||||
const lastDotIndex = url.lastIndexOf('.')
|
||||
if (lastDotIndex === -1) return false;
|
||||
const extension = url.slice(lastDotIndex + 1).split('?')[0].toLowerCase()
|
||||
return props.fileType.includes(extension)
|
||||
})
|
||||
if (!valid) return common.msg('您选择的图片格式有误。')
|
||||
console.log(valid)
|
||||
const data = {
|
||||
bizScen: 'S3005'
|
||||
}
|
||||
@@ -129,8 +127,8 @@
|
||||
fileList.push(...res.splice(0, props.limit - fileList.length))
|
||||
emits('update:modelValue', fileList.map(res => res.fileId))
|
||||
|
||||
}).catch(() => {
|
||||
|
||||
}).catch((err) => {
|
||||
common.msg(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user