| | |
| | | </el-input> |
| | | </div> |
| | | </el-form-item> |
| | | <el-form-item prop="verifycode" style="line-height:0px;"> |
| | | <el-form-item prop="verifycode" style="line-height:0px;" v-show="shop_login_err_num >= 3"> |
| | | <div class="d-b-c"> |
| | | <div class="left-img-input" style="width: auto;"> |
| | | <el-input v-model="ruleForm.verifycode" ref="verifycode" placeholder="验证码" class="l-input" |
| | |
| | | import UserApi from '@/api/user.js'; |
| | | import { |
| | | setCookie, |
| | | getCookie, |
| | | setSessionStorage |
| | | } from '@/utils/base.js'; |
| | | export default { |
| | |
| | | data() { |
| | | // 验证码自定义验证规则 |
| | | const validateVerifycode = (rule, value, callback) => { |
| | | if (value === "") { |
| | | this.refreshCode(); |
| | | callback(new Error('请输入验证码')) |
| | | } else if (value !== this.identifyCode) { |
| | | console.log('验证码:', value); |
| | | this.refreshCode(); |
| | | callback(new Error('验证码不正确!')) |
| | | } else { |
| | | callback() |
| | | this.shop_login_err_num = parseInt(getCookie('shop_login_err_num')) || 0; |
| | | // 错误次数过多时校验验证码 by lyzflash |
| | | if (this.shop_login_err_num >= 3) { |
| | | if (value === "") { |
| | | this.refreshCode(); |
| | | callback(new Error('请输入验证码')) |
| | | } else if (value !== this.identifyCode) { |
| | | // console.log('验证码:', value); |
| | | this.refreshCode(); |
| | | callback(new Error('验证码不正确!')) |
| | | } |
| | | } |
| | | callback(); |
| | | } |
| | | return { |
| | | loginForm: {}, |
| | |
| | | }] |
| | | }, |
| | | /*基础配置*/ |
| | | baseData: {} |
| | | baseData: {}, |
| | | shop_login_err_num: 0, // 登录错误次数 |
| | | }; |
| | | }, |
| | | created() { |
| | | this.shop_login_err_num = parseInt(getCookie('shop_login_err_num')) || 0; |
| | | this.refreshCode(); |
| | | this.getData(); |
| | | if (this.$route.query.from && this.$route.query.from == 'admin') { |
| | |
| | | setCookie('userinfo', res.data); |
| | | /*设置一个登录状态*/ |
| | | setCookie('isLogin', true); |
| | | setCookie('shop_login_err_num', 0); // 登录成功后将登录错误次数清0 by lyzflash |
| | | /*跳转到首页*/ |
| | | this.$router.push({ |
| | | path: '/' |