command-center-v3-common 0.0.115 → 0.0.117
Sign up to get free protection for your applications and to get access to all the features.
@@ -8258,8 +8258,8 @@ const tN = { id: "operator-menu-box" }, nN = { class: "w-[200px] text-sm h-full
|
|
8258
8258
|
});
|
8259
8259
|
async function c() {
|
8260
8260
|
var b;
|
8261
|
-
const
|
8262
|
-
r.value = r.value.filter((w) => _.includes(w.permission)), l("menu-list", r.value), ((b = r.value) == null ? void 0 : b.length) <= 0 && l("change-jump", d());
|
8261
|
+
const m = gt.getCache("userInfo"), _ = m == null ? void 0 : m.permissionList;
|
8262
|
+
r.value = r.value.filter((w) => _.includes(w.permission)), l("menu-list", r.value), ((b = r.value) == null ? void 0 : b.length) <= 0 && l("change-jump", await d());
|
8263
8263
|
}
|
8264
8264
|
async function d() {
|
8265
8265
|
const m = window.location.hostname, { code: _, data: b } = await ZD({ hostName: m });
|
@@ -27,7 +27,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
27
27
|
* vue-router v4.3.0
|
28
28
|
* (c) 2024 Eduardo San Martin Morote
|
29
29
|
* @license MIT
|
30
|
-
*/var wl;(function(t){t.pop="pop",t.push="push"})(wl||(wl={}));var El;(function(t){t.back="back",t.forward="forward",t.unknown=""})(El||(El={})),Symbol(process.env.NODE_ENV!=="production"?"navigation failure":"");var Sl;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Sl||(Sl={})),Symbol(process.env.NODE_ENV!=="production"?"router view location matched":""),Symbol(process.env.NODE_ENV!=="production"?"router view depth":"");const Uf=Symbol(process.env.NODE_ENV!=="production"?"router":"");Symbol(process.env.NODE_ENV!=="production"?"route location":""),Symbol(process.env.NODE_ENV!=="production"?"router view location":"");function zf(){return e.inject(Uf)}const Wf={id:"operator-menu-box"},jf={class:"w-[200px] text-sm h-full overflow-auto shadow-[inset_0px_0px_10px] shadow-hy-bg-2 bg-hy-page-bg-1/50"},Hf=["id","onClick"],Yf={class:"flex items-center click-box w-full"},Gf={class:"flex-grow w-0 ml-2 overflow-ellipsis overflow-hidden whitespace-nowrap"},qf=e.defineComponent({__name:"menu-components",props:{menuList:{default:()=>[]},menuTitle:{default:"菜单列表"}},emits:["onChange","menu-list","change-jump"],setup(t,{expose:n,emit:o}){const a=t,s=o;zf();const l=e.ref(""),r=e.ref([]);e.onMounted(()=>{r.value=a.menuList,i()});async function i(){var _;const m=ze.getCache("userInfo").permissionList;r.value=r.value.filter(y=>m.includes(y.permission)),s("menu-list",r.value),((_=r.value)==null?void 0:_.length)<=0&&s("change-jump",c())}async function c(){const f=window.location.hostname,{code:m,data:_}=await Mf({hostName:f});if(m===200&&_)return _.redirectUrl}function p(f){l.value=f}function d(f){s("onChange",f)}return n({setRouterPath:p}),(f,m)=>{const _=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("div",Wf,[e.createElementVNode("div",jf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(y,u)=>(e.openBlock(),e.createElementBlock("div",{id:y.permission,key:u,class:"click-box",onClick:N=>d(y.path)},[e.createElementVNode("div",{class:e.normalizeClass(["group flex items-center bg-gradient-to-b hover:from-[#163352] hover:to-[#0da7c1] hover:text-hy-text-main duration-500 px-[20px] border-box cursor-pointer h-[60px] shadow-[inset_0px_0px_10px] shadow-hy-bg-2 text-hy-text-secondary",{"bg-gradient-to-b from-[#163352] to-[#0da7c1] !text-hy-text-main":e.unref(l)===y.path}])},[e.createElementVNode("div",Yf,[e.createVNode(_,{width:"16",height:"16",name:y.iconName},null,8,["name"]),e.createElementVNode("div",Gf,e.toDisplayString(y.label),1)])],2)],8,Hf))),128))])])}}}),Kf={class:"flex flex-col items-center justify-center gap-y-3 w-full h-full bg-hy-page-bg-2 text-hy-text-secondary"},Xf={class:"text-base"},Jf=e.defineComponent({__name:"index",props:{icon:{default:"sys-icon-no-data"},iconWidth:{default:40},iconHeight:{default:46},title:{default:""}},setup(t){return(n,o)=>{const a=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("div",Kf,[e.renderSlot(n.$slots,"content",{},()=>[e.createVNode(a,{name:n.icon,width:n.iconWidth,height:n.iconHeight},null,8,["name","width","height"]),e.createElementVNode("span",Xf,e.toDisplayString(n.title),1)])])}}});function Tl(t){return oe.post({url:"/organization/orgTreeWithSimpleDevice",data:t,isFormData:!0})}function Zf(t){return oe.post({url:"/organization/orgTree",data:t,isFormData:!0})}function Qf(t){return oe.post({url:"/organization/orgTreeSimple",data:t,isFormData:!0})}function vf(t){return oe.post({url:"/organization/page",data:t,isFormData:!0})}function em(t){return oe.post({url:t.id?"/organization/orgType/update":"/organization/orgType/insert",data:t,isJson:!0})}function tm(t){const n=t.emit;e.ref(t.props||{});const o=e.ref(null),a=e.ref(!1),s=e.ref([]),l=e.ref([]),r=e.ref([]);function i(){if(s.value.length){const _=s.value[s.value.length-1];return l.value.find(u=>u.value===_).label}}function c(_){a.value=_}function p(_){o.value.togglePopperVisible(!1),c(!1),n("change",_||[])}async function d(){const _=await Qf();f(_.data)}function f(_){l.value=[];const y=u=>{u.forEach(N=>{N.label=N.companyName,N.value=N.id,l.value.push({label:N.companyName,value:N.id}),N.children&&N.children.length>0?y(N.children):delete N.children})};y(_),r.value=_}function m(_){s.value=_}return{orgCascaderRef:o,focusType:a,value:s,organizationList:l,options:r,organizationListFn:i,visibleChange:c,handleChange:p,getData:d,handlerData:f,setDefaultValue:m}}const nm={class:"relative"},om={key:0},am={key:0,class:"cursor-pointer flex items-center flex-wrap"},sm={class:"flex items-center"},lm={key:0,class:"text-xs text-hy-text-secondary"},Dl=e.defineComponent({__name:"org-cascader",props:{size:{default:""},className:{default:""},placeholder:{default:"请选择部门"},contentType:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["change"],setup(t,{expose:n,emit:o}){const a=t,s=o,{orgCascaderRef:l,focusType:r,value:i,organizationList:c,options:p,organizationListFn:d,visibleChange:f,handleChange:m,getData:_,handlerData:y,setDefaultValue:u}=tm({emit:s,props:a});return e.onMounted(()=>{_()}),n({setDefaultValue:u,getData:_}),(N,k)=>{const E=e.resolveComponent("el-cascader"),b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",nm,[N.contentType?(e.openBlock(),e.createElementBlock("div",om,[e.createElementVNode("div",{style:e.normalizeStyle({opacity:e.unref(r)?1:0,position:e.unref(r)?"relative":"absolute"}),class:"top-0 left-0"},[e.createVNode(E,{ref_key:"orgCascaderRef",ref:l,modelValue:e.unref(i),"onUpdate:modelValue":k[0]||(k[0]=S=>e.isRef(i)?i.value=S:null),class:"w-full",size:N.size,options:e.unref(p),disabled:N.disabled,props:{checkStrictly:!0},clearable:"",placeholder:N.placeholder,filterable:"","show-all-levels":!1,onVisibleChange:k[1]||(k[1]=S=>e.unref(f)(S)),onChange:e.unref(m)},null,8,["modelValue","size","options","disabled","placeholder","onChange"])],4),e.unref(r)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",am,[e.createElementVNode("span",sm,[e.createVNode(b,{class:"relative top-[-2px]"},{default:e.withCtx(()=>[e.createVNode(e.unref(Ad))]),_:1}),e.renderSlot(N.$slots,"default")]),e.unref(i)&&e.unref(i).length?(e.openBlock(),e.createElementBlock("span",lm,"("+e.toDisplayString(e.unref(d)())+")",1)):e.createCommentVNode("",!0)]))])):(e.openBlock(),e.createBlock(E,{key:1,ref_key:"orgCascaderRef",ref:l,modelValue:e.unref(i),"onUpdate:modelValue":k[2]||(k[2]=S=>e.isRef(i)?i.value=S:null),class:e.normalizeClass([N.className,"w-full"]),size:N.size,options:e.unref(p),props:{checkStrictly:!0},clearable:"",disabled:N.disabled,placeholder:N.placeholder,filterable:"","show-all-levels":!1,onChange:e.unref(m)},null,8,["modelValue","class","size","options","disabled","placeholder","onChange"]))])}}}),rm={class:"w-full h-full flex items-center justify-center"},Me=e.defineComponent({__name:"index",props:{name:{default:"sys-button-edit"},className:{default:"text-hy-info-2"},color:{default:""},width:{default:"16"},height:{default:"16"},tips:{default:""}},emits:["click"],setup(t,{emit:n}){const o=t,a=n;function s(){a("click")}return(l,r)=>{const i=e.resolveComponent("svg-icon"),c=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",{class:"click-box shadow-[0_0_4px_0] hover:border-hy-main/70 shadow-hy-page-bg-2 duration-500 hover:shadow-hy-main flex items-center justify-center cursor-pointer w-[30px] h-[30px] bg-hy-page-bg-2 border border-hy-border-2 mx-1 rounded-full",onClick:e.withModifiers(s,["stop"])},[o.tips?(e.openBlock(),e.createBlock(c,{key:0,effect:"dark",content:o.tips,placement:"bottom"},{default:e.withCtx(()=>[e.createElementVNode("div",rm,[e.createVNode(i,e.normalizeProps(e.guardReactiveProps({...o})),null,16)])]),_:1},8,["content"])):(e.openBlock(),e.createBlock(i,e.normalizeProps(e.mergeProps({key:1},{...o})),null,16))])}}}),im=["href"],Vl=e.defineComponent({__name:"index",props:{prefix:{default:"icon"},name:{default:""},className:{default:""},color:{default:""},width:{default:""},height:{default:""}},setup(t){const n=t,o=e.computed(()=>`#icon-${n.name}`),a=e.computed(()=>n.className?`svg-icon ${n.className}`:"svg-icon");return(s,l)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(e.unref(a)),style:e.normalizeStyle({color:s.color,width:s.width,height:s.height})},[e.createElementVNode("use",{class:"svg-use",href:e.unref(o)},null,8,im)],6))}}),cm={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"},dm=[e.createElementVNode("path",{fill:"currentColor",d:"m192 384l320 384l320-384z"},null,-1)];function pm(t,n){return e.openBlock(),e.createElementBlock("svg",cm,[...dm])}const $l={name:"ep-caret-bottom",render:pm},fm={class:"relative"},mm={class:"leading-4"},hm={key:0,class:"text-xs text-hy-text-secondary"},um=e.defineComponent({__name:"index",props:{selectList:{type:Array,default:()=>[]},selectLabelKey:{type:String,default:()=>"label"},selectValueKey:{type:String,default:()=>"value"},column:{type:Object,default:()=>{}},modelValue:{type:[String,Number]}},emits:["getListData","update:modelValue"],setup(t,{emit:n}){const o=t,a=n,s=e.ref(o.modelValue),l=e.ref(!1),r=e.ref();e.watch(s,f=>{a("update:modelValue",f),a("getListData")},{deep:!0});const i=e.computed(()=>f=>{var m;return(m=o.selectList.find(_=>_[o.selectValueKey]===f))==null?void 0:m[o.selectLabelKey]});function c(){l.value=!1}function p(){l.value=!0,r.value.focus(),r.value.toggleMenu()}function d(f){l.value=f}return(f,m)=>{const _=e.resolveComponent("el-option"),y=e.resolveComponent("el-select"),u=$l,N=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",fm,[e.withDirectives(e.createElementVNode("div",null,[e.createVNode(y,{ref_key:"selectRef",ref:r,modelValue:e.unref(s),"onUpdate:modelValue":m[0]||(m[0]=k=>e.isRef(s)?s.value=k:null),class:"w-full",clearable:"",placeholder:t.column.label,onChange:c,onVisibleChange:d},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.selectList,(k,E)=>(e.openBlock(),e.createBlock(_,{key:E,label:k[t.selectLabelKey],value:k[t.selectValueKey]},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])],512),[[e.vShow,e.unref(l)]]),e.withDirectives(e.createElementVNode("span",{class:"flex items-center gap-x-1 cursor-pointer",onClick:p},[e.createVNode(N,{size:16},{default:e.withCtx(()=>[e.createVNode(u)]),_:1}),e.createElementVNode("span",mm,e.toDisplayString(t.column.label),1),e.unref(i)(e.unref(s))?(e.openBlock(),e.createElementBlock("span",hm," ("+e.toDisplayString(e.unref(i)(e.unref(s)))+") ",1)):e.createCommentVNode("",!0)],512),[[e.vShow,!e.unref(l)]])])}}}),_m={class:"flex flex-col"},gm={class:"dialog-header flex flex-col items-center justify-center gap-y-1 relative"},ym={class:"dialog-body"},xm=["innerHTML"],km={class:"flex items-center justify-center mt-10"},Nm=e.defineComponent({__name:"index",emits:["onSubmit","onClose"],setup(t,{expose:n,emit:o}){const a=o,s=e.ref(!1),l=e.ref(),r=e.ref(),i=e.ref(),c=e.ref({width:440,tipsTitleIcon:"sys-button-delete",tipsTitleIconClass:"text-hy-danger",tipsTitle:"删除用户",tipsContent:"删除本条数据后不可恢复,是否确认删除?",isShowClose:!0,isShowSubmit:!0,closeBtnText:"取消",submitBtnText:"删除",closeBtnType:"primary",submitBtnType:"danger"});function p(_,y,u){return new Promise(N=>{l.value=null,r.value=null,i.value=N,c.value={...c.value,..._},l.value=y,r.value=u,s.value=!0})}function d(){s.value=!1,e.nextTick(()=>{l.value&&l.value(),a("onSubmit")})}function f(){s.value=!1,e.nextTick(()=>{i.value&&i.value(),r.value&&r.value(),a("onClose")})}function m(){c.value.setClose?c.value.setClose(()=>{f()}):f()}return n({onShowModal:p,onSubmit:d,onClose:m}),(_,y)=>{const u=e.resolveComponent("SvgIcon"),N=e.resolveComponent("el-button"),k=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(k,{modelValue:e.unref(s),"onUpdate:modelValue":y[0]||(y[0]=E=>e.isRef(s)?s.value=E:null),"append-to-body":!0,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":!1,class:"dialog-main","z-index":4e3,width:`${e.unref(c).width}px`},{default:e.withCtx(()=>[e.createElementVNode("div",_m,[e.createVNode($e,{name:"sys-box-border-login",width:"24",height:"24","class-name":"text-[#2DF2FF]"},{content:e.withCtx(()=>[e.createElementVNode("div",gm,[e.unref(c).tipsTitleIcon?(e.openBlock(),e.createBlock(u,{key:0,name:e.unref(c).tipsTitleIcon,"class-name":e.unref(c).tipsTitleIconClass,width:"20",height:"20"},null,8,["name","class-name"])):e.createCommentVNode("",!0),e.createElementVNode("h3",null,e.toDisplayString(e.unref(c).tipsTitle),1),e.unref(c).setClose?(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-hy-danger absolute click-box top-[10px] right-[10px]",onClick:m},[e.createVNode(u,{name:"sys-button-close",width:"26",height:"26"})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ym,[e.createElementVNode("p",{class:"flex items-center justify-center text-sm text-white tracking-wide",innerHTML:e.unref(c).tipsContent},null,8,xm),e.createElementVNode("div",km,[e.unref(c).isShowClose?(e.openBlock(),e.createBlock(N,{key:0,type:e.unref(c).closeBtnType,class:"!px-6 tracking-widest",onClick:m},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).closeBtnText),1)]),_:1},8,["type"])):e.createCommentVNode("",!0),e.unref(c).isShowSubmit?(e.openBlock(),e.createBlock(N,{key:1,type:e.unref(c).submitBtnType,class:"!px-6 tracking-widest",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).submitBtnText),1)]),_:1},8,["type"])):e.createCommentVNode("",!0)])])]),_:1})])]),_:1},8,["modelValue","width"])}}});function mt(t,n,o){return new Promise(a=>{const s=e.ref(),l=document.createElement("div");document.body.appendChild(l);const r=e.createApp({render(){return e.h(Nm,{ref:s})}});r.use(pe),r.component("SvgIcon",Vl),r.mount(l),s.value.onShowModal(t,()=>{l.remove(),r.unmount(),a({}),n&&n()},()=>{l.remove(),r.unmount(),a({}),o&&o()})})}const bm=["src"],Cm={key:2,class:"w-full h-full flex items-center justify-center overflow-hidden font-bold rounded-full"},xt=e.defineComponent({__name:"index",props:{url:{default:""},gbDevice:{default:0},onlineState:{default:0},stateShow:{type:Boolean,default:!1},name:{default:"base-user-online-2"},className:{default:"w-[90%] h-[90%]"},contentClass:{default:""}},setup(t){const n=t,o=e.computed(()=>!!e.useSlots().content),a=e.ref(!1),s=e.computed(()=>!a.value&&n.url);function l(r){a.value=r}return(r,i)=>{const c=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(r.gbDevice===1&&r.onlineState===1?"background:linear-gradient(180deg, #5A2120 0%, #C81F12 100%); color:#FDE777;border-color: #FDE777":""),class:"border-hy-main/50 text-hy-text-secondary relative w-[46px] h-[46px] box-border flex items-center justify-center cursor-pointer bg-hy-page-bg-2 border rounded-full text-base"},[s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:r.url,class:e.normalizeClass(["rounded-full object-cover",r.className]),onError:l},null,42,bm)):e.createCommentVNode("",!0),!s.value&&r.gbDevice!==1?(e.openBlock(),e.createBlock(c,e.normalizeProps(e.mergeProps({key:1},{name:r.name,className:r.className})),null,16)):e.createCommentVNode("",!0),!s.value&&r.gbDevice===1?(e.openBlock(),e.createElementBlock("div",Cm," GB ")):e.createCommentVNode("",!0),!o.value&&r.stateShow?(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass([`${r.contentClass} ${r.onlineState===1?"bg-hy-success shadow-hy-success":"bg-hy-text-secondary shadow-hy-text-secondary"}`,"absolute bottom-[-2px] right-[-2px] w-[36%] h-[36%] rounded-full shadow-[0_0_4px_0]"])},null,2)):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"content")],4)}}}),Bl={};Bl.getData=t=>new Promise((n,o)=>{let a={};wm(t).then(s=>{a.arrayBuffer=s;try{a.orientation=Dm(s)}catch{a.orientation=-1}n(a)}).catch(s=>{o(s)})});function wm(t){let n=null;return new Promise((o,a)=>{if(t.src)if(/^data\:/i.test(t.src))n=Sm(t.src),o(n);else if(/^blob\:/i.test(t.src)){var s=new FileReader;s.onload=function(r){n=r.target.result,o(n)},Em(t.src,function(r){s.readAsArrayBuffer(r)})}else{var l=new XMLHttpRequest;l.onload=function(){if(this.status==200||this.status===0)n=l.response,o(n);else throw"Could not load image";l=null},l.open("GET",t.src,!0),l.responseType="arraybuffer",l.send(null)}else a("img error")})}function Em(t,n){var o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType="blob",o.onload=function(a){(this.status==200||this.status===0)&&n(this.response)},o.send()}function Sm(t,n){n=n||t.match(/^data\:([^\;]+)\;base64,/mi)[1]||"",t=t.replace(/^data\:([^\;]+)\;base64,/gmi,"");for(var o=atob(t),a=o.length%2==0?o.length:o.length+1,s=new ArrayBuffer(a),l=new Uint16Array(s),r=0;r<a;r++)l[r]=o.charCodeAt(r);return s}function Tm(t,n,o){var a="",s;for(s=n,o+=n;s<o;s++)a+=String.fromCharCode(t.getUint8(s));return a}function Dm(t){var n=new DataView(t),o=n.byteLength,a,s,l,r,i,c,p,d,f,m;if(n.getUint8(0)===255&&n.getUint8(1)===216)for(f=2;f<o;){if(n.getUint8(f)===255&&n.getUint8(f+1)===225){p=f;break}f++}if(p&&(s=p+4,l=p+10,Tm(n,s,4)==="Exif"&&(c=n.getUint16(l),i=c===18761,(i||c===19789)&&n.getUint16(l+2,i)===42&&(r=n.getUint32(l+4,i),r>=8&&(d=l+r)))),d){for(o=n.getUint16(d,i),m=0;m<o;m++)if(f=d+m*12+2,n.getUint16(f,i)===274){f+=8,a=n.getUint16(f,i);break}}return a}const Vm=(t,n)=>{const o=t.__vccOpts||t;for(const[a,s]of n)o[a]=s;return o},$m=e.defineComponent({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}},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(t){return Array.isArray(t)?Number(t[0])>=0&&Number(t[1])>=0:Number(t)>=0}},fillColor:{type:String,default:""}},computed:{cropInfo(){let t={};if(t.top=this.cropOffsertY>21?"-21px":"0px",t.width=this.cropW>0?this.cropW:0,t.height=this.cropH>0?this.cropH:0,this.infoTrue){let n=1;this.high&&!this.full&&(n=window.devicePixelRatio),this.enlarge!==1&!this.full&&(n=Math.abs(Number(this.enlarge))),t.width=t.width*n,t.height=t.height*n,this.full&&(t.width=t.width/this.scale,t.height=t.height/this.scale)}return t.width=t.width.toFixed(0),t.height=t.height.toFixed(0),t},isIE(){return!!window.ActiveXObject||"ActiveXObject"in window},passive(){return this.isIE?null:{passive:!1}}},watch:{img(){this.checkedImg()},imgs(t){t!==""&&this.reload()},cropW(){this.showPreview()},cropH(){this.showPreview()},cropOffsertX(){this.showPreview()},cropOffsertY(){this.showPreview()},scale(t,n){this.showPreview()},x(){this.showPreview()},y(){this.showPreview()},autoCrop(t){t&&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(t){var n=navigator.userAgent.split(" "),o="";let a=0;const s=new RegExp(t,"i");for(var l=0;l<n.length;l++)s.test(n[l])&&(o=n[l]);return o?a=o.split("/")[1].split("."):a=["0","0","0"],a},checkOrientationImage(t,n,o,a){if(this.getVersion("chrome")[0]>=81)n=-1;else if(this.getVersion("safari")[0]>=605){const r=this.getVersion("version");r[0]>13&&r[1]>1&&(n=-1)}else{const r=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(r){let i=r[1];i=i.split("_"),(i[0]>13||i[0]>=13&&i[1]>=4)&&(n=-1)}}let s=document.createElement("canvas"),l=s.getContext("2d");switch(l.save(),n){case 2:s.width=o,s.height=a,l.translate(o,0),l.scale(-1,1);break;case 3:s.width=o,s.height=a,l.translate(o/2,a/2),l.rotate(180*Math.PI/180),l.translate(-o/2,-a/2);break;case 4:s.width=o,s.height=a,l.translate(0,a),l.scale(1,-1);break;case 5:s.height=o,s.width=a,l.rotate(.5*Math.PI),l.scale(1,-1);break;case 6:s.width=a,s.height=o,l.translate(a/2,o/2),l.rotate(90*Math.PI/180),l.translate(-o/2,-a/2);break;case 7:s.height=o,s.width=a,l.rotate(.5*Math.PI),l.translate(o,-a),l.scale(-1,1);break;case 8:s.height=o,s.width=a,l.translate(a/2,o/2),l.rotate(-90*Math.PI/180),l.translate(-o/2,-a/2);break;default:s.width=o,s.height=a}l.drawImage(t,0,0,o,a),l.restore(),s.toBlob(r=>{let i=URL.createObjectURL(r);URL.revokeObjectURL(this.imgs),this.imgs=i},"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.clearCrop();let t=new Image;if(t.onload=()=>{if(this.img==="")return this.$emit("img-load",new Error("图片不能为空")),!1;let o=t.width,a=t.height;Bl.getData(t).then(s=>{this.orientation=s.orientation||1;let l=Number(this.maxImgSize);if(!this.orientation&&o<l&a<l){this.imgs=this.img;return}o>l&&(a=a/o*l,o=l),a>l&&(o=o/a*l,a=l),this.checkOrientationImage(t,this.orientation,o,a)}).catch(s=>{this.$emit("img-load","error"),this.$emit("img-load-error",s)})},t.onerror=o=>{this.$emit("img-load","error"),this.$emit("img-load-error",o)},this.img.substr(0,4)!=="data"&&(t.crossOrigin=""),this.isIE){var n=new XMLHttpRequest;n.onload=function(){var o=URL.createObjectURL(this.response);t.src=o},n.open("GET",this.img,!0),n.responseType="blob",n.send()}else t.src=this.img},startMove(t){if(t.preventDefault(),this.move&&!this.crop){if(!this.canMove)return!1;this.moveX=("clientX"in t?t.clientX:t.touches[0].clientX)-this.x,this.moveY=("clientY"in t?t.clientY:t.touches[0].clientY)-this.y,t.touches?(window.addEventListener("touchmove",this.moveImg),window.addEventListener("touchend",this.leaveImg),t.touches.length==2&&(this.touches=t.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=t.offsetX?t.offsetX:t.touches[0].pageX-this.$refs.cropper.offsetLeft,this.cropOffsertY=t.offsetY?t.offsetY:t.touches[0].pageY-this.$refs.cropper.offsetTop,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.touches[0].clientY,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.cropW=0,this.cropH=0},touchScale(t){t.preventDefault();let n=this.scale;var o={x:this.touches[0].clientX,y:this.touches[0].clientY},a={x:t.touches[0].clientX,y:t.touches[0].clientY},s={x:this.touches[1].clientX,y:this.touches[1].clientY},l={x:t.touches[1].clientX,y:t.touches[1].clientY},r=Math.sqrt(Math.pow(o.x-s.x,2)+Math.pow(o.y-s.y,2)),i=Math.sqrt(Math.pow(a.x-l.x,2)+Math.pow(a.y-l.y,2)),c=i-r,p=1;p=p/this.trueWidth>p/this.trueHeight?p/this.trueHeight:p/this.trueWidth,p=p>.1?.1:p;var d=p*c;if(!this.touchNow){if(this.touchNow=!0,c>0?n+=Math.abs(d):c<0&&n>Math.abs(d)&&(n-=Math.abs(d)),this.touches=t.touches,setTimeout(()=>{this.touchNow=!1},8),!this.checkoutImgAxis(this.x,this.y,n))return!1;this.scale=n}},cancelTouchScale(t){window.removeEventListener("touchmove",this.touchScale)},moveImg(t){if(t.preventDefault(),t.touches&&t.touches.length===2)return this.touches=t.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale),window.removeEventListener("touchmove",this.moveImg),!1;let n="clientX"in t?t.clientX:t.touches[0].clientX,o="clientY"in t?t.clientY:t.touches[0].clientY,a,s;a=n-this.moveX,s=o-this.moveY,this.$nextTick(()=>{if(this.centerBox){let l=this.getImgAxis(a,s,this.scale),r=this.getCropAxis(),i=this.trueHeight*this.scale,c=this.trueWidth*this.scale,p,d,f,m;switch(this.rotate){case 1:case-1:case 3:case-3:p=this.cropOffsertX-this.trueWidth*(1-this.scale)/2+(i-c)/2,d=this.cropOffsertY-this.trueHeight*(1-this.scale)/2+(c-i)/2,f=p-i+this.cropW,m=d-c+this.cropH;break;default:p=this.cropOffsertX-this.trueWidth*(1-this.scale)/2,d=this.cropOffsertY-this.trueHeight*(1-this.scale)/2,f=p-c+this.cropW,m=d-i+this.cropH;break}l.x1>=r.x1&&(a=p),l.y1>=r.y1&&(s=d),l.x2<=r.x2&&(a=f),l.y2<=r.y2&&(s=m)}this.x=a,this.y=s,this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})})},leaveImg(t){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(t){t.preventDefault();let n=this.scale;var o=t.deltaY||t.wheelDelta,a=navigator.userAgent.indexOf("Firefox");o=a>0?o*30:o,this.isIE&&(o=-o);var s=this.coe;s=s/this.trueWidth>s/this.trueHeight?s/this.trueHeight:s/this.trueWidth;var l=s*o;l<0?n+=Math.abs(l):n>Math.abs(l)&&(n-=Math.abs(l));let r=l<0?"add":"reduce";if(r!==this.coeStatus&&(this.coeStatus=r,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,n))return!1;this.scale=n},changeScale(t){let n=this.scale;t=t||1;var o=20;if(o=o/this.trueWidth>o/this.trueHeight?o/this.trueHeight:o/this.trueWidth,t=t*o,t>0?n+=Math.abs(t):n>Math.abs(t)&&(n-=Math.abs(t)),!this.checkoutImgAxis(this.x,this.y,n))return!1;this.scale=n},createCrop(t){t.preventDefault();var n="clientX"in t?t.clientX:t.touches?t.touches[0].clientX:0,o="clientY"in t?t.clientY:t.touches?t.touches[0].clientY:0;this.$nextTick(()=>{var a=n-this.cropX,s=o-this.cropY;if(a>0?(this.cropW=a+this.cropChangeX>this.w?this.w-this.cropChangeX:a,this.cropOffsertX=this.cropChangeX):(this.cropW=this.w-this.cropChangeX+Math.abs(a)>this.w?this.cropChangeX:Math.abs(a),this.cropOffsertX=this.cropChangeX+a>0?this.cropChangeX+a:0),!this.fixed)s>0?(this.cropH=s+this.cropChangeY>this.h?this.h-this.cropChangeY:s,this.cropOffsertY=this.cropChangeY):(this.cropH=this.h-this.cropChangeY+Math.abs(s)>this.h?this.cropChangeY:Math.abs(s),this.cropOffsertY=this.cropChangeY+s>0?this.cropChangeY+s:0);else{var l=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];l+this.cropOffsertY>this.h?(this.cropH=this.h-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0],a>0?this.cropOffsertX=this.cropChangeX:this.cropOffsertX=this.cropChangeX-this.cropW):this.cropH=l,this.cropOffsertY=this.cropOffsertY}})},changeCropSize(t,n,o,a,s){t.preventDefault(),window.addEventListener("mousemove",this.changeCropNow),window.addEventListener("mouseup",this.changeCropEnd),window.addEventListener("touchmove",this.changeCropNow),window.addEventListener("touchend",this.changeCropEnd),this.canChangeX=n,this.canChangeY=o,this.changeCropTypeX=a,this.changeCropTypeY=s,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.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(t){t.preventDefault();var n="clientX"in t?t.clientX:t.touches?t.touches[0].clientX:0,o="clientY"in t?t.clientY:t.touches?t.touches[0].clientY:0;let a=this.w,s=this.h,l=0,r=0;if(this.centerBox){let p=this.getImgAxis(),d=p.x2,f=p.y2;l=p.x1>0?p.x1:0,r=p.y1>0?p.y1:0,a>d&&(a=d),s>f&&(s=f)}const[i,c]=this.checkCropLimitSize();this.$nextTick(()=>{var p=n-this.cropX,d=o-this.cropY;if(this.canChangeX&&(this.changeCropTypeX===1?this.cropOldW-p<i?(this.cropW=i,this.cropOffsertX=this.cropOldW+this.cropChangeX-l-i):this.cropOldW-p>0?(this.cropW=a-this.cropChangeX-p<=a-l?this.cropOldW-p:this.cropOldW+this.cropChangeX-l,this.cropOffsertX=a-this.cropChangeX-p<=a-l?this.cropChangeX+p:l):(this.cropW=Math.abs(p)+this.cropChangeX<=a?Math.abs(p)-this.cropOldW:a-this.cropOldW-this.cropChangeX,this.cropOffsertX=this.cropChangeX+this.cropOldW):this.changeCropTypeX===2&&(this.cropOldW+p<i?this.cropW=i:this.cropOldW+p>0?(this.cropW=this.cropOldW+p+this.cropOffsertX<=a?this.cropOldW+p:a-this.cropOffsertX,this.cropOffsertX=this.cropChangeX):(this.cropW=a-this.cropChangeX+Math.abs(p+this.cropOldW)<=a-l?Math.abs(p+this.cropOldW):this.cropChangeX-l,this.cropOffsertX=a-this.cropChangeX+Math.abs(p+this.cropOldW)<=a-l?this.cropChangeX-Math.abs(p+this.cropOldW):l))),this.canChangeY&&(this.changeCropTypeY===1?this.cropOldH-d<c?(this.cropH=c,this.cropOffsertY=this.cropOldH+this.cropChangeY-r-c):this.cropOldH-d>0?(this.cropH=s-this.cropChangeY-d<=s-r?this.cropOldH-d:this.cropOldH+this.cropChangeY-r,this.cropOffsertY=s-this.cropChangeY-d<=s-r?this.cropChangeY+d:r):(this.cropH=Math.abs(d)+this.cropChangeY<=s?Math.abs(d)-this.cropOldH:s-this.cropOldH-this.cropChangeY,this.cropOffsertY=this.cropChangeY+this.cropOldH):this.changeCropTypeY===2&&(this.cropOldH+d<c?this.cropH=c:this.cropOldH+d>0?(this.cropH=this.cropOldH+d+this.cropOffsertY<=s?this.cropOldH+d:s-this.cropOffsertY,this.cropOffsertY=this.cropChangeY):(this.cropH=s-this.cropChangeY+Math.abs(d+this.cropOldH)<=s-r?Math.abs(d+this.cropOldH):this.cropChangeY-r,this.cropOffsertY=s-this.cropChangeY+Math.abs(d+this.cropOldH)<=s-r?this.cropChangeY-Math.abs(d+this.cropOldH):r))),this.canChangeX&&this.fixed){var f=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];f<c?(this.cropH=c,this.cropW=this.fixedNumber[0]*c/this.fixedNumber[1],this.changeCropTypeX===1&&(this.cropOffsertX=this.cropChangeX+(this.cropOldW-this.cropW))):f+this.cropOffsertY>s?(this.cropH=s-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=f}if(this.canChangeY&&this.fixed){var m=this.cropH/this.fixedNumber[1]*this.fixedNumber[0];m<i?(this.cropW=i,this.cropH=this.fixedNumber[1]*i/this.fixedNumber[0],this.cropOffsertY=this.cropOldH+this.cropChangeY-this.cropH):m+this.cropOffsertX>a?(this.cropW=a-this.cropOffsertX,this.cropH=this.cropW/this.fixedNumber[0]*this.fixedNumber[1]):this.cropW=m}})},checkCropLimitSize(){let{cropW:t,cropH:n,limitMinSize:o}=this,a=new Array;return Array.isArray(o)?a=o:a=[o,o],t=parseFloat(a[0]),n=parseFloat(a[1]),[t,n]},changeCropEnd(t){window.removeEventListener("mousemove",this.changeCropNow),window.removeEventListener("mouseup",this.changeCropEnd),window.removeEventListener("touchmove",this.changeCropNow),window.removeEventListener("touchend",this.changeCropEnd)},calculateSize(t,n,o,a,s,l){const r=t/n;let i=s,c=l;return i<o&&(i=o,c=Math.ceil(i/r)),c<a&&(c=a,i=Math.ceil(c*r),i<o&&(i=o,c=Math.ceil(i/r))),i<s&&(i=s,c=Math.ceil(i/r)),c<l&&(c=l,i=Math.ceil(c*r)),{width:i,height:c}},endCrop(){this.cropW===0&&this.cropH===0&&(this.cropping=!1);let[t,n]=this.checkCropLimitSize();const{width:o,height:a}=this.fixed?this.calculateSize(this.fixedNumber[0],this.fixedNumber[1],t,n,this.cropW,this.cropH):{width:t,height:n};o>this.cropW&&(this.cropW=o,this.cropOffsertX+o>this.w&&(this.cropOffsertX=this.w-o)),a>this.cropH&&(this.cropH=a,this.cropOffsertY+a>this.h&&(this.cropOffsertY=this.h-a)),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(t){if(t.preventDefault(),!this.canMoveBox)return this.crop=!1,this.startMove(t),!1;if(t.touches&&t.touches.length===2)return this.crop=!1,this.startMove(t),this.leaveCrop(),!1;window.addEventListener("mousemove",this.moveCrop),window.addEventListener("mouseup",this.leaveCrop),window.addEventListener("touchmove",this.moveCrop),window.addEventListener("touchend",this.leaveCrop);let n="clientX"in t?t.clientX:t.touches[0].clientX,o="clientY"in t?t.clientY:t.touches[0].clientY,a,s;a=n-this.cropOffsertX,s=o-this.cropOffsertY,this.cropX=a,this.cropY=s,this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})},moveCrop(t,n){let o=0,a=0;t&&(t.preventDefault(),o="clientX"in t?t.clientX:t.touches[0].clientX,a="clientY"in t?t.clientY:t.touches[0].clientY),this.$nextTick(()=>{let s,l,r=o-this.cropX,i=a-this.cropY;if(n&&(r=this.cropOffsertX,i=this.cropOffsertY),r<=0?s=0:r+this.cropW>this.w?s=this.w-this.cropW:s=r,i<=0?l=0:i+this.cropH>this.h?l=this.h-this.cropH:l=i,this.centerBox){let c=this.getImgAxis();s<=c.x1&&(s=c.x1),s+this.cropW>c.x2&&(s=c.x2-this.cropW),l<=c.y1&&(l=c.y1),l+this.cropH>c.y2&&(l=c.y2-this.cropH)}this.cropOffsertX=s,this.cropOffsertY=l,this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})})},getImgAxis(t,n,o){t=t||this.x,n=n||this.y,o=o||this.scale;let a={x1:0,x2:0,y1:0,y2:0},s=this.trueWidth*o,l=this.trueHeight*o;switch(this.rotate){case 0:a.x1=t+this.trueWidth*(1-o)/2,a.x2=a.x1+this.trueWidth*o,a.y1=n+this.trueHeight*(1-o)/2,a.y2=a.y1+this.trueHeight*o;break;case 1:case-1:case 3:case-3:a.x1=t+this.trueWidth*(1-o)/2+(s-l)/2,a.x2=a.x1+this.trueHeight*o,a.y1=n+this.trueHeight*(1-o)/2+(l-s)/2,a.y2=a.y1+this.trueWidth*o;break;default:a.x1=t+this.trueWidth*(1-o)/2,a.x2=a.x1+this.trueWidth*o,a.y1=n+this.trueHeight*(1-o)/2,a.y2=a.y1+this.trueHeight*o;break}return a},getCropAxis(){let t={x1:0,x2:0,y1:0,y2:0};return t.x1=this.cropOffsertX,t.x2=t.x1+this.cropW,t.y1=this.cropOffsertY,t.y2=t.y1+this.cropH,t},leaveCrop(t){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(t){let n=document.createElement("canvas"),o=new Image,a=this.rotate,s=this.trueWidth,l=this.trueHeight,r=this.cropOffsertX,i=this.cropOffsertY;o.onload=()=>{if(this.cropW!==0){let d=n.getContext("2d"),f=1;this.high&!this.full&&(f=window.devicePixelRatio),this.enlarge!==1&!this.full&&(f=Math.abs(Number(this.enlarge)));let m=this.cropW*f,_=this.cropH*f,y=s*this.scale*f,u=l*this.scale*f,N=(this.x-r+this.trueWidth*(1-this.scale)/2)*f,k=(this.y-i+this.trueHeight*(1-this.scale)/2)*f;switch(p(m,_),d.save(),this.fillColor&&(d.fillStyle=this.fillColor,d.fillRect(0,0,n.width,n.height)),a){case 0:this.full?(p(m/this.scale,_/this.scale),d.drawImage(o,N/this.scale,k/this.scale,y/this.scale,u/this.scale)):d.drawImage(o,N,k,y,u);break;case 1:case-3:this.full?(p(m/this.scale,_/this.scale),N=N/this.scale+(y/this.scale-u/this.scale)/2,k=k/this.scale+(u/this.scale-y/this.scale)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,k,-N-u/this.scale,y/this.scale,u/this.scale)):(N=N+(y-u)/2,k=k+(u-y)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,k,-N-u,y,u));break;case 2:case-2:this.full?(p(m/this.scale,_/this.scale),d.rotate(a*90*Math.PI/180),N=N/this.scale,k=k/this.scale,d.drawImage(o,-N-y/this.scale,-k-u/this.scale,y/this.scale,u/this.scale)):(d.rotate(a*90*Math.PI/180),d.drawImage(o,-N-y,-k-u,y,u));break;case 3:case-1:this.full?(p(m/this.scale,_/this.scale),N=N/this.scale+(y/this.scale-u/this.scale)/2,k=k/this.scale+(u/this.scale-y/this.scale)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,-k-y/this.scale,N,y/this.scale,u/this.scale)):(N=N+(y-u)/2,k=k+(u-y)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,-k-y,N,y,u));break;default:this.full?(p(m/this.scale,_/this.scale),d.drawImage(o,N/this.scale,k/this.scale,y/this.scale,u/this.scale)):d.drawImage(o,N,k,y,u)}d.restore()}else{let d=s*this.scale,f=l*this.scale,m=n.getContext("2d");switch(m.save(),this.fillColor&&(m.fillStyle=this.fillColor,m.fillRect(0,0,n.width,n.height)),a){case 0:p(d,f),m.drawImage(o,0,0,d,f);break;case 1:case-3:p(f,d),m.rotate(a*90*Math.PI/180),m.drawImage(o,0,-f,d,f);break;case 2:case-2:p(d,f),m.rotate(a*90*Math.PI/180),m.drawImage(o,-d,-f,d,f);break;case 3:case-1:p(f,d),m.rotate(a*90*Math.PI/180),m.drawImage(o,-d,0,d,f);break;default:p(d,f),m.drawImage(o,0,0,d,f)}m.restore()}t(n)};var c=this.img.substr(0,4);c!=="data"&&(o.crossOrigin="Anonymous"),o.src=this.imgs;function p(d,f){n.width=Math.round(d),n.height=Math.round(f)}},getCropData(t){this.getCropChecked(n=>{t(n.toDataURL("image/"+this.outputType,this.outputSize))})},getCropBlob(t){this.getCropChecked(n=>{n.toBlob(o=>t(o),"image/"+this.outputType,this.outputSize)})},showPreview(){if(this.isCanShow)this.isCanShow=!1,setTimeout(()=>{this.isCanShow=!0},16);else return!1;let t=this.cropW,n=this.cropH,o=this.scale;var a={};a.div={width:`${t}px`,height:`${n}px`};let s=(this.x-this.cropOffsertX)/o,l=(this.y-this.cropOffsertY)/o,r=0;a.w=t,a.h=n,a.url=this.imgs,a.img={width:`${this.trueWidth}px`,height:`${this.trueHeight}px`,transform:`scale(${o})translate3d(${s}px, ${l}px, ${r}px)rotateZ(${this.rotate*90}deg)`},a.html=`
|
30
|
+
*/var wl;(function(t){t.pop="pop",t.push="push"})(wl||(wl={}));var El;(function(t){t.back="back",t.forward="forward",t.unknown=""})(El||(El={})),Symbol(process.env.NODE_ENV!=="production"?"navigation failure":"");var Sl;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Sl||(Sl={})),Symbol(process.env.NODE_ENV!=="production"?"router view location matched":""),Symbol(process.env.NODE_ENV!=="production"?"router view depth":"");const Uf=Symbol(process.env.NODE_ENV!=="production"?"router":"");Symbol(process.env.NODE_ENV!=="production"?"route location":""),Symbol(process.env.NODE_ENV!=="production"?"router view location":"");function zf(){return e.inject(Uf)}const Wf={id:"operator-menu-box"},jf={class:"w-[200px] text-sm h-full overflow-auto shadow-[inset_0px_0px_10px] shadow-hy-bg-2 bg-hy-page-bg-1/50"},Hf=["id","onClick"],Yf={class:"flex items-center click-box w-full"},Gf={class:"flex-grow w-0 ml-2 overflow-ellipsis overflow-hidden whitespace-nowrap"},qf=e.defineComponent({__name:"menu-components",props:{menuList:{default:()=>[]},menuTitle:{default:"菜单列表"}},emits:["onChange","menu-list","change-jump"],setup(t,{expose:n,emit:o}){const a=t,s=o;zf();const l=e.ref(""),r=e.ref([]);e.onMounted(()=>{r.value=a.menuList,i()});async function i(){var _;const f=ze.getCache("userInfo"),m=f==null?void 0:f.permissionList;r.value=r.value.filter(y=>m.includes(y.permission)),s("menu-list",r.value),((_=r.value)==null?void 0:_.length)<=0&&s("change-jump",await c())}async function c(){const f=window.location.hostname,{code:m,data:_}=await Mf({hostName:f});if(m===200&&_)return _.redirectUrl}function p(f){l.value=f}function d(f){s("onChange",f)}return n({setRouterPath:p}),(f,m)=>{const _=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("div",Wf,[e.createElementVNode("div",jf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(y,u)=>(e.openBlock(),e.createElementBlock("div",{id:y.permission,key:u,class:"click-box",onClick:N=>d(y.path)},[e.createElementVNode("div",{class:e.normalizeClass(["group flex items-center bg-gradient-to-b hover:from-[#163352] hover:to-[#0da7c1] hover:text-hy-text-main duration-500 px-[20px] border-box cursor-pointer h-[60px] shadow-[inset_0px_0px_10px] shadow-hy-bg-2 text-hy-text-secondary",{"bg-gradient-to-b from-[#163352] to-[#0da7c1] !text-hy-text-main":e.unref(l)===y.path}])},[e.createElementVNode("div",Yf,[e.createVNode(_,{width:"16",height:"16",name:y.iconName},null,8,["name"]),e.createElementVNode("div",Gf,e.toDisplayString(y.label),1)])],2)],8,Hf))),128))])])}}}),Kf={class:"flex flex-col items-center justify-center gap-y-3 w-full h-full bg-hy-page-bg-2 text-hy-text-secondary"},Xf={class:"text-base"},Jf=e.defineComponent({__name:"index",props:{icon:{default:"sys-icon-no-data"},iconWidth:{default:40},iconHeight:{default:46},title:{default:""}},setup(t){return(n,o)=>{const a=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("div",Kf,[e.renderSlot(n.$slots,"content",{},()=>[e.createVNode(a,{name:n.icon,width:n.iconWidth,height:n.iconHeight},null,8,["name","width","height"]),e.createElementVNode("span",Xf,e.toDisplayString(n.title),1)])])}}});function Tl(t){return oe.post({url:"/organization/orgTreeWithSimpleDevice",data:t,isFormData:!0})}function Zf(t){return oe.post({url:"/organization/orgTree",data:t,isFormData:!0})}function Qf(t){return oe.post({url:"/organization/orgTreeSimple",data:t,isFormData:!0})}function vf(t){return oe.post({url:"/organization/page",data:t,isFormData:!0})}function em(t){return oe.post({url:t.id?"/organization/orgType/update":"/organization/orgType/insert",data:t,isJson:!0})}function tm(t){const n=t.emit;e.ref(t.props||{});const o=e.ref(null),a=e.ref(!1),s=e.ref([]),l=e.ref([]),r=e.ref([]);function i(){if(s.value.length){const _=s.value[s.value.length-1];return l.value.find(u=>u.value===_).label}}function c(_){a.value=_}function p(_){o.value.togglePopperVisible(!1),c(!1),n("change",_||[])}async function d(){const _=await Qf();f(_.data)}function f(_){l.value=[];const y=u=>{u.forEach(N=>{N.label=N.companyName,N.value=N.id,l.value.push({label:N.companyName,value:N.id}),N.children&&N.children.length>0?y(N.children):delete N.children})};y(_),r.value=_}function m(_){s.value=_}return{orgCascaderRef:o,focusType:a,value:s,organizationList:l,options:r,organizationListFn:i,visibleChange:c,handleChange:p,getData:d,handlerData:f,setDefaultValue:m}}const nm={class:"relative"},om={key:0},am={key:0,class:"cursor-pointer flex items-center flex-wrap"},sm={class:"flex items-center"},lm={key:0,class:"text-xs text-hy-text-secondary"},Dl=e.defineComponent({__name:"org-cascader",props:{size:{default:""},className:{default:""},placeholder:{default:"请选择部门"},contentType:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["change"],setup(t,{expose:n,emit:o}){const a=t,s=o,{orgCascaderRef:l,focusType:r,value:i,organizationList:c,options:p,organizationListFn:d,visibleChange:f,handleChange:m,getData:_,handlerData:y,setDefaultValue:u}=tm({emit:s,props:a});return e.onMounted(()=>{_()}),n({setDefaultValue:u,getData:_}),(N,k)=>{const E=e.resolveComponent("el-cascader"),b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",nm,[N.contentType?(e.openBlock(),e.createElementBlock("div",om,[e.createElementVNode("div",{style:e.normalizeStyle({opacity:e.unref(r)?1:0,position:e.unref(r)?"relative":"absolute"}),class:"top-0 left-0"},[e.createVNode(E,{ref_key:"orgCascaderRef",ref:l,modelValue:e.unref(i),"onUpdate:modelValue":k[0]||(k[0]=S=>e.isRef(i)?i.value=S:null),class:"w-full",size:N.size,options:e.unref(p),disabled:N.disabled,props:{checkStrictly:!0},clearable:"",placeholder:N.placeholder,filterable:"","show-all-levels":!1,onVisibleChange:k[1]||(k[1]=S=>e.unref(f)(S)),onChange:e.unref(m)},null,8,["modelValue","size","options","disabled","placeholder","onChange"])],4),e.unref(r)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",am,[e.createElementVNode("span",sm,[e.createVNode(b,{class:"relative top-[-2px]"},{default:e.withCtx(()=>[e.createVNode(e.unref(Ad))]),_:1}),e.renderSlot(N.$slots,"default")]),e.unref(i)&&e.unref(i).length?(e.openBlock(),e.createElementBlock("span",lm,"("+e.toDisplayString(e.unref(d)())+")",1)):e.createCommentVNode("",!0)]))])):(e.openBlock(),e.createBlock(E,{key:1,ref_key:"orgCascaderRef",ref:l,modelValue:e.unref(i),"onUpdate:modelValue":k[2]||(k[2]=S=>e.isRef(i)?i.value=S:null),class:e.normalizeClass([N.className,"w-full"]),size:N.size,options:e.unref(p),props:{checkStrictly:!0},clearable:"",disabled:N.disabled,placeholder:N.placeholder,filterable:"","show-all-levels":!1,onChange:e.unref(m)},null,8,["modelValue","class","size","options","disabled","placeholder","onChange"]))])}}}),rm={class:"w-full h-full flex items-center justify-center"},Me=e.defineComponent({__name:"index",props:{name:{default:"sys-button-edit"},className:{default:"text-hy-info-2"},color:{default:""},width:{default:"16"},height:{default:"16"},tips:{default:""}},emits:["click"],setup(t,{emit:n}){const o=t,a=n;function s(){a("click")}return(l,r)=>{const i=e.resolveComponent("svg-icon"),c=e.resolveComponent("el-tooltip");return e.openBlock(),e.createElementBlock("div",{class:"click-box shadow-[0_0_4px_0] hover:border-hy-main/70 shadow-hy-page-bg-2 duration-500 hover:shadow-hy-main flex items-center justify-center cursor-pointer w-[30px] h-[30px] bg-hy-page-bg-2 border border-hy-border-2 mx-1 rounded-full",onClick:e.withModifiers(s,["stop"])},[o.tips?(e.openBlock(),e.createBlock(c,{key:0,effect:"dark",content:o.tips,placement:"bottom"},{default:e.withCtx(()=>[e.createElementVNode("div",rm,[e.createVNode(i,e.normalizeProps(e.guardReactiveProps({...o})),null,16)])]),_:1},8,["content"])):(e.openBlock(),e.createBlock(i,e.normalizeProps(e.mergeProps({key:1},{...o})),null,16))])}}}),im=["href"],Vl=e.defineComponent({__name:"index",props:{prefix:{default:"icon"},name:{default:""},className:{default:""},color:{default:""},width:{default:""},height:{default:""}},setup(t){const n=t,o=e.computed(()=>`#icon-${n.name}`),a=e.computed(()=>n.className?`svg-icon ${n.className}`:"svg-icon");return(s,l)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(e.unref(a)),style:e.normalizeStyle({color:s.color,width:s.width,height:s.height})},[e.createElementVNode("use",{class:"svg-use",href:e.unref(o)},null,8,im)],6))}}),cm={viewBox:"0 0 1024 1024",width:"1.2em",height:"1.2em"},dm=[e.createElementVNode("path",{fill:"currentColor",d:"m192 384l320 384l320-384z"},null,-1)];function pm(t,n){return e.openBlock(),e.createElementBlock("svg",cm,[...dm])}const $l={name:"ep-caret-bottom",render:pm},fm={class:"relative"},mm={class:"leading-4"},hm={key:0,class:"text-xs text-hy-text-secondary"},um=e.defineComponent({__name:"index",props:{selectList:{type:Array,default:()=>[]},selectLabelKey:{type:String,default:()=>"label"},selectValueKey:{type:String,default:()=>"value"},column:{type:Object,default:()=>{}},modelValue:{type:[String,Number]}},emits:["getListData","update:modelValue"],setup(t,{emit:n}){const o=t,a=n,s=e.ref(o.modelValue),l=e.ref(!1),r=e.ref();e.watch(s,f=>{a("update:modelValue",f),a("getListData")},{deep:!0});const i=e.computed(()=>f=>{var m;return(m=o.selectList.find(_=>_[o.selectValueKey]===f))==null?void 0:m[o.selectLabelKey]});function c(){l.value=!1}function p(){l.value=!0,r.value.focus(),r.value.toggleMenu()}function d(f){l.value=f}return(f,m)=>{const _=e.resolveComponent("el-option"),y=e.resolveComponent("el-select"),u=$l,N=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",fm,[e.withDirectives(e.createElementVNode("div",null,[e.createVNode(y,{ref_key:"selectRef",ref:r,modelValue:e.unref(s),"onUpdate:modelValue":m[0]||(m[0]=k=>e.isRef(s)?s.value=k:null),class:"w-full",clearable:"",placeholder:t.column.label,onChange:c,onVisibleChange:d},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.selectList,(k,E)=>(e.openBlock(),e.createBlock(_,{key:E,label:k[t.selectLabelKey],value:k[t.selectValueKey]},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])],512),[[e.vShow,e.unref(l)]]),e.withDirectives(e.createElementVNode("span",{class:"flex items-center gap-x-1 cursor-pointer",onClick:p},[e.createVNode(N,{size:16},{default:e.withCtx(()=>[e.createVNode(u)]),_:1}),e.createElementVNode("span",mm,e.toDisplayString(t.column.label),1),e.unref(i)(e.unref(s))?(e.openBlock(),e.createElementBlock("span",hm," ("+e.toDisplayString(e.unref(i)(e.unref(s)))+") ",1)):e.createCommentVNode("",!0)],512),[[e.vShow,!e.unref(l)]])])}}}),_m={class:"flex flex-col"},gm={class:"dialog-header flex flex-col items-center justify-center gap-y-1 relative"},ym={class:"dialog-body"},xm=["innerHTML"],km={class:"flex items-center justify-center mt-10"},Nm=e.defineComponent({__name:"index",emits:["onSubmit","onClose"],setup(t,{expose:n,emit:o}){const a=o,s=e.ref(!1),l=e.ref(),r=e.ref(),i=e.ref(),c=e.ref({width:440,tipsTitleIcon:"sys-button-delete",tipsTitleIconClass:"text-hy-danger",tipsTitle:"删除用户",tipsContent:"删除本条数据后不可恢复,是否确认删除?",isShowClose:!0,isShowSubmit:!0,closeBtnText:"取消",submitBtnText:"删除",closeBtnType:"primary",submitBtnType:"danger"});function p(_,y,u){return new Promise(N=>{l.value=null,r.value=null,i.value=N,c.value={...c.value,..._},l.value=y,r.value=u,s.value=!0})}function d(){s.value=!1,e.nextTick(()=>{l.value&&l.value(),a("onSubmit")})}function f(){s.value=!1,e.nextTick(()=>{i.value&&i.value(),r.value&&r.value(),a("onClose")})}function m(){c.value.setClose?c.value.setClose(()=>{f()}):f()}return n({onShowModal:p,onSubmit:d,onClose:m}),(_,y)=>{const u=e.resolveComponent("SvgIcon"),N=e.resolveComponent("el-button"),k=e.resolveComponent("el-dialog");return e.openBlock(),e.createBlock(k,{modelValue:e.unref(s),"onUpdate:modelValue":y[0]||(y[0]=E=>e.isRef(s)?s.value=E:null),"append-to-body":!0,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":!1,class:"dialog-main","z-index":4e3,width:`${e.unref(c).width}px`},{default:e.withCtx(()=>[e.createElementVNode("div",_m,[e.createVNode($e,{name:"sys-box-border-login",width:"24",height:"24","class-name":"text-[#2DF2FF]"},{content:e.withCtx(()=>[e.createElementVNode("div",gm,[e.unref(c).tipsTitleIcon?(e.openBlock(),e.createBlock(u,{key:0,name:e.unref(c).tipsTitleIcon,"class-name":e.unref(c).tipsTitleIconClass,width:"20",height:"20"},null,8,["name","class-name"])):e.createCommentVNode("",!0),e.createElementVNode("h3",null,e.toDisplayString(e.unref(c).tipsTitle),1),e.unref(c).setClose?(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-hy-danger absolute click-box top-[10px] right-[10px]",onClick:m},[e.createVNode(u,{name:"sys-button-close",width:"26",height:"26"})])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ym,[e.createElementVNode("p",{class:"flex items-center justify-center text-sm text-white tracking-wide",innerHTML:e.unref(c).tipsContent},null,8,xm),e.createElementVNode("div",km,[e.unref(c).isShowClose?(e.openBlock(),e.createBlock(N,{key:0,type:e.unref(c).closeBtnType,class:"!px-6 tracking-widest",onClick:m},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).closeBtnText),1)]),_:1},8,["type"])):e.createCommentVNode("",!0),e.unref(c).isShowSubmit?(e.openBlock(),e.createBlock(N,{key:1,type:e.unref(c).submitBtnType,class:"!px-6 tracking-widest",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).submitBtnText),1)]),_:1},8,["type"])):e.createCommentVNode("",!0)])])]),_:1})])]),_:1},8,["modelValue","width"])}}});function mt(t,n,o){return new Promise(a=>{const s=e.ref(),l=document.createElement("div");document.body.appendChild(l);const r=e.createApp({render(){return e.h(Nm,{ref:s})}});r.use(pe),r.component("SvgIcon",Vl),r.mount(l),s.value.onShowModal(t,()=>{l.remove(),r.unmount(),a({}),n&&n()},()=>{l.remove(),r.unmount(),a({}),o&&o()})})}const bm=["src"],Cm={key:2,class:"w-full h-full flex items-center justify-center overflow-hidden font-bold rounded-full"},xt=e.defineComponent({__name:"index",props:{url:{default:""},gbDevice:{default:0},onlineState:{default:0},stateShow:{type:Boolean,default:!1},name:{default:"base-user-online-2"},className:{default:"w-[90%] h-[90%]"},contentClass:{default:""}},setup(t){const n=t,o=e.computed(()=>!!e.useSlots().content),a=e.ref(!1),s=e.computed(()=>!a.value&&n.url);function l(r){a.value=r}return(r,i)=>{const c=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(r.gbDevice===1&&r.onlineState===1?"background:linear-gradient(180deg, #5A2120 0%, #C81F12 100%); color:#FDE777;border-color: #FDE777":""),class:"border-hy-main/50 text-hy-text-secondary relative w-[46px] h-[46px] box-border flex items-center justify-center cursor-pointer bg-hy-page-bg-2 border rounded-full text-base"},[s.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:r.url,class:e.normalizeClass(["rounded-full object-cover",r.className]),onError:l},null,42,bm)):e.createCommentVNode("",!0),!s.value&&r.gbDevice!==1?(e.openBlock(),e.createBlock(c,e.normalizeProps(e.mergeProps({key:1},{name:r.name,className:r.className})),null,16)):e.createCommentVNode("",!0),!s.value&&r.gbDevice===1?(e.openBlock(),e.createElementBlock("div",Cm," GB ")):e.createCommentVNode("",!0),!o.value&&r.stateShow?(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass([`${r.contentClass} ${r.onlineState===1?"bg-hy-success shadow-hy-success":"bg-hy-text-secondary shadow-hy-text-secondary"}`,"absolute bottom-[-2px] right-[-2px] w-[36%] h-[36%] rounded-full shadow-[0_0_4px_0]"])},null,2)):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"content")],4)}}}),Bl={};Bl.getData=t=>new Promise((n,o)=>{let a={};wm(t).then(s=>{a.arrayBuffer=s;try{a.orientation=Dm(s)}catch{a.orientation=-1}n(a)}).catch(s=>{o(s)})});function wm(t){let n=null;return new Promise((o,a)=>{if(t.src)if(/^data\:/i.test(t.src))n=Sm(t.src),o(n);else if(/^blob\:/i.test(t.src)){var s=new FileReader;s.onload=function(r){n=r.target.result,o(n)},Em(t.src,function(r){s.readAsArrayBuffer(r)})}else{var l=new XMLHttpRequest;l.onload=function(){if(this.status==200||this.status===0)n=l.response,o(n);else throw"Could not load image";l=null},l.open("GET",t.src,!0),l.responseType="arraybuffer",l.send(null)}else a("img error")})}function Em(t,n){var o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType="blob",o.onload=function(a){(this.status==200||this.status===0)&&n(this.response)},o.send()}function Sm(t,n){n=n||t.match(/^data\:([^\;]+)\;base64,/mi)[1]||"",t=t.replace(/^data\:([^\;]+)\;base64,/gmi,"");for(var o=atob(t),a=o.length%2==0?o.length:o.length+1,s=new ArrayBuffer(a),l=new Uint16Array(s),r=0;r<a;r++)l[r]=o.charCodeAt(r);return s}function Tm(t,n,o){var a="",s;for(s=n,o+=n;s<o;s++)a+=String.fromCharCode(t.getUint8(s));return a}function Dm(t){var n=new DataView(t),o=n.byteLength,a,s,l,r,i,c,p,d,f,m;if(n.getUint8(0)===255&&n.getUint8(1)===216)for(f=2;f<o;){if(n.getUint8(f)===255&&n.getUint8(f+1)===225){p=f;break}f++}if(p&&(s=p+4,l=p+10,Tm(n,s,4)==="Exif"&&(c=n.getUint16(l),i=c===18761,(i||c===19789)&&n.getUint16(l+2,i)===42&&(r=n.getUint32(l+4,i),r>=8&&(d=l+r)))),d){for(o=n.getUint16(d,i),m=0;m<o;m++)if(f=d+m*12+2,n.getUint16(f,i)===274){f+=8,a=n.getUint16(f,i);break}}return a}const Vm=(t,n)=>{const o=t.__vccOpts||t;for(const[a,s]of n)o[a]=s;return o},$m=e.defineComponent({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}},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(t){return Array.isArray(t)?Number(t[0])>=0&&Number(t[1])>=0:Number(t)>=0}},fillColor:{type:String,default:""}},computed:{cropInfo(){let t={};if(t.top=this.cropOffsertY>21?"-21px":"0px",t.width=this.cropW>0?this.cropW:0,t.height=this.cropH>0?this.cropH:0,this.infoTrue){let n=1;this.high&&!this.full&&(n=window.devicePixelRatio),this.enlarge!==1&!this.full&&(n=Math.abs(Number(this.enlarge))),t.width=t.width*n,t.height=t.height*n,this.full&&(t.width=t.width/this.scale,t.height=t.height/this.scale)}return t.width=t.width.toFixed(0),t.height=t.height.toFixed(0),t},isIE(){return!!window.ActiveXObject||"ActiveXObject"in window},passive(){return this.isIE?null:{passive:!1}}},watch:{img(){this.checkedImg()},imgs(t){t!==""&&this.reload()},cropW(){this.showPreview()},cropH(){this.showPreview()},cropOffsertX(){this.showPreview()},cropOffsertY(){this.showPreview()},scale(t,n){this.showPreview()},x(){this.showPreview()},y(){this.showPreview()},autoCrop(t){t&&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(t){var n=navigator.userAgent.split(" "),o="";let a=0;const s=new RegExp(t,"i");for(var l=0;l<n.length;l++)s.test(n[l])&&(o=n[l]);return o?a=o.split("/")[1].split("."):a=["0","0","0"],a},checkOrientationImage(t,n,o,a){if(this.getVersion("chrome")[0]>=81)n=-1;else if(this.getVersion("safari")[0]>=605){const r=this.getVersion("version");r[0]>13&&r[1]>1&&(n=-1)}else{const r=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(r){let i=r[1];i=i.split("_"),(i[0]>13||i[0]>=13&&i[1]>=4)&&(n=-1)}}let s=document.createElement("canvas"),l=s.getContext("2d");switch(l.save(),n){case 2:s.width=o,s.height=a,l.translate(o,0),l.scale(-1,1);break;case 3:s.width=o,s.height=a,l.translate(o/2,a/2),l.rotate(180*Math.PI/180),l.translate(-o/2,-a/2);break;case 4:s.width=o,s.height=a,l.translate(0,a),l.scale(1,-1);break;case 5:s.height=o,s.width=a,l.rotate(.5*Math.PI),l.scale(1,-1);break;case 6:s.width=a,s.height=o,l.translate(a/2,o/2),l.rotate(90*Math.PI/180),l.translate(-o/2,-a/2);break;case 7:s.height=o,s.width=a,l.rotate(.5*Math.PI),l.translate(o,-a),l.scale(-1,1);break;case 8:s.height=o,s.width=a,l.translate(a/2,o/2),l.rotate(-90*Math.PI/180),l.translate(-o/2,-a/2);break;default:s.width=o,s.height=a}l.drawImage(t,0,0,o,a),l.restore(),s.toBlob(r=>{let i=URL.createObjectURL(r);URL.revokeObjectURL(this.imgs),this.imgs=i},"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.clearCrop();let t=new Image;if(t.onload=()=>{if(this.img==="")return this.$emit("img-load",new Error("图片不能为空")),!1;let o=t.width,a=t.height;Bl.getData(t).then(s=>{this.orientation=s.orientation||1;let l=Number(this.maxImgSize);if(!this.orientation&&o<l&a<l){this.imgs=this.img;return}o>l&&(a=a/o*l,o=l),a>l&&(o=o/a*l,a=l),this.checkOrientationImage(t,this.orientation,o,a)}).catch(s=>{this.$emit("img-load","error"),this.$emit("img-load-error",s)})},t.onerror=o=>{this.$emit("img-load","error"),this.$emit("img-load-error",o)},this.img.substr(0,4)!=="data"&&(t.crossOrigin=""),this.isIE){var n=new XMLHttpRequest;n.onload=function(){var o=URL.createObjectURL(this.response);t.src=o},n.open("GET",this.img,!0),n.responseType="blob",n.send()}else t.src=this.img},startMove(t){if(t.preventDefault(),this.move&&!this.crop){if(!this.canMove)return!1;this.moveX=("clientX"in t?t.clientX:t.touches[0].clientX)-this.x,this.moveY=("clientY"in t?t.clientY:t.touches[0].clientY)-this.y,t.touches?(window.addEventListener("touchmove",this.moveImg),window.addEventListener("touchend",this.leaveImg),t.touches.length==2&&(this.touches=t.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=t.offsetX?t.offsetX:t.touches[0].pageX-this.$refs.cropper.offsetLeft,this.cropOffsertY=t.offsetY?t.offsetY:t.touches[0].pageY-this.$refs.cropper.offsetTop,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.touches[0].clientY,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.cropW=0,this.cropH=0},touchScale(t){t.preventDefault();let n=this.scale;var o={x:this.touches[0].clientX,y:this.touches[0].clientY},a={x:t.touches[0].clientX,y:t.touches[0].clientY},s={x:this.touches[1].clientX,y:this.touches[1].clientY},l={x:t.touches[1].clientX,y:t.touches[1].clientY},r=Math.sqrt(Math.pow(o.x-s.x,2)+Math.pow(o.y-s.y,2)),i=Math.sqrt(Math.pow(a.x-l.x,2)+Math.pow(a.y-l.y,2)),c=i-r,p=1;p=p/this.trueWidth>p/this.trueHeight?p/this.trueHeight:p/this.trueWidth,p=p>.1?.1:p;var d=p*c;if(!this.touchNow){if(this.touchNow=!0,c>0?n+=Math.abs(d):c<0&&n>Math.abs(d)&&(n-=Math.abs(d)),this.touches=t.touches,setTimeout(()=>{this.touchNow=!1},8),!this.checkoutImgAxis(this.x,this.y,n))return!1;this.scale=n}},cancelTouchScale(t){window.removeEventListener("touchmove",this.touchScale)},moveImg(t){if(t.preventDefault(),t.touches&&t.touches.length===2)return this.touches=t.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale),window.removeEventListener("touchmove",this.moveImg),!1;let n="clientX"in t?t.clientX:t.touches[0].clientX,o="clientY"in t?t.clientY:t.touches[0].clientY,a,s;a=n-this.moveX,s=o-this.moveY,this.$nextTick(()=>{if(this.centerBox){let l=this.getImgAxis(a,s,this.scale),r=this.getCropAxis(),i=this.trueHeight*this.scale,c=this.trueWidth*this.scale,p,d,f,m;switch(this.rotate){case 1:case-1:case 3:case-3:p=this.cropOffsertX-this.trueWidth*(1-this.scale)/2+(i-c)/2,d=this.cropOffsertY-this.trueHeight*(1-this.scale)/2+(c-i)/2,f=p-i+this.cropW,m=d-c+this.cropH;break;default:p=this.cropOffsertX-this.trueWidth*(1-this.scale)/2,d=this.cropOffsertY-this.trueHeight*(1-this.scale)/2,f=p-c+this.cropW,m=d-i+this.cropH;break}l.x1>=r.x1&&(a=p),l.y1>=r.y1&&(s=d),l.x2<=r.x2&&(a=f),l.y2<=r.y2&&(s=m)}this.x=a,this.y=s,this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})})},leaveImg(t){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(t){t.preventDefault();let n=this.scale;var o=t.deltaY||t.wheelDelta,a=navigator.userAgent.indexOf("Firefox");o=a>0?o*30:o,this.isIE&&(o=-o);var s=this.coe;s=s/this.trueWidth>s/this.trueHeight?s/this.trueHeight:s/this.trueWidth;var l=s*o;l<0?n+=Math.abs(l):n>Math.abs(l)&&(n-=Math.abs(l));let r=l<0?"add":"reduce";if(r!==this.coeStatus&&(this.coeStatus=r,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,n))return!1;this.scale=n},changeScale(t){let n=this.scale;t=t||1;var o=20;if(o=o/this.trueWidth>o/this.trueHeight?o/this.trueHeight:o/this.trueWidth,t=t*o,t>0?n+=Math.abs(t):n>Math.abs(t)&&(n-=Math.abs(t)),!this.checkoutImgAxis(this.x,this.y,n))return!1;this.scale=n},createCrop(t){t.preventDefault();var n="clientX"in t?t.clientX:t.touches?t.touches[0].clientX:0,o="clientY"in t?t.clientY:t.touches?t.touches[0].clientY:0;this.$nextTick(()=>{var a=n-this.cropX,s=o-this.cropY;if(a>0?(this.cropW=a+this.cropChangeX>this.w?this.w-this.cropChangeX:a,this.cropOffsertX=this.cropChangeX):(this.cropW=this.w-this.cropChangeX+Math.abs(a)>this.w?this.cropChangeX:Math.abs(a),this.cropOffsertX=this.cropChangeX+a>0?this.cropChangeX+a:0),!this.fixed)s>0?(this.cropH=s+this.cropChangeY>this.h?this.h-this.cropChangeY:s,this.cropOffsertY=this.cropChangeY):(this.cropH=this.h-this.cropChangeY+Math.abs(s)>this.h?this.cropChangeY:Math.abs(s),this.cropOffsertY=this.cropChangeY+s>0?this.cropChangeY+s:0);else{var l=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];l+this.cropOffsertY>this.h?(this.cropH=this.h-this.cropOffsertY,this.cropW=this.cropH/this.fixedNumber[1]*this.fixedNumber[0],a>0?this.cropOffsertX=this.cropChangeX:this.cropOffsertX=this.cropChangeX-this.cropW):this.cropH=l,this.cropOffsertY=this.cropOffsertY}})},changeCropSize(t,n,o,a,s){t.preventDefault(),window.addEventListener("mousemove",this.changeCropNow),window.addEventListener("mouseup",this.changeCropEnd),window.addEventListener("touchmove",this.changeCropNow),window.addEventListener("touchend",this.changeCropEnd),this.canChangeX=n,this.canChangeY=o,this.changeCropTypeX=a,this.changeCropTypeY=s,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.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(t){t.preventDefault();var n="clientX"in t?t.clientX:t.touches?t.touches[0].clientX:0,o="clientY"in t?t.clientY:t.touches?t.touches[0].clientY:0;let a=this.w,s=this.h,l=0,r=0;if(this.centerBox){let p=this.getImgAxis(),d=p.x2,f=p.y2;l=p.x1>0?p.x1:0,r=p.y1>0?p.y1:0,a>d&&(a=d),s>f&&(s=f)}const[i,c]=this.checkCropLimitSize();this.$nextTick(()=>{var p=n-this.cropX,d=o-this.cropY;if(this.canChangeX&&(this.changeCropTypeX===1?this.cropOldW-p<i?(this.cropW=i,this.cropOffsertX=this.cropOldW+this.cropChangeX-l-i):this.cropOldW-p>0?(this.cropW=a-this.cropChangeX-p<=a-l?this.cropOldW-p:this.cropOldW+this.cropChangeX-l,this.cropOffsertX=a-this.cropChangeX-p<=a-l?this.cropChangeX+p:l):(this.cropW=Math.abs(p)+this.cropChangeX<=a?Math.abs(p)-this.cropOldW:a-this.cropOldW-this.cropChangeX,this.cropOffsertX=this.cropChangeX+this.cropOldW):this.changeCropTypeX===2&&(this.cropOldW+p<i?this.cropW=i:this.cropOldW+p>0?(this.cropW=this.cropOldW+p+this.cropOffsertX<=a?this.cropOldW+p:a-this.cropOffsertX,this.cropOffsertX=this.cropChangeX):(this.cropW=a-this.cropChangeX+Math.abs(p+this.cropOldW)<=a-l?Math.abs(p+this.cropOldW):this.cropChangeX-l,this.cropOffsertX=a-this.cropChangeX+Math.abs(p+this.cropOldW)<=a-l?this.cropChangeX-Math.abs(p+this.cropOldW):l))),this.canChangeY&&(this.changeCropTypeY===1?this.cropOldH-d<c?(this.cropH=c,this.cropOffsertY=this.cropOldH+this.cropChangeY-r-c):this.cropOldH-d>0?(this.cropH=s-this.cropChangeY-d<=s-r?this.cropOldH-d:this.cropOldH+this.cropChangeY-r,this.cropOffsertY=s-this.cropChangeY-d<=s-r?this.cropChangeY+d:r):(this.cropH=Math.abs(d)+this.cropChangeY<=s?Math.abs(d)-this.cropOldH:s-this.cropOldH-this.cropChangeY,this.cropOffsertY=this.cropChangeY+this.cropOldH):this.changeCropTypeY===2&&(this.cropOldH+d<c?this.cropH=c:this.cropOldH+d>0?(this.cropH=this.cropOldH+d+this.cropOffsertY<=s?this.cropOldH+d:s-this.cropOffsertY,this.cropOffsertY=this.cropChangeY):(this.cropH=s-this.cropChangeY+Math.abs(d+this.cropOldH)<=s-r?Math.abs(d+this.cropOldH):this.cropChangeY-r,this.cropOffsertY=s-this.cropChangeY+Math.abs(d+this.cropOldH)<=s-r?this.cropChangeY-Math.abs(d+this.cropOldH):r))),this.canChangeX&&this.fixed){var f=this.cropW/this.fixedNumber[0]*this.fixedNumber[1];f<c?(this.cropH=c,this.cropW=this.fixedNumber[0]*c/this.fixedNumber[1],this.changeCropTypeX===1&&(this.cropOffsertX=this.cropChangeX+(this.cropOldW-this.cropW))):f+this.cropOffsertY>s?(this.cropH=s-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=f}if(this.canChangeY&&this.fixed){var m=this.cropH/this.fixedNumber[1]*this.fixedNumber[0];m<i?(this.cropW=i,this.cropH=this.fixedNumber[1]*i/this.fixedNumber[0],this.cropOffsertY=this.cropOldH+this.cropChangeY-this.cropH):m+this.cropOffsertX>a?(this.cropW=a-this.cropOffsertX,this.cropH=this.cropW/this.fixedNumber[0]*this.fixedNumber[1]):this.cropW=m}})},checkCropLimitSize(){let{cropW:t,cropH:n,limitMinSize:o}=this,a=new Array;return Array.isArray(o)?a=o:a=[o,o],t=parseFloat(a[0]),n=parseFloat(a[1]),[t,n]},changeCropEnd(t){window.removeEventListener("mousemove",this.changeCropNow),window.removeEventListener("mouseup",this.changeCropEnd),window.removeEventListener("touchmove",this.changeCropNow),window.removeEventListener("touchend",this.changeCropEnd)},calculateSize(t,n,o,a,s,l){const r=t/n;let i=s,c=l;return i<o&&(i=o,c=Math.ceil(i/r)),c<a&&(c=a,i=Math.ceil(c*r),i<o&&(i=o,c=Math.ceil(i/r))),i<s&&(i=s,c=Math.ceil(i/r)),c<l&&(c=l,i=Math.ceil(c*r)),{width:i,height:c}},endCrop(){this.cropW===0&&this.cropH===0&&(this.cropping=!1);let[t,n]=this.checkCropLimitSize();const{width:o,height:a}=this.fixed?this.calculateSize(this.fixedNumber[0],this.fixedNumber[1],t,n,this.cropW,this.cropH):{width:t,height:n};o>this.cropW&&(this.cropW=o,this.cropOffsertX+o>this.w&&(this.cropOffsertX=this.w-o)),a>this.cropH&&(this.cropH=a,this.cropOffsertY+a>this.h&&(this.cropOffsertY=this.h-a)),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(t){if(t.preventDefault(),!this.canMoveBox)return this.crop=!1,this.startMove(t),!1;if(t.touches&&t.touches.length===2)return this.crop=!1,this.startMove(t),this.leaveCrop(),!1;window.addEventListener("mousemove",this.moveCrop),window.addEventListener("mouseup",this.leaveCrop),window.addEventListener("touchmove",this.moveCrop),window.addEventListener("touchend",this.leaveCrop);let n="clientX"in t?t.clientX:t.touches[0].clientX,o="clientY"in t?t.clientY:t.touches[0].clientY,a,s;a=n-this.cropOffsertX,s=o-this.cropOffsertY,this.cropX=a,this.cropY=s,this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})},moveCrop(t,n){let o=0,a=0;t&&(t.preventDefault(),o="clientX"in t?t.clientX:t.touches[0].clientX,a="clientY"in t?t.clientY:t.touches[0].clientY),this.$nextTick(()=>{let s,l,r=o-this.cropX,i=a-this.cropY;if(n&&(r=this.cropOffsertX,i=this.cropOffsertY),r<=0?s=0:r+this.cropW>this.w?s=this.w-this.cropW:s=r,i<=0?l=0:i+this.cropH>this.h?l=this.h-this.cropH:l=i,this.centerBox){let c=this.getImgAxis();s<=c.x1&&(s=c.x1),s+this.cropW>c.x2&&(s=c.x2-this.cropW),l<=c.y1&&(l=c.y1),l+this.cropH>c.y2&&(l=c.y2-this.cropH)}this.cropOffsertX=s,this.cropOffsertY=l,this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})})},getImgAxis(t,n,o){t=t||this.x,n=n||this.y,o=o||this.scale;let a={x1:0,x2:0,y1:0,y2:0},s=this.trueWidth*o,l=this.trueHeight*o;switch(this.rotate){case 0:a.x1=t+this.trueWidth*(1-o)/2,a.x2=a.x1+this.trueWidth*o,a.y1=n+this.trueHeight*(1-o)/2,a.y2=a.y1+this.trueHeight*o;break;case 1:case-1:case 3:case-3:a.x1=t+this.trueWidth*(1-o)/2+(s-l)/2,a.x2=a.x1+this.trueHeight*o,a.y1=n+this.trueHeight*(1-o)/2+(l-s)/2,a.y2=a.y1+this.trueWidth*o;break;default:a.x1=t+this.trueWidth*(1-o)/2,a.x2=a.x1+this.trueWidth*o,a.y1=n+this.trueHeight*(1-o)/2,a.y2=a.y1+this.trueHeight*o;break}return a},getCropAxis(){let t={x1:0,x2:0,y1:0,y2:0};return t.x1=this.cropOffsertX,t.x2=t.x1+this.cropW,t.y1=this.cropOffsertY,t.y2=t.y1+this.cropH,t},leaveCrop(t){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(t){let n=document.createElement("canvas"),o=new Image,a=this.rotate,s=this.trueWidth,l=this.trueHeight,r=this.cropOffsertX,i=this.cropOffsertY;o.onload=()=>{if(this.cropW!==0){let d=n.getContext("2d"),f=1;this.high&!this.full&&(f=window.devicePixelRatio),this.enlarge!==1&!this.full&&(f=Math.abs(Number(this.enlarge)));let m=this.cropW*f,_=this.cropH*f,y=s*this.scale*f,u=l*this.scale*f,N=(this.x-r+this.trueWidth*(1-this.scale)/2)*f,k=(this.y-i+this.trueHeight*(1-this.scale)/2)*f;switch(p(m,_),d.save(),this.fillColor&&(d.fillStyle=this.fillColor,d.fillRect(0,0,n.width,n.height)),a){case 0:this.full?(p(m/this.scale,_/this.scale),d.drawImage(o,N/this.scale,k/this.scale,y/this.scale,u/this.scale)):d.drawImage(o,N,k,y,u);break;case 1:case-3:this.full?(p(m/this.scale,_/this.scale),N=N/this.scale+(y/this.scale-u/this.scale)/2,k=k/this.scale+(u/this.scale-y/this.scale)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,k,-N-u/this.scale,y/this.scale,u/this.scale)):(N=N+(y-u)/2,k=k+(u-y)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,k,-N-u,y,u));break;case 2:case-2:this.full?(p(m/this.scale,_/this.scale),d.rotate(a*90*Math.PI/180),N=N/this.scale,k=k/this.scale,d.drawImage(o,-N-y/this.scale,-k-u/this.scale,y/this.scale,u/this.scale)):(d.rotate(a*90*Math.PI/180),d.drawImage(o,-N-y,-k-u,y,u));break;case 3:case-1:this.full?(p(m/this.scale,_/this.scale),N=N/this.scale+(y/this.scale-u/this.scale)/2,k=k/this.scale+(u/this.scale-y/this.scale)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,-k-y/this.scale,N,y/this.scale,u/this.scale)):(N=N+(y-u)/2,k=k+(u-y)/2,d.rotate(a*90*Math.PI/180),d.drawImage(o,-k-y,N,y,u));break;default:this.full?(p(m/this.scale,_/this.scale),d.drawImage(o,N/this.scale,k/this.scale,y/this.scale,u/this.scale)):d.drawImage(o,N,k,y,u)}d.restore()}else{let d=s*this.scale,f=l*this.scale,m=n.getContext("2d");switch(m.save(),this.fillColor&&(m.fillStyle=this.fillColor,m.fillRect(0,0,n.width,n.height)),a){case 0:p(d,f),m.drawImage(o,0,0,d,f);break;case 1:case-3:p(f,d),m.rotate(a*90*Math.PI/180),m.drawImage(o,0,-f,d,f);break;case 2:case-2:p(d,f),m.rotate(a*90*Math.PI/180),m.drawImage(o,-d,-f,d,f);break;case 3:case-1:p(f,d),m.rotate(a*90*Math.PI/180),m.drawImage(o,-d,0,d,f);break;default:p(d,f),m.drawImage(o,0,0,d,f)}m.restore()}t(n)};var c=this.img.substr(0,4);c!=="data"&&(o.crossOrigin="Anonymous"),o.src=this.imgs;function p(d,f){n.width=Math.round(d),n.height=Math.round(f)}},getCropData(t){this.getCropChecked(n=>{t(n.toDataURL("image/"+this.outputType,this.outputSize))})},getCropBlob(t){this.getCropChecked(n=>{n.toBlob(o=>t(o),"image/"+this.outputType,this.outputSize)})},showPreview(){if(this.isCanShow)this.isCanShow=!1,setTimeout(()=>{this.isCanShow=!0},16);else return!1;let t=this.cropW,n=this.cropH,o=this.scale;var a={};a.div={width:`${t}px`,height:`${n}px`};let s=(this.x-this.cropOffsertX)/o,l=(this.y-this.cropOffsertY)/o,r=0;a.w=t,a.h=n,a.url=this.imgs,a.img={width:`${this.trueWidth}px`,height:`${this.trueHeight}px`,transform:`scale(${o})translate3d(${s}px, ${l}px, ${r}px)rotateZ(${this.rotate*90}deg)`},a.html=`
|
31
31
|
<div class="show-preview" style="width: ${a.w}px; height: ${a.h}px,; overflow: hidden">
|
32
32
|
<div style="width: ${t}px; height: ${n}px">
|
33
33
|
<img src=${a.url} style="width: ${this.trueWidth}px; height: ${this.trueHeight}px; transform:
|