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.8 KiB

import{_ as I,s as S,f as w,l as U,g as q,P as B,Q as P,c as K,a,d as o,w as s,F as L,O as j,m as H,r as n,o as m,t as O,u as E,i as _,R as y,e as M,S as Q,T as $}from"./index-Dk5CK9SF.js";import z from"./tenantDialog-DH6W9rMW.js";const A={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=j(),x=S.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:"请输入密码。"}]};q(()=>{p()}),B(()=>b.query.redirect,r=>{e.redirect=r},{immediate:!0});function p(){P().then(r=>{let{data:t}=r;e.captchaImg="data:image/png;base64,"+t.img,e.loginForm.captcha=t.guid})}function k(){e.passwordType==="password"?e.passwordType="":e.passwordType="password"}function u(){f.value.validate(r=>{if(r)e.loading=!0,Q(e.loginForm).then(t=>{let{data:i}=t;if(i.length>1)h.value.openDialog(i);else{let l={userName:e.loginForm.userName,password:e.loginForm.password,tenantId:i[0].id,captcha:e.loginForm.captcha};x.login(l).then(d=>{d.code===1&&F.push({path:"/redirect"+(e.redirect??"/")})})}}).catch(()=>{p(),e.loading=!1});else return console.log("error submit!!"),!1})}return(r,t)=>{const i=n("User"),l=n("el-icon"),d=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 m(),K(L,null,[a("div",A,[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,[t[3]||(t[3]=a("h3",{class:"title",style:{"margin-bottom":"10px"}},"常熟安通林汽车饰件有限公司",-1)),a("h3",J,O(E($).title)+" 系统登录",1)]),o(g,{prop:"userName"},{default:s(()=>[a("span",W,[o(l,null,{default:s(()=>[o(i)]),_:1})]),o(d,{ref:"userName",modelValue:e.loginForm.userName,"onUpdate:modelValue":t[0]||(t[0]=c=>e.loginForm.userName=c),placeholder:"用户名",type:"text",tabindex:"1","auto-complete":"on"},null,8,["modelValue"])]),_:1}),o(g,{prop:"password"},{default:s(()=>[a("span",X,[o(l,null,{default:s(()=>[o(v)]),_:1})]),(m(),_(d,{key:e.passwordType,modelValue:e.loginForm.password,"onUpdate:modelValue":t[1]||(t[1]=c=>e.loginForm.password=c),type:e.passwordType,placeholder:"密码",tabindex:"2","auto-complete":"on",onKeyup:y(u,["enter"])},null,8,["modelValue","type"])),a("span",{class:"show-pwd",onClick:k},[e.passwordType==="password"?(m(),_(l,{key:0},{default:s(()=>[o(C)]),_:1})):(m(),_(l,{key:1},{default:s(()=>[o(N)]),_:1}))])]),_:1}),a("div",Y,[o(g,{prop:"captchaCode",style:{width:"65%"}},{default:s(()=>[a("span",Z,[o(l,null,{default:s(()=>[o(T)]),_:1})]),o(d,{modelValue:e.loginForm.captchaCode,"onUpdate:modelValue":t[2]||(t[2]=c=>e.loginForm.captchaCode=c),placeholder:"验证码",type:"text",tabindex:"3",onKeyup:y(u,["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:u},{default:s(()=>t[4]||(t[4]=[M(" 登录 ")])),_:1},8,["loading"])]),_:1},8,["model"])]),o(z,{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)}}}),le=I(te,[["__scopeId","data-v-c9d8693d"]]);export{le as default};