webpackJsonp([49],{X2KN:function(t,o,e){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var a=e("mvHQ"),n=e.n(a),s=e("Au9i"),i={mixins:[e("5g4Q").a],data:function(){return{actionsheetConf:{flag:!1,arr:[{name:"拍照",method:this.picture},{name:"从相册中选取",method:this.album}],cancelText:"取消按钮",closeOnClickModal:!0},photoInfo:{path:"",flag:!1}}},methods:{toast:function(){this.actionsheetConf.flag=!0},picture:function(){s.Indicator.open({text:"获取中...",spinnerType:"triple-bounce"});var t=this,o=plus.camera.getCamera(),e=o.supportedImageResolutions[0],a=o.supportedImageFormats[0];o.captureImage(function(o){console.log("Capture image success: "+o),t.compressPhoto(o)},function(t){console.log("picture error "+n()(t)),s.Indicator.close()},{resolution:e,format:a})},album:function(){var t=this;s.Indicator.open({text:"获取中...",spinnerType:"triple-bounce"}),console.log("从相册中选择图片:"),plus.gallery.pick(function(o){console.log(o),t.compressPhoto(o)},function(t){console.log("取消选择图片 "+n()(t)),s.Indicator.close()},{filter:"image"})},compressPhoto:function(t){var o=this;plus.io.resolveLocalFileSystemURL(t,function(t){var e=t.toLocalURL();console.log("src "+e);var a=Date.parse(new Date);plus.zip.compressImage({src:e,dst:"_doc/signature_"+a+".jpg",overwrite:!0,quality:100,width:"300px",height:"360px"},function(t){s.Indicator.close();var e=t.size;console.log("filesize:"+t.size+",totalsize:"+e),e>10485760?Object(s.Toast)({message:"照片大小超出限制",position:"bottom",duration:3e3}):(o.photoInfo.path=t.target,o.photoInfo.flag=!0,console.log("文件路径 "+o.photoInfo.path))},function(t){s.Indicator.close(),Object(s.Toast)({message:"照片压缩失败",position:"bottom",duration:3e3})})})}}},c={render:function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("transition",{attrs:{name:"slide"}},[e("div",{staticClass:"camera"},[e("mt-header",{staticClass:"header",attrs:{title:"camera",fixed:t.headerConf.fixed}},[e("div",{attrs:{slot:"left"},slot:"left"},[e("mt-button",{attrs:{icon:"back"},on:{click:t.back}},[t._v("返回")])],1)]),t._v(" "),e("div",{staticClass:"content"},[e("mt-actionsheet",{attrs:{actions:t.actionsheetConf.arr,cancelText:t.actionsheetConf.cancelText,closeOnClickModal:t.actionsheetConf.closeOnClickModal},model:{value:t.actionsheetConf.flag,callback:function(o){t.$set(t.actionsheetConf,"flag",o)},expression:"actionsheetConf.flag"}}),t._v(" "),e("div",{staticClass:"row"},[e("h3",[t._v("拍照需要build或者打成包之后方可看见效果")])]),t._v(" "),e("mt-button",{attrs:{type:"default"},on:{click:function(o){return t.toast("top")}}},[t._v("选取照片")]),t._v(" "),e("div",{directives:[{name:"show",rawName:"v-show",value:t.photoInfo.flag,expression:"photoInfo.flag"}],staticClass:"photo",attrs:{id:"photo"}},[e("img",{attrs:{src:t.photoInfo.path,alt:""}})])],1)],1)])},staticRenderFns:[]};var r=e("VU/8")(i,c,!1,function(t){e("ip9r")},"data-v-004b11c2",null);o.default=r.exports},ip9r:function(t,o){}}); //# sourceMappingURL=49.fb86290b94704ea0ee91.js.map