saveImageToPhotos() {
let type = uni.getSystemInfoSync().platform;
let height = type === 'android' ? '85' : '58';
let top = type === 'android' ? '15' : '15';
let pages = getCurrentPages();
let page = pages[pages.length - 1];
let bitmap = null;
let currentWebview = page.$getAppWebview();
bitmap = new plus.nativeObj.Bitmap('amway_img');
currentWebview.draw(bitmap, function() {
let rand = Math.floor(Math.random() * 10000)
let saveUrl = '_doc/' + rand + 'a.jpg'
bitmap.save(saveUrl, {
}, function(i) {
uni.saveImageToPhotosAlbum({
filePath: i.target,
success:()=> {
bitmap.clear();
uni.showToast({
title: '保存图片成功',
duration: 1500
});
}
});
}, function(e) {
uni.showToast({
title: '保存失败'
})
});
}, function(e) {
uni.showToast({
title: '保存失败'
})
}, {
clip: {
top: `${
top}%`,
left: '0%',
height: `${
height}%`,
width: '100%'
}
});
},