截屏保存图片到本地

capture() {  
	var pages = getCurrentPages();  
	var page = pages[pages.length - 1];  
	console.log("当前页"+pages.length-1);
	var bitmap=null;  
	var currentWebview = page.$getAppWebview();
	bitmap = new plus.nativeObj.Bitmap('amway_img');  
	// 将webview内容绘制到Bitmap对象中  
	currentWebview.draw(bitmap,function(){  
		console.log('截屏绘制图片成功');  
		bitmap.save( "_doc/a.jpg"  
		,{}  
		,function(i){  
			console.log('保存图片成功:'+JSON.stringify(i));  
			uni.saveImageToPhotosAlbum({  
				filePath: i.target,  
				success: function () {  
					bitmap.clear(); //销毁Bitmap图片  
					uni.showToast({  
						title: '保存图片成功',  
						mask: false,  
						duration: 1500  
					});  
				}  
			});  
		}  
		,function(e){  
			console.log('保存图片失败:'+JSON.stringify(e));  
		});  
	},function(e){  
		console.log('截屏绘制图片失败:'+JSON.stringify(e));  
	});  
	//currentWebview.append(amway_bit);    
	},