//拍摄
Shooting(){
// #ifdef APP-PLUS
var camera = plus.camera.getCamera(1);
var res = camera.supportedVideoResolutions[0];
var fmt = camera.supportedVideoFormats[0];
camera.captureImage(
function(path) {
if (path) {
uni.saveFile({
tempFilePath: path,
success: function(res) {
var savedFilePath = res.savedFilePath;
//将临时文件保存到本地
uni.saveImageToPhotosAlbum({
filePath: savedFilePath,
success: function() {
ShowToast('拍摄成功')
}
});
}
});
}
console.log('Capture image success: ' + path);
},
function(error) {
console.log('Capture image failed: ' + error.message);
//捕获图片失败
if (error.message) {
ShowToast('捕获图片失败')
}
},
{
resolution: res,
format: fmt
}
);
// #endif
// #ifdef MP-WEIXIN
//微信小程序 跳转到另外一个页面
uni.navigateTo({
url:'Shooting'
})
// #endif
},
最后修改:2020 年 07 月 19 日 12 : 15 AM
© 允许规范转载
1 条评论
非技术的路过。