2 lines
5.6 KiB
JavaScript
2 lines
5.6 KiB
JavaScript
var K=Object.defineProperty;var W=(a,n,m)=>n in a?K(a,n,{enumerable:!0,configurable:!0,writable:!0,value:m}):a[n]=m;var h=(a,n,m)=>W(a,typeof n!="symbol"?n+"":n,m);import{B as G,a as v,o as O,n as R,j as Y,D as z,G as d,H as o,P as r,a6 as Z,u as p,a7 as J,I as u,a8 as x,C as y,Z as Q,Y as X,O as ee,V as B,U as P}from"./vue-Ce7h5hs3.js";import{_ as te}from"./login-header-Dbn1AN0b.js";import{e as oe,w as ae,x as ne,y as se,g as le,f as ie,r as re,z as ce,_ as de}from"./index-BQ5jItLS.js";import{l as M}from"./index-C9pWMHjm.js";import{b}from"./validate-BmIGZnH0.js";import{c as ue}from"./index-DoXya3pc.js";import{t as me}from"./useDark-CnW-Stpb.js";const e={width:0,height:0,bubbleEl:null,canvas:null,ctx:{},circles:[],animate:!0,requestId:null},pe=function(){e.width=window.innerWidth,e.height=window.innerHeight,e.bubbleEl=document.getElementById("bubble"),e.bubbleEl.style.height=e.height+"px",e.canvas=document.getElementById("bubble-canvas"),e.canvas.width=e.width,e.canvas.height=e.height,e.ctx=e.canvas.getContext("2d"),e.circles=[];for(let a=0;a<e.width*.5;a++){const n=new fe;e.circles.push(n)}T(),he()};function q(){e.animate=!(document.body.scrollTop>e.height)}function D(){e.width=window.innerWidth,e.height=window.innerHeight,e.bubbleEl.style.height=e.height+"px",e.canvas.width=e.width,e.canvas.height=e.height}function T(){if(e.animate){e.ctx.clearRect(0,0,e.width,e.height);for(const a in e.circles)e.circles[a].draw()}e.requestId=requestAnimationFrame(T)}class fe{constructor(){h(this,"pos");h(this,"alpha");h(this,"scale");h(this,"velocity");h(this,"draw");this.pos={x:Math.random()*e.width,y:e.height+Math.random()*100},this.alpha=.1+Math.random()*.3,this.scale=.1+Math.random()*.3,this.velocity=Math.random(),this.draw=function(){this.pos.y-=this.velocity,this.alpha-=5e-4,e.ctx.beginPath(),e.ctx.arc(this.pos.x,this.pos.y,this.scale*10,0,2*Math.PI,!1),e.ctx.fillStyle="rgba(255,255,255,"+this.alpha+")",e.ctx.fill()}}}function he(){window.addEventListener("scroll",q),window.addEventListener("resize",D)}function ge(){window.removeEventListener("scroll",q),window.removeEventListener("resize",D),cancelAnimationFrame(e.requestId)}const we={class:"switch-language"},be={class:"login"},_e={class:"login-box"},ve={class:"form"},xe=["src"],ye={class:"content"},ke=G({__name:"login",setup(a){let n;const m=oe(),U=ae();me(m.layout.isDark);const k=x("formRef"),I=x("usernameRef"),C=x("passwordRef"),g=v({showCaptcha:!1,submitLoading:!1}),s=v({username:"",password:"",keep:!1,captchaId:se(),captchaInfo:""}),{t:f}=ne.useI18n(),S=v({username:[b({name:"required",message:f("login.Please enter an account")}),b({name:"account"})],password:[b({name:"required",message:f("login.Please input a password")}),b({name:"password"})]}),A=()=>{var l,t;s.username===""?(l=I.value)==null||l.focus():s.password===""&&((t=C.value)==null||t.focus())};O(()=>{n=window.setTimeout(()=>{pe()},1e3),M("get").then(l=>{g.showCaptcha=l.data.captcha,R(()=>A())}).catch(l=>{console.log(l)})}),Y(()=>{clearTimeout(n),ge()});const V=()=>{var l;(l=k.value)==null||l.validate(t=>{t&&(g.showCaptcha?ue(s.captchaId,c=>E(c)):E())})},E=(l="")=>{g.submitLoading=!0,s.captchaInfo=l,M("post",s).then(t=>{var w;const c=(w=t==null?void 0:t.data)==null?void 0:w.userInfo;c!=null&&c.token&&(U.dataFill(c,!1),R(()=>{re.push({path:ce})}))}).catch(()=>{}).finally(()=>{g.submitLoading=!1})};return(l,t)=>{const c=u("Icon"),w=u("el-dropdown-item"),F=u("el-dropdown-menu"),H=u("el-dropdown"),L=u("el-input"),_=u("el-form-item"),$=u("el-checkbox"),N=u("el-button"),j=u("el-form");return y(),z("div",null,[d("div",we,[o(H,{size:"large","hide-timeout":50,placement:"bottom-end","hide-on-click":!0},{dropdown:r(()=>[o(F,{class:"chang-lang"},{default:r(()=>[(y(!0),z(Q,null,X(p(m).lang.langArray,i=>(y(),ee(w,{key:i.name,onClick:Ie=>p(le)(i.name)},{default:r(()=>[B(P(i.value),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),default:r(()=>[o(c,{name:"fa fa-globe",color:"var(--el-text-color-secondary)",size:"28"})]),_:1})]),d("div",{onContextmenu:t[0]||(t[0]=Z(()=>{},["stop"])),id:"bubble",class:"bubble"},t[6]||(t[6]=[d("canvas",{id:"bubble-canvas",class:"bubble-canvas"},null,-1)]),32),d("div",be,[d("div",_e,[t[7]||(t[7]=d("div",{class:"head"},[d("img",{src:te,alt:""})],-1)),d("div",ve,[d("img",{class:"profile-avatar",src:p(ie)("/static/images/avatar.png"),alt:""},null,8,xe),d("div",ye,[o(j,{onKeyup:t[5]||(t[5]=J(i=>V(),["enter"])),ref_key:"formRef",ref:k,rules:S,size:"large",model:s},{default:r(()=>[o(_,{prop:"username"},{default:r(()=>[o(L,{ref_key:"usernameRef",ref:I,type:"text",clearable:"",modelValue:s.username,"onUpdate:modelValue":t[1]||(t[1]=i=>s.username=i),placeholder:p(f)("login.Please enter an account")},{prefix:r(()=>[o(c,{name:"fa fa-user",class:"form-item-icon",size:"16",color:"var(--el-input-icon-color)"})]),_:1},8,["modelValue","placeholder"])]),_:1}),o(_,{prop:"password"},{default:r(()=>[o(L,{ref_key:"passwordRef",ref:C,modelValue:s.password,"onUpdate:modelValue":t[2]||(t[2]=i=>s.password=i),type:"password",placeholder:p(f)("login.Please input a password"),"show-password":""},{prefix:r(()=>[o(c,{name:"fa fa-unlock-alt",class:"form-item-icon",size:"16",color:"var(--el-input-icon-color)"})]),_:1},8,["modelValue","placeholder"])]),_:1}),o($,{modelValue:s.keep,"onUpdate:modelValue":t[3]||(t[3]=i=>s.keep=i),label:p(f)("login.Hold session"),size:"default"},null,8,["modelValue","label"]),o(_,null,{default:r(()=>[o(N,{loading:g.submitLoading,class:"submit-button",round:"",type:"primary",size:"large",onClick:t[4]||(t[4]=i=>V())},{default:r(()=>[B(P(p(f)("login.Sign in")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["rules","model"])])])])])])}}}),Me=de(ke,[["__scopeId","data-v-1c4bfbfb"]]);export{Me as default};
|