2 lines
6.0 KiB
JavaScript
2 lines
6.0 KiB
JavaScript
import{d as e,bw as a,b4 as l,a$ as t,b5 as s,r as o,bk as n,bt as r,F as c,a7 as i,ad as u,b2 as d,o as g,bx as m,b6 as p,D as v,c as f,l as _,m as y,ag as h,g as w,w as x,ak as b,by as k,aB as I,e as T,O as V,t as z,N as $,bz as j,aj as D,am as S,P as C,bA as E,Q as B,bB as F,E as K,bf as G}from"./index.1752127231660zIbJHk2O.js";import{E as R}from"./el-card.1752127231660B6JdeAnJ.js";import{E as U}from"./el-text.1752127231660DlDlwk5p.js";import{_ as q}from"./index.1752127231660B0tqmD2Z.js";import{a as A,c as L}from"./custom.1752127231660r-ddqOQP.js";const N={class:"login-container"},O={class:"absolute-lt flex-x-end p-3 w-full"},J={class:"text-center relative"},M={class:"flex-y-center w-full"},P={class:"flex-y-center w-full"},Q={class:"flex-y-center w-full"},W={key:1,class:"google-code-image-box"},H={style:{"text-align":"center","margin-bottom":"4px"}},X=G(e({__name:"index",setup(e){const{copy:G}=a({legacy:!0});l();const X=t(),Y=s(),Z=p();o(Y.theme===n.DARK);const ee=o(!0),ae=o(!1),le=o(!1),te=o(k),{height:se}=r(),oe=o(""),ne=o({user_name:"",password:"",google_code:""}),re=o("");const ce=c((()=>({})));function ie(){const e="/"+ge.value.active;d.push({path:e})}function ue(){te.value.validate((async e=>{if(e){ae.value=!0;const e=function(){let e=ne.value;return"customer"===ge.value.active&&(e={...ne.value,ms_name:ne.value.user_name}),e}(),a={username:e.user_name,password:e.password,google_code:e.google_code};re.value="",await X.login(a).then((e=>{clearInterval(xe),(null==e?void 0:e.qr_code_url)?re.value=null==e?void 0:e.qr_code_url:(re.value="",ie())})).catch((()=>{})).finally((()=>{ae.value=!1}))}}))}function de(e){e instanceof KeyboardEvent&&(le.value=e.getModifierState("CapsLock"))}o(""),i((()=>{se.value<600?ee.value=!1:ee.value=!0}));const ge=o({active:"",list:[{identity:"admin",name:"管理员平台"},{identity:"customer",name:"客户管理平台"}]});u({visible:!1,type:"user-form",width:400,title:"",leftBtnText:"确 定",rightBtnText:""});let me=JSON.parse(sessionStorage.getItem("loginInfo")||"{}");ge.value.active=me.loginType,oe.value&&oe.value!==ge.value.active&&!["admin","customer"].includes(ge.value.active)&&(localStorage.clear(),d.push({path:"/login",replace:!0})),oe.value=ge.value.active;localStorage.getItem(oe.value+"accessToken")&&ie();const pe=o("account_login"),ve=e=>{"account_login"===pe.value?(pe.value="tg_login",we()):(pe.value="account_login",clearInterval(xe))};g((()=>{"customer"==me.loginType&&(pe.value="tg_login",we())}));const fe=F((e=>{G(e).then((()=>{m.success("复制成功")}))}),300),_e=()=>{window.open("https://t.me/bfbf")},ye=o(""),he=o(""),we=()=>{A({}).then((e=>{ye.value=e.token,he.value=e.expires_at,be()})).catch((e=>{}))};let xe=null;const be=()=>{new Date(he.value).getTime()-Date.now()<=0?clearInterval(xe):(clearInterval(xe),xe=setInterval((()=>{L({token:ye.value}).then((e=>{e.logged_in?(localStorage.setItem("customeraccessToken",e.loginToken),ie(),clearInterval(xe)):e.valid||(m.warning("授权认证过期,请刷新界面重新获取认证"),clearInterval(xe))})).catch((e=>{clearInterval(xe)}))}),3e3))};return g((()=>{ge.value.active})),v((()=>Z.path),(e=>{e.startsWith("/login/")&&ge.value.active})),(e,a)=>{const l=b,t=q,s=D,o=j,n=S,r=E,c=k,i=U,u=I("Document"),d=K,g=R;return T(),f("div",N,[_("div",O,["customer"==w(ge).active?(T(),y(l,{key:0,size:"small",type:"primary",style:{"margin-right":"20px",width:"100px"},plain:"",round:"",onClick:ve},{default:x((()=>[V(z("tg_login"===w(pe)?"账号密码登录":"TG注册/登录"),1)])),_:1})):h("",!0)]),w(ge).active?(T(),y(g,{key:0,class:"login-input-container !border-none !bg-transparent !rounded-[4%] w-100 <sm:w-85"},{default:x((()=>{var g;return[_("div",J,[_("h2",null,z(null==(g=w(ge).list.find((e=>e.identity===w(ge).active)))?void 0:g.name),1)]),"account_login"===w(pe)?(T(),y(c,{key:0,ref_key:"loginFormRef",ref:te,model:w(ne),rules:w(ce),class:"login-form"},{default:x((()=>[$(o,{prop:"user_name"},{default:x((()=>[_("div",M,[$(t,{"icon-class":"user",class:"mx-2"}),$(s,{ref:"user_name",modelValue:w(ne).user_name,"onUpdate:modelValue":a[0]||(a[0]=e=>w(ne).user_name=e),placeholder:e.$t("login.username"),name:"user_name",size:"large",class:"h-[48px]"},null,8,["modelValue","placeholder"])])])),_:1}),$(n,{visible:w(le),content:e.$t("login.capsLock"),placement:"right"},{default:x((()=>[$(o,{prop:"password"},{default:x((()=>[_("div",P,[$(t,{"icon-class":"lock",class:"mx-2"}),$(s,{modelValue:w(ne).password,"onUpdate:modelValue":a[1]||(a[1]=e=>w(ne).password=e),placeholder:e.$t("login.password"),type:"password",name:"password",onKeyup:[de,C(ue,["enter"])],size:"large",class:"h-[48px] pr-2","show-password":""},null,8,["modelValue","placeholder"])])])),_:1})])),_:1},8,["visible","content"]),"customer"!=w(ge).active?(T(),y(o,{key:0,prop:"google_code"},{default:x((()=>[_("div",Q,[$(t,{"icon-class":"captcha",class:"mx-2"}),$(s,{modelValue:w(ne).google_code,"onUpdate:modelValue":a[2]||(a[2]=e=>w(ne).google_code=e),"auto-complete":"off",size:"large",class:"flex-1",placeholder:"Google验证码,登录和重置密码首次请勿填写",onKeyup:C(ue,["enter"])},null,8,["modelValue"])])])),_:1})):h("",!0),w(re)?(T(),f("div",W,[$(r,{class:"google-code-image",src:w(re)},null,8,["src"])])):h("",!0),$(l,{loading:w(ae),type:"primary",size:"large",class:"w-full",onClick:B(ue,["prevent"])},{default:x((()=>[V(z(e.$t("login.login")),1)])),_:1},8,["loading"])])),_:1},8,["model","rules"])):(T(),y(c,{key:1,ref_key:"loginFormRef",ref:te,class:"login-form"},{default:x((()=>[_("div",H,[$(i,{type:"warning"},{default:x((()=>a[4]||(a[4]=[V("复制信息跳转八方官方机器人粘贴完成登录")]))),_:1,__:[4]})]),$(l,{type:"primary",plain:"",round:"",size:"large",class:"w-full tg_code",onClick:a[3]||(a[3]=e=>w(fe)(`/login ${w(ye)}`))},{default:x((()=>[_("span",null,z(`/login ${w(ye)}`),1),$(d,{style:{"margin-left":"10px"}},{default:x((()=>[$(u)])),_:1})])),_:1}),$(l,{type:"primary",class:"w-full",style:{"margin-top":"10px","margin-left":"0"},onClick:_e},{default:x((()=>a[5]||(a[5]=[V("跳转TG机器人")]))),_:1,__:[5]})])),_:1},512))]})),_:1})):h("",!0)])}}}),[["__scopeId","data-v-94706d08"]]);export{X as default};
|