tg_web_dist/js/index.1752062302465mNAjA5wa.js
2025-07-09 19:59:16 +08:00

2 lines
6.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{d as e,bw as a,b4 as l,a$ as t,b5 as s,r as o,bk as n,bx as r,bt as c,F as i,a7 as u,ad as d,b2 as g,o as m,by as p,bd as v,D as f,c as _,l as y,m as h,ag as w,g as x,w as b,ak as k,O as I,t as T,N as V,aj as z,bz as $,P as j,am as D,bA as S,Q as C,E,aB as B,bB as F,e as K,bf as G}from"./index.1752062302465Dm1WLi1E.js";import{E as R}from"./el-card.1752062302465CuLrDPQF.js";import{E as U}from"./el-text.1752062302465B58VJyFi.js";import{_ as q}from"./index.1752062302465CMI6vnv8.js";import{a as A,c as L}from"./custom.1752062302465yCjOVJdR.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=v();o(Y.theme===n.DARK);const ee=o(!0),ae=o(!1),le=o(!1),te=o(r),{height:se}=c(),oe=o(""),ne=o({user_name:"",password:"",google_code:""}),re=o("");const ce=i((()=>({})));function ie(){const e="/"+ge.value.active;g.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(""),u((()=>{se.value<600?ee.value=!1:ee.value=!0}));const ge=o({active:"",list:[{identity:"admin",name:"管理员平台"},{identity:"customer",name:"客户管理平台"}]});d({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(),g.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))};m((()=>{"customer"==me.loginType&&(pe.value="tg_login",we())}));const fe=F((e=>{G(e).then((()=>{p.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||(p.warning("授权认证过期,请刷新界面重新获取认证"),clearInterval(xe))})).catch((e=>{clearInterval(xe)}))}),3e3))};return m((()=>{ge.value.active})),f((()=>Z.path),(e=>{e.startsWith("/login/")&&ge.value.active})),(e,a)=>{const l=k,t=q,s=z,o=$,n=D,c=S,i=r,u=U,d=B("Document"),g=E,m=R;return K(),_("div",N,[y("div",O,["customer"==x(ge).active?(K(),h(l,{key:0,size:"small",type:"primary",style:{"margin-right":"20px",width:"100px"},plain:"",round:"",onClick:ve},{default:b((()=>[I(T("tg_login"===x(pe)?"账号密码登录":"TG注册/登录"),1)])),_:1})):w("",!0)]),x(ge).active?(K(),h(m,{key:0,class:"login-input-container !border-none !bg-transparent !rounded-[4%] w-100 <sm:w-85"},{default:b((()=>{var r;return[y("div",J,[y("h2",null,T(null==(r=x(ge).list.find((e=>e.identity===x(ge).active)))?void 0:r.name),1)]),"account_login"===x(pe)?(K(),h(i,{key:0,ref_key:"loginFormRef",ref:te,model:x(ne),rules:x(ce),class:"login-form"},{default:b((()=>[V(o,{prop:"user_name"},{default:b((()=>[y("div",M,[V(t,{"icon-class":"user",class:"mx-2"}),V(s,{ref:"user_name",modelValue:x(ne).user_name,"onUpdate:modelValue":a[0]||(a[0]=e=>x(ne).user_name=e),placeholder:e.$t("login.username"),name:"user_name",size:"large",class:"h-[48px]"},null,8,["modelValue","placeholder"])])])),_:1}),V(n,{visible:x(le),content:e.$t("login.capsLock"),placement:"right"},{default:b((()=>[V(o,{prop:"password"},{default:b((()=>[y("div",P,[V(t,{"icon-class":"lock",class:"mx-2"}),V(s,{modelValue:x(ne).password,"onUpdate:modelValue":a[1]||(a[1]=e=>x(ne).password=e),placeholder:e.$t("login.password"),type:"password",name:"password",onKeyup:[de,j(ue,["enter"])],size:"large",class:"h-[48px] pr-2","show-password":""},null,8,["modelValue","placeholder"])])])),_:1})])),_:1},8,["visible","content"]),"customer"!=x(ge).active?(K(),h(o,{key:0,prop:"google_code"},{default:b((()=>[y("div",Q,[V(t,{"icon-class":"captcha",class:"mx-2"}),V(s,{modelValue:x(ne).google_code,"onUpdate:modelValue":a[2]||(a[2]=e=>x(ne).google_code=e),"auto-complete":"off",size:"large",class:"flex-1",placeholder:"Google验证码登录和重置密码首次请勿填写",onKeyup:j(ue,["enter"])},null,8,["modelValue"])])])),_:1})):w("",!0),x(re)?(K(),_("div",W,[V(c,{class:"google-code-image",src:x(re)},null,8,["src"])])):w("",!0),V(l,{loading:x(ae),type:"primary",size:"large",class:"w-full",onClick:C(ue,["prevent"])},{default:b((()=>[I(T(e.$t("login.login")),1)])),_:1},8,["loading"])])),_:1},8,["model","rules"])):(K(),h(i,{key:1,ref_key:"loginFormRef",ref:te,class:"login-form"},{default:b((()=>[y("div",H,[V(u,{type:"warning"},{default:b((()=>a[4]||(a[4]=[I("复制信息跳转八方官方机器人粘贴完成登录")]))),_:1,__:[4]})]),V(l,{type:"primary",plain:"",round:"",size:"large",class:"w-full tg_code",onClick:a[3]||(a[3]=e=>x(fe)(`/login ${x(ye)}`))},{default:b((()=>[y("span",null,T(`/login ${x(ye)}`),1),V(g,{style:{"margin-left":"10px"}},{default:b((()=>[V(d)])),_:1})])),_:1}),V(l,{type:"primary",class:"w-full",style:{"margin-top":"10px","margin-left":"0"},onClick:_e},{default:b((()=>a[5]||(a[5]=[I("跳转TG机器人")]))),_:1,__:[5]})])),_:1},512))]})),_:1})):w("",!0)])}}}),[["__scopeId","data-v-94706d08"]]);export{X as default};