Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增 chooseImage返回的参数添加source属性 #4707

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/platforms/app-plus/service/api/media/choose-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function chooseImage ({
function successCallback (paths) {
const tempFiles = []
const tempFilePaths = []
let source = "album";
Promise.all(paths.map((path) => getFileInfo(path)))
.then((filesInfo) => {
filesInfo.forEach((file, index) => {
Expand All @@ -49,13 +50,15 @@ export function chooseImage ({
invoke(callbackId, {
errMsg: 'chooseImage:ok',
tempFilePaths,
tempFiles
tempFiles,
source
})
})
.catch(errorCallback)
}

function openCamera () {
source = "camera";
const camera = plus.camera.getCamera()
camera.captureImage(path => successCallback([path]),
errorCallback, {
Expand All @@ -67,6 +70,7 @@ export function chooseImage ({
}

function openAlbum () {
source = "album";
plus.gallery.pick(({ files }) => successCallback(files), errorCallback, {
maximum: count,
multiple: true,
Expand Down