This commit is contained in:
wangchengming 2025-08-20 13:29:29 +08:00
parent 2a50804e35
commit 304011be2b
3 changed files with 15 additions and 3 deletions

View File

@ -6,6 +6,7 @@ export function uploadFile(data) {
url: '/common/upload',
method: 'post',
data: data,
timeout: 300000, // 300秒 = 5分钟根据文件大小调整
headers: {
'Content-Type': 'multipart/form-data'
}

View File

@ -31,7 +31,7 @@
</div>
</div>
<el-upload action="#" class="noFileCard" :http-request="requestUpload" list-type="picture-card"
:file-list="fileList" multiple :on-change="handleChange" :show-file-list="false"
:file-list="cardfileList" :limit="1" :on-change="handleChange" :show-file-list="false"
:before-upload="beforeUpload">
<el-icon class="avatar-uploader-icon">
<Plus />
@ -70,6 +70,7 @@ const emit = defineEmits(['setFormFile'])
//
const fileList = ref([])
const cardfileList = ref([])
// 1- 2- 9-
const _fileType = ref('1')
const baseUrl = import.meta.env.VITE_APP_BASE_API
@ -135,6 +136,16 @@ const requestUpload = async (options) => {
size: res.size,
suffix: res.suffix
})
cardfileList.value = [{
id: undefined,
busSupplierId: undefined,
fileType: _fileType,
fileUrl: baseUrl + res.fileName,
fileName: res.fileName,
originalFileName: res.originalFilename,
size: res.size,
suffix: res.suffix
}]
emit('setFormFile', fileList.value)
}
} catch (error) {
@ -176,7 +187,7 @@ const beforeUpload = (file) => {
const handleChange = (file, files) => {
//
// fileList
// fileList.value = []
cardfileList.value = []
}
//
defineExpose({

View File

@ -17,7 +17,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: import.meta.env.VITE_APP_BASE_API,
// 超时
timeout: 300000
timeout: 10000
})
// request拦截器