login-1220728f.js 7.1 KB

12
  1. import{n as i,a_ as L,c as B,f,d as _,aC as g,T as s,Z as x,a1 as E,a6 as m,a$ as D,b0 as C,o as N,j as A,a2 as F,a9 as U,b1 as $,ax as z,b2 as j,a7 as a,ay as l,a0 as H,b3 as W,az as q}from"./index-0cfc8c89.js";import"./dayjs-919e6097.js";import{D as Q}from"./DarkModeToggle-cdd0dfa0.js";var Z={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"};const Y=Z;function I(t){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?Object(arguments[e]):{},n=Object.keys(o);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(r){return Object.getOwnPropertyDescriptor(o,r).enumerable}))),n.forEach(function(r){J(t,r,o[r])})}return t}function J(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var S=function(e,o){var n=I({},e,o.attrs);return i(L,I({},n,{icon:Y}),null)};S.displayName="LockOutlined";S.inheritAttrs=!1;const X=S;var K={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z"}}]},name:"user",theme:"outlined"};const ee=K;function T(t){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?Object(arguments[e]):{},n=Object.keys(o);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(r){return Object.getOwnPropertyDescriptor(o,r).enumerable}))),n.forEach(function(r){te(t,r,o[r])})}return t}function te(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var O=function(e,o){var n=T({},e,o.attrs);return i(L,T({},n,{icon:ee}),null)};O.displayName="UserOutlined";O.inheritAttrs=!1;const oe=O,ne="/plugin/media/assets/logo-e9919423.png",se="/plugin/media/assets/login-box-bg-9027741f.svg";var p=(t=>(t[t.LOGIN=0]="LOGIN",t[t.REGISTER=1]="REGISTER",t[t.RESET_PASSWORD=2]="RESET_PASSWORD",t))(p||{});const w=B(0);function P(){function t(n){w.value=n}const e=f(()=>w.value);function o(){t(0)}return{setLoginState:t,getLoginState:e,handleBackLogin:o}}const re={class:"mb-3 text-2xl font-bold text-center xl:text-3xl enter-x xl:text-left color-text"},ae=_({__name:"login-form-title",setup(t){const{t:e}=g(),{getLoginState:o}=P(),n=f(()=>({[p.RESET_PASSWORD]:e("sys.login.forgetFormTitle"),[p.LOGIN]:e("sys.login.signInFormTitle"),[p.REGISTER]:e("sys.login.signUpFormTitle")})[s(o)]);return(r,c)=>(x(),E("h2",re,m(n.value),1))}}),ie=_({__name:"login-form",setup(t){const{t:e}=g(),{setLoginState:o,getLoginState:n}=P(),r=f(()=>s(n)===p.LOGIN),c={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:oe},"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:X},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:V,form:v}=D({schema:c}),{notification:M}=$(),G=C(),y=async()=>{const u=await V();if(u)try{v.submitting=!0;const d=u,k={username:d.username,password:d.password},b=await G.login(k);b&&M.success({message:e("sys.login.loginSuccessTitle"),description:`${e("sys.login.loginSuccessDesc")}: ${b.username}`,duration:3})}catch(d){console.error(`login-error: ${d}`)}finally{v.submitting=!1}},h=u=>{u.keyCode===13&&r.value&&y()};return N(()=>{window.addEventListener("keydown",h)}),A(()=>{window.removeEventListener("keydown",h)}),(u,d)=>r.value?(x(),E(F,{key:0},[i(ae,{class:"enter-x"}),i(s(R))],64)):U("",!0)}}),le=["title","alt"],ce={class:"my-auto"},ue=["alt"],de={class:"mt-10 font-medium text-white -enter-x"},pe={class:"inline-block mt-4 text-2xl"},me={class:"mt-4 font-normal text-white text-md -enter-x"},_e={class:"absolute mt-4 right-4"},fe={class:"sm:w-4/6 xl:w-4/5 w-full mx-auto my-auto p-4 rounded-md shadow-md xl:shadow-none"},ge=_({name:"Login"}),Oe=_({...ge,setup(t){const{bem:e}=q("login"),{title:o}=z({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_GLOB_GB_HTTP_REFRESH_TIME:"60000",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:n}=g();return(r,c)=>(x(),E("div",{class:l(s(e)())},[c[0]||(c[0]=j('<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)),a("div",{class:l([s(e)("slogan"),"hidden xl:flex"])},[a("div",{class:l(s(e)("logo"))},[a("img",{title:s(o),alt:s(o),src:ne},null,8,le),a("div",{class:l([s(e)("logo-title"),"truncate"])},m(s(o)),3)],2),a("div",ce,[a("img",{alt:s(o),src:se,class:"w-2/3 -enter-x"},null,8,ue),a("div",de,[a("span",pe,m(s(n)("sys.login.signInTitle")),1)]),a("div",me,m(s(n)("sys.login.signInDesc")),1)])],2),a("div",{class:l([s(e)("form"),"enter-x"])},[a("div",_e,[i(s(Q))]),a("div",fe,[i(s(W),{class:l(s(e)("card")),bodyStyle:{background:"rgba(255, 255, 255, 0.6)",backdropFilter:"blur(10px)",WebkitBackdropFilter:"blur(10px)"}},{default:H(()=>[i(ie)]),_:1},8,["class"])])],2)],2))}});export{Oe as default};
  2. //# sourceMappingURL=login-1220728f.js.map