mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-11-04 17:00:37 +00:00
8 lines
37 KiB
JavaScript
8 lines
37 KiB
JavaScript
import{y as O,z as M,s as I,ab as A,A as f,a1 as k,H as N,a0 as F,$ as B,d as j,k as Y,u as R,j as y,W as U,B as S,C as b,_ as L,l as _,r as P,a2 as E,a as q}from"./element-plus-D1Ezoxxm.js";import{_ as Z}from"./f-MniSWpLh.js";import{updtaeAdmin as G}from"./user-DNg7l1wq.js";import{_ as V,f as Q,u as J,a as K}from"./index-BzWqH73M.js";import{u as ee}from"./userLevel-tvlzLPRg.js";import"./monaco-editor-uXAv8CL-.js";import"./form-create-C-8Ibman.js";import"./vxe-ot-ELJR6.js";import"./screenfull-4lR0nMAj.js";const D={};D.getData=e=>new Promise((t,s)=>{let i={};te(e).then(r=>{i.arrayBuffer=r;try{i.orientation=re(r)}catch{i.orientation=-1}t(i)}).catch(r=>{s(r)})});function te(e){let t=null;return new Promise((s,i)=>{if(e.src)if(/^data\:/i.test(e.src))t=ie(e.src),s(t);else if(/^blob\:/i.test(e.src)){var r=new FileReader;r.onload=function(h){t=h.target.result,s(t)},se(e.src,function(h){r.readAsArrayBuffer(h)})}else{var o=new XMLHttpRequest;o.onload=function(){if(this.status==200||this.status===0)t=o.response,s(t);else throw"Could not load image";o=null},o.open("GET",e.src,!0),o.responseType="arraybuffer",o.send(null)}else i("img error")})}function se(e,t){var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="blob",s.onload=function(i){(this.status==200||this.status===0)&&t(this.response)},s.send()}function ie(e,t){t=t||e.match(/^data\:([^\;]+)\;base64,/mi)[1]||"",e=e.replace(/^data\:([^\;]+)\;base64,/gmi,"");for(var s=atob(e),i=s.length%2==0?s.length:s.length+1,r=new ArrayBuffer(i),o=new Uint16Array(r),h=0;h<i;h++)o[h]=s.charCodeAt(h);return r}function oe(e,t,s){var i="",r;for(r=t,s+=t;r<s;r++)i+=String.fromCharCode(e.getUint8(r));return i}function re(e){var t=new DataView(e),s=t.byteLength,i,r,o,h,a,l,n,c,d,u;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(d=2;d<s;){if(t.getUint8(d)===255&&t.getUint8(d+1)===225){n=d;break}d++}if(n&&(r=n+4,o=n+10,oe(t,r,4)==="Exif"&&(l=t.getUint16(o),a=l===18761,(a||l===19789)&&t.getUint16(o+2,a)===42&&(h=t.getUint32(o+4,a),h>=8&&(c=o+h)))),c){for(s=t.getUint16(c,a),u=0;u<s;u++)if(d=c+u*12+2,t.getUint16(d,a)===274){d+=8,i=t.getUint16(d,a);break}}return i}const he=(e,t)=>{const s=e.__vccOpts||e;for(const[i,r]of t)s[i]=r;return s},ae=j({data:function(){return{w:0,h:0,scale:1,x:0,y:0,loading:!0,trueWidth:0,trueHeight:0,move:!0,moveX:0,moveY:0,crop:!1,cropping:!1,cropW:0,cropH:0,cropOldW:0,cropOldH:0,canChangeX:!1,canChangeY:!1,changeCropTypeX:1,changeCropTypeY:1,cropX:0,cropY:0,cropChangeX:0,cropChangeY:0,cropOffsertX:0,cropOffsertY:0,support:"",touches:[],touchNow:!1,rotate:0,isIos:!1,orientation:0,imgs:"",coe:.2,scaling:!1,scalingSet:"",coeStatus:"",isCanShow:!0,imgIsQqualCrop:!1}},props:{img:{type:[String,Blob,null,File],default:""},outputSize:{type:Number,default:1},outputType:{type:String,default:"jpeg"},info:{type:Boolean,default:!0},canScale:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!1},autoCropWidth:{type:[Number,String],default:0},autoCropHeight:{type:[Number,String],default:0},fixed:{type:Boolean,default:!1},fixedNumber:{type:Array,default:()=>[1,1]},fixedBox:{type:Boolean,default:!1},full:{type:Boolean,default:!1},canMove:{type:Boolean,default:!0},canMoveBox:{type:Boolean,default:!0},original:{type:Boolean,default:!1},centerBox:{type:Boolean,default:!1},high:{type:Boolean,default:!0},infoTrue:{type:Boolean,default:!1},maxImgSize:{type:[Number,String],default:2e3},enlarge:{type:[Number,String],default:1},preW:{type:[Number,String],default:0},mode:{type:String,default:"contain"},limitMinSize:{type:[Number,Array,String],default:()=>10,validator:function(e){return Array.isArray(e)?Number(e[0])>=0&&Number(e[1])>=0:Number(e)>=0}},fillColor:{type:String,default:""}},computed:{cropInfo(){let e={};if(e.top=this.cropOffsertY>21?"-21px":"0px",e.width=this.cropW>0?this.cropW:0,e.height=this.cropH>0?this.cropH:0,this.infoTrue){let t=1;this.high&&!this.full&&(t=window.devicePixelRatio),this.enlarge!==1&!this.full&&(t=Math.abs(Number(this.enlarge))),e.width=e.width*t,e.height=e.height*t,this.full&&(e.width=e.width/this.scale,e.height=e.height/this.scale)}return e.width=e.width.toFixed(0),e.height=e.height.toFixed(0),e},isIE(){return!!window.ActiveXObject||"ActiveXObject"in window},passive(){return this.isIE?null:{passive:!1}},isRotateRightOrLeft(){return[1,-1,3,-3].includes(this.rotate)}},watch:{img(){this.checkedImg()},imgs(e){e!==""&&this.reload()},cropW(){this.showPreview()},cropH(){this.showPreview()},cropOffsertX(){this.showPreview()},cropOffsertY(){this.showPreview()},scale(e,t){this.showPreview()},x(){this.showPreview()},y(){this.showPreview()},autoCrop(e){e&&this.goAutoCrop()},autoCropWidth(){this.autoCrop&&this.goAutoCrop()},autoCropHeight(){this.autoCrop&&this.goAutoCrop()},mode(){this.checkedImg()},rotate(){this.showPreview(),this.autoCrop?this.goAutoCrop(this.cropW,this.cropH):(this.cropW>0||this.cropH>0)&&this.goAutoCrop(this.cropW,this.cropH)}},methods:{getVersion(e){var t=navigator.userAgent.split(" "),s="";let i=0;const r=new RegExp(e,"i");for(var o=0;o<t.length;o++)r.test(t[o])&&(s=t[o]);return s?i=s.split("/")[1].split("."):i=["0","0","0"],i},checkOrientationImage(e,t,s,i){if(this.getVersion("chrome")[0]>=81)t=-1;else if(this.getVersion("safari")[0]>=605){const h=this.getVersion("version");h[0]>13&&h[1]>1&&(t=-1)}else{const h=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(h){let a=h[1];a=a.split("_"),(a[0]>13||a[0]>=13&&a[1]>=4)&&(t=-1)}}let r=document.createElement("canvas"),o=r.getContext("2d");switch(o.save(),t){case 2:r.width=s,r.height=i,o.translate(s,0),o.scale(-1,1);break;case 3:r.width=s,r.height=i,o.translate(s/2,i/2),o.rotate(180*Math.PI/180),o.translate(-s/2,-i/2);break;case 4:r.width=s,r.height=i,o.translate(0,i),o.scale(1,-1);break;case 5:r.height=s,r.width=i,o.rotate(.5*Math.PI),o.scale(1,-1);break;case 6:r.width=i,r.height=s,o.translate(i/2,s/2),o.rotate(90*Math.PI/180),o.translate(-s/2,-i/2);break;case 7:r.height=s,r.width=i,o.rotate(.5*Math.PI),o.translate(s,-i),o.scale(-1,1);break;case 8:r.height=s,r.width=i,o.translate(i/2,s/2),o.rotate(-90*Math.PI/180),o.translate(-s/2,-i/2);break;default:r.width=s,r.height=i}o.drawImage(e,0,0,s,i),o.restore(),r.toBlob(h=>{let a=URL.createObjectURL(h);URL.revokeObjectURL(this.imgs),this.imgs=a},"image/"+this.outputType,1)},checkedImg(){if(this.img===null||this.img===""){this.imgs="",this.clearCrop();return}this.loading=!0,this.scale=1,this.rotate=0,this.imgIsQqualCrop=!1,this.clearCrop();let e=new Image;if(e.onload=()=>{if(this.img==="")return this.$emit("img-load",new Error("图片不能为空")),!1;let s=e.width,i=e.height;D.getData(e).then(r=>{this.orientation=r.orientation||1;let o=Number(this.maxImgSize);if(!this.orientation&&s<o&i<o){this.imgs=this.img;return}s>o&&(i=i/s*o,s=o),i>o&&(s=s/i*o,i=o),this.checkOrientationImage(e,this.orientation,s,i)}).catch(r=>{this.$emit("img-load","error"),this.$emit("img-load-error",r)})},e.onerror=s=>{this.$emit("img-load","error"),this.$emit("img-load-error",s)},this.img.substr(0,4)!=="data"&&(e.crossOrigin=""),this.isIE){var t=new XMLHttpRequest;t.onload=function(){var s=URL.createObjectURL(this.response);e.src=s},t.open("GET",this.img,!0),t.responseType="blob",t.send()}else e.src=this.img},startMove(e){if(e.preventDefault(),this.move&&!this.crop){if(!this.canMove)return!1;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,e.touches?(window.addEventListener("touchmove",this.moveImg),window.addEventListener("touchend",this.leaveImg),e.touches.length==2&&(this.touches=e.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale))):(window.addEventListener("mousemove",this.moveImg),window.addEventListener("mouseup",this.leaveImg)),this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})}else this.cropping=!0,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(e){e.preventDefault();let t=this.scale;var s={x:this.touches[0].clientX,y:this.touches[0].clientY},i={x:e.touches[0].clientX,y:e.touches[0].clientY},r={x:this.touches[1].clientX,y:this.touches[1].clientY},o={x:e.touches[1].clientX,y:e.touches[1].clientY},h=Math.sqrt(Math.pow(s.x-r.x,2)+Math.pow(s.y-r.y,2)),a=Math.sqrt(Math.pow(i.x-o.x,2)+Math.pow(i.y-o.y,2)),l=a-h,n=1;n=n/this.trueWidth>n/this.trueHeight?n/this.trueHeight:n/this.trueWidth,n=n>.1?.1:n;var c=n*l;if(!this.touchNow){if(this.touchNow=!0,l>0?t+=Math.abs(c):l<0&&t>Math.abs(c)&&(t-=Math.abs(c)),this.touches=e.touches,setTimeout(()=>{this.touchNow=!1},8),!this.checkoutImgAxis(this.x,this.y,t))return!1;this.scale=t}},cancelTouchScale(e){window.removeEventListener("touchmove",this.touchScale)},moveImg(e){if(e.preventDefault(),e.touches&&e.touches.length===2)return this.touches=e.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale),window.removeEventListener("touchmove",this.moveImg),!1;let t="clientX"in e?e.clientX:e.touches[0].clientX,s="clientY"in e?e.clientY:e.touches[0].clientY,i,r;i=t-this.moveX,r=s-this.moveY,this.$nextTick(()=>{if(this.centerBox){let o=this.getImgAxis(i,r,this.scale),h=this.getCropAxis(),a=this.trueHeight*this.scale,l=this.trueWidth*this.scale,n,c,d,u;switch(this.rotate){case 1:case-1:case 3:case-3:n=this.cropOffsertX-this.trueWidth*(1-this.scale)/2+(a-l)/2,c=this.cropOffsertY-this.trueHeight*(1-this.scale)/2+(l-a)/2,d=n-a+this.cropW,u=c-l+this.cropH;break;default:n=this.cropOffsertX-this.trueWidth*(1-this.scale)/2,c=this.cropOffsertY-this.trueHeight*(1-this.scale)/2,d=n-l+this.cropW,u=c-a+this.cropH;break}o.x1>=h.x1&&(i=n),o.y1>=h.y1&&(r=c),o.x2<=h.x2&&(i=d),o.y2<=h.y2&&(r=u)}this.x=i,this.y=r,this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})})},leaveImg(e){window.removeEventListener("mousemove",this.moveImg),window.removeEventListener("touchmove",this.moveImg),window.removeEventListener("mouseup",this.leaveImg),window.removeEventListener("touchend",this.leaveImg),this.$emit("img-moving",{moving:!1,axis:this.getImgAxis()})},scaleImg(){this.canScale&&window.addEventListener(this.support,this.changeSize,this.passive)},cancelScale(){this.canScale&&window.removeEventListener(this.support,this.changeSize)},changeSize(e){e.preventDefault();let t=this.scale;var s=e.deltaY||e.wheelDelta,i=navigator.userAgent.indexOf("Firefox");s=i>0?s*30:s,this.isIE&&(s=-s);var r=this.coe;r=r/this.trueWidth>r/this.trueHeight?r/this.trueHeight:r/this.trueWidth;var o=r*s;o<0?t+=Math.abs(o):t>Math.abs(o)&&(t-=Math.abs(o));let h=o<0?"add":"reduce";if(h!==this.coeStatus&&(this.coeStatus=h,this.coe=.2),this.scaling||(this.scalingSet=setTimeout(()=>{this.scaling=!1,this.coe=this.coe+=.01},50)),this.scaling=!0,!this.checkoutImgAxis(this.x,this.y,t))return!1;this.scale=t},changeScale(e){let t=this.scale;e=e||1;var s=20;if(s=s/this.trueWidth>s/this.trueHeight?s/this.trueHeight:s/this.trueWidth,e=e*s,e>0?t+=Math.abs(e):t>Math.abs(e)&&(t-=Math.abs(e)),!this.checkoutImgAxis(this.x,this.y,t))return!1;this.scale=t},createCrop(e){e.preventDefault();var t="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0,s="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;this.$nextTick(()=>{var i=t-this.cropX,r=s-this.cropY;if(i>0?(this.cropW=i+this.cropChangeX>this.w?this.w-this.cropChangeX:i,this.cropOffsertX=this.cropChangeX):(this.cropW=this.w-this.cropChangeX+Math.abs(i)>this.w?this.cropChangeX:Math.abs(i),this.cropOffsertX=this.cropChangeX+i>0?this.cropChangeX+i:0),!this.fixed)r>0?(this.cropH=r+this.cropChangeY>this.h?this.h-this.cropChangeY:r,this.cropOffsertY=this.cropChangeY):(this.cropH=this.h-this.cropChangeY+Math.abs(r)>this.h?this.cropChangeY:Math.abs(r),this.cropOffsertY=this.cropChangeY+r>0?this.cropChangeY+r:0);else{var o=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];o+this.cropOffsertY>this.h?(this.cropH=this.h-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0],i>0?this.cropOffsertX=this.cropChangeX:this.cropOffsertX=this.cropChangeX-this.cropW):this.cropH=o,this.cropOffsertY=this.cropOffsertY}})},changeCropSize(e,t,s,i,r){e.preventDefault(),window.addEventListener("mousemove",this.changeCropNow),window.addEventListener("mouseup",this.changeCropEnd),window.addEventListener("touchmove",this.changeCropNow),window.addEventListener("touchend",this.changeCropEnd),this.canChangeX=t,this.canChangeY=s,this.changeCropTypeX=i,this.changeCropTypeY=r,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,this.fixed&&this.canChangeX&&this.canChangeY&&(this.canChangeY=0),this.$emit("change-crop-size",{width:this.cropW,height:this.cropH})},changeCropNow(e){e.preventDefault();var t="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0,s="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;let i=this.w,r=this.h,o=0,h=0;if(this.centerBox){let n=this.getImgAxis(),c=n.x2,d=n.y2;o=n.x1>0?n.x1:0,h=n.y1>0?n.y1:0,i>c&&(i=c),r>d&&(r=d)}const[a,l]=this.checkCropLimitSize();this.$nextTick(()=>{var n=t-this.cropX,c=s-this.cropY;if(this.canChangeX&&(this.changeCropTypeX===1?this.cropOldW-n<a?(this.cropW=a,this.cropOffsertX=this.cropOldW+this.cropChangeX-o-a):this.cropOldW-n>0?(this.cropW=i-this.cropChangeX-n<=i-o?this.cropOldW-n:this.cropOldW+this.cropChangeX-o,this.cropOffsertX=i-this.cropChangeX-n<=i-o?this.cropChangeX+n:o):(this.cropW=Math.abs(n)+this.cropChangeX<=i?Math.abs(n)-this.cropOldW:i-this.cropOldW-this.cropChangeX,this.cropOffsertX=this.cropChangeX+this.cropOldW):this.changeCropTypeX===2&&(this.cropOldW+n<a?this.cropW=a:this.cropOldW+n>0?(this.cropW=this.cropOldW+n+this.cropOffsertX<=i?this.cropOldW+n:i-this.cropOffsertX,this.cropOffsertX=this.cropChangeX):(this.cropW=i-this.cropChangeX+Math.abs(n+this.cropOldW)<=i-o?Math.abs(n+this.cropOldW):this.cropChangeX-o,this.cropOffsertX=i-this.cropChangeX+Math.abs(n+this.cropOldW)<=i-o?this.cropChangeX-Math.abs(n+this.cropOldW):o))),this.canChangeY&&(this.changeCropTypeY===1?this.cropOldH-c<l?(this.cropH=l,this.cropOffsertY=this.cropOldH+this.cropChangeY-h-l):this.cropOldH-c>0?(this.cropH=r-this.cropChangeY-c<=r-h?this.cropOldH-c:this.cropOldH+this.cropChangeY-h,this.cropOffsertY=r-this.cropChangeY-c<=r-h?this.cropChangeY+c:h):(this.cropH=Math.abs(c)+this.cropChangeY<=r?Math.abs(c)-this.cropOldH:r-this.cropOldH-this.cropChangeY,this.cropOffsertY=this.cropChangeY+this.cropOldH):this.changeCropTypeY===2&&(this.cropOldH+c<l?this.cropH=l:this.cropOldH+c>0?(this.cropH=this.cropOldH+c+this.cropOffsertY<=r?this.cropOldH+c:r-this.cropOffsertY,this.cropOffsertY=this.cropChangeY):(this.cropH=r-this.cropChangeY+Math.abs(c+this.cropOldH)<=r-h?Math.abs(c+this.cropOldH):this.cropChangeY-h,this.cropOffsertY=r-this.cropChangeY+Math.abs(c+this.cropOldH)<=r-h?this.cropChangeY-Math.abs(c+this.cropOldH):h))),this.canChangeX&&this.fixed){var d=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];d<l?(this.cropH=l,this.cropW=this.fixedNumber[0]*l/this.fixedNumber[1],this.changeCropTypeX===1&&(this.cropOffsertX=this.cropChangeX+(this.cropOldW-this.cropW))):d+this.cropOffsertY>r?(this.cropH=r-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0],this.changeCropTypeX===1&&(this.cropOffsertX=this.cropChangeX+(this.cropOldW-this.cropW))):this.cropH=d}if(this.canChangeY&&this.fixed){var u=this.cropH/this.fixedNumber[1]*this.fixedNumber[0];u<a?(this.cropW=a,this.cropH=this.fixedNumber[1]*a/this.fixedNumber[0],this.cropOffsertY=this.cropOldH+this.cropChangeY-this.cropH):u+this.cropOffsertX>i?(this.cropW=i-this.cropOffsertX,this.cropH=this.cropW/this.fixedNumber[0]*this.fixedNumber[1]):this.cropW=u}})},checkCropLimitSize(){let{cropW:e,cropH:t,limitMinSize:s}=this,i=new Array;return Array.isArray(s)?i=s:i=[s,s],e=parseFloat(i[0]),t=parseFloat(i[1]),[e,t]},changeCropEnd(e){window.removeEventListener("mousemove",this.changeCropNow),window.removeEventListener("mouseup",this.changeCropEnd),window.removeEventListener("touchmove",this.changeCropNow),window.removeEventListener("touchend",this.changeCropEnd)},calculateSize(e,t,s,i,r,o){const h=e/t;let a=r,l=o;return a<s&&(a=s,l=Math.ceil(a/h)),l<i&&(l=i,a=Math.ceil(l*h),a<s&&(a=s,l=Math.ceil(a/h))),a<r&&(a=r,l=Math.ceil(a/h)),l<o&&(l=o,a=Math.ceil(l*h)),{width:a,height:l}},endCrop(){this.cropW===0&&this.cropH===0&&(this.cropping=!1);let[e,t]=this.checkCropLimitSize();const{width:s,height:i}=this.fixed?this.calculateSize(this.fixedNumber[0],this.fixedNumber[1],e,t,this.cropW,this.cropH):{width:e,height:t};s>this.cropW&&(this.cropW=s,this.cropOffsertX+s>this.w&&(this.cropOffsertX=this.w-s)),i>this.cropH&&(this.cropH=i,this.cropOffsertY+i>this.h&&(this.cropOffsertY=this.h-i)),window.removeEventListener("mousemove",this.createCrop),window.removeEventListener("mouseup",this.endCrop),window.removeEventListener("touchmove",this.createCrop),window.removeEventListener("touchend",this.endCrop)},startCrop(){this.crop=!0},stopCrop(){this.crop=!1},clearCrop(){this.cropping=!1,this.cropW=0,this.cropH=0},cropMove(e){if(e.preventDefault(),!this.canMoveBox)return this.crop=!1,this.startMove(e),!1;if(e.touches&&e.touches.length===2)return this.crop=!1,this.startMove(e),this.leaveCrop(),!1;window.addEventListener("mousemove",this.moveCrop),window.addEventListener("mouseup",this.leaveCrop),window.addEventListener("touchmove",this.moveCrop),window.addEventListener("touchend",this.leaveCrop);let t="clientX"in e?e.clientX:e.touches[0].clientX,s="clientY"in e?e.clientY:e.touches[0].clientY,i,r;i=t-this.cropOffsertX,r=s-this.cropOffsertY,this.cropX=i,this.cropY=r,this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})},moveCrop(e,t){let s=0,i=0;e&&(e.preventDefault(),s="clientX"in e?e.clientX:e.touches[0].clientX,i="clientY"in e?e.clientY:e.touches[0].clientY),this.$nextTick(()=>{let r,o,h=s-this.cropX,a=i-this.cropY;if(t&&(h=this.cropOffsertX,a=this.cropOffsertY),h<=0?r=0:h+this.cropW>this.w?r=this.w-this.cropW:r=h,a<=0?o=0:a+this.cropH>this.h?o=this.h-this.cropH:o=a,this.centerBox){let l=this.getImgAxis();r<=l.x1&&(r=l.x1),r+this.cropW>l.x2&&(r=l.x2-this.cropW),o<=l.y1&&(o=l.y1),o+this.cropH>l.y2&&(o=l.y2-this.cropH)}this.cropOffsertX=r,this.cropOffsertY=o,this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})})},getImgAxis(e,t,s){e=e||this.x,t=t||this.y,s=s||this.scale;let i={x1:0,x2:0,y1:0,y2:0},r=this.trueWidth*s,o=this.trueHeight*s;switch(this.rotate){case 0:i.x1=e+this.trueWidth*(1-s)/2,i.x2=i.x1+this.trueWidth*s,i.y1=t+this.trueHeight*(1-s)/2,i.y2=i.y1+this.trueHeight*s;break;case 1:case-1:case 3:case-3:i.x1=e+this.trueWidth*(1-s)/2+(r-o)/2,i.x2=i.x1+this.trueHeight*s,i.y1=t+this.trueHeight*(1-s)/2+(o-r)/2,i.y2=i.y1+this.trueWidth*s;break;default:i.x1=e+this.trueWidth*(1-s)/2,i.x2=i.x1+this.trueWidth*s,i.y1=t+this.trueHeight*(1-s)/2,i.y2=i.y1+this.trueHeight*s;break}return i},getCropAxis(){let e={x1:0,x2:0,y1:0,y2:0};return e.x1=this.cropOffsertX,e.x2=e.x1+this.cropW,e.y1=this.cropOffsertY,e.y2=e.y1+this.cropH,e},leaveCrop(e){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.$emit("crop-moving",{moving:!1,axis:this.getCropAxis()})},getCropChecked(e){let t=document.createElement("canvas"),s=t.getContext("2d"),i=new Image,r=this.rotate,o=this.trueWidth,h=this.trueHeight,a=this.cropOffsertX,l=this.cropOffsertY;i.onload=()=>{if(this.cropW!==0){let u=1;this.high&!this.full&&(u=window.devicePixelRatio),this.enlarge!==1&!this.full&&(u=Math.abs(Number(this.enlarge)));let w=this.cropW*u,W=this.cropH*u,m=o*this.scale*u,v=h*this.scale*u,x=(this.x-a+this.trueWidth*(1-this.scale)/2)*u,p=(this.y-l+this.trueHeight*(1-this.scale)/2)*u;switch(d(w,W),s.save(),r){case 0:this.full?(d(w/this.scale,W/this.scale),s.drawImage(i,x/this.scale,p/this.scale,m/this.scale,v/this.scale)):s.drawImage(i,x,p,m,v);break;case 1:case-3:this.full?(d(w/this.scale,W/this.scale),x=x/this.scale+(m/this.scale-v/this.scale)/2,p=p/this.scale+(v/this.scale-m/this.scale)/2,s.rotate(r*90*Math.PI/180),s.drawImage(i,p,-x-v/this.scale,m/this.scale,v/this.scale)):(x=x+(m-v)/2,p=p+(v-m)/2,s.rotate(r*90*Math.PI/180),s.drawImage(i,p,-x-v,m,v));break;case 2:case-2:this.full?(d(w/this.scale,W/this.scale),s.rotate(r*90*Math.PI/180),x=x/this.scale,p=p/this.scale,s.drawImage(i,-x-m/this.scale,-p-v/this.scale,m/this.scale,v/this.scale)):(s.rotate(r*90*Math.PI/180),s.drawImage(i,-x-m,-p-v,m,v));break;case 3:case-1:this.full?(d(w/this.scale,W/this.scale),x=x/this.scale+(m/this.scale-v/this.scale)/2,p=p/this.scale+(v/this.scale-m/this.scale)/2,s.rotate(r*90*Math.PI/180),s.drawImage(i,-p-m/this.scale,x,m/this.scale,v/this.scale)):(x=x+(m-v)/2,p=p+(v-m)/2,s.rotate(r*90*Math.PI/180),s.drawImage(i,-p-m,x,m,v));break;default:this.full?(d(w/this.scale,W/this.scale),s.drawImage(i,x/this.scale,p/this.scale,m/this.scale,v/this.scale)):s.drawImage(i,x,p,m,v)}s.restore()}else{let u=o*this.scale,w=h*this.scale;switch(s.save(),r){case 0:d(u,w),s.drawImage(i,0,0,u,w);break;case 1:case-3:d(w,u),s.rotate(r*90*Math.PI/180),s.drawImage(i,0,-w,u,w);break;case 2:case-2:d(u,w),s.rotate(r*90*Math.PI/180),s.drawImage(i,-u,-w,u,w);break;case 3:case-1:d(w,u),s.rotate(r*90*Math.PI/180),s.drawImage(i,-u,0,u,w);break;default:d(u,w),s.drawImage(i,0,0,u,w)}s.restore()}e(t)};var n=this.img.substr(0,4);n!=="data"&&(i.crossOrigin="Anonymous"),i.src=this.imgs;const c=this.fillColor;function d(u,w){t.width=Math.round(u),t.height=Math.round(w),c&&(s.fillStyle=c,s.fillRect(0,0,t.width,t.height))}},getCropData(e){this.getCropChecked(t=>{e(t.toDataURL("image/"+this.outputType,this.outputSize))})},getCropBlob(e){this.getCropChecked(t=>{t.toBlob(s=>e(s),"image/"+this.outputType,this.outputSize)})},showPreview(){if(this.isCanShow)this.isCanShow=!1,setTimeout(()=>{this.isCanShow=!0},16);else return!1;let e=this.cropW,t=this.cropH,s=this.scale;var i={};i.div={width:`${e}px`,height:`${t}px`};let r=(this.x-this.cropOffsertX)/s,o=(this.y-this.cropOffsertY)/s,h=0;i.w=e,i.h=t,i.url=this.imgs,i.img={width:`${this.trueWidth}px`,height:`${this.trueHeight}px`,transform:`scale(${s})translate3d(${r}px, ${o}px, ${h}px)rotateZ(${this.rotate*90}deg)`},i.html=`
|
||
<div class="show-preview" style="width: ${i.w}px; height: ${i.h}px,; overflow: hidden">
|
||
<div style="width: ${e}px; height: ${t}px">
|
||
<img src=${i.url} style="width: ${this.trueWidth}px; height: ${this.trueHeight}px; transform:
|
||
scale(${s})translate3d(${r}px, ${o}px, ${h}px)rotateZ(${this.rotate*90}deg)">
|
||
</div>
|
||
</div>`,this.$emit("real-time",i)},reload(){let e=new Image;e.onload=()=>{this.w=parseFloat(window.getComputedStyle(this.$refs.cropper).width),this.h=parseFloat(window.getComputedStyle(this.$refs.cropper).height),this.trueWidth=e.width,this.trueHeight=e.height,this.original?this.scale=1:this.scale=this.checkedMode(),this.$nextTick(()=>{this.x=-(this.trueWidth-this.trueWidth*this.scale)/2+(this.w-this.trueWidth*this.scale)/2,this.y=-(this.trueHeight-this.trueHeight*this.scale)/2+(this.h-this.trueHeight*this.scale)/2,this.loading=!1,this.autoCrop&&this.goAutoCrop(),this.$emit("img-load","success"),setTimeout(()=>{this.showPreview()},20)})},e.onerror=()=>{this.$emit("img-load","error")},e.src=this.imgs},checkedMode(){let e=1,t=this.trueWidth,s=this.trueHeight;const i=this.mode.split(" ");switch(i[0]){case"contain":this.trueWidth>this.w&&(e=this.w/this.trueWidth),this.trueHeight*e>this.h&&(e=this.h/this.trueHeight);break;case"cover":t=this.w,e=t/this.trueWidth,s=s*e,s<this.h&&(s=this.h,e=s/this.trueHeight);break;default:try{let r=i[0];if(r.search("px")!==-1){r=r.replace("px",""),t=parseFloat(r);const o=t/this.trueWidth;let h=1,a=i[1];a.search("px")!==-1&&(a=a.replace("px",""),s=parseFloat(a),h=s/this.trueHeight),e=Math.min(o,h)}if(r.search("%")!==-1&&(r=r.replace("%",""),t=parseFloat(r)/100*this.w,e=t/this.trueWidth),i.length===2&&r==="auto"){let o=i[1];o.search("px")!==-1&&(o=o.replace("px",""),s=parseFloat(o),e=s/this.trueHeight),o.search("%")!==-1&&(o=o.replace("%",""),s=parseFloat(o)/100*this.h,e=s/this.trueHeight)}}catch{e=1}}return e},goAutoCrop(e,t){if(this.imgs===""||this.imgs===null)return;this.clearCrop(),this.cropping=!0;let s=this.w,i=this.h;if(this.centerBox){const h=Math.abs(this.rotate)%2>0;let a=(h?this.trueHeight:this.trueWidth)*this.scale,l=(h?this.trueWidth:this.trueHeight)*this.scale;s=a<s?a:s,i=l<i?l:i}var r=e||parseFloat(this.autoCropWidth),o=t||parseFloat(this.autoCropHeight);(r===0||o===0)&&(r=s*.8,o=i*.8),r=r>s?s:r,o=o>i?i:o,this.fixed&&(o=r/this.fixedNumber[0]*this.fixedNumber[1]),o>this.h&&(o=this.h,r=o/this.fixedNumber[1]*this.fixedNumber[0]),this.changeCrop(r,o)},changeCrop(e,t){if(this.centerBox){let s=this.getImgAxis();e>s.x2-s.x1&&(e=s.x2-s.x1,t=e/this.fixedNumber[0]*this.fixedNumber[1]),t>s.y2-s.y1&&(t=s.y2-s.y1,e=t/this.fixedNumber[1]*this.fixedNumber[0])}this.cropW=e,this.cropH=t,this.checkCropLimitSize(),this.$nextTick(()=>{this.cropOffsertX=(this.w-this.cropW)/2,this.cropOffsertY=(this.h-this.cropH)/2,this.centerBox&&this.moveCrop(null,!0)})},refresh(){this.img,this.imgs="",this.scale=1,this.crop=!1,this.rotate=0,this.w=0,this.h=0,this.trueWidth=0,this.trueHeight=0,this.imgIsQqualCrop=!1,this.clearCrop(),this.$nextTick(()=>{this.checkedImg()})},rotateLeft(){this.rotate=this.rotate<=-3?0:this.rotate-1},rotateRight(){this.rotate=this.rotate>=3?0:this.rotate+1},rotateClear(){this.rotate=0},checkoutImgAxis(e,t,s){e=e||this.x,t=t||this.y,s=s||this.scale;let i=!0;if(this.centerBox){let r=this.getImgAxis(e,t,s),o=this.getCropAxis();r.x1>=o.x1&&(i=!1),r.x2<=o.x2&&(i=!1),r.y1>=o.y1&&(i=!1),r.y2<=o.y2&&(i=!1),i||this.changeImgScale(r,o,s)}return i},changeImgScale(e,t,s){let i=this.trueWidth,r=this.trueHeight,o=i*s,h=r*s;if(o>=this.cropW&&h>=this.cropH)this.scale=s;else{const a=this.cropW/i,l=this.cropH/r,n=this.cropH<=r*a?a:l;this.scale=n,o=i*n,h=r*n}this.imgIsQqualCrop||(e.x1>=t.x1&&(this.isRotateRightOrLeft?this.x=t.x1-(i-o)/2-(o-h)/2:this.x=t.x1-(i-o)/2),e.x2<=t.x2&&(this.isRotateRightOrLeft?this.x=t.x1-(i-o)/2-(o-h)/2-h+this.cropW:this.x=t.x2-(i-o)/2-o),e.y1>=t.y1&&(this.isRotateRightOrLeft?this.y=t.y1-(r-h)/2-(h-o)/2:this.y=t.y1-(r-h)/2),e.y2<=t.y2&&(this.isRotateRightOrLeft?this.y=t.y2-(r-h)/2-(h-o)/2-o:this.y=t.y2-(r-h)/2-h)),(o<this.cropW||h<this.cropH)&&(this.imgIsQqualCrop=!0)}},mounted(){this.support="onwheel"in document.createElement("div")?"wheel":document.onmousewheel!==void 0?"mousewheel":"DOMMouseScroll";let e=this;var t=navigator.userAgent;this.isIOS=!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(s,i,r){for(var o=atob(this.toDataURL(i,r).split(",")[1]),h=o.length,a=new Uint8Array(h),l=0;l<h;l++)a[l]=o.charCodeAt(l);s(new Blob([a],{type:e.type||"image/png"}))}}),this.showPreview(),this.checkedImg()},unmounted(){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.cancelScale()}}),ce={key:0,class:"cropper-box"},ne=["src"],le={class:"cropper-view-box"},pe=["src"],ue={key:1};function de(e,t,s,i,r,o){return O(),M("div",{class:"vue-cropper",ref:"cropper",onMouseover:t[28]||(t[28]=(...h)=>e.scaleImg&&e.scaleImg(...h)),onMouseout:t[29]||(t[29]=(...h)=>e.cancelScale&&e.cancelScale(...h))},[e.imgs?(O(),M("div",ce,[I(f("div",{class:"cropper-box-canvas",style:k({width:e.trueWidth+"px",height:e.trueHeight+"px",transform:"scale("+e.scale+","+e.scale+") translate3d("+e.x/e.scale+"px,"+e.y/e.scale+"px,0)rotateZ("+e.rotate*90+"deg)"})},[f("img",{src:e.imgs,alt:"cropper-img",ref:"cropperImg"},null,8,ne)],4),[[A,!e.loading]])])):N("",!0),f("div",{class:F(["cropper-drag-box",{"cropper-move":e.move&&!e.crop,"cropper-crop":e.crop,"cropper-modal":e.cropping}]),onMousedown:t[0]||(t[0]=(...h)=>e.startMove&&e.startMove(...h)),onTouchstart:t[1]||(t[1]=(...h)=>e.startMove&&e.startMove(...h))},null,34),I(f("div",{class:"cropper-crop-box",style:k({width:e.cropW+"px",height:e.cropH+"px",transform:"translate3d("+e.cropOffsertX+"px,"+e.cropOffsertY+"px,0)"})},[f("span",le,[f("img",{style:k({width:e.trueWidth+"px",height:e.trueHeight+"px",transform:"scale("+e.scale+","+e.scale+") translate3d("+(e.x-e.cropOffsertX)/e.scale+"px,"+(e.y-e.cropOffsertY)/e.scale+"px,0)rotateZ("+e.rotate*90+"deg)"}),src:e.imgs,alt:"cropper-img"},null,12,pe)]),f("span",{class:"cropper-face cropper-move",onMousedown:t[2]||(t[2]=(...h)=>e.cropMove&&e.cropMove(...h)),onTouchstart:t[3]||(t[3]=(...h)=>e.cropMove&&e.cropMove(...h))},null,32),e.info?(O(),M("span",{key:0,class:"crop-info",style:k({top:e.cropInfo.top})},B(e.cropInfo.width)+" × "+B(e.cropInfo.height),5)):N("",!0),e.fixedBox?N("",!0):(O(),M("span",ue,[f("span",{class:"crop-line line-w",onMousedown:t[4]||(t[4]=h=>e.changeCropSize(h,!1,!0,0,1)),onTouchstart:t[5]||(t[5]=h=>e.changeCropSize(h,!1,!0,0,1))},null,32),f("span",{class:"crop-line line-a",onMousedown:t[6]||(t[6]=h=>e.changeCropSize(h,!0,!1,1,0)),onTouchstart:t[7]||(t[7]=h=>e.changeCropSize(h,!0,!1,1,0))},null,32),f("span",{class:"crop-line line-s",onMousedown:t[8]||(t[8]=h=>e.changeCropSize(h,!1,!0,0,2)),onTouchstart:t[9]||(t[9]=h=>e.changeCropSize(h,!1,!0,0,2))},null,32),f("span",{class:"crop-line line-d",onMousedown:t[10]||(t[10]=h=>e.changeCropSize(h,!0,!1,2,0)),onTouchstart:t[11]||(t[11]=h=>e.changeCropSize(h,!0,!1,2,0))},null,32),f("span",{class:"crop-point point1",onMousedown:t[12]||(t[12]=h=>e.changeCropSize(h,!0,!0,1,1)),onTouchstart:t[13]||(t[13]=h=>e.changeCropSize(h,!0,!0,1,1))},null,32),f("span",{class:"crop-point point2",onMousedown:t[14]||(t[14]=h=>e.changeCropSize(h,!1,!0,0,1)),onTouchstart:t[15]||(t[15]=h=>e.changeCropSize(h,!1,!0,0,1))},null,32),f("span",{class:"crop-point point3",onMousedown:t[16]||(t[16]=h=>e.changeCropSize(h,!0,!0,2,1)),onTouchstart:t[17]||(t[17]=h=>e.changeCropSize(h,!0,!0,2,1))},null,32),f("span",{class:"crop-point point4",onMousedown:t[18]||(t[18]=h=>e.changeCropSize(h,!0,!1,1,0)),onTouchstart:t[19]||(t[19]=h=>e.changeCropSize(h,!0,!1,1,0))},null,32),f("span",{class:"crop-point point5",onMousedown:t[20]||(t[20]=h=>e.changeCropSize(h,!0,!1,2,0)),onTouchstart:t[21]||(t[21]=h=>e.changeCropSize(h,!0,!1,2,0))},null,32),f("span",{class:"crop-point point6",onMousedown:t[22]||(t[22]=h=>e.changeCropSize(h,!0,!0,1,2)),onTouchstart:t[23]||(t[23]=h=>e.changeCropSize(h,!0,!0,1,2))},null,32),f("span",{class:"crop-point point7",onMousedown:t[24]||(t[24]=h=>e.changeCropSize(h,!1,!0,0,2)),onTouchstart:t[25]||(t[25]=h=>e.changeCropSize(h,!1,!0,0,2))},null,32),f("span",{class:"crop-point point8",onMousedown:t[26]||(t[26]=h=>e.changeCropSize(h,!0,!0,2,2)),onTouchstart:t[27]||(t[27]=h=>e.changeCropSize(h,!0,!0,2,2))},null,32)]))],4),[[A,e.cropping]])],544)}const ge=he(ae,[["render",de],["__scopeId","data-v-a742df44"]]),fe={class:"cropper-content"},me={class:"cropper-box"},ve={class:"cropper"},we={class:"footer-btn"},xe={class:"scope-btn"},Ce={class:"show-preview"},ye={class:"preview"},be=["src"],Oe={class:"upload-btn"},He=Object.assign({name:"CropperImage"},{__name:"index",emits:["uploadImgSuccess"],setup(e,{emit:t}){const s=t,i=_(""),r=_(""),o=_({}),h=P({img:"",outputSize:1,outputType:"png",info:!0,canScale:!0,autoCrop:!0,autoCropWidth:200,autoCropHeight:200,fixed:!0,fixedNumber:[1,1],full:!1,fixedBox:!1,canMove:!0,canMoveBox:!0,original:!1,centerBox:!0,height:!1,infoTrue:!1,maxImgSize:3e3,enlarge:1,mode:"300px 300px"}),a=_(null);function l(p){""+p}function n(p){p=p||1,a.value.changeScale(p)}function c(){a.value.rotateLeft()}function d(){a.value.rotateRight()}function u(p){o.value=p,a.value.getCropBlob(g=>{w(g,function(C){r.value=C})})}function w(p,g){var C=new FileReader;C.readAsDataURL(p),C.onload=function(H){g(H.target.result)}}function W(p){let g=p.target.files[0];if(!/\.(jpg|jpeg|png|JPG|PNG)$/.test(p.target.value))return E({message:"图片类型要求:jpeg、jpg、png",type:"error"}),!1;let C=new FileReader;C.onload=H=>{let X;typeof H.target.result=="object"?X=window.URL.createObjectURL(new Blob([H.target.result])):X=H.target.result,h.img=X},C.readAsDataURL(g)}function m(p,g="file"){const C=p.split(","),H=C[0].match(/:(.*?);/)[1],X=H.split("/")[1],$=atob(C[1]);let T=$.length;const z=new Uint8Array(T);for(;T--;)z[T]=$.charCodeAt(T);return new File([z],`${g}.${X}`,{type:H})}function v(p){const g=new FormData;g.append("file",p),Q(g).then(C=>{C.status==200?s("uploadImgSuccess",C.data):E({message:"上传失败",type:"error",duration:1e3})})}function x(){a.value.getCropData(p=>{i.value=m(p),v(i.value)})}return(p,g)=>{const C=Y("el-button"),H=R("db-click");return O(),M("div",fe,[f("div",me,[f("div",ve,[y(U(ge),{ref_key:"cropper",ref:a,img:h.img,outputSize:h.outputSize,outputType:h.outputType,info:h.info,canScale:h.canScale,autoCrop:h.autoCrop,autoCropWidth:h.autoCropWidth,autoCropHeight:h.autoCropHeight,fixed:h.fixed,fixedNumber:h.fixedNumber,full:h.full,fixedBox:h.fixedBox,canMove:h.canMove,canMoveBox:h.canMoveBox,original:h.original,centerBox:h.centerBox,height:h.height,infoTrue:h.infoTrue,maxImgSize:h.maxImgSize,enlarge:h.enlarge,mode:h.mode,onRealTime:u,onImgLoad:l},null,8,["img","outputSize","outputType","info","canScale","autoCrop","autoCropWidth","autoCropHeight","fixed","fixedNumber","full","fixedBox","canMove","canMoveBox","original","centerBox","height","infoTrue","maxImgSize","enlarge","mode"])]),f("div",we,[f("div",xe,[f("input",{type:"file",id:"uploads",style:{position:"absolute",clip:"rect(0 0 0 0)"},accept:"image/png, image/jpeg, image/gif, image/jpg",onChange:g[0]||(g[0]=X=>W(X))},null,32),I((O(),S(C,{type:"danger",plain:"",icon:"ZoomIn",onClick:g[1]||(g[1]=X=>n(1))},{default:b(()=>[...g[4]||(g[4]=[L("放大",-1)])]),_:1})),[[H]]),I((O(),S(C,{type:"danger",plain:"",icon:"ZoomOut",onClick:g[2]||(g[2]=X=>n(-1))},{default:b(()=>[...g[5]||(g[5]=[L("缩小",-1)])]),_:1})),[[H]]),I((O(),S(C,{type:"danger",plain:"",onClick:c},{default:b(()=>[...g[6]||(g[6]=[L("↺ 左旋转",-1)])]),_:1})),[[H]]),I((O(),S(C,{type:"danger",plain:"",onClick:d},{default:b(()=>[...g[7]||(g[7]=[L("↻ 右旋转",-1)])]),_:1})),[[H]])])])]),f("div",Ce,[f("div",ye,[f("img",{src:o.value.url,style:k(o.value.img)},null,12,be)]),f("div",Oe,[g[9]||(g[9]=f("label",{class:"btn",for:"uploads"},"选择图片",-1)),I((O(),S(C,{type:"success",onClick:g[3]||(g[3]=X=>x())},{default:b(()=>[...g[8]||(g[8]=[L("确认上传",-1)])]),_:1})),[[H]])])])])}}}),We=V(He,[["__scopeId","data-v-3065e45e"]]),Xe=["src"],Ie={key:1,src:Z,alt:""},Me=Object.assign({name:"setting_user"},{__name:"index",setup(e){const t=J();K(),ee();const s=_(null),i=_(""),r=_(!1),o=P({avatar:"",real_name:"",pwd:"",new_pwd:"",conf_pwd:"",head_pic:""}),h={real_name:[{required:!0,message:"您的姓名不能为空",trigger:"blur"}]};q(()=>{i.value=t.userInfo.account,o.head_pic=t.userInfo.head_pic,o.real_name=t.userInfo.real_name});function a(n){r.value=!1,o.head_pic=n.src}function l(){s.value.validate(n=>{n?G(o).then(c=>{t.userRealName(o.real_name),t.userRealHeadPic(o.head_pic),E.success(c.msg)}).catch(c=>{E.error(c.msg)}):o.new_pwd!==o.conf_pwd&&E.error("您输入的新密码与旧密码不一致")})}return(n,c)=>{const d=Y("el-form-item"),u=Y("el-input"),w=Y("el-button"),W=Y("el-form"),m=Y("el-card"),v=Y("el-dialog"),x=R("db-click");return O(),M("div",null,[y(m,{bordered:!1,shadow:"never",class:"ivu-mt"},{default:b(()=>[y(W,{ref_key:"formValidateRef",ref:s,model:o,rules:h,"label-width":"160px","label-position":"right"},{default:b(()=>[y(d,{label:"头像:"},{default:b(()=>[I((O(),M("div",{class:"avatar",onClick:c[0]||(c[0]=p=>r.value=!0)},[o.head_pic?(O(),M("img",{key:0,src:o.head_pic,alt:""},null,8,Xe)):(O(),M("img",Ie))])),[[x]])]),_:1}),y(d,{label:"账号:",prop:""},{default:b(()=>[y(u,{type:"text",modelValue:i.value,"onUpdate:modelValue":c[1]||(c[1]=p=>i.value=p),disabled:!0,class:"input"},null,8,["modelValue"])]),_:1}),y(d,{label:"姓名:",prop:"real_name"},{default:b(()=>[y(u,{type:"text",modelValue:o.real_name,"onUpdate:modelValue":c[2]||(c[2]=p=>o.real_name=p),class:"input"},null,8,["modelValue"])]),_:1}),y(d,{label:"原始密码:"},{default:b(()=>[y(u,{type:"password",modelValue:o.pwd,"onUpdate:modelValue":c[3]||(c[3]=p=>o.pwd=p),class:"input"},null,8,["modelValue"])]),_:1}),y(d,{label:"新密码:"},{default:b(()=>[y(u,{type:"password",modelValue:o.new_pwd,"onUpdate:modelValue":c[4]||(c[4]=p=>o.new_pwd=p),class:"input"},null,8,["modelValue"])]),_:1}),y(d,{label:"确认新密码:"},{default:b(()=>[y(u,{type:"password",modelValue:o.conf_pwd,"onUpdate:modelValue":c[5]||(c[5]=p=>o.conf_pwd=p),class:"input"},null,8,["modelValue"])]),_:1}),y(d,null,{default:b(()=>[I((O(),S(w,{type:"primary",onClick:c[6]||(c[6]=p=>l())},{default:b(()=>[...c[8]||(c[8]=[L("提交",-1)])]),_:1})),[[x]])]),_:1})]),_:1},8,["model"])]),_:1}),y(v,{modelValue:r.value,"onUpdate:modelValue":c[7]||(c[7]=p=>r.value=p),title:"头像上传",width:"720px"},{default:b(()=>[r.value?(O(),S(U(We),{key:0,onUploadImgSuccess:a})):N("",!0)]),_:1},8,["modelValue"])])}}}),ze=V(Me,[["__scopeId","data-v-aafd260b"]]);export{ze as default};
|