pickHead(){ var _this = this; plus.gallery.pick(function(path){ _this.headImage=path; var files = [{name:"imgUpload",path:path}] var wt=plus.nativeUI.showWaiting(); var task=plus.uploader.createUpload(url,{method:"POST"}, function(t,status){ console.log(t.responseText) wt.close(); if(status==200){ var r = JSON.parse( t.responseText ); if(r.code==200){ _this.userInfor.headImage = r.data; }else{ return } }else{ mui.toast('网络请求失败!') } } ); task.addData("client","plus"); task.addData("uid",Math.floor( Math.random()*100000000+10000000).toString()); for(var i=0;i<files.length;i++){ var f=files[i]; task.addFile(f.path,{key:f.name}); } task.start(); }, function(e){ mui.toast('取消选择图片'); }, {filter:'image'}); }