diff --git a/employee-mp/src/components/uploader/utils.js b/employee-mp/src/components/uploader/utils.js index 675b304..be1b2f6 100644 --- a/employee-mp/src/components/uploader/utils.js +++ b/employee-mp/src/components/uploader/utils.js @@ -37,22 +37,22 @@ export function isVideoFile(item) { return false; } function formatImage(res) { - return res.tempFiles.map(item => - Object.assign(Object.assign({}, pickExclude(item, ['path'])), { - type: 'image', - url: item.path, - thumb: item.path - }) - ); + return res.tempFiles.map(item => + Object.assign(Object.assign({}, pickExclude(item, ['tempFilePath'])), { + type: 'image', + url: item.tempFilePath, + thumb: item.tempFilePath + }) + ); } function formatVideo(res) { - return [ - Object.assign(Object.assign({}, pickExclude(res, ['tempFilePath', 'thumbTempFilePath', 'errMsg'])), { - type: 'video', - url: res.tempFilePath, - thumb: res.thumbTempFilePath - }) - ]; + return res.tempFiles.map(item => + Object.assign(Object.assign({}, pickExclude(item, ['tempFilePath', 'thumbTempFilePath', 'errMsg'])), { + type: 'image', + url: item.tempFilePath, + thumb: item.thumbTempFilePath + }) + ); } function formatMedia(res) { return res.tempFiles.map(item => @@ -74,7 +74,8 @@ export function chooseFile({ accept, multiple, capture, compressed, maxDuration, return new Promise((resolve, reject) => { switch (accept) { case 'image': - wx.chooseImage({ + wx.chooseMedia({ + mediaType: ['image'], count: multiple ? Math.min(maxCount, 9) : 1, sourceType: capture, sizeType, @@ -94,7 +95,8 @@ export function chooseFile({ accept, multiple, capture, compressed, maxDuration, }); break; case 'video': - wx.chooseVideo({ + wx.chooseMedia({ + mediaType: ['video'], sourceType: capture, compressed, maxDuration, diff --git a/ower-mp/src/components/uploader/utils.js b/ower-mp/src/components/uploader/utils.js index 675b304..be1b2f6 100644 --- a/ower-mp/src/components/uploader/utils.js +++ b/ower-mp/src/components/uploader/utils.js @@ -37,22 +37,22 @@ export function isVideoFile(item) { return false; } function formatImage(res) { - return res.tempFiles.map(item => - Object.assign(Object.assign({}, pickExclude(item, ['path'])), { - type: 'image', - url: item.path, - thumb: item.path - }) - ); + return res.tempFiles.map(item => + Object.assign(Object.assign({}, pickExclude(item, ['tempFilePath'])), { + type: 'image', + url: item.tempFilePath, + thumb: item.tempFilePath + }) + ); } function formatVideo(res) { - return [ - Object.assign(Object.assign({}, pickExclude(res, ['tempFilePath', 'thumbTempFilePath', 'errMsg'])), { - type: 'video', - url: res.tempFilePath, - thumb: res.thumbTempFilePath - }) - ]; + return res.tempFiles.map(item => + Object.assign(Object.assign({}, pickExclude(item, ['tempFilePath', 'thumbTempFilePath', 'errMsg'])), { + type: 'image', + url: item.tempFilePath, + thumb: item.thumbTempFilePath + }) + ); } function formatMedia(res) { return res.tempFiles.map(item => @@ -74,7 +74,8 @@ export function chooseFile({ accept, multiple, capture, compressed, maxDuration, return new Promise((resolve, reject) => { switch (accept) { case 'image': - wx.chooseImage({ + wx.chooseMedia({ + mediaType: ['image'], count: multiple ? Math.min(maxCount, 9) : 1, sourceType: capture, sizeType, @@ -94,7 +95,8 @@ export function chooseFile({ accept, multiple, capture, compressed, maxDuration, }); break; case 'video': - wx.chooseVideo({ + wx.chooseMedia({ + mediaType: ['video'], sourceType: capture, compressed, maxDuration,