chunk-74755442.938303c6.js
3.7 KB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-74755442"],{2017:function(e,t,n){"use strict";n("b2b7")},"9ed6":function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"login-container"},[n("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:e.loginForm,rules:e.loginRules,"auto-complete":"on","label-position":"left"}},[n("div",{staticClass:"title-container"},[n("h3",{staticClass:"title"},[e._v("登录")])]),e._v(" "),n("el-form-item",{attrs:{prop:"phone"}},[n("span",{staticClass:"svg-container"},[n("svg-icon",{staticStyle:{width:"18px",height:"18px"},attrs:{"icon-class":"phone"}})],1),e._v(" "),n("el-input",{ref:"phone",attrs:{placeholder:"手机号",name:"phone",type:"text",tabindex:"1",onkeyup:"value=value.replace(/[^\\d]/g,'')","auto-complete":"on"},model:{value:e.loginForm.phone,callback:function(t){e.$set(e.loginForm,"phone",t)},expression:"loginForm.phone"}})],1),e._v(" "),n("el-form-item",{attrs:{prop:"password"}},[n("span",{staticClass:"svg-container"},[n("svg-icon",{staticStyle:{width:"18px",height:"18px"},attrs:{"icon-class":"yzm"}})],1),e._v(" "),n("el-input",{ref:"password",staticStyle:{width:"140px"},attrs:{type:"text",placeholder:"验证码",name:"password",tabindex:"2","auto-complete":"on",onkeyup:"value=value.replace(/[^\\d]/g,'')"},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(" "),n("el-button",{staticStyle:{float:"right","margin-top":"6px","margin-right":"10px"},attrs:{type:"primary",disabled:e.isDisable},on:{click:e.getVerifyCode}},[e._v(e._s(e.btnTitle))])],1),e._v(" "),n("el-button",{staticStyle:{width:"100%","margin-bottom":"30px"},attrs:{loading:e.loading,type:"primary"},nativeOn:{click:function(t){return t.preventDefault(),e.handleLogin(t)}}},[e._v("登录\n ")])],1)],1)},o=[],r=(n("61f7"),n("c24f")),s={name:"Login",data:function(){var e=function(e,t,n){console.log(t),t?/^1[345678]\d{9}$/.test(t)?n():n(new Error("请输入正确手机号")):n(new Error("请输入手机号"))},t=function(e,t,n){t?n():n(new Error("请输入验证码"))};return{loginForm:{phone:"",password:""},loginRules:{phone:[{required:!0,trigger:"blur",validator:e}],password:[{required:!0,trigger:"blur",validator:t}]},loading:!1,isDisable:!1,btnTitle:"发送验证码",redirect:void 0}},watch:{$route:{handler:function(e){this.redirect=e.query&&e.query.redirect},immediate:!0}},methods:{getVerifyCode:function(){var e=this;this.isDisable=!0;var t=this.loginForm.phone;this.loginForm.phone&&/^1[345678]\d{9}$/.test(this.loginForm.phone)?Object(r["d"])(t).then((function(t){var n=t;"8888"==n.code?(console.log(111),e.validateBtn(),e.$message({type:"success",message:"验证码发送成功!"})):(e.isDisable=!1,e.$message({type:"error",message:n.msg}))})):(this.isDisable=!1,this.$message({type:"error",message:"请输入正确的手机号!"}))},validateBtn:function(){var e=this,t=60,n=setInterval((function(){e.isDisable=!0,t--,e.btnTitle=t+"秒后重试",t<=0&&(e.isDisable=!1,clearInterval(n),e.btnTitle="获取验证码")}),1e3)},handleLogin:function(){var e=this;this.$refs.loginForm.validate((function(t){if(!t)return console.log("error submit!!"),!1;e.loading=!0,e.$store.dispatch("user/login",e.loginForm).then((function(t){"8888"==t.code&&e.$router.push({path:e.redirect||"/"}),e.loading=!1})).catch((function(){e.loading=!1}))}))}}},a=s,l=(n("2017"),n("c3bc"),n("4ac2")),c=Object(l["a"])(a,i,o,!1,null,"646cc43b",null);t["default"]=c.exports},b2b7:function(e,t,n){},c3bc:function(e,t,n){"use strict";n("e9e4")},e9e4:function(e,t,n){}}]);