From 5acf36216b6dc227664e3b35a552cb50c9f87b44 Mon Sep 17 00:00:00 2001 From: wangdong <1551135706@qq.com> Date: Sun, 16 Jun 2024 14:03:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/upload.js | 6 +++--- pages/squareDynamic/index.vue | 4 ++-- pages/squareDynamic/publish.vue | 4 ++-- utils/request/upload/utils.js | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/api/upload.js b/api/upload.js index 60aee8d..619c0d3 100644 --- a/api/upload.js +++ b/api/upload.js @@ -7,11 +7,11 @@ const api = { // 图片上传 export const image = (files, checkLogin = true) => { - // 文件上传大小, 2M - const maxSize = 1024 * 1024 * 2 + // 文件上传大小, 5M + const maxSize = 1024 * 1024 * 5 // 执行上传 return new Promise((resolve, reject) => { - request.urlFileUpload({ name: 'file', files, maxSize, data: { test: 123, checkLogin: Number(checkLogin) } }) + request.urlFileUpload({ name: 'file', files, maxSize, data: { filename: files[0].name, test: 123, checkLogin: Number(checkLogin) } }) .then(result => resolve(result.map(item => item.data.fileInfo.file_id), result)) .catch(reject) }) diff --git a/pages/squareDynamic/index.vue b/pages/squareDynamic/index.vue index a14db9c..9233ea6 100644 --- a/pages/squareDynamic/index.vue +++ b/pages/squareDynamic/index.vue @@ -285,9 +285,9 @@   })   return Promise.all(tasks) }, - previewFile() { + previewFile(url) { uni.downloadFile({ -       url: 'https://www.royaum.com.cn/static/test/test.xls', +       url,       success: (res) => {         if (res.statusCode === 200) { this.isPreview = true; diff --git a/pages/squareDynamic/publish.vue b/pages/squareDynamic/publish.vue index 7384366..658678c 100644 --- a/pages/squareDynamic/publish.vue +++ b/pages/squareDynamic/publish.vue @@ -8,10 +8,10 @@ - + 添加照片 - 最多5张 + 最多9张 diff --git a/utils/request/upload/utils.js b/utils/request/upload/utils.js index ce5004e..8a8aa02 100644 --- a/utils/request/upload/utils.js +++ b/utils/request/upload/utils.js @@ -272,6 +272,7 @@ export const urlUpload = function(requestInfo, dataFactory) { if (requestInfo.data) { config.formData = requestInfo.data; } + console.log(config); const uploadTask = uni.uploadFile(config); uploadTask.onProgressUpdate(res => { requestInfo.onProgressUpdate && requestInfo.onProgressUpdate(Object.assign({}, fileData, res));