You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.7 KiB
1 lines
3.7 KiB
import{_ as I,s as q,i as w,g as U,j as B,A as P,O as S,c as j,a,d as o,w as s,F as K,N as L,D as H,r as n,o as u,t as O,q as A,h as _,P as y,e as E,Q as M,R as Q}from"./index-CL0IOL6c.js";import $ from"./tenantDialog-Cp0LMyZ6.js";const z={class:"login-container"},G={class:"title-container"},J={class:"title"},W={class:"svg-container"},X={class:"svg-container"},Y={style:{display:"flex","justify-content":"space-between"}},Z={class:"svg-container"},ee={style:{width:"30%"}},oe=["src"],te=Object.assign({name:"loginIndex"},{__name:"index",setup(ae){const F=L(),x=q.userStore(),b=H(),f=w(),h=w(),e=U({loginForm:{userName:"",password:"",captchaCode:"",captcha:""},captchaImg:"",loading:!1,passwordType:"password",redirect:void 0}),V={userName:[{required:!0,trigger:"blur",message:"请输入用户名。"}],captchaCode:[{required:!0,trigger:"blur",message:"请输入验证码。"}],password:[{required:!0,trigger:"blur",message:"请输入密码。"}]};B(()=>{p()}),P(()=>b.query.redirect,l=>{e.redirect=l},{immediate:!0});function p(){S().then(l=>{let{data:t}=l;e.captchaImg="data:image/png;base64,"+t.img,e.loginForm.captcha=t.guid})}function k(){e.passwordType==="password"?e.passwordType="":e.passwordType="password"}function m(){f.value.validate(l=>{if(l)e.loading=!0,M(e.loginForm).then(t=>{let{data:i}=t;if(i.length>1)h.value.openDialog(i);else{let r={userName:e.loginForm.userName,password:e.loginForm.password,tenantId:i[0].id,captcha:e.loginForm.captcha};x.login(r).then(c=>{c.code===1&&F.push({path:"/redirect"+(e.redirect??"/")})})}}).catch(()=>{p(),e.loading=!1});else return console.log("error submit!!"),!1})}return(l,t)=>{const i=n("User"),r=n("el-icon"),c=n("el-input"),g=n("el-form-item"),v=n("Lock"),C=n("View"),N=n("Hide"),T=n("PriceTag"),R=n("el-button"),D=n("el-form");return u(),j(K,null,[a("div",z,[o(D,{ref_key:"loginFormRef",ref:f,model:e.loginForm,rules:V,class:"login-form","auto-complete":"on","label-position":"left"},{default:s(()=>[a("div",G,[a("h3",J,O(A(Q).title)+" 系统登录",1)]),o(g,{prop:"userName"},{default:s(()=>[a("span",W,[o(r,null,{default:s(()=>[o(i)]),_:1})]),o(c,{ref:"userName",modelValue:e.loginForm.userName,"onUpdate:modelValue":t[0]||(t[0]=d=>e.loginForm.userName=d),placeholder:"用户名",type:"text",tabindex:"1","auto-complete":"on"},null,8,["modelValue"])]),_:1}),o(g,{prop:"password"},{default:s(()=>[a("span",X,[o(r,null,{default:s(()=>[o(v)]),_:1})]),(u(),_(c,{key:e.passwordType,modelValue:e.loginForm.password,"onUpdate:modelValue":t[1]||(t[1]=d=>e.loginForm.password=d),type:e.passwordType,placeholder:"密码",tabindex:"2","auto-complete":"on",onKeyup:y(m,["enter"])},null,8,["modelValue","type"])),a("span",{class:"show-pwd",onClick:k},[e.passwordType==="password"?(u(),_(r,{key:0},{default:s(()=>[o(C)]),_:1})):(u(),_(r,{key:1},{default:s(()=>[o(N)]),_:1}))])]),_:1}),a("div",Y,[o(g,{prop:"captchaCode",style:{width:"65%"}},{default:s(()=>[a("span",Z,[o(r,null,{default:s(()=>[o(T)]),_:1})]),o(c,{modelValue:e.loginForm.captchaCode,"onUpdate:modelValue":t[2]||(t[2]=d=>e.loginForm.captchaCode=d),placeholder:"验证码",type:"text",tabindex:"3",onKeyup:y(m,["enter"])},null,8,["modelValue"])]),_:1}),a("div",ee,[a("img",{src:e.captchaImg,style:{width:"100%",height:"47px",color:"#fff"},title:"点击,换一张",onClick:p},null,8,oe)])]),o(R,{loading:e.loading,type:"primary",style:{width:"100%","margin-bottom":"30px",height:"40px"},onClick:m},{default:s(()=>t[3]||(t[3]=[E(" 登录 ")])),_:1},8,["loading"])]),_:1},8,["model"])]),o($,{ref_key:"tenantDialogRef",ref:h,onDialogClose:p,username:e.loginForm.username,password:e.loginForm.password,redirect:e.redirect,captcha:e.loginForm.captcha},null,8,["username","password","redirect","captcha"])],64)}}}),re=I(te,[["__scopeId","data-v-e97d44f1"]]);export{re as default};
|
|
|