mirror of
https://github.com/chowa/ejyy.git
synced 2026-01-21 05:07:48 +08:00
update chooseFile
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user