(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-67189526"],{3679:function(e,t,o){"use strict";o("b2f5")},"4c5a":function(e,t,o){e.exports=o.p+"static/img/form-lf.508c57a8.jpg"},"97ee":function(e,t,o){"use strict";o("ce74")},"9ed6":function(e,t,o){"use strict";o.r(t);var i=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"login-container"},[i("img",{staticClass:"logo-name",attrs:{src:o("f6ce"),alt:"低值易耗品库存管理系统"}}),e._v(" "),i("el-row",{staticClass:"flex-1 min-1200",attrs:{type:"flex",justify:"center",align:"center",gutter:20}},[i("el-col",[i("div",{staticClass:"form-main w1050"},[i("el-row",[i("el-col",{attrs:{span:12}},[i("img",{staticClass:"logo-lf",attrs:{src:o("4c5a"),alt:"登录"}})]),e._v(" "),i("el-col",{attrs:{span:12}},[i("div",{staticClass:"login-box"},[i("el-form",{ref:"loginForm",attrs:{id:"loginForm",model:e.loginForm,rules:e.loginRules}},[i("h3",{staticClass:"title"},[e._v("欢迎登录")]),e._v(" "),i("div",{staticClass:"f-lable"},[e._v("账号")]),e._v(" "),i("el-form-item",{attrs:{prop:"account"}},[i("el-input",{ref:"account",attrs:{id:"input-b",placeholder:"请输入账号",name:"account",type:"text","auto-complete":"on"},model:{value:e.loginForm.account,callback:function(t){e.$set(e.loginForm,"account",t)},expression:"loginForm.account"}})],1),e._v(" "),i("div",{staticClass:"f-lable"},[e._v("密码")]),e._v(" "),i("el-form-item",{attrs:{prop:"password"}},[i("el-input",{key:e.passwordType,ref:"pwd",attrs:{id:"input-block",type:e.passwordType,placeholder:"请输入密码",name:"password","auto-complete":"on"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin(t)}},model:{value:e.loginForm.password,callback:function(t){e.$set(e.loginForm,"password",t)},expression:"loginForm.password"}}),e._v(" "),i("span",{staticClass:"show-pwd",on:{click:e.showPwd}},[i("svg-icon",{attrs:{"icon-class":"password"===e.passwordType?"eye":"eye-open"}})],1)],1),e._v(" "),"code"===e.loginForm.verifyType&&e.captchaEnabled?[i("div",{staticClass:"f-lable"},[e._v("验证码")]),e._v(" "),i("el-form-item",{staticClass:"captcha",attrs:{prop:"code"}},[i("el-input",{staticStyle:{width:"218px"},attrs:{placeholder:"验证码",type:"text",tabindex:"3",autocomplete:"off"},model:{value:e.loginForm.code,callback:function(t){e.$set(e.loginForm,"code","string"===typeof t?t.trim():t)},expression:"loginForm.code"}}),e._v(" "),i("div",{staticClass:"imgs",on:{click:function(t){return e.getCode()}}},[i("img",{attrs:{src:e.codeUrl}}),e._v(" "),i("span",{directives:[{name:"show",rawName:"v-show",value:e.showCaptchatImg,expression:"showCaptchatImg"}]},[e._v("已失效")])])],1)]:e._e(),e._v(" "),i("el-button",{staticClass:"login-btn",attrs:{id:"loginBtn",loading:e.loading,disabled:e.disabled},nativeOn:{click:function(t){return t.preventDefault(),e.handleLogin(t)}}},[e._v("登录\n ")])],2)],1)])],1)],1)])],1)],1)},s=[],n=(o("61f7"),o("c24f")),a=o("a18c"),r={name:"Login",data:function(){return{verify:!1,showCaptchatImg:!1,codeUrl:"",fullWidth:document.body.clientWidth,swiperOption:{pagination:{el:".pagination"},autoplay:{enabled:!1,disableOnInteraction:!1,delay:3e3}},loginForm:{account:"",password:"",uuid:"",code:"",loginType:"user_pass",verifyType:"code"},loginRules:{account:[{required:!0,trigger:"blur",message:"请输入用户名"}],password:[{required:!0,trigger:"blur",message:"请输入密码"}],code:[{required:!0,message:"请输入正确的验证码",trigger:"blur"}]},passwordType:"password",capsTooltip:!1,loading:!1,showDialog:!1,redirect:void 0,otherQuery:{},disabled:!1,isWeixin:this.$wechat.isWeixin(),captchaEnabled:!1}},components:{},watch:{fullWidth:function(e){if(!this.timer){this.screenWidth=e,this.timer=!0;var t=this;setTimeout((function(){t.timer=!1}),400)}},$route:{handler:function(e){var t=e.query;t&&(this.redirect=t.redirect,this.otherQuery=this.getOtherQuery(t))},immediate:!0}},created:function(){var e=this;document.onkeydown=function(t){if(-1!==e.$route.path.indexOf("login")){var o=window.event.keyCode;13===o&&e.handleLogin()}},window.addEventListener("resize",this.handleResize)},mounted:function(){""===this.loginForm.account?this.$refs.account.focus():""===this.loginForm.pwd&&this.$refs.password.focus(),this.getCode()},methods:{verifyTrue:function(){this.verify=!0},verifyFalse:function(){this.verify=!1},checkCapslock:function(e){var t=e.key;this.capsTooltip=t&&1===t.length&&t>="A"&&t<="Z"},showPwd:function(){var e=this;"password"===this.passwordType?this.passwordType="":this.passwordType="password",this.$nextTick((function(){e.$refs.pwd.focus()}))},handleLogin:function(){var e=this;this.$refs.loginForm.validate((function(t){if(!t)return!1;e.success(null)}))},success:function(e){var t=this;this.loginForm.captcha=this.$store.state.user.captcha;var o=this.$loading({lock:!0,text:"正在登录中."});this.$store.dispatch("user/login",this.loginForm).then((function(){t.$store.dispatch("user/getInfo").then((function(e){t.$store.dispatch("permission/generateRoutes",e.roles).then((function(e){a["a"].options.routes=e,a["a"].addRoutes(e),t.$router.push({path:t.redirect||"/dashboard",query:t.otherQuery}),o.close(),t.disabled=!0}))})).catch((function(e){o.close(),t.disabled=!1,t.$wechat.isPhone()&&t.$dialog.error(e.message),t.loginForm.code=null,t.getCode()}))})).catch((function(e){o.close(),t.disabled=!1,t.$wechat.isPhone()&&t.$dialog.error(e.message),t.loginForm.code=null,t.getCode()}))},getCode:function(){var e=this;"code"===this.loginForm.verifyType?Object(n["d"])().then((function(t){e.captchaEnabled=void 0===t.captchaEnabled||t.captchaEnabled,e.captchaEnabled&&(e.codeUrl="data:image/jpeg;base64,"+t.img),e.loginForm.uuid=t.uuid,e.showCaptchatImg=!1,setTimeout((function(){e.showCaptchatImg=!0}),27e4)})).catch((function(e){console.log(e)})):"jigsaw"===this.loginForm.verifyType?(this.loginForm.code="jigsaw",this.loginForm.uuid=""):"slide"===this.loginForm.verifyType||"sms"===this.loginForm.verifyType?Object(n["e"])().then((function(t){e.loginForm.uuid=t.uuid})).catch((function(e){console.error(e)})):this.$message.error("不支持的验证码类型:"+this.loginForm.verifyType)},getOtherQuery:function(e){return Object.keys(e).reduce((function(t,o){return"redirect"!==o&&(t[o]=e[o]),t}),{})}}},c=r,l=(o("97ee"),o("3679"),o("2877")),d=Object(l["a"])(c,i,s,!1,null,"6478b3af",null);t["default"]=d.exports},b2f5:function(e,t,o){},ce74:function(e,t,o){}}]);
|