1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-admin-scan-index"],{"122f":function(e,t,n){"use strict";var i=n("3668"),a=n.n(i);a.a},"2a22":function(e,t,n){"use strict";n("6a54");var i=n("f5bd").default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=i(n("39d8")),r=i(n("2634")),o=i(n("2fdc"));n("bf0f"),n("18f7"),n("de6c"),n("dc89"),n("2425"),n("aa9c"),n("dd2b"),n("fd3c");var d=i(n("23ab")),c=n("aa10"),s=(n("d542"),i(n("eaf5"))),u={components:{easyLoadimage:d.default},data:function(){return{uploading:!0,domain:c.HTTP_REQUEST_URL,imgList:[],fileList:[],token:"",images:[],mer_id:0,allSize:0,limit:20}},onLoad:function(e){this.token=e.token,this.mer_id=e.mer_id||0},onShow:function(){},methods:{add:function(){var e=this;uni.chooseImage({count:100,sizeType:["compressed"],sourceType:["album","camera"],success:function(t){for(var n=function(n){uni.getImageInfo({src:t.tempFilePaths[n],success:function(i){var a=i.width,r=i.height,o=a/r;a>400&&(a=400,r=Math.floor(a/o));var d=document.createElement("img");d.src=t.tempFilePaths[n];var c=document.createElement("canvas"),s=c.getContext("2d");c.width=a,c.height=r,s.drawImage(d,0,0,a,r),c.toBlob((function(i){new File([i],t.tempFiles[n].name,{type:i.type});var a=window.URL.createObjectURL(i);e.images.push({img:a,name:t.tempFiles[n].name});var r=i.size,o=r/1024/1024;e.imgList.length<20&&(e.imgList.push({src:a,size:o}),e.allSize+=o)}),"image/jpeg",.8)},fail:function(e){}})},i=0;i<t.tempFiles.length;i++)n(i)}})},submitUpload:function(){var e=this;return(0,o.default)((0,r.default)().mark((function t(){var n,i;return(0,r.default)().wrap((function(t){while(1)switch(t.prev=t.next){case 0:n=e,i=0;case 2:if(!(i<n.images.length)){t.next=9;break}return t.next=5,n.uploadImages(n.images[i]);case 5:i==n.imgList.length-1&&(n.uploading=!1,n.loading=!1);case 6:i++,t.next=2;break;case 9:case"end":return t.stop()}}),t)})))()},uploadImages:function(e){var t=this;return new Promise(function(){var n=(0,o.default)((0,r.default)().mark((function n(i){return(0,r.default)().wrap((function(n){while(1)switch(n.prev=n.next){case 0:uni.showLoading({title:"上传中..."}),uni.uploadFile({url:c.HTTP_REQUEST_URL+"/api/scan_upload/image/field/"+t.token,filePath:e.img,name:"field",formData:{name:e.name,mer_id:t.mer_id},header:(0,a.default)({},c.TOKENNAME,"Bearer "+s.default.state.app.token),success:function(e){if(uni.hideLoading(),403==e.statusCode)t.$util.Tips({title:e.message});else{var n=e.data?JSON.parse(e.data):{};200==n.status?i(n):t.$util.Tips({title:e.message})}},fail:function(e){uni.hideLoading(),t.$util.Tips({title:e})}});case 2:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}())},DelPic:function(e){this.imgList.splice(e,1),this.images.splice(e,1),this.getImageSize()},getImageSize:function(){var e=0;this.imgList.length?(this.imgList.map((function(t){e+=t.size})),this.allSize=e):this.allSize=0},again:function(){this.uploading=!0,this.imgList=[],this.images=[],this.allSize=0}},onHide:function(){}};t.default=u},"361c":function(e,t,n){"use strict";n.r(t);var i=n("2a22"),a=n.n(i);for(var r in i)["default"].indexOf(r)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(r);t["default"]=a.a},3668:function(e,t,n){var i=n("ddaf");i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var a=n("967d").default;a("27ca1862",i,!0,{sourceMap:!1,shadowMode:!1})},"42c4":function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return i}));var i={easyLoadimage:n("23ab").default},a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",{staticClass:"main"},[e.uploading?[n("v-uni-view",{staticClass:"image-list"},[n("v-uni-view",{staticClass:"input_photo acea-row row-middle"},e._l(e.imgList,(function(t,i){return i<=19?n("v-uni-view",{key:i,staticClass:"pictrue"},[n("easy-loadimage",{attrs:{mode:"widthFix","image-src":t.src}}),n("v-uni-view",{staticClass:"close_btn",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.DelPic(i)
|