index-BHH5xkYV.js 11 KB

12
  1. var e=Object.defineProperty,t=Object.defineProperties,a=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,a,s)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s,n=(e,t)=>{for(var a in t||(t={}))l.call(t,a)&&r(e,a,t[a]);if(s)for(var a of s(t))o.call(t,a)&&r(e,a,t[a]);return e},i=(e,s)=>t(e,a(s));import{u,a as d,b as c,A as p,t as g,l as v,g as f,R as h,U as m,H as y}from"./index-DF0Gm8tW.js";/* empty css *//* empty css *//* empty css */import{k as x,M as b,N as w,r as k,d as _,n as M,O as j,c as T,P as B,D as $,Q as P,u as V,R as L,S as O,U as I,V as R,W as U,X as C,s as E,Y as S,B as D,Z as X,x as z,G as A,_ as F,F as N,$ as H,a0 as q,a1 as Y,a2 as W,a3 as G,C as K,a4 as Q,a5 as Z,i as J,a6 as ee,a7 as te,a8 as ae,a9 as se,aa as le,E as oe,f as re}from"./vendor-CgKklJ4r.js";import{_ as ne}from"./_plugin-vue_export-helper-BCo6x5W8.js";/* empty css */import"./el-form-item-l0sNRNKZ.js";/* empty css *//* empty css *//* empty css *//* empty css */import{_ as ie}from"./index-Cd4TCLWv.js";/* empty css *//* empty css */import{_ as ue}from"./LoginLeftView-C2zIbKT8.js";import"./index-DD3bX7Dm.js";const de=["innerHTML"],ce=ne(x(i(n({},{name:"ArtDragVerify"}),{__name:"index",props:{value:{type:Boolean,default:!1},width:{default:"100%"},height:{default:40},text:{default:"按住滑块拖动"},successText:{default:"success"},background:{default:"#eee"},progressBarBg:{default:"#1385FF"},completedBg:{default:"#57D187"},circle:{type:Boolean,default:!1},radius:{default:"calc(var(--custom-radius) / 3 + 2px)"},handlerIcon:{default:"&#xea50;"},successIcon:{default:"&#xe621;"},handlerBg:{default:"#fff"},textSize:{default:"13px"},textColor:{default:"#333"}},emits:["handlerMove","update:value","passCallback"],setup(e,{expose:t,emit:a}){const s=a,l=e,o=b({isMoving:!1,x:0,isOk:!1}),{isOk:r}=w(o),n=k(),i=k(),u=k(),d=k();let c,p,g,v;const f=e=>{c=e.targetTouches[0].pageX,p=e.targetTouches[0].pageY},h=e=>{g=e.targetTouches[0].pageX,v=e.targetTouches[0].pageY,Math.abs(g-c)>Math.abs(v-p)&&e.preventDefault()};document.addEventListener("touchstart",f),document.addEventListener("touchmove",h,{passive:!1});const m=()=>{var e;return"string"==typeof l.width?(null==(e=n.value)?void 0:e.offsetWidth)||260:l.width};_((()=>{var e;null==(e=n.value)||e.style.setProperty("--textColor",l.textColor),M((()=>{var e,t;const a=m();null==(e=n.value)||e.style.setProperty("--width",Math.floor(a/2)+"px"),null==(t=n.value)||t.style.setProperty("--pwidth",-Math.floor(a/2)+"px")})),document.addEventListener("touchstart",f),document.addEventListener("touchmove",h,{passive:!1})})),j((()=>{document.removeEventListener("touchstart",f),document.removeEventListener("touchmove",h)}));const y={left:"0",width:l.height+"px",height:l.height+"px",background:l.handlerBg},x=T((()=>({width:"string"==typeof l.width?l.width:l.width+"px",height:l.height+"px",lineHeight:l.height+"px",background:l.background,borderRadius:l.circle?l.height/2+"px":l.radius}))),E={background:l.progressBarBg,height:l.height+"px",borderRadius:l.circle?l.height/2+"px 0 0 "+l.height/2+"px":l.radius},S=T((()=>({fontSize:l.textSize}))),D=T((()=>l.value?l.successText:l.text)),X=e=>{l.value||(o.isMoving=!0,u.value.style.transition="none",o.x=(e.pageX||e.touches[0].pageX)-parseInt(u.value.style.left.replace("px",""),10)),s("handlerMove")},z=e=>{if(o.isMoving&&!l.value){const t=m();let a=(e.pageX||e.touches[0].pageX)-o.x;a>0&&a<=t-l.height?(u.value.style.left=a+"px",d.value.style.width=a+l.height/2+"px"):a>t-l.height&&(u.value.style.left=t-l.height+"px",d.value.style.width=t-l.height/2+"px",F())}},A=e=>{if(o.isMoving&&!l.value){const t=m();(e.pageX||e.changedTouches[0].pageX)-o.x<t-l.height?(o.isOk=!0,u.value.style.left="0",u.value.style.transition="all 0.2s",d.value.style.width="0",o.isOk=!1):(u.value.style.transition="none",u.value.style.left=t-l.height+"px",d.value.style.width=t-l.height/2+"px",F()),o.isMoving=!1}},F=()=>{s("update:value",!0),o.isMoving=!1,d.value.style.background=l.completedBg,i.value.style["-webkit-text-fill-color"]="unset",i.value.style.animation="slidetounlock2 2s cubic-bezier(0, 0.2, 1, 1) infinite",i.value.style.color="#fff",s("passCallback")};return t({reset:()=>{u.value.style.left="0",d.value.style.width="0",u.value.children[0].innerHTML=l.handlerIcon,i.value.style["-webkit-text-fill-color"]="transparent",i.value.style.animation="slidetounlock 2s cubic-bezier(0, 0.2, 1, 1) infinite",i.value.style.color=l.background,s("update:value",!1),o.isOk=!1,o.isMoving=!1,o.x=0}}),(e,t)=>($(),B("div",{ref_key:"dragVerify",ref:n,class:"drag_verify",style:P(V(x)),onMousemove:z,onMouseup:A,onMouseleave:A,onTouchmove:z,onTouchend:A},[L("div",{class:O(["dv_progress_bar",{goFirst2:V(r)}]),ref_key:"progressBar",ref:d,style:E},null,2),L("div",{class:"dv_text",style:P(V(S)),ref_key:"messageRef",ref:i},[e.$slots.textBefore?I(e.$slots,"textBefore",{key:0},void 0,!0):R("",!0),U(" "+C(V(D))+" ",1),e.$slots.textAfter?I(e.$slots,"textAfter",{key:1},void 0,!0):R("",!0)],4),L("div",{class:O(["dv_handler dv_handler_bg",{goFirst:V(r)}]),onMousedown:X,onTouchstart:X,ref_key:"handler",ref:u,style:y},[L("i",{class:"iconfont-sys",innerHTML:e.value?e.successIcon:e.handlerIcon},null,8,de)],34)],36))}})),[["__scopeId","data-v-293ffbae"]]),pe={class:"login"},ge={class:"right-wrap"},ve={class:"top-right-wrap"},fe={class:"iconfont-sys"},he={class:"menu-txt"},me={key:0,class:"iconfont-sys icon-check"},ye={class:"header"},xe={class:"login-wrap"},be={class:"form"},we={class:"title"},ke={class:"sub-title"},_e={class:"drag-verify"},Me={class:"forget-password"},je={style:{"margin-top":"30px"}},Te={class:"footer"},Be=ne(x(i(n({},{name:"Login"}),{__name:"index",setup(e){const{t:t}=u(),a=T((()=>[{key:"super",label:t("login.roles.super"),userName:"lizhi",password:"123456",roles:["R_SUPER"]},{key:"admin",label:t("login.roles.admin"),userName:"Admin",password:"123456",roles:["R_ADMIN"]},{key:"user",label:t("login.roles.user"),userName:"User",password:"123456",roles:["R_USER"]}])),s=d(),{isDark:l}=E(s),o=k(),r=c(),n=S(),i=k(!1),x=k(!1),w=p.systemInfo.name,M=k(),j=b({account:"",username:"",password:"",rememberPassword:!0}),P=T((()=>({username:[{required:!0,message:t("login.placeholder[0]"),trigger:"blur"}],password:[{required:!0,message:t("login.placeholder[1]"),trigger:"blur"}]}))),I=k(!1);_((()=>{ne("super")}));const ne=e=>{var t,s;const l=a.value.find((t=>t.key===e));j.account=e,j.username=null!=(t=null==l?void 0:l.userName)?t:"",j.password=null!=(s=null==l?void 0:l.password)?s:""},de=()=>{return e=this,t=null,a=function*(){if(M.value)try{if(!(yield M.value.validate()))return;if(!i.value)return void(x.value=!0);I.value=!0;const{username:e,password:t}=j,{token:a,refreshToken:s}=yield m.login({username:e,password:t});if(!a)throw new Error("Login failed - no token received");r.setToken(a,s);const l=yield m.getUserInfo();r.setUserInfo(l),r.setLoginStatus(!0),$e(),n.push("/")}catch(e){e instanceof y||oe.error("登录失败,请稍后重试")}finally{I.value=!1,Be()}},new Promise(((s,l)=>{var o=e=>{try{n(a.next(e))}catch(t){l(t)}},r=e=>{try{n(a.throw(e))}catch(t){l(t)}},n=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,r);n((a=a.apply(e,t)).next())}));var e,t,a},Be=()=>{o.value.reset()},$e=()=>{setTimeout((()=>{re({title:t("login.success.title"),type:"success",duration:2500,zIndex:1e4,message:`${t("login.success.message")}, ${w}!`})}),150)},{locale:Pe}=u(),Ve=e=>{Pe.value!==e&&(Pe.value=e,r.setLanguage(e))};return(e,t)=>{const s=ue,r=q,n=F,u=Y,d=ie,c=Q,p=G,m=W,y=Z,b=ce,k=ee,_=D("RouterLink"),T=ae,E=le,S=X("ripple");return $(),B("div",pe,[z(s),L("div",ge,[L("div",ve,[L("div",{class:"btn theme-btn",onClick:t[0]||(t[0]=(...e)=>V(g)&&V(g)(...e))},[L("i",fe,C(V(l)?"":""),1)]),z(u,{onCommand:Ve,"popper-class":"langDropDownStyle"},{dropdown:A((()=>[z(n,null,{default:A((()=>[($(!0),B(N,null,H(V(v),(e=>($(),B("div",{key:e.value,class:"lang-btn-item"},[z(r,{command:e.value,class:O({"is-selected":V(Pe)===e.value})},{default:A((()=>[L("span",he,C(e.label),1),V(Pe)===e.value?($(),B("i",me,"")):R("",!0)])),_:2},1032,["command","class"])])))),128))])),_:1})])),default:A((()=>[t[6]||(t[6]=L("div",{class:"btn language-btn"},[L("i",{class:"iconfont-sys icon-language"},"")],-1))])),_:1,__:[6]})]),L("div",ye,[z(d,{class:"icon"}),L("h1",null,C(V(w)),1)]),L("div",xe,[L("div",be,[L("h3",we,C(e.$t("login.title")),1),L("p",ke,C(e.$t("login.subTitle")),1),z(E,{ref_key:"formRef",ref:M,model:V(j),rules:V(P),onKeyup:se(de,["enter"]),style:{"margin-top":"25px"}},{default:A((()=>[z(m,{prop:"account"},{default:A((()=>[z(p,{modelValue:V(j).account,"onUpdate:modelValue":t[1]||(t[1]=e=>V(j).account=e),onChange:ne,class:"account-select"},{default:A((()=>[($(!0),B(N,null,H(V(a),(e=>($(),K(c,{key:e.key,label:e.label,value:e.key},{default:A((()=>[L("span",null,C(e.label),1)])),_:2},1032,["label","value"])))),128))])),_:1},8,["modelValue"])])),_:1}),z(m,{prop:"username"},{default:A((()=>[z(y,{placeholder:e.$t("login.placeholder[0]"),modelValue:V(j).username,"onUpdate:modelValue":t[2]||(t[2]=e=>V(j).username=e),modelModifiers:{trim:!0}},null,8,["placeholder","modelValue"])])),_:1}),z(m,{prop:"password"},{default:A((()=>[z(y,{placeholder:e.$t("login.placeholder[1]"),modelValue:V(j).password,"onUpdate:modelValue":t[3]||(t[3]=e=>V(j).password=e),modelModifiers:{trim:!0},type:"password",radius:"8px",autocomplete:"off","show-password":""},null,8,["placeholder","modelValue"])])),_:1}),L("div",_e,[L("div",{class:O(["drag-verify-content",{error:!V(i)&&V(x)}])},[z(b,{ref_key:"dragVerify",ref:o,value:V(i),"onUpdate:value":t[4]||(t[4]=e=>J(i)?i.value=e:null),text:e.$t("login.sliderText"),textColor:"var(--art-gray-800)",successText:e.$t("login.sliderSuccessText"),progressBarBg:V(f)("--el-color-primary"),background:"var(--art-gray-200)",handlerBg:"var(--art-main-bg-color)"},null,8,["value","text","successText","progressBarBg"])],2),L("p",{class:O(["error-text",{"show-error-text":!V(i)&&V(x)}])},C(e.$t("login.placeholder[2]")),3)]),L("div",Me,[z(k,{modelValue:V(j).rememberPassword,"onUpdate:modelValue":t[5]||(t[5]=e=>V(j).rememberPassword=e)},{default:A((()=>[U(C(e.$t("login.rememberPwd")),1)])),_:1},8,["modelValue"]),z(_,{to:V(h).ForgetPassword},{default:A((()=>[U(C(e.$t("login.forgetPwd")),1)])),_:1},8,["to"])]),L("div",je,[te(($(),K(T,{class:"login-btn",type:"primary",onClick:de,loading:V(I)},{default:A((()=>[U(C(e.$t("login.btnText")),1)])),_:1},8,["loading"])),[[S]])]),L("div",Te,[L("p",null,[U(C(e.$t("login.noAccount"))+" ",1),z(_,{to:V(h).Register},{default:A((()=>[U(C(e.$t("login.register")),1)])),_:1},8,["to"])])])])),_:1},8,["model","rules"])])])])])}}})),[["__scopeId","data-v-499e7447"]]);export{Be as default};