| 1 |
- import{k as V,e as g,d as u,u as t,X as f,a6 as x,_ as m,o as G,b as P,f as p,F as k,aa as M,ai as D,a9 as s,a7 as r,Z as F}from"./vue-fae2b924.js";import{F as E,aT as B,aU as C,aa as N,q as A,g as U,aV as $,S as W}from"./radical-3ee02118.js";import{j as z}from"./index-137e94ff.js";import{D as H}from"./DarkModeToggle-b6220ec2.js";const q="/plugin/media/assets/logo-e9919423.png",j="/plugin/media/assets/login-box-bg-9027741f.svg";var _=(o=>(o[o.LOGIN=0]="LOGIN",o[o.REGISTER=1]="REGISTER",o[o.RESET_PASSWORD=2]="RESET_PASSWORD",o))(_||{});const h=V(0);function v(){function o(a){h.value=a}const e=g(()=>h.value);function n(){o(0)}return{setLoginState:o,getLoginState:e,handleBackLogin:n}}const K={class:"mb-3 text-2xl font-bold text-center xl:text-3xl enter-x xl:text-left color-text"},Q=u({__name:"login-form-title",setup(o){const{t:e}=E(),{getLoginState:n}=v(),a=g(()=>({[_.RESET_PASSWORD]:e("sys.login.forgetFormTitle"),[_.LOGIN]:e("sys.login.signInFormTitle"),[_.REGISTER]:e("sys.login.signUpFormTitle")})[t(n)]);return(i,l)=>(f(),x("h2",K,m(a.value),1))}}),Z=u({__name:"login-form",setup(o){const{t:e}=E(),{setLoginState:n,getLoginState:a}=v(),i=g(()=>t(a)===_.LOGIN),l={type:"object",properties:{username:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{size:"large",allowClear:!0,placeholder:e("sys.login.usernamePlaceholder")},"x-content":{prefix:B},"x-validator":{required:!0},default:"admin"},password:{type:"string","x-decorator":"FormItem","x-component":"Password","x-component-props":{size:"large",allowClear:!0,placeholder:e("sys.login.passwordPlaceholder")},"x-content":{prefix:C},required:!0,default:"admin"},submit:{type:"void","x-component":"Button","x-component-props":{size:"large",block:!0,type:"primary","@click":()=>y()},"x-reactions":{fulfill:{schema:{"x-component-props.loading":"{{ $form.submitting }}"}}},"x-content":e("sys.login.loginButton")}}},{FormilyForm:R,submit:w,form:S}=N({schema:l}),{notification:b}=A(),L=z(),y=async()=>{const c=await w();if(c)try{S.submitting=!0;const d=c,O={username:d.username,password:d.password},T=await L.login(O);T&&b.success({message:e("sys.login.loginSuccessTitle"),description:`${e("sys.login.loginSuccessDesc")}: ${T.username}`,duration:3})}catch(d){console.error(`login-error: ${d}`)}finally{S.submitting=!1}},I=c=>{c.keyCode===13&&i.value&&y()};return G(()=>{window.addEventListener("keydown",I)}),P(()=>{window.removeEventListener("keydown",I)}),(c,d)=>i.value?(f(),x(k,{key:0},[p(Q,{class:"enter-x"}),p(t(R))],64)):M("",!0)}}),X=["title","alt"],Y={class:"my-auto"},J=["alt"],ee={class:"mt-10 font-medium text-white -enter-x"},te={class:"inline-block mt-4 text-2xl"},oe={class:"mt-4 font-normal text-white text-md -enter-x"},se={class:"absolute mt-4 right-4"},ne={class:"sm:w-4/6 xl:w-4/5 w-full mx-auto my-auto p-4 rounded-md shadow-md xl:shadow-none"},ae=u({name:"Login"}),de=u({...ae,setup(o){const{bem:e}=W("login"),{title:n}=U({VITE_PORT:"3000",VITE_GLOB_APP_TITLE:"SagooMedia",VITE_GLOB_APP_SHORT_NAME:"SagooMedia",VITE_NEED_LOGIN:"false",VITE_USE_MOCK:"true",VITE_PUBLIC_PATH:"/plugin/media",VITE_DROP_CONSOLE:"true",VITE_BUILD_COMPRESS:"none",VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE:"false",VITE_GLOB_HTTP_REFRESH_TIME:"5000",VITE_USE_IMAGEMIN:"true",VITE_LEGACY:"false",VITE_M7S_SERVER:"/media",VITE_M7S_WS_SERVER:"/media",BASE_URL:"/plugin/media",MODE:"production",DEV:!1,PROD:!0,SSR:!1}),{t:a}=E();return(i,l)=>(f(),x("div",{class:r(t(e)())},[l[0]||(l[0]=D('<svg class="login-bg" viewBox="0 0 1000 1000" preserveAspectRatio="none"><defs><linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="#1890ff" stop-opacity="0.8"></stop><stop offset="100%" stop-color="#722ed1" stop-opacity="0.8"></stop></linearGradient><linearGradient id="gradient-dark" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" stop-color="#1890ff" stop-opacity="0.8"></stop><stop offset="100%" stop-color="#722ed1" stop-opacity="0.8"></stop></linearGradient></defs><path d="M0,0 L700,0 Q800,300 700,500 Q600,700 700,1000 L0,1000 Z"></path></svg>',1)),s("div",{class:r([t(e)("slogan"),"hidden xl:flex"])},[s("div",{class:r(t(e)("logo"))},[s("img",{title:t(n),alt:t(n),src:q},null,8,X),s("div",{class:r([t(e)("logo-title"),"truncate"])},m(t(n)),3)],2),s("div",Y,[s("img",{alt:t(n),src:j,class:"w-2/3 -enter-x"},null,8,J),s("div",ee,[s("span",te,m(t(a)("sys.login.signInTitle")),1)]),s("div",oe,m(t(a)("sys.login.signInDesc")),1)])],2),s("div",{class:r([t(e)("form"),"enter-x"])},[s("div",se,[p(t(H))]),s("div",ne,[p(t($),{class:r(t(e)("card")),bodyStyle:{background:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"}},{default:F(()=>[p(Z)]),_:1},8,["class"])])],2)],2))}});export{de as default};
|