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));