tg_web_dist/js/index.CRFJduL6.js
2025-06-27 16:21:05 +08:00

2 lines
6.6 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,bm as a,aS as l,bn as s,m as o,w as t,l as n,N as c,c as i,a6 as r,a5 as u,e as d,g as m,O as g,t as p,bo as v,bp as f,aN as _,aT as h,r as y,b6 as b,bq as w,bj as x,F as k,a7 as I,ad as T,aQ as V,o as z,a$ as S,D as j,ag as C,b8 as D,b9 as E,aY as $,ba as K,aj as N,br as R,P as q,am as G,bs as L,Q as U,ak as A,E as F,bb as H,bt as B,b1 as J}from"./index.DBufqXQZ.js";import{E as O}from"./el-card.Bem8-qYG.js";import{_ as Q}from"./index.CZi_qfny.js";import{E as M,a as P,b as W}from"./el-dropdown-item.DJcVKBKC.js";import{E as Y}from"./el-text.Dfh5NCmD.js";import{g as Z,c as X}from"./custom.D0bx8wrp.js";const ee=e({__name:"index",props:{size:{type:String,required:!1}},setup(e){const f=[{label:"中文",value:a.ZH_CN},{label:"English",value:a.EN}],_=l(),{locale:h,t:y}=s();function b(e){h.value=e,_.changeLanguage(e),v.success(y("langSelect.message.success"))}return(a,l)=>{const s=Q,v=W,h=P,y=M;return d(),o(y,{trigger:"click",onCommand:b},{dropdown:t((()=>[c(h,null,{default:t((()=>[(d(),i(u,null,r(f,(e=>c(v,{key:e.value,disabled:m(_).language===e.value,command:e.value},{default:t((()=>[g(p(e.label),1)])),_:2},1032,["disabled","command"]))),64))])),_:1})])),default:t((()=>[n("div",null,[c(s,{"icon-class":"language",size:e.size},null,8,["size"])])])),_:1})}}}),ae={class:"login-container"},le={class:"absolute-lt flex-x-end p-3 w-full"},se={class:"text-center relative"},oe={class:"flex-y-center w-full"},te={class:"flex-y-center w-full"},ne={class:"flex-y-center w-full"},ce={key:0,class:"google-code-image-box"},ie=J(e({__name:"index",setup(e){const{copy:a}=f({legacy:!0});l();const s=_(),r=h(),u=S(),J=y(r.theme===b.DARK),M=y(!0),P=y(!1),W=y(!1),ie=y(w),{height:re}=x(),ue=y(""),de=y({user_name:"",password:"",google_code:""}),me=y("");const ge=k((()=>({})));function pe(){const e="/"+he.value.active;V.push({path:e})}function ve(){ie.value.validate((e=>{if(e){P.value=!0;const e=function(){let e=de.value;return"customer"===he.value.active&&(e={...de.value,ms_name:de.value.user_name}),e}(),a={username:e.user_name,password:e.password};me.value="",pe(),s.login(a).then((e=>{(null==e?void 0:e.qr_code_url)?me.value=null==e?void 0:e.qr_code_url:(me.value="",pe())})).catch((()=>{})).finally((()=>{P.value=!1}))}}))}y("");const fe=()=>{const e=r.theme===b.DARK?b.LIGHT:b.DARK;r.changeTheme(e)};function _e(e){e instanceof KeyboardEvent&&(W.value=e.getModifierState("CapsLock"))}I((()=>{re.value<600?M.value=!1:M.value=!0}));const he=y({active:"",list:[{identity:"admin",name:"管理员平台"},{identity:"customer",name:"客户管理平台"}]});T({visible:!1,type:"user-form",width:400,title:"",leftBtnText:"确 定",rightBtnText:""});let ye=JSON.parse(sessionStorage.getItem("loginInfo")||"{}");he.value.active=ye.loginType,ue.value&&ue.value!==he.value.active&&!["admin","customer"].includes(he.value.active)&&(localStorage.clear(),V.push({path:"/login",replace:!0})),ue.value=he.value.active;localStorage.getItem(ue.value+"accessToken")&&pe();const be=y("account_login"),we=()=>{"account_login"===be.value?(be.value="tg_login",Ve()):be.value="account_login"},xe=B((e=>{a(e).then((()=>{v.success("复制成功")}))}),300),ke=()=>{window.open("https://t.me/bfbf")},Ie=y(""),Te=y(""),Ve=()=>{Z({}).then((e=>{Ie.value=e.token,Te.value=e.expires_at,Se()})).catch((e=>{}))};let ze=null;const Se=()=>{new Date(Te.value).getTime()-Date.now()<=0?clearInterval(ze):(clearInterval(ze),ze=setInterval((()=>{X({token:Ie.value}).then((e=>{e.logged_in?(localStorage.setItem("customeraccessToken",e.loginToken),pe(),clearInterval(ze)):e.valid||(v.warning("授权认证过期,请刷新界面重新获取认证"),clearInterval(ze))})).catch((e=>{}))}),3e3))};return z((()=>{he.value.active})),j((()=>u.path),(e=>{e.startsWith("/login/")&&he.value.active})),(e,a)=>{const l=Y,s=K,r=ee,u=Q,v=N,f=R,_=G,h=L,y=A,b=w,x=H("Document"),k=F,I=O;return d(),i("div",ae,[n("div",le,["customer"==m(he).active?(d(),o(l,{key:0,type:"primary",style:{"margin-right":"20px"},onClick:we},{default:t((()=>[g(p("tg_login"===m(be)?"账号密码登录":"TG登录"),1)])),_:1})):C("",!0),c(s,{modelValue:m(J),"onUpdate:modelValue":a[0]||(a[0]=e=>$(J)?J.value=e:null),"inline-prompt":"","active-icon":m(E),"inactive-icon":m(D),onChange:fe},null,8,["modelValue","active-icon","inactive-icon"]),c(r,{class:"ml-2 cursor-pointer"})]),m(he).active?(d(),o(I,{key:0,class:"login-input-container !border-none !bg-transparent !rounded-[4%] w-100 <sm:w-85"},{default:t((()=>{var l;return[n("div",se,[n("h2",null,p(null==(l=m(he).list.find((e=>e.identity===m(he).active)))?void 0:l.name),1)]),"account_login"===m(be)?(d(),o(b,{key:0,ref_key:"loginFormRef",ref:ie,model:m(de),rules:m(ge),class:"login-form"},{default:t((()=>[c(f,{prop:"user_name"},{default:t((()=>[n("div",oe,[c(u,{"icon-class":"user",class:"mx-2"}),c(v,{ref:"user_name",modelValue:m(de).user_name,"onUpdate:modelValue":a[1]||(a[1]=e=>m(de).user_name=e),placeholder:e.$t("login.username"),name:"user_name",size:"large",class:"h-[48px]"},null,8,["modelValue","placeholder"])])])),_:1}),c(_,{visible:m(W),content:e.$t("login.capsLock"),placement:"right"},{default:t((()=>[c(f,{prop:"password"},{default:t((()=>[n("div",te,[c(u,{"icon-class":"lock",class:"mx-2"}),c(v,{modelValue:m(de).password,"onUpdate:modelValue":a[2]||(a[2]=e=>m(de).password=e),placeholder:e.$t("login.password"),type:"password",name:"password",onKeyup:[_e,q(ve,["enter"])],size:"large",class:"h-[48px] pr-2","show-password":""},null,8,["modelValue","placeholder"])])])),_:1})])),_:1},8,["visible","content"]),c(f,{prop:"google_code"},{default:t((()=>[n("div",ne,[c(u,{"icon-class":"captcha",class:"mx-2"}),c(v,{modelValue:m(de).google_code,"onUpdate:modelValue":a[3]||(a[3]=e=>m(de).google_code=e),"auto-complete":"off",size:"large",class:"flex-1",placeholder:"Google验证码登录和重置密码首次请勿填写",onKeyup:q(ve,["enter"])},null,8,["modelValue"])])])),_:1}),m(me)?(d(),i("div",ce,[c(h,{class:"google-code-image",src:m(me)},null,8,["src"])])):C("",!0),c(y,{loading:m(P),type:"primary",size:"large",class:"w-full",onClick:U(ve,["prevent"])},{default:t((()=>[g(p(e.$t("login.login")),1)])),_:1},8,["loading"])])),_:1},8,["model","rules"])):(d(),o(b,{key:1,ref_key:"loginFormRef",ref:ie,class:"login-form"},{default:t((()=>[c(y,{type:"primary",plain:"",round:"",size:"large",class:"w-full tg_code",onClick:a[4]||(a[4]=e=>m(xe)(`/login ${m(Ie)}`))},{default:t((()=>[n("span",null,p(`/login ${m(Ie)}`),1),c(k,{style:{"margin-left":"10px"}},{default:t((()=>[c(x)])),_:1})])),_:1}),c(y,{type:"primary",class:"w-full",style:{"margin-top":"10px","margin-left":"0"},onClick:ke},{default:t((()=>a[5]||(a[5]=[g("跳转TG机器人")]))),_:1,__:[5]})])),_:1},512))]})),_:1})):C("",!0)])}}}),[["__scopeId","data-v-c80b49a8"]]);export{ie as default};