Commit 7df6e77ec766039deb2d82a1dc63e448777148a5

Authored by 王富生
1 parent d36d4859

登陆验证码提交

Showing 1 changed file with 11 additions and 4 deletions
src/views/login/index.vue
@@ -102,19 +102,26 @@ export default { @@ -102,19 +102,26 @@ export default {
102 getVerifyCode(){ 102 getVerifyCode(){
103 let phone = this.loginForm.phone; 103 let phone = this.loginForm.phone;
104 if (!this.loginForm.phone) { 104 if (!this.loginForm.phone) {
105 - new Error('请输入手机号!'); 105 + this.$message({
  106 + type: 'error',
  107 + message: '请输入正确的手机号!'
  108 + });
106 } else if(!/^1[345678]\d{9}$/.test(this.loginForm.phone)) { 109 } else if(!/^1[345678]\d{9}$/.test(this.loginForm.phone)) {
107 - new Error('请输入正确手机号!'); 110 + this.$message({
  111 + type: 'error',
  112 + message: '请输入正确的手机号!'
  113 + });
108 } 114 }
109 //获取验证码 115 //获取验证码
110 else { 116 else {
111 sendValidatorCode(phone).then(response =>{ 117 sendValidatorCode(phone).then(response =>{
112 - let data = response.data; 118 + let data = response;
113 if(data.code=='8888'){ 119 if(data.code=='8888'){
114 this.$message({ 120 this.$message({
115 type: 'success', 121 type: 'success',
116 message: '验证码发送成功!' 122 message: '验证码发送成功!'
117 }); 123 });
  124 + this.validateBtn();
118 }else{ 125 }else{
119 this.$message({ 126 this.$message({
120 type: 'error', 127 type: 'error',
@@ -122,7 +129,7 @@ export default { @@ -122,7 +129,7 @@ export default {
122 }); 129 });
123 } 130 }
124 }); 131 });
125 - //this.validateBtn(); 132 +
126 133
127 } 134 }
128 }, 135 },