tg_web_dist/js/index.CZazsYyh.js

2 lines
6.4 KiB
JavaScript
Raw Normal View History

2025-07-01 14:42:09 +08:00
import{d as e,bm as a,aS as l,bn as s,m as n,w as o,l as t,O as c,c as i,a7 as r,a6 as u,bo as d,e as m,g,P as v,t as p,bp as f,aN as _,aT as h,aU as y,r as b,b6 as w,bq as k,bj as x,F as T,a8 as I,ae as S,aQ as V,o as z,D as C,bb as D,ah as E,b8 as j,b9 as R,a_ as $,ba as K,ak as L,br as q,Q as N,an as U,bs as A,R as F,al as G,E as B,bt as H,b1 as J}from"./index.Dp_uSW6y.js";import{E as O}from"./el-card.Zsvnolk4.js";import{_ as Q}from"./index.CftLazBh.js";import{E as M,a as P,b as W}from"./el-dropdown-item.DBtzPq_3.js";import{E as Z}from"./el-text.DTndLzKF.js";import{g as X,c as Y}from"./custom.CvOULV1b.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),d.success(y("langSelect.message.success"))}return(a,l)=>{const s=Q,d=W,h=P,y=M;return m(),n(y,{trigger:"click",onCommand:b},{dropdown:o((()=>[c(h,null,{default:o((()=>[(m(),i(u,null,r(f,(e=>c(d,{key:e.value,disabled:g(_).language===e.value,command:e.value},{default:o((()=>[v(p(e.label),1)])),_:2},1032,["disabled","command"]))),64))])),_:1})])),default:o((()=>[t("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"},ne={class:"flex-y-center w-full"},oe={class:"flex-y-center w-full"},te={key:0,class:"google-code-image-box"},ce=J(e({__name:"index",setup(e){const{copy:a}=f({legacy:!0});l();const s=_(),r=h(),u=y(),J=b(r.theme===w.DARK),M=b(!0),P=b(!1),W=b(!1),ce=b(k),{height:ie}=x(),re=b(""),ue=b({user_name:"",password:"",google_code:""}),de=b("");const me=T((()=>({})));function ge(){const e="/"+_e.value.active;V.push({path:e})}function ve(){ce.value.validate((e=>{if(e){P.value=!0;const e=function(){let e=ue.value;return"customer"===_e.value.active&&(e={...ue.value,ms_name:ue.value.user_name}),e}(),a={username:e.user_name,password:e.password};de.value="",ge(),s.login(a).then((e=>{(null==e?void 0:e.qr_code_url)?de.value=null==e?void 0:e.qr_code_url:(de.value="",ge()),console.log(e,11111)})).catch((()=>{})).finally((()=>{P.value=!1}))}}))}b("");const pe=()=>{const e=r.theme===w.DARK?w.LIGHT:w.DARK;r.changeTheme(e)};function fe(e){e instanceof KeyboardEvent&&(W.value=e.getModifierState("CapsLock"))}I((()=>{ie.value<600?M.value=!1:M.value=!0}));const _e=b({active:"",list:[{identity:"admin",name:"管理员平台"},{identity:"customer",name:"客户管理平台"}]});S({visible:!1,type:"user-form",width:400,title:"",leftBtnText:"确 定",rightBtnText:""});let he=JSON.parse(sessionStorage.getItem("loginInfo")||"{}");_e.value.active=he.loginType,re.value&&re.value!==_e.value.active&&!["admin","customer"].includes(_e.value.active)&&(localStorage.clear(),V.push({path:"/login",replace:!0})),console.log(_e.value.active,111,he.loginType),re.value=_e.value.active;localStorage.getItem(re.value+"accessToken")&&ge();const ye=b("account_login"),be=()=>{"account_login"===ye.value?(ye.value="tg_login",Ie()):ye.value="account_login"},we=H((e=>{a(e).then((()=>{d.success("复制成功")}))}),300),ke=()=>{window.open("https://t.me/bfbf")},xe=b(""),Te=b(""),Ie=()=>{X({}).then((e=>{xe.value=e.token,Te.value=e.expires_at,Ve()})).catch((e=>{console.log(e)}))};let Se=null;const Ve=()=>{new Date(Te.value).getTime()-Date.now()<=0?clearInterval(Se):(clearInterval(Se),Se=setInterval((()=>{Y({token:xe.value}).then((e=>{console.log(e),e.logged_in?(localStorage.setItem("customeraccessToken",e.loginToken),ge(),clearInterval(Se)):e.valid||(console.log("未登录"),d.warning("授权认证过期,请刷新界面重新获取认证"),clearInterval(Se))})).catch((e=>{console.log(e)}))}),3e3))};return z((()=>{console.log(u),_e.value.active})),C((()=>u.path),(e=>{e.startsWith("/login/")&&_e.value.active})),(e,a)=>{const l=Z,s=K,r=ee,u=Q,d=L,f=q,_=U,h=A,y=G,b=k,w=D("Document"),x=B,T=O;return m(),i("div",ae,[t("div",le,["customer"==g(_e).active?(m(),n(l,{key:0,type:"primary",style:{"margin-right":"20px"},onClick:be},{defa