Files
AllinSSL/frontend/static/js/index-Dvx01Tcy.js
2026-01-13 17:47:39 +08:00

2 lines
7.7 KiB
JavaScript

import{d as e,Z as a,_ as l,a0 as r,e as s,s as t,f as o,r as n,aG as c,y as u,aH as i,o as d,a6 as m,a as p,c as v,$ as _,aI as g,n as h,t as w,a4 as f,ab as b,aJ as x,B as y,i as C}from"./main-Cz0Kbk_r.js";import{u as k,P as S,m as z}from"./index-DajjVwSG.js";import{l as M,a as j}from"./public-Ig7Z0OE-.js";import{a as D}from"./index-CIL5XN93.js";import"./index-CJfR-ED3.js";const I={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},O=e({name:"CodeOutlined",render:function(e,s){return l(),a("svg",I,s[0]||(s[0]=[r("path",{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 0 0 308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 0 0-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z",fill:"currentColor"},null,-1)]))}}),V={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},H=e({name:"LockOutlined",render:function(e,s){return l(),a("svg",V,s[0]||(s[0]=[r("path",{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 1 0-56 0z",fill:"currentColor"},null,-1)]))}}),L={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},B=e({name:"UserOutlined",render:function(e,s){return l(),a("svg",L,s[0]||(s[0]=[r("path",{d:"M858.5 763.6a374 374 0 0 0-80.6-119.5a375.63 375.63 0 0 0-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1c-.4.2-.8.3-1.2.5c-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 0 0-80.6 119.5A371.7 371.7 0 0 0 136 901.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8c2-77.2 33-149.5 87.8-204.3c56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 0 0 8-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z",fill:"currentColor"},null,-1)]))}}),{success:K}=o(),{handleError:R}=k(),T=s("login-store",()=>{const e=n(null),a=n(""),l=D("login-token",""),r=n(!1),s=n({username:"",password:"",code:""}),t=D("remember-me",!1),o=n(null),{fetch:c,error:u,data:i,message:d,loading:m}=M(),p=()=>{s.value.username="",s.value.password="",t.value=!1,u.value=null},v=async()=>{try{const{data:e}=await j();a.value=e.data}catch(e){R(e)}},_=()=>{const e=S("must_code",!1);r.value=1===Number(e),r.value&&v()};return{loading:m,codeImg:a,error:u,user:e,loginData:s,rememberMe:t,forgotPasswordRef:o,mustCode:r,handleLogin:async e=>{try{u.value=null,d.value=!0,await c(e);const{status:a}=i.value;if(!a)throw new Error(i.value.message);K("登录成功,正在跳转中..."),setTimeout(()=>location.href="/",1e3),_()}catch(a){u.value=a.message,_()}},handleLogout:()=>{e.value=null,l.value=null,p(),location.href="/login"},handleGetCode:v,checkMustCode:_,resetForm:p,clearToken:()=>{l.value=null}}}),U=()=>{const e=localStorage.getItem("loginData");return e?JSON.parse(e):null},E=(e,a)=>{localStorage.setItem("loginData",JSON.stringify({username:e,password:a}))},G=()=>{const e=(()=>{const e=T();return{...e,...t(e)}})(),{handleError:a}=k(),{error:l,loginData:r,handleLogin:s,rememberMe:o,checkMustCode:m,mustCode:p,handleGetCode:v}=e,_=n(null),g=async e=>{try{const a=(t=e.password,z(`${t}_bt_all_in_ssl`).toString());await s({...e,password:a}),o.value&&!l.value?E(e.username,e.password):l.value?(r.value.password="",p.value&&v()):l.value||o.value||localStorage.removeItem("loginData")}catch(n){a(n),p.value&&v()}var t},h=async e=>{if(e.preventDefault(),_.value)try{await _.value.validate(),await g(r.value)}catch(a){}},w=c();return w.run(()=>{u(l,e=>{e&&setTimeout(()=>{l.value=""},5e3)}),i(()=>{w.stop()})}),d(()=>{if(m(),o.value){const e=U();e&&(r.value.username=e.username,r.value.password=e.password)}}),{...e,formRef:_,handleSubmit:h,handleKeyup:e=>{"Enter"===e.key&&h(e)},handleLogin:g,getRememberData:U,setRememberData:E}},P="_container_1pdcl_4",$="_loginBox_1pdcl_20",q="_leftImageWrapper_1pdcl_26",A="_leftImage_1pdcl_26",J="_leftSection_1pdcl_51",N="_leftTitle_1pdcl_59",W="_logo_1pdcl_63",F="_rightSection_1pdcl_76",Z="_title_1pdcl_89",Q="_formContainer_1pdcl_95",X="_formWrapper_1pdcl_101",Y="_formContent_1pdcl_106",ee="_formInputs_1pdcl_111",ae="_formActions_1pdcl_130",le="_rememberSection_1pdcl_135",re="_error_1pdcl_166",se="_codeImageContainer_1pdcl_355",te="_forgotPassword_1pdcl_370",oe="_icon_1pdcl_375";const ne=e({name:"LoginView",setup(){const{loading:e,error:a,rememberMe:l,handleSubmit:r,handleKeyup:s,loginData:t,handleGetCode:o,codeImg:n,mustCode:c,formRef:u}=G(),{isDark:i}=m(),d=p(["textColor2","actionColor","errorColor","primaryColor","primaryColorSuppl"]);return()=>{let m;return v("div",{style:d.value},[v("div",{class:P,style:`background-image:${i.value?"url(/static/images/login-bg-dark.svg)":"url(/static/images/login-bg.svg)"};`},[v("div",{class:$},[v("div",{class:J},[v("h2",{class:N},[v("img",{src:"/static/images/logo.png",alt:"logo",class:W},null),v("span",null,[_("t_2_1747047214975")])]),v("div",{class:q},[v("img",{src:"/static/images/login-display.svg",alt:_("t_1_1744164835667"),class:A},null)])]),v("div",{class:F},[v("div",{class:Q},[v("h1",{class:Z},[_("t_2_1744164839713")]),v(g,{ref:u,model:t.value,onSubmit:r,class:X},{default:()=>{return[v("div",{class:Y},[v("div",{class:ee},[v(h,{"show-label":!1,path:"username",rule:{required:!0,message:_("t_3_1744164839524"),trigger:["input","blur"]}},{default:()=>[v(w,{value:t.value.username,"onUpdate:value":e=>t.value.username=e,onKeyup:s,disabled:e.value,placeholder:_("t_3_1744164839524"),clearable:!0,size:"large"},{prefix:()=>v(f,{component:B,class:oe},null)})]}),v(h,{"show-label":!1,path:"password",rule:{required:!0,message:_("t_4_1744164840458"),trigger:["input","blur"]}},{default:()=>[v(w,{onKeyup:s,disabled:e.value,value:t.value.password,"onUpdate:value":e=>t.value.password=e,type:"password",placeholder:_("t_4_1744164840458"),clearable:!0,size:"large",showPasswordOn:"click"},{prefix:()=>v(f,{component:H,class:oe},null)})]}),c.value?v(h,{"show-label":!1,path:"code",rule:{required:c.value,message:_("t_25_1745289355721"),trigger:["input","blur"]}},{default:()=>[v(w,{onKeyup:s,disabled:e.value,value:t.value.code,"onUpdate:value":e=>t.value.code=e,type:"text",placeholder:_("t_25_1745289355721"),clearable:!0,size:"large"},{prefix:()=>v(f,{component:O,class:oe},null),suffix:()=>v("span",{onClick:o,title:_("t_0_1745936396853"),class:`w-[10rem] h-[4rem] mr-[-1.5rem] flex items-center justify-center relative z-[999] cursor-pointer bg-slate-400 rounded-r-[6px] ${se}`},[v(b,{src:n.value,"preview-disabled":!0,class:"max-w-full max-h-full object-contain"},null)])})]}):null]),v("div",{class:ae},[v("div",{class:le},[v(x,{checked:l.value,"onUpdate:checked":e=>l.value=e},(u=m=_("t_5_1744164840468"),"function"==typeof u||"[object Object]"===Object.prototype.toString.call(u)&&!C(u)?m:{default:()=>[m]})),v("a",{class:te,href:"https://www.bt.cn/bbs/thread-144776-1-1.html",target:"_blank",rel:"noopener noreferrer"},[_("t_6_1744164838900")])]),a.value&&v("div",{class:re},[a.value]),v(y,{type:"primary",size:"large",block:!0,loading:e.value,attrType:"submit",onClick:r},{default:()=>[e.value?_("t_7_1744164838625"):_("t_8_1744164839833")]})])])];var u}})])])])])])}}});export{ne as default};