|
楼主 |
发表于 2016-8-3 10:15:58
|
显示全部楼层
var sourceType =1;
var me = this;
function onSuccess(imageURI) {
localStorage.setItem("imageURI", imageURI);
function onSuccess(fileEntry) {
function win(file) {
me.comp("PicPopOver").hide();
var reader = new FileReader();
reader.onloadend = function(evt) {
console.log("read success");
console.log(evt.target.result);
$(me.getElementByXid("headurl")).attr("src", evt.target.result);
};
reader.readAsDataURL(file);
}
var fail = function(evt) {
me.comp("PicPopOver").hide();
window.plugins.toast.show('选择头像失败', "short", "center");
};
fileEntry.file(win, fail);
}
window.resolveLocalFileSystemURI(imageURI, onSuccess,
function(error) {
me.comp("PicPopOver").hide();
});
}
function onFail(message) {
me.comp("PicPopOver").hide();
setTimeout(function() {
window.plugins.toast.show("选择头像失败", "short", "center");
}, 1000);
}
navigator.camera.getPicture(onSuccess, onFail, {
quality : 50,
// destinationType : Camera.DestinationType.NATIVE_URI,
destinationType:navigator.camera.DestinationType.NATIVE_URI,
sourceType : sourceType,
// targetWidth:100,
// targetHeight:100,
allowEdit : true
});
|
|