import{e as s,j as a,r as e,f as l,g as i,a as n,q as t,s as o,ad as u,b as r,t as c,m as v,aw as d,A as p,o as m,J as f,L as x,n as g,G as k,H as b,ax as w,X as y,_ as C}from"./index-D8tPjwDN.js";import{g as _}from"./user-manage-CEddPOA8.js";import{c as h}from"./socket-CtIqJ6J7.js";import{a as j}from"./init-CFue6ItV.js";import{a as S}from"./login-DxVnJutz.js";import{e as I}from"./index-DGBKTRr-.js";const R=""+new URL("avatar-uscRzRXF.png",import.meta.url).href,U={class:"login-box"},z={key:0,class:"user-box"},J={class:"user-list"},N=["onClick"],D={class:"name"},F={key:1,class:"password-box"},L={class:"user-info user-info-active"},O={class:"name"},X={class:"password-list"},q={class:"pin-keypad"},A=["onClick"],B={class:"version"},G=C(s({__name:"index",setup(s){const C=a("/api/v1/app/ws/state"),G=h(C.wsUrl),H=s=>{s.loginFlag&&(sessionStorage.setItem("token",JSON.stringify(s.loginUser)),d.push("/index"))},P=e([]);l((()=>{G.subscribe("DeviceContext",H),G.connect(),(async()=>{const s=await _();P.value=s.data})()})),i((()=>{G.unsubscribe("DeviceContext",H)}));const T=e(),E=e(""),K=s=>{E.value.length>=4||(E.value.length<4&&(E.value+=s),4===E.value.length&&Q())},M=e(!1),Q=async()=>{var s;if(!(await j()).data)return I.error("设备正在初始化，请稍候重试"),void(E.value="");const a={id:null==(s=T.value)?void 0:s.id,password:E.value},e=await S(a);e.success?(sessionStorage.setItem("token",JSON.stringify(e.data)),await d.push("/index")):(M.value=!0,setTimeout((()=>{M.value=!1}),600),E.value="")},V=e(!1),W=()=>{var s;(null==(s=T.value)?void 0:s.id)&&(V.value=!0)},Y=()=>{V.value=!1,E.value=""};return(s,a)=>{const e=w,l=p("Select"),i=y,d=p("Right"),C=p("Back");return m(),n("div",U,[t(u,{name:"flip-card",mode:"out-in"},{default:o((()=>{var s;return[V.value?(m(),n("div",F,[r("div",L,[t(e,{size:40,src:v(R)},null,8,["src"]),r("span",O,c(T.value.account),1)]),a[3]||(a[3]=r("p",{class:"title"},"请输入4位PIN码",-1)),r("div",X,[(m(),n(f,null,x(4,(s=>r("div",{key:s,class:g(["password-item",{"password-item-fill":s<=E.value.length,"password-error":M.value}])},null,2))),64))]),r("div",q,[(m(),n(f,null,x(9,(s=>r("div",{key:s,class:"key",onClick:a=>K(s.toString())},c(s),9,A))),64)),a[2]||(a[2]=r("div",null,null,-1)),r("div",{class:"key",onClick:a[0]||(a[0]=s=>K("0"))},"0")]),r("div",{class:"next-box next-box-active",onClick:Y},[t(i,null,{default:o((()=>[t(C)])),_:1})])])):(m(),n("div",z,[a[1]||(a[1]=r("p",{class:"title"},"选择用户",-1)),r("div",J,[(m(!0),n(f,null,x(P.value,(s=>{var a,u;return m(),n("div",{class:g(["user-info",{"user-info-active":(null==(a=T.value)?void 0:a.id)===s.id}]),key:s.id,onClick:a=>T.value=s},[t(e,{size:60,src:v(R)},null,8,["src"]),r("span",D,c(s.account),1),k(t(i,{color:"#fff"},{default:o((()=>[t(l)])),_:2},1536),[[b,(null==(u=T.value)?void 0:u.id)===s.id]])],10,N)})),128))]),r("div",{class:g(["next-box",{"next-box-active":null==(s=T.value)?void 0:s.id}]),onClick:W},[t(i,null,{default:o((()=>[t(d)])),_:1})],2)]))]})),_:1}),r("div",B,"版本号：v "+c(v("0.0.24")),1)])}}}),[["__scopeId","data-v-1195dbbb"]]);export{G as default};
