crm_second_opening_mini/components/uploadImg/index.js

11 lines
3.0 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/uploadImg/index"],{"4a40":function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){}));var i=function(){var t=this.$createElement,e=(this._self._c,this.imgList.length<this.single&&this.isEdit);this.$mp.data=Object.assign({},{$root:{g0:e}})},o=[]},6277:function(t,e,n){"use strict";n.r(e);var i=n("c7ef"),o=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=o.a},"62e8":function(t,e,n){},8391:function(t,e,n){"use strict";n.r(e);var i=n("4a40"),o=n("6277");for(var a in o)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(a);n("fd63b");var s=n("f0c5"),c=Object(s["a"])(o["default"],i["b"],i["c"],!1,null,"25c2bf47",null,!1,i["a"],void 0);e["default"]=c.exports},c7ef:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n("0c59"),o=n("dc92"),a={props:{imgList:{type:Array,default:[]},flag:{type:Boolean,default:!0},title:{type:String,default:"附件"},single:{type:Number,default:9},istype:{type:String,default:"all"},isEdit:{type:Boolean,default:!0}},data:function(){return{BASE_IMG_URL:i.BASE_IMG_URL}},methods:{toPriveImg:function(t){this.openCommonImg(this.imgList,t)},uploadFiles:function(){var e=this,n=[];"all"==this.istype?n=["album","camera"]:"album"==this.istype?n=["album"]:"camera"==this.istype&&(n=["camera"]),t.chooseImage({count:this.single,sourceType:n,sizeType:["compressed"],success:function(t){console.log(t,"====");var n=t.tempFilePaths;n.forEach((function(t){e.imgList.length<e.single&&e.toUpload(t)}))}})},toUpload:function(e){var n=this;t.uploadFile({url:o.uploadUrl,name:"file",header:{token:t.getStorageSync("token")},filePath:e,success:function(e){var i=JSON.parse(e.data);if(1==i.code){var o={id:i.data.id,file_path:i.data.url};n.$emit("uploadImg",o)}else t.showToast({title:"上传失败",icon:"none"})},fail:function(t){console.log(t)}})},delImg:function(t){this.$emit("delImg",t)},getImageInfo:function(e){return new Promise((function(n,i){t.showLoading({title:"压缩中...",icon:"none"}),t.getImageInfo({src:e,success:function(e){console.log("压缩前",e);var i=e.width,o=e.height,a=new Image;a.src=e.path;var s=document.createElement("canvas"),c=s.getContext("2d");s.width=i/2,s.height=o/2,console.log(a),c.drawImage(a,0,0,i/2,o/2),s.toBlob((function(e){var i=window.URL.createObjectURL(e);console.log("压缩后",i),n(i),t.hideLoading()}))}})}))}}};e.default=a}).call(this,n("543d")["default"])},fd63b:function(t,e,n){"use strict";var i=n("62e8"),o=n.n(i);o.a}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
'components/uploadImg/index-create-component',
{
'components/uploadImg/index-create-component':(function(module, exports, __webpack_require__){
__webpack_require__('543d')['createComponent'](__webpack_require__("8391"))
})
},
[['components/uploadImg/index-create-component']]
]);