Login-DjwjR_ty.js 3.5 KB

1
  1. import{G as e,K as t,M as n,Q as r,V as i,W as a,X as o,a as s,i as c,it as l,k as u,ot as d,q as f,r as p,st as m,tt as h}from"./vue-router-DiegbtGD.js";import{t as g}from"./UserOutlined-DRj_YW6J.js";var _={icon:{tag:`svg`,attrs:{viewBox:`64 64 896 896`,focusable:`false`},children:[{tag:`path`,attrs:{d:`M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z`}}]},name:`lock`,theme:`outlined`};function v(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:Object(arguments[t]),r=Object.keys(n);typeof Object.getOwnPropertySymbols==`function`&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){y(e,t,n[t])})}return e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var b=function(e,r){return t(n,v({},v({},e,r.attrs),{icon:_}),null)};b.displayName=`LockOutlined`,b.inheritAttrs=!1;var x={style:{"min-height":`100vh`,display:`flex`,"align-items":`center`,"justify-content":`center`,background:`linear-gradient(135deg, #667eea 0%, #764ba2 100%)`,padding:`20px`}},S={style:{"text-align":`center`}},C={style:{"text-align":`center`,"margin-top":`16px`}},w=f({__name:`Login`,setup(n){let f=c(),_=p(),v=s(),y=d(!1),w=d({username:``,password:``});o(()=>{v.isAuthenticated&&f.replace(`/dashboard`)});let T=async()=>{y.value=!0;try{await v.login(w.value),u.success(`登录成功`);let e=_.query.redirect||`/dashboard`;f.replace(e)}catch(e){u.error(e?.message||`登录失败`)}finally{y.value=!1}};return(n,o)=>{let s=h(`a-typography-text`),c=h(`a-input`),u=h(`a-form-item`),d=h(`a-input-password`),f=h(`a-button`),p=h(`a-form`),_=h(`a-space`),v=h(`a-card`);return r(),a(`div`,x,[t(v,{style:{width:`100%`,"max-width":`400px`,"box-shadow":`0 8px 32px rgba(0,0,0,0.1)`,"border-radius":`12px`},bordered:!1},{default:l(()=>[t(_,{direction:`vertical`,size:24,style:{width:`100%`}},{default:l(()=>[i(`div`,S,[o[3]||=i(`h2`,{style:{"margin-bottom":`8px`,color:`#1890ff`}},`MQTT 仪表板`,-1),t(s,{type:`secondary`},{default:l(()=>[...o[2]||=[e(`请登录您的账户`,-1)]]),_:1})]),t(p,{model:w.value,onFinish:T,layout:`vertical`,"required-mark":!1},{default:l(()=>[t(u,{label:`用户名`,name:`username`,rules:[{required:!0,message:`请输入用户名`},{min:3,message:`用户名至少3个字符`}]},{default:l(()=>[t(c,{value:w.value.username,"onUpdate:value":o[0]||=e=>w.value.username=e,placeholder:`请输入用户名`,size:`large`},{prefix:l(()=>[t(m(g))]),_:1},8,[`value`])]),_:1}),t(u,{label:`密码`,name:`password`,rules:[{required:!0,message:`请输入密码`},{min:6,message:`密码至少6个字符`}]},{default:l(()=>[t(d,{value:w.value.password,"onUpdate:value":o[1]||=e=>w.value.password=e,placeholder:`请输入密码`,size:`large`},{prefix:l(()=>[t(m(b))]),_:1},8,[`value`])]),_:1}),t(u,null,{default:l(()=>[t(f,{type:`primary`,"html-type":`submit`,loading:y.value,size:`large`,style:{width:`100%`}},{default:l(()=>[...o[4]||=[e(` 登录 `,-1)]]),_:1},8,[`loading`])]),_:1})]),_:1},8,[`model`]),i(`div`,C,[t(s,{type:`secondary`,style:{"font-size":`12px`}},{default:l(()=>[...o[5]||=[e(` MQTT 设备监控仪表板 v1.0 `,-1)]]),_:1})])]),_:1})]),_:1})])}}});export{w as default};