;(function(){function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e2){throw _e2;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e3){didErr=true;err=_e3;},f:function f(){try{if(!normalCompletion&&it.return!=null)it.return();}finally{if(didErr)throw err;}}};}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i0?createVNode(Fragment,null,[createVNode("div",{"class":styles$2.title},[item.name]),createVNode("div",{"class":styles$2['subject-list']},[item.subjects&&item.subjects.map(function(sub){return createVNode("div",{"class":styles$2['subject-item'],"onClick":function onClick(){return _this2.onSelect(sub.id);}},[createVNode(Image$1,{"src":sub.img,"width":"100%","height":"100%","fit":"cover"},{loading:function loading(){return createVNode(Loading,{"type":"spinner","size":20},null);}}),createVNode("div",{"class":styles$2.topBg},[createVNode(Checkbox,{"name":sub.id,"class":styles$2.checkbox,"ref":function ref(el){return _this2.checkboxRefs[sub.id]=el;}},{icon:function icon(props){return createVNode(Icon,{"name":props.checked?checkBoxActive:checkBoxDefault,"size":"22"},null);}}),createVNode("p",{"class":styles$2.name},[sub.name])])]);})])]):null;}))?_slot:{default:function _default(){return[_slot];}}):createVNode(RadioGroup,{"modelValue":this.radio,"onUpdate:modelValue":function onUpdateModelValue($event){return _this2.radio=$event;}},_isSlot(_slot2=this.subjectList.map(function(item){return item.subjects&&item.subjects.length>0?createVNode(Fragment,null,[createVNode("div",{"class":styles$2.title},[item.name]),createVNode("div",{"class":styles$2['subject-list']},[item.subjects&&item.subjects.map(function(sub){return createVNode("div",{"class":styles$2['subject-item'],"onClick":function onClick(){return _this2.onSelect(sub.id);}},[createVNode(Image$1,{"src":sub.img,"width":"100%","height":"100%","fit":"cover"},{loading:function loading(){return createVNode(Loading,{"type":"spinner","size":20},null);}}),createVNode("div",{"class":styles$2.topBg},[createVNode(Radio,{"name":sub.id,"class":styles$2.checkbox},{icon:function icon(props){return createVNode(Icon,{"name":props.checked?checkBoxActive:checkBoxDefault,"size":"22"},null);}}),createVNode("p",{"class":styles$2.name},[sub.name])])]);})])]):null;}))?_slot2:{default:function _default(){return[_slot2];}}):createVNode(ColResult,{"tips":"暂无声部数据","btnStatus":false},null),createVNode("div",{"class":styles$2["btn-group"]},[createVNode(Button,{"round":true,"block":true,"type":"primary","onClick":function onClick(){return _this2.onChoice(_this2.selectType==='Checkbox'?_this2.checkBox:_this2.radio);}},{default:function _default(){return[createTextVNode("\u786E\u5B9A")];}})])]);}}));var queryString={};var strictUriEncode=function strictUriEncode(str){return encodeURIComponent(str).replace(/[!'()*]/g,function(x){return"%".concat(x.charCodeAt(0).toString(16).toUpperCase());});};var token='%[a-f0-9]{2}';var singleMatcher=new RegExp(token,'gi');var multiMatcher=new RegExp('('+token+')+','gi');function decodeComponents(components,split){try{// Try to decode the entire string first return decodeURIComponent(components.join(''));}catch(err){// Do nothing }if(components.length===1){return components;}split=split||1;// Split the array in 2 parts var left=components.slice(0,split);var right=components.slice(split);return Array.prototype.concat.call([],decodeComponents(left),decodeComponents(right));}function decode(input){try{return decodeURIComponent(input);}catch(err){var tokens=input.match(singleMatcher);for(var i=1;i0?'&cPop='+ +new Date():'?cPop='+ +new Date();history.pushState("","","".concat(origin).concat(url));}else{var _splitUrl=window.location.hash.slice(1).split('?');var _query=qs.parse(_splitUrl[1]);if(_query.cPop){window.history.go(-1);}}if(this.$refs.protocolPopup){this.$refs.protocolPopup.scrollTop=0;}}},render:function render(){var _this3=this;return createVNode(Popup,{"ref":"protocolPopup","show":this.modelValue,"transitionAppear":true,"position":"bottom","style":{height:'100%'}},{default:function _default(){return[_this3.$slots.default&&_this3.$slots.default()];}});}}));var index$2='';var index$1='';var uploader="_uploader_jyku5_1";var uploaderText="_uploaderText_jyku5_52";var uploadImg="_uploadImg_jyku5_57";var styles$1={"uploader-section":"_uploader-section_jyku5_1","img-close":"_img-close_jyku5_9","col-uploader":"_col-uploader_jyku5_24",uploader:uploader,uploaderText:uploaderText,uploadImg:uploadImg};var index='';var Exif={};Exif.getData=function(img){return new Promise(function(reslove,reject){var obj={};getImageData(img).then(function(data){obj.arrayBuffer=data;obj.orientation=getOrientation(data);reslove(obj);}).catch(function(error){reject(error);});});};function getImageData(img){var data=null;return new Promise(function(reslove,reject){if(img.src){if(/^data\:/i.test(img.src)){data=base64ToArrayBuffer(img.src);reslove(data);}else if(/^blob\:/i.test(img.src)){var fileReader=new FileReader();fileReader.onload=function(e){data=e.target.result;reslove(data);};objectURLToBlob(img.src,function(blob){fileReader.readAsArrayBuffer(blob);});}else{var http=new XMLHttpRequest();http.onload=function(){if(this.status==200||this.status===0){data=http.response;reslove(data);}else{throw"Could not load image";}http=null;};http.open("GET",img.src,true);http.responseType="arraybuffer";http.send(null);}}else{reject("img error");}});}function objectURLToBlob(url,callback){var http=new XMLHttpRequest();http.open("GET",url,true);http.responseType="blob";http.onload=function(e){if(this.status==200||this.status===0){callback(this.response);}};http.send();}function base64ToArrayBuffer(base64){base64=base64.replace(/^data\:([^\;]+)\;base64,/gmi,"");var binary=atob(base64);var len=binary.length;var buffer=new ArrayBuffer(len);var view=new Uint8Array(buffer);for(var i=0;i=8){ifdStart=tiffOffset+firstIFDOffset;}}}}}if(ifdStart){length=dataView.getUint16(ifdStart,littleEndian);for(i=0;i21?"-21px":"0px";obj.width=this.cropW>0?this.cropW:0;obj.height=this.cropH>0?this.cropH:0;if(this.infoTrue){var dpr=1;if(this.high&&!this.full){dpr=window.devicePixelRatio;}if(this.enlarge!==1&!this.full){dpr=Math.abs(Number(this.enlarge));}obj.width=obj.width*dpr;obj.height=obj.height*dpr;if(this.full){obj.width=obj.width/this.scale;obj.height=obj.height/this.scale;}}obj.width=obj.width.toFixed(0);obj.height=obj.height.toFixed(0);return obj;},isIE:function isIE(){var isIE=!!window.ActiveXObject||"ActiveXObject"in window;return isIE;},passive:function passive(){return this.isIE?null:{passive:false};}},watch:{img:function img(){this.checkedImg();},imgs:function imgs(val){if(val===""){return;}this.reload();},cropW:function cropW(){this.showPreview();},cropH:function cropH(){this.showPreview();},cropOffsertX:function cropOffsertX(){this.showPreview();},cropOffsertY:function cropOffsertY(){this.showPreview();},scale:function scale(val,oldVal){this.showPreview();},x:function x(){this.showPreview();},y:function y(){this.showPreview();},autoCrop:function autoCrop(val){if(val){this.goAutoCrop();}},autoCropWidth:function autoCropWidth(){if(this.autoCrop){this.goAutoCrop();}},autoCropHeight:function autoCropHeight(){if(this.autoCrop){this.goAutoCrop();}},mode:function mode(){this.checkedImg();},rotate:function rotate(){this.showPreview();if(this.autoCrop){this.goAutoCrop(this.cropW,this.cropH);}else{if(this.cropW>0||this.cropH>0){this.goAutoCrop(this.cropW,this.cropH);}}}},methods:{getVersion:function getVersion(name){var arr=navigator.userAgent.split(" ");var chromeVersion="";var result=0;var reg=new RegExp(name,"i");for(var i=0;i=81){orientation=-1;}else{if(this.getVersion("safari")[0]>=605){var safariVersion=this.getVersion("version");if(safariVersion[0]>13&&safariVersion[1]>1){orientation=-1;}}else{var isIos=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(isIos){var version=isIos[1];version=version.split("_");if(version[0]>13||version[0]>=13&&version[1]>=4){orientation=-1;}}}}var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");ctx.save();switch(orientation){case 2:canvas.width=width;canvas.height=height;ctx.translate(width,0);ctx.scale(-1,1);break;case 3:canvas.width=width;canvas.height=height;ctx.translate(width/2,height/2);ctx.rotate(180*Math.PI/180);ctx.translate(-width/2,-height/2);break;case 4:canvas.width=width;canvas.height=height;ctx.translate(0,height);ctx.scale(1,-1);break;case 5:canvas.height=width;canvas.width=height;ctx.rotate(0.5*Math.PI);ctx.scale(1,-1);break;case 6:canvas.width=height;canvas.height=width;ctx.translate(height/2,width/2);ctx.rotate(90*Math.PI/180);ctx.translate(-width/2,-height/2);break;case 7:canvas.height=width;canvas.width=height;ctx.rotate(0.5*Math.PI);ctx.translate(width,-height);ctx.scale(-1,1);break;case 8:canvas.height=width;canvas.width=height;ctx.translate(height/2,width/2);ctx.rotate(-90*Math.PI/180);ctx.translate(-width/2,-height/2);break;default:canvas.width=width;canvas.height=height;}ctx.drawImage(img,0,0,width,height);ctx.restore();canvas.toBlob(function(blob){var data=URL.createObjectURL(blob);URL.revokeObjectURL(_this4.imgs);_this4.imgs=data;},"image/"+this.outputType,1);},checkedImg:function checkedImg(){var _this5=this;if(this.img===null||this.img===""){this.imgs="";this.clearCrop();return;}this.loading=true;this.scale=1;this.rotate=0;this.clearCrop();var img=new Image();img.onload=function(){if(_this5.img===""){_this5.$emit("img-load","error");return false;}var width=img.width;var height=img.height;Exif.getData(img).then(function(data){_this5.orientation=data.orientation||1;var max=Number(_this5.maxImgSize);if(!_this5.orientation&&widthmax){height=height/width*max;width=max;}if(height>max){width=width/height*max;height=max;}_this5.checkOrientationImage(img,_this5.orientation,width,height);});};img.onerror=function(){_this5.$emit("img-load","error");};if(this.img.substr(0,4)!=="data"){img.crossOrigin="";}if(this.isIE){var xhr=new XMLHttpRequest();xhr.onload=function(){var url=URL.createObjectURL(this.response);img.src=url;};xhr.open("GET",this.img,true);xhr.responseType="blob";xhr.send();}else{img.src=this.img;}},startMove:function startMove(e){e.preventDefault();if(this.move&&!this.crop){if(!this.canMove){return false;}this.moveX=("clientX"in e?e.clientX:e.touches[0].clientX)-this.x;this.moveY=("clientY"in e?e.clientY:e.touches[0].clientY)-this.y;if(e.touches){window.addEventListener("touchmove",this.moveImg);window.addEventListener("touchend",this.leaveImg);if(e.touches.length==2){this.touches=e.touches;window.addEventListener("touchmove",this.touchScale);window.addEventListener("touchend",this.cancelTouchScale);}}else{window.addEventListener("mousemove",this.moveImg);window.addEventListener("mouseup",this.leaveImg);}this.$emit("imgMoving",{moving:true,axis:this.getImgAxis()});this.$emit("img-moving",{moving:true,axis:this.getImgAxis()});}else{this.cropping=true;window.addEventListener("mousemove",this.createCrop);window.addEventListener("mouseup",this.endCrop);window.addEventListener("touchmove",this.createCrop);window.addEventListener("touchend",this.endCrop);this.cropOffsertX=e.offsetX?e.offsetX:e.touches[0].pageX-this.$refs.cropper.offsetLeft;this.cropOffsertY=e.offsetY?e.offsetY:e.touches[0].pageY-this.$refs.cropper.offsetTop;this.cropX="clientX"in e?e.clientX:e.touches[0].clientX;this.cropY="clientY"in e?e.clientY:e.touches[0].clientY;this.cropChangeX=this.cropOffsertX;this.cropChangeY=this.cropOffsertY;this.cropW=0;this.cropH=0;}},touchScale:function touchScale(e){var _this6=this;e.preventDefault();var scale=this.scale;var oldTouch1={x:this.touches[0].clientX,y:this.touches[0].clientY};var newTouch1={x:e.touches[0].clientX,y:e.touches[0].clientY};var oldTouch2={x:this.touches[1].clientX,y:this.touches[1].clientY};var newTouch2={x:e.touches[1].clientX,y:e.touches[1].clientY};var oldL=Math.sqrt(Math.pow(oldTouch1.x-oldTouch2.x,2)+Math.pow(oldTouch1.y-oldTouch2.y,2));var newL=Math.sqrt(Math.pow(newTouch1.x-newTouch2.x,2)+Math.pow(newTouch1.y-newTouch2.y,2));var cha=newL-oldL;var coe=1;coe=coe/this.trueWidth>coe/this.trueHeight?coe/this.trueHeight:coe/this.trueWidth;coe=coe>0.1?0.1:coe;var num=coe*cha;if(!this.touchNow){this.touchNow=true;if(cha>0){scale+=Math.abs(num);}else if(cha<0){scale>Math.abs(num)?scale-=Math.abs(num):scale;}this.touches=e.touches;setTimeout(function(){_this6.touchNow=false;},8);if(!this.checkoutImgAxis(this.x,this.y,scale)){return false;}this.scale=scale;}},cancelTouchScale:function cancelTouchScale(e){window.removeEventListener("touchmove",this.touchScale);},moveImg:function moveImg(e){var _this7=this;e.preventDefault();if(e.touches&&e.touches.length===2){this.touches=e.touches;window.addEventListener("touchmove",this.touchScale);window.addEventListener("touchend",this.cancelTouchScale);window.removeEventListener("touchmove",this.moveImg);return false;}var nowX="clientX"in e?e.clientX:e.touches[0].clientX;var nowY="clientY"in e?e.clientY:e.touches[0].clientY;var changeX,changeY;changeX=nowX-this.moveX;changeY=nowY-this.moveY;this.$nextTick(function(){if(_this7.centerBox){var axis=_this7.getImgAxis(changeX,changeY,_this7.scale);var cropAxis=_this7.getCropAxis();var imgW=_this7.trueHeight*_this7.scale;var imgH=_this7.trueWidth*_this7.scale;var maxLeft,maxTop,maxRight,maxBottom;switch(_this7.rotate){case 1:case-1:case 3:case-3:maxLeft=_this7.cropOffsertX-_this7.trueWidth*(1-_this7.scale)/2+(imgW-imgH)/2;maxTop=_this7.cropOffsertY-_this7.trueHeight*(1-_this7.scale)/2+(imgH-imgW)/2;maxRight=maxLeft-imgW+_this7.cropW;maxBottom=maxTop-imgH+_this7.cropH;break;default:maxLeft=_this7.cropOffsertX-_this7.trueWidth*(1-_this7.scale)/2;maxTop=_this7.cropOffsertY-_this7.trueHeight*(1-_this7.scale)/2;maxRight=maxLeft-imgH+_this7.cropW;maxBottom=maxTop-imgW+_this7.cropH;break;}if(axis.x1>=cropAxis.x1){changeX=maxLeft;}if(axis.y1>=cropAxis.y1){changeY=maxTop;}if(axis.x2<=cropAxis.x2){changeX=maxRight;}if(axis.y2<=cropAxis.y2){changeY=maxBottom;}}_this7.x=changeX;_this7.y=changeY;_this7.$emit("imgMoving",{moving:true,axis:_this7.getImgAxis()});_this7.$emit("img-moving",{moving:true,axis:_this7.getImgAxis()});});},leaveImg:function leaveImg(e){window.removeEventListener("mousemove",this.moveImg);window.removeEventListener("touchmove",this.moveImg);window.removeEventListener("mouseup",this.leaveImg);window.removeEventListener("touchend",this.leaveImg);this.$emit("imgMoving",{moving:false,axis:this.getImgAxis()});this.$emit("img-moving",{moving:false,axis:this.getImgAxis()});},scaleImg:function scaleImg(){if(this.canScale){window.addEventListener(this.support,this.changeSize,this.passive);}},cancelScale:function cancelScale(){if(this.canScale){window.removeEventListener(this.support,this.changeSize);}},changeSize:function changeSize(e){var _this8=this;e.preventDefault();var scale=this.scale;var change=e.deltaY||e.wheelDelta;var isFirefox=navigator.userAgent.indexOf("Firefox");change=isFirefox>0?change*30:change;if(this.isIE){change=-change;}var coe=this.coe;coe=coe/this.trueWidth>coe/this.trueHeight?coe/this.trueHeight:coe/this.trueWidth;var num=coe*change;num<0?scale+=Math.abs(num):scale>Math.abs(num)?scale-=Math.abs(num):scale;var status=num<0?"add":"reduce";if(status!==this.coeStatus){this.coeStatus=status;this.coe=0.2;}if(!this.scaling){this.scalingSet=setTimeout(function(){_this8.scaling=false;_this8.coe=_this8.coe+=0.01;},50);}this.scaling=true;if(!this.checkoutImgAxis(this.x,this.y,scale)){return false;}this.scale=scale;},changeScale:function changeScale(num){var scale=this.scale;num=num||1;var coe=20;coe=coe/this.trueWidth>coe/this.trueHeight?coe/this.trueHeight:coe/this.trueWidth;num=num*coe;num>0?scale+=Math.abs(num):scale>Math.abs(num)?scale-=Math.abs(num):scale;if(!this.checkoutImgAxis(this.x,this.y,scale)){return false;}this.scale=scale;},createCrop:function createCrop(e){var _this9=this;e.preventDefault();var nowX="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0;var nowY="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;this.$nextTick(function(){var fw=nowX-_this9.cropX;var fh=nowY-_this9.cropY;if(fw>0){_this9.cropW=fw+_this9.cropChangeX>_this9.w?_this9.w-_this9.cropChangeX:fw;_this9.cropOffsertX=_this9.cropChangeX;}else{_this9.cropW=_this9.w-_this9.cropChangeX+Math.abs(fw)>_this9.w?_this9.cropChangeX:Math.abs(fw);_this9.cropOffsertX=_this9.cropChangeX+fw>0?_this9.cropChangeX+fw:0;}if(!_this9.fixed){if(fh>0){_this9.cropH=fh+_this9.cropChangeY>_this9.h?_this9.h-_this9.cropChangeY:fh;_this9.cropOffsertY=_this9.cropChangeY;}else{_this9.cropH=_this9.h-_this9.cropChangeY+Math.abs(fh)>_this9.h?_this9.cropChangeY:Math.abs(fh);_this9.cropOffsertY=_this9.cropChangeY+fh>0?_this9.cropChangeY+fh:0;}}else{var fixedHeight=_this9.cropW/_this9.fixedNumber[0]*_this9.fixedNumber[1];if(fixedHeight+_this9.cropOffsertY>_this9.h){_this9.cropH=_this9.h-_this9.cropOffsertY;_this9.cropW=_this9.cropH/_this9.fixedNumber[1]*_this9.fixedNumber[0];if(fw>0){_this9.cropOffsertX=_this9.cropChangeX;}else{_this9.cropOffsertX=_this9.cropChangeX-_this9.cropW;}}else{_this9.cropH=fixedHeight;}_this9.cropOffsertY=_this9.cropOffsertY;}});},changeCropSize:function changeCropSize(e,w,h,typeW,typeH){e.preventDefault();window.addEventListener("mousemove",this.changeCropNow);window.addEventListener("mouseup",this.changeCropEnd);window.addEventListener("touchmove",this.changeCropNow);window.addEventListener("touchend",this.changeCropEnd);this.canChangeX=w;this.canChangeY=h;this.changeCropTypeX=typeW;this.changeCropTypeY=typeH;this.cropX="clientX"in e?e.clientX:e.touches[0].clientX;this.cropY="clientY"in e?e.clientY:e.touches[0].clientY;this.cropOldW=this.cropW;this.cropOldH=this.cropH;this.cropChangeX=this.cropOffsertX;this.cropChangeY=this.cropOffsertY;if(this.fixed){if(this.canChangeX&&this.canChangeY){this.canChangeY=0;}}this.$emit("change-crop-size",{width:this.cropW,height:this.cropH});},changeCropNow:function changeCropNow(e){var _this10=this;e.preventDefault();var nowX="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0;var nowY="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;var wrapperW=this.w;var wrapperH=this.h;var minX=0;var minY=0;if(this.centerBox){var axis=this.getImgAxis();var imgW=axis.x2;var imgH=axis.y2;minX=axis.x1>0?axis.x1:0;minY=axis.y1>0?axis.y1:0;if(wrapperW>imgW){wrapperW=imgW;}if(wrapperH>imgH){wrapperH=imgH;}}this.$nextTick(function(){var fw=nowX-_this10.cropX;var fh=nowY-_this10.cropY;if(_this10.canChangeX){if(_this10.changeCropTypeX===1){if(_this10.cropOldW-fw>0){_this10.cropW=wrapperW-_this10.cropChangeX-fw<=wrapperW-minX?_this10.cropOldW-fw:_this10.cropOldW+_this10.cropChangeX-minX;_this10.cropOffsertX=wrapperW-_this10.cropChangeX-fw<=wrapperW-minX?_this10.cropChangeX+fw:minX;}else{_this10.cropW=Math.abs(fw)+_this10.cropChangeX<=wrapperW?Math.abs(fw)-_this10.cropOldW:wrapperW-_this10.cropOldW-_this10.cropChangeX;_this10.cropOffsertX=_this10.cropChangeX+_this10.cropOldW;}}else if(_this10.changeCropTypeX===2){if(_this10.cropOldW+fw>0){_this10.cropW=_this10.cropOldW+fw+_this10.cropOffsertX<=wrapperW?_this10.cropOldW+fw:wrapperW-_this10.cropOffsertX;_this10.cropOffsertX=_this10.cropChangeX;}else{_this10.cropW=wrapperW-_this10.cropChangeX+Math.abs(fw+_this10.cropOldW)<=wrapperW-minX?Math.abs(fw+_this10.cropOldW):_this10.cropChangeX-minX;_this10.cropOffsertX=wrapperW-_this10.cropChangeX+Math.abs(fw+_this10.cropOldW)<=wrapperW-minX?_this10.cropChangeX-Math.abs(fw+_this10.cropOldW):minX;}}}if(_this10.canChangeY){if(_this10.changeCropTypeY===1){if(_this10.cropOldH-fh>0){_this10.cropH=wrapperH-_this10.cropChangeY-fh<=wrapperH-minY?_this10.cropOldH-fh:_this10.cropOldH+_this10.cropChangeY-minY;_this10.cropOffsertY=wrapperH-_this10.cropChangeY-fh<=wrapperH-minY?_this10.cropChangeY+fh:minY;}else{_this10.cropH=Math.abs(fh)+_this10.cropChangeY<=wrapperH?Math.abs(fh)-_this10.cropOldH:wrapperH-_this10.cropOldH-_this10.cropChangeY;_this10.cropOffsertY=_this10.cropChangeY+_this10.cropOldH;}}else if(_this10.changeCropTypeY===2){if(_this10.cropOldH+fh>0){_this10.cropH=_this10.cropOldH+fh+_this10.cropOffsertY<=wrapperH?_this10.cropOldH+fh:wrapperH-_this10.cropOffsertY;_this10.cropOffsertY=_this10.cropChangeY;}else{_this10.cropH=wrapperH-_this10.cropChangeY+Math.abs(fh+_this10.cropOldH)<=wrapperH-minY?Math.abs(fh+_this10.cropOldH):_this10.cropChangeY-minY;_this10.cropOffsertY=wrapperH-_this10.cropChangeY+Math.abs(fh+_this10.cropOldH)<=wrapperH-minY?_this10.cropChangeY-Math.abs(fh+_this10.cropOldH):minY;}}}if(_this10.canChangeX&&_this10.fixed){var fixedHeight=_this10.cropW/_this10.fixedNumber[0]*_this10.fixedNumber[1];if(fixedHeight+_this10.cropOffsertY>wrapperH){_this10.cropH=wrapperH-_this10.cropOffsertY;_this10.cropW=_this10.cropH/_this10.fixedNumber[1]*_this10.fixedNumber[0];}else{_this10.cropH=fixedHeight;}}if(_this10.canChangeY&&_this10.fixed){var fixedWidth=_this10.cropH/_this10.fixedNumber[1]*_this10.fixedNumber[0];if(fixedWidth+_this10.cropOffsertX>wrapperW){_this10.cropW=wrapperW-_this10.cropOffsertX;_this10.cropH=_this10.cropW/_this10.fixedNumber[0]*_this10.fixedNumber[1];}else{_this10.cropW=fixedWidth;}}});},checkCropLimitSize:function checkCropLimitSize(){var cropW=this.cropW,cropH=this.cropH,limitMinSize=this.limitMinSize;var limitMinNum=new Array();if(!Array.isArray[limitMinSize]){limitMinNum=[limitMinSize,limitMinSize];}else{limitMinNum=limitMinSize;}cropW=parseFloat(limitMinNum[0]);cropH=parseFloat(limitMinNum[1]);return[cropW,cropH];},changeCropEnd:function changeCropEnd(e){window.removeEventListener("mousemove",this.changeCropNow);window.removeEventListener("mouseup",this.changeCropEnd);window.removeEventListener("touchmove",this.changeCropNow);window.removeEventListener("touchend",this.changeCropEnd);},endCrop:function endCrop(){if(this.cropW===0&&this.cropH===0){this.cropping=false;}window.removeEventListener("mousemove",this.createCrop);window.removeEventListener("mouseup",this.endCrop);window.removeEventListener("touchmove",this.createCrop);window.removeEventListener("touchend",this.endCrop);},startCrop:function startCrop(){this.crop=true;},stopCrop:function stopCrop(){this.crop=false;},clearCrop:function clearCrop(){this.cropping=false;this.cropW=0;this.cropH=0;},cropMove:function cropMove(e){e.preventDefault();if(!this.canMoveBox){this.crop=false;this.startMove(e);return false;}if(e.touches&&e.touches.length===2){this.crop=false;this.startMove(e);this.leaveCrop();return false;}window.addEventListener("mousemove",this.moveCrop);window.addEventListener("mouseup",this.leaveCrop);window.addEventListener("touchmove",this.moveCrop);window.addEventListener("touchend",this.leaveCrop);var x="clientX"in e?e.clientX:e.touches[0].clientX;var y="clientY"in e?e.clientY:e.touches[0].clientY;var newX,newY;newX=x-this.cropOffsertX;newY=y-this.cropOffsertY;this.cropX=newX;this.cropY=newY;this.$emit("cropMoving",{moving:true,axis:this.getCropAxis()});this.$emit("crop-moving",{moving:true,axis:this.getCropAxis()});},moveCrop:function moveCrop(e,isMove){var _this11=this;var nowX=0;var nowY=0;if(e){e.preventDefault();nowX="clientX"in e?e.clientX:e.touches[0].clientX;nowY="clientY"in e?e.clientY:e.touches[0].clientY;}this.$nextTick(function(){var cx,cy;var fw=nowX-_this11.cropX;var fh=nowY-_this11.cropY;if(isMove){fw=_this11.cropOffsertX;fh=_this11.cropOffsertY;}if(fw<=0){cx=0;}else if(fw+_this11.cropW>_this11.w){cx=_this11.w-_this11.cropW;}else{cx=fw;}if(fh<=0){cy=0;}else if(fh+_this11.cropH>_this11.h){cy=_this11.h-_this11.cropH;}else{cy=fh;}if(_this11.centerBox){var axis=_this11.getImgAxis();if(cx<=axis.x1){cx=axis.x1;}if(cx+_this11.cropW>axis.x2){cx=axis.x2-_this11.cropW;}if(cy<=axis.y1){cy=axis.y1;}if(cy+_this11.cropH>axis.y2){cy=axis.y2-_this11.cropH;}}_this11.cropOffsertX=cx;_this11.cropOffsertY=cy;_this11.$emit("cropMoving",{moving:true,axis:_this11.getCropAxis()});_this11.$emit("crop-moving",{moving:true,axis:_this11.getCropAxis()});});},getImgAxis:function getImgAxis(x,y,scale){x=x||this.x;y=y||this.y;scale=scale||this.scale;var obj={x1:0,x2:0,y1:0,y2:0};var imgW=this.trueWidth*scale;var imgH=this.trueHeight*scale;switch(this.rotate){case 0:obj.x1=x+this.trueWidth*(1-scale)/2;obj.x2=obj.x1+this.trueWidth*scale;obj.y1=y+this.trueHeight*(1-scale)/2;obj.y2=obj.y1+this.trueHeight*scale;break;case 1:case-1:case 3:case-3:obj.x1=x+this.trueWidth*(1-scale)/2+(imgW-imgH)/2;obj.x2=obj.x1+this.trueHeight*scale;obj.y1=y+this.trueHeight*(1-scale)/2+(imgH-imgW)/2;obj.y2=obj.y1+this.trueWidth*scale;break;default:obj.x1=x+this.trueWidth*(1-scale)/2;obj.x2=obj.x1+this.trueWidth*scale;obj.y1=y+this.trueHeight*(1-scale)/2;obj.y2=obj.y1+this.trueHeight*scale;break;}return obj;},getCropAxis:function getCropAxis(){var obj={x1:0,x2:0,y1:0,y2:0};obj.x1=this.cropOffsertX;obj.x2=obj.x1+this.cropW;obj.y1=this.cropOffsertY;obj.y2=obj.y1+this.cropH;return obj;},leaveCrop:function leaveCrop(e){window.removeEventListener("mousemove",this.moveCrop);window.removeEventListener("mouseup",this.leaveCrop);window.removeEventListener("touchmove",this.moveCrop);window.removeEventListener("touchend",this.leaveCrop);this.$emit("cropMoving",{moving:false,axis:this.getCropAxis()});this.$emit("crop-moving",{moving:false,axis:this.getCropAxis()});},getCropChecked:function getCropChecked(cb){var _this12=this;var canvas=document.createElement("canvas");var img=new Image();var rotate=this.rotate;var trueWidth=this.trueWidth;var trueHeight=this.trueHeight;var cropOffsertX=this.cropOffsertX;var cropOffsertY=this.cropOffsertY;img.onload=function(){if(_this12.cropW!==0){var ctx=canvas.getContext("2d");var dpr=1;if(_this12.high&!_this12.full){dpr=window.devicePixelRatio;}if(_this12.enlarge!==1&!_this12.full){dpr=Math.abs(Number(_this12.enlarge));}var width=_this12.cropW*dpr;var height=_this12.cropH*dpr;var imgW=trueWidth*_this12.scale*dpr;var imgH=trueHeight*_this12.scale*dpr;var dx=(_this12.x-cropOffsertX+_this12.trueWidth*(1-_this12.scale)/2)*dpr;var dy=(_this12.y-cropOffsertY+_this12.trueHeight*(1-_this12.scale)/2)*dpr;setCanvasSize(width,height);ctx.save();switch(rotate){case 0:if(!_this12.full){ctx.drawImage(img,dx,dy,imgW,imgH);}else{setCanvasSize(width/_this12.scale,height/_this12.scale);ctx.drawImage(img,dx/_this12.scale,dy/_this12.scale,imgW/_this12.scale,imgH/_this12.scale);}break;case 1:case-3:if(!_this12.full){dx=dx+(imgW-imgH)/2;dy=dy+(imgH-imgW)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,dy,-dx-imgH,imgW,imgH);}else{setCanvasSize(width/_this12.scale,height/_this12.scale);dx=dx/_this12.scale+(imgW/_this12.scale-imgH/_this12.scale)/2;dy=dy/_this12.scale+(imgH/_this12.scale-imgW/_this12.scale)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,dy,-dx-imgH/_this12.scale,imgW/_this12.scale,imgH/_this12.scale);}break;case 2:case-2:if(!_this12.full){ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,-dx-imgW,-dy-imgH,imgW,imgH);}else{setCanvasSize(width/_this12.scale,height/_this12.scale);ctx.rotate(rotate*90*Math.PI/180);dx=dx/_this12.scale;dy=dy/_this12.scale;ctx.drawImage(img,-dx-imgW/_this12.scale,-dy-imgH/_this12.scale,imgW/_this12.scale,imgH/_this12.scale);}break;case 3:case-1:if(!_this12.full){dx=dx+(imgW-imgH)/2;dy=dy+(imgH-imgW)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,-dy-imgW,dx,imgW,imgH);}else{setCanvasSize(width/_this12.scale,height/_this12.scale);dx=dx/_this12.scale+(imgW/_this12.scale-imgH/_this12.scale)/2;dy=dy/_this12.scale+(imgH/_this12.scale-imgW/_this12.scale)/2;ctx.rotate(rotate*90*Math.PI/180);ctx.drawImage(img,-dy-imgW/_this12.scale,dx,imgW/_this12.scale,imgH/_this12.scale);}break;default:if(!_this12.full){ctx.drawImage(img,dx,dy,imgW,imgH);}else{setCanvasSize(width/_this12.scale,height/_this12.scale);ctx.drawImage(img,dx/_this12.scale,dy/_this12.scale,imgW/_this12.scale,imgH/_this12.scale);}}ctx.restore();}else{var _width=trueWidth*_this12.scale;var _height=trueHeight*_this12.scale;var _ctx2=canvas.getContext("2d");_ctx2.save();switch(rotate){case 0:setCanvasSize(_width,_height);_ctx2.drawImage(img,0,0,_width,_height);break;case 1:case-3:setCanvasSize(_height,_width);_ctx2.rotate(rotate*90*Math.PI/180);_ctx2.drawImage(img,0,-_height,_width,_height);break;case 2:case-2:setCanvasSize(_width,_height);_ctx2.rotate(rotate*90*Math.PI/180);_ctx2.drawImage(img,-_width,-_height,_width,_height);break;case 3:case-1:setCanvasSize(_height,_width);_ctx2.rotate(rotate*90*Math.PI/180);_ctx2.drawImage(img,-_width,0,_width,_height);break;default:setCanvasSize(_width,_height);_ctx2.drawImage(img,0,0,_width,_height);}_ctx2.restore();}cb(canvas);};var s=this.img.substr(0,4);if(s!=="data"){img.crossOrigin="Anonymous";}img.src=this.imgs;function setCanvasSize(width,height){canvas.width=Math.round(width);canvas.height=Math.round(height);}},getCropData:function getCropData(cb){var _this13=this;this.getCropChecked(function(data){cb(data.toDataURL("image/"+_this13.outputType,_this13.outputSize));});},getCropBlob:function getCropBlob(cb){var _this14=this;this.getCropChecked(function(data){data.toBlob(function(blob){return cb(blob);},"image/"+_this14.outputType,_this14.outputSize);});},showPreview:function showPreview(){var _this15=this;if(this.isCanShow){this.isCanShow=false;setTimeout(function(){_this15.isCanShow=true;},16);}else{return false;}var w=this.cropW;var h=this.cropH;var scale=this.scale;var obj={};obj.div={width:"".concat(w,"px"),height:"".concat(h,"px")};var transformX=(this.x-this.cropOffsertX)/scale;var transformY=(this.y-this.cropOffsertY)/scale;var transformZ=0;obj.w=w;obj.h=h;obj.url=this.imgs;obj.img={width:"".concat(this.trueWidth,"px"),height:"".concat(this.trueHeight,"px"),transform:"scale(".concat(scale,")translate3d(").concat(transformX,"px, ").concat(transformY,"px, ").concat(transformZ,"px)rotateZ(").concat(this.rotate*90,"deg)")};obj.html="\n
\n
\n \n
\n
");this.$emit("realTime",obj);this.$emit("real-time",obj);},reload:function reload(){var _this16=this;var img=new Image();img.onload=function(){_this16.w=parseFloat(window.getComputedStyle(_this16.$refs.cropper).width);_this16.h=parseFloat(window.getComputedStyle(_this16.$refs.cropper).height);_this16.trueWidth=img.width;_this16.trueHeight=img.height;if(!_this16.original){_this16.scale=_this16.checkedMode();}else{_this16.scale=1;}_this16.$nextTick(function(){_this16.x=-(_this16.trueWidth-_this16.trueWidth*_this16.scale)/2+(_this16.w-_this16.trueWidth*_this16.scale)/2;_this16.y=-(_this16.trueHeight-_this16.trueHeight*_this16.scale)/2+(_this16.h-_this16.trueHeight*_this16.scale)/2;_this16.loading=false;if(_this16.autoCrop){_this16.goAutoCrop();}_this16.$emit("img-load","success");_this16.$emit("imgLoad","success");setTimeout(function(){_this16.showPreview();},20);});};img.onerror=function(){_this16.$emit("imgLoad","error");_this16.$emit("img-load","error");};img.src=this.imgs;},checkedMode:function checkedMode(){var scale=1;var imgW=this.trueWidth;var imgH=this.trueHeight;var arr=this.mode.split(" ");switch(arr[0]){case"contain":if(this.trueWidth>this.w){scale=this.w/this.trueWidth;}if(this.trueHeight*scale>this.h){scale=this.h/this.trueHeight;}break;case"cover":imgW=this.w;scale=imgW/this.trueWidth;imgH=imgH*scale;if(imgH0;var imgW=(switchWH?this.trueHeight:this.trueWidth)*this.scale;var imgH=(switchWH?this.trueWidth:this.trueHeight)*this.scale;maxWidth=imgWmaxWidth?maxWidth:w;h=h>maxHeight?maxHeight:h;if(this.fixed){h=w/this.fixedNumber[0]*this.fixedNumber[1];}if(h>this.h){h=this.h;w=h/this.fixedNumber[1]*this.fixedNumber[0];}this.changeCrop(w,h);},changeCrop:function changeCrop(w,h){var _this17=this;if(this.centerBox){var axis=this.getImgAxis();if(w>axis.x2-axis.x1){w=axis.x2-axis.x1;h=w/this.fixedNumber[0]*this.fixedNumber[1];}if(h>axis.y2-axis.y1){h=axis.y2-axis.y1;w=h/this.fixedNumber[1]*this.fixedNumber[0];}}this.cropW=w;this.cropH=h;this.checkCropLimitSize();this.$nextTick(function(){_this17.cropOffsertX=(_this17.w-_this17.cropW)/2;_this17.cropOffsertY=(_this17.h-_this17.cropH)/2;if(_this17.centerBox){_this17.moveCrop(null,true);}});},refresh:function refresh(){var _this18=this;this.img;this.imgs="";this.scale=1;this.crop=false;this.rotate=0;this.w=0;this.h=0;this.trueWidth=0;this.trueHeight=0;this.clearCrop();this.$nextTick(function(){_this18.checkedImg();});},rotateLeft:function rotateLeft(){this.rotate=this.rotate<=-3?0:this.rotate-1;},rotateRight:function rotateRight(){this.rotate=this.rotate>=3?0:this.rotate+1;},rotateClear:function rotateClear(){this.rotate=0;},checkoutImgAxis:function checkoutImgAxis(x,y,scale){x=x||this.x;y=y||this.y;scale=scale||this.scale;var canGo=true;if(this.centerBox){var axis=this.getImgAxis(x,y,scale);var cropAxis=this.getCropAxis();if(axis.x1>=cropAxis.x1){canGo=false;}if(axis.x2<=cropAxis.x2){canGo=false;}if(axis.y1>=cropAxis.y1){canGo=false;}if(axis.y2<=cropAxis.y2){canGo=false;}}return canGo;}},mounted:function mounted(){this.support="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";var that=this;var u=navigator.userAgent;this.isIOS=!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);if(!HTMLCanvasElement.prototype.toBlob){Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function value(callback,type,quality){var binStr=atob(this.toDataURL(type,quality).split(",")[1]),len=binStr.length,arr=new Uint8Array(len);for(var i=0;i * * javascript: * this.$refs.cropper.loadFile() * * @param file */loadFile:function loadFile(file){var _this19=this;if(file instanceof File){this.onLoadImg(file).then(function(base64){_this19.img=base64;setTimeout(function(){_this19.config.autoCrop=true;_this19.addSlide();},10);});}else{throw new Error("Arguments file is not File");}},/** * * @param base64 */loadBase64:function loadBase64(base64){var _this20=this;if(typeof base64!=="string"){throw new Error("Arguments base64 is not string");}var base=base64.split(",");if(!/^data:image\/(.*?);base64$/.test(base[0])){throw new Error("Arguments base64 MIME is not image/*");}// Base64 Regex @see https://learnku.com/articles/42295 if(!/^[\/]?([\da-zA-Z]+[\/+]+)*[\da-zA-Z]+([+=]{1,2}|[\/])?$/.test(base[1])){throw new Error("Not standard base64");}this.img=base64;setTimeout(function(){_this20.config.autoCrop=true;_this20.addSlide();},10);},rotating:function rotating(e){this.$refs.cropper.rotateRight();// document.getElementsByClassName("cropper-modal")[0].style = "background-color: rgba(0,0,0,0.5);transition: 0.88s"; },canceltailor:function canceltailor(){this.img="";this.onCancelTailor();},tailoring:function tailoring(){var _this21=this;// 获取截图的base64数据 this.$refs.cropper.getCropData(function(data){_this21.getBase64Data(data);_this21.getBlob(data);_this21.img="";_this21.config.autoCrop=false;});// 获取截图的blob数据 this.$refs.cropper.getCropBlob(function(data){_this21.getBase64Data(data);_this21.getBlob(data);// Blob 转 File var suffix={jpeg:"jpg",png:"png",webp:"webp"}[_this21.config.outputType];var time=new Date().getTime();var file=new File([data],"".concat(time,".").concat(suffix),{type:"image/".concat(_this21.config.outputType)});_this21.getFile(file);_this21.img="";_this21.config.autoCrop=false;});},upPhoto:function upPhoto(e){var _this22=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var photoUrl;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:photoUrl=e.target.files[0];_this22.$refs.headInput.value=null;if(!(photoUrl!=undefined)){_context2.next=9;break;}_this22.imgOriginF(photoUrl);_context2.next=6;return _this22.onLoadImg(photoUrl);case 6:_this22.img=_context2.sent;_this22.config.autoCrop=true;setTimeout(function(){_this22.addSlide();},20);case 9:case"end":return _context2.stop();}}},_callee2);}))();},onCropMoving:function onCropMoving(e){// console.log('onCropMoving') },onImgMoving:function onImgMoving(e){// console.log('onCropMoving') }},render:function render(){return createVNode("div",{"class":[styles.upbtn,styles.uploadWarper]},[this.hideInput,!this.hideInput?createVNode("input",{"style":"opacity: 0;","class":styles.upbtn,"type":"file","accept":"image/*","onChange":this.upPhoto,"ref":"headInput"},null):null,this.img!=''?createVNode("div",{"class":styles.bg},[this.config.ceilbutton?createVNode("div",{"class":styles.btndiv},[createVNode("div",{"class":styles.btn,"onClick":this.canceltailor,"style":{backgroundColor:this.config.cancelButtonBackgroundColor,color:this.config.cancelButtonTextColor}},[this.config.cancelButtonText]),createVNode("div",{"class":styles.img,"onClick":this.rotating},null),createVNode("div",{"class":styles.btn,"onClick":this.tailoring,"style":{backgroundColor:this.config.confirmButtonBackgroundColor,color:this.config.confirmButtonTextColor}},[this.config.confirmButtonText])]):null,createVNode("div",{"class":styles.wrapper},[createVNode(VueCropper,{"ref":"cropper","img":this.img,"outputSize":this.config.outputSize,"outputType":this.config.outputType,"info":this.config.info,"canScale":this.config.canScale,"autoCrop":this.config.autoCrop,"autoCropWidth":this.config.autoCropWidth,"autoCropHeight":this.config.autoCropHeight,"fixedBox":this.config.fixedBox,"fixed":this.config.fixed,"fixedNumber":this.config.fixedNumber,"full":this.config.full,"canMove":this.config.canMove,"canMoveBox":this.config.canMoveBox,"original":this.config.original,"centerBox":this.config.centerBox,"high":this.config.high,"infoTrue":this.config.infoTrue,"maxImgSize":this.config.maxImgSize,"enlarge":this.config.enlarge,"mode":this.config.mode,"onCropMoving":this.onCropMoving,"onImgMoving":this.onImgMoving},null)]),!this.config.ceilbutton?createVNode("div",{"class":styles.btndiv},[createVNode("div",{"class":styles.btn,"onClick":this.canceltailor,"style":{backgroundColor:this.config.cancelButtonBackgroundColor,color:this.config.cancelButtonTextColor}},[this.config.cancelButtonText]),createVNode("div",{"class":styles.img,"onClick":this.rotating},null),createVNode("div",{"class":styles.btn,"onClick":this.tailoring,"style":{backgroundColor:this.config.confirmButtonBackgroundColor,color:this.config.confirmButtonTextColor}},[this.config.confirmButtonText])]):null]):null]);}});var iconUploader="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAcCAYAAAAAwr0iAAAAAXNSR0IArs4c6QAABCZJREFUSEu1ll1oXEUUx/9nbjbsRkRFq4l2d+/M3WhwFaukRUpFoT4oluJDG/EDQYr4poK2IOqLbf2IIOJjlWgJgopWiiCCloAifgTFaKOG7L1z65YQIrQS2+wm2TtHJtxdwtps7rpxnu5lzvnPb87HzBD+5xGG4b4oil4XQnw+Pj6+d2hoKFq9JLVav1wuX7O8vHwYQJGIWtpaHWZeYOZ3PM8bqesGQfA7gOvi/5uUUj8nAmBmobWeAHBDu0ESQjzkuu671i8IAg3Atd9dXV3bcrnceCIA3/d3ENFX7SzOzD4RHSei76WU73cEEIbhsDFmfxsAJ4hoFxH1GWM21f2I6GNmvtr+E9EjzPxrPLcopfylkdcwDLcbY+4AcFFs8DCAzUkBmHkrgGuJaBSASOJn4WhsbKzLdd2jzPxAEqe1bNLp9KZKpTJsd9mGznkKguBZAIfacFrLdCiKoknHcUaI6Mq6ETPbKKbi/xkiWow7ZlkIMUxaa5+ZVZsAzMwREXWtyvVsFEV7CoXC16u11u2CIAjswZAkZ5b8CDOPVqvViWKxuKS17jXG7CSipwFsISILdpqIzhljtOd59zQDzM3N/TQ4OLjcAA+CgBPs3h4m9yqlpi5ky8w2ks8AOFjfDBH9JqW8vhkgm81OENFSYgC7IyHEVinlbJw7USqVtqRSqUtrtdrJQqEwVxfTWh9g5ldiu9Oe52V93/+OiLYBMETkLSwszBeLxTOJARzH2Z3P5z+xDrZVoyg6SkSFWMDWwZu1Wu3J/v7+leIKguAbALfab2PMDmY+K4SwKfpCCHHMGHO/53lvJwU4qZS60Rr7vt9PRD8AuLg5DUQ0IqXcFwPsBnA8PnhmmfnxdDo9VqlUXCJ6GcC3SqnnEgEw82ue5z0VCx8B8Oga9WKEEAXXdfXMzEzP4uLiPDM7a9geTgxARE9IKd+wQlrrH5n55hYFu1cp9WEMa+vlqo4BABxQSr0ai34J4La1AIjobinlZ7HtXwAu2QiAUaWUvRNscdlCWoG5wDjT09OT6+3tPV8qlbJCiD9aRCp5CgCcXVpayg8MDPyttU4DOMHM25vEawAeVEp9EKeq0YobEQGr8aJSyt4XKJfLmVqttp+Z9zDzZUQ04TjOS/l8fuX4nZqauiKVStlD6/KNioC9w22vD7mue6yFKGz1V6vVTwHc3soOQFspqGtFzHywu7t7OJvNVpoXmJ6evsVxnLcAtOqSutt/Aqg72/ayrTYhhLAP0M3MvBPAnQkvNKvzL4Ckt+E6kU08fUgp9Xzd2j5ITgHIJXbv0JCIHpNS2lN1ZVAYhi8YYxpEHeqv5z6fyWQKfX19fzYAJicnuzOZzEcAdq3n3eH8OSHEfa7r2k5pjMarWGt9l30VE1H9Vdzheg13w8ynUqnUe7lcbqZZ9B/GxP8H1HlPxgAAAABJRU5ErkJggg==";var ColUpload=exports('c',defineComponent({name:'col-upload',props:{modelValue:String,tips:{type:String,default:'点击上传'},deletable:{type:Boolean,default:true},cropper:{// 是否进行裁切 type:Boolean,default:false},options:{// 裁切需要参数 type:Object,default:{}},onUploadChange:{type:Function,default:function _default(url){}}},methods:{beforeRead:function beforeRead(file){var isLt2M=file.size/1024/1024<5;if(!isLt2M){Toast('上传文件大小不能超过 5MB');return false;}return true;},beforeDelete:function beforeDelete(file,detail){// this.dataModel.splice(detail.index, 1) return true;},afterRead:function afterRead(file,detail){var _this23=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var formData,res;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.prev=0;file.status='uploading';file.message='上传中...';formData=new FormData();formData.append('file',file.file);_context3.next=7;return request.post('/api-teacher/uploadFile',{data:formData});case 7:res=_context3.sent;_this23.$emit('update:modelValue',res.data.url);_this23.onUploadChange(res.data.url);_context3.next=14;break;case 12:_context3.prev=12;_context3.t0=_context3["catch"](0);case 14:case"end":return _context3.stop();}}},_callee3,null,[[0,12]]);}))();},onClose:function onClose(e){this.$emit('update:modelValue',null);this.onUploadChange();e.stopPropagation();},getFile:function getFile(file){var _this24=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(){var formData,res;return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.prev=0;formData=new FormData();formData.append('file',file);_context4.next=5;return request.post('/api-teacher/uploadFile',{data:formData});case 5:res=_context4.sent;_this24.$emit('update:modelValue',res.data.url);_this24.onUploadChange(res.data.url);_context4.next=12;break;case 10:_context4.prev=10;_context4.t0=_context4["catch"](0);case 12:case"end":return _context4.stop();}}},_callee4,null,[[0,10]]);}))();}},render:function render(){var _this25=this;useCustomFieldValue(function(){return _this25.modelValue;});return createVNode("div",{"class":styles$1['uploader-section']},[this.modelValue&&this.deletable?createVNode(Icon,{"name":"cross","onClick":this.onClose,"class":styles$1["img-close"]},null):null,this.cropper?createVNode("div",{"class":styles$1['col-uploader']},[this.modelValue?createVNode(Image$1,{"fit":"cover","position":"center","class":styles$1.uploadImg,"src":this.modelValue},null):createVNode("div",{"class":styles$1.uploader},[createVNode(Icon,{"name":iconUploader,"size":"32"},null),createVNode("p",{"class":styles$1.uploaderText},[this.tips])]),createVNode(ColCropper,{"option":this.options,"getFile":this.getFile},null)]):// @ts-ignore createVNode(Uploader,{"afterRead":this.afterRead,"beforeRead":this.beforeRead,"beforeDelete":this.beforeDelete},{default:function _default(){return _this25.modelValue?createVNode(Image$1,{"fit":"cover","position":"center","class":styles$1.uploadImg,"src":_this25.modelValue},null):createVNode("div",{"class":styles$1.uploader},[createVNode(Icon,{"name":iconUploader,"size":"32"},null),createVNode("p",{"class":styles$1.uploaderText},[_this25.tips])]);}})]);}}));}};});})();