Browse Source

手机号验证

1
mo 3 năm trước cách đây
mục cha
commit
ddc6b0c069
3 tập tin đã thay đổi với 9 bổ sung7 xóa
  1. 2 1
      src/components/minForm.vue
  2. 1 1
      src/components/silder.vue
  3. 6 5
      src/components/submitForm.vue

+ 2 - 1
src/components/minForm.vue

@@ -100,7 +100,7 @@ export default {
           this.$toast("提交成功");
           this.$emit('close')
         } else {
-          this.$toast("提交失败");
+          this.$toast(res.data.msg);
         }
       });
     },
@@ -131,6 +131,7 @@ export default {
         },
       }).then((res) => {
         if (res.data.code == 200) {
+           this.time = 60
           this.$toast("发送成功");
           const timer = setInterval(() => {
             if (this.time > 0) {

+ 1 - 1
src/components/silder.vue

@@ -67,7 +67,7 @@
       destroy-on-close
       custom-class="mydialog"
     >
-      <submitForm />
+      <submitForm @close='visiable=false'/>
 
       <!-- <el-form ref="form"
                :model="form"

+ 6 - 5
src/components/submitForm.vue

@@ -108,9 +108,10 @@ export default {
             },
           }).then((res) => {
             if (res.data.code === 200) {
-              this.$message.success("发送成功");
+              this.$message.success("提交成功");
+               this.$emit('close')
             } else {
-              this.$message.error("发送失败");
+              this.$message.error(res.data.msg);
             }
           });
         }
@@ -122,19 +123,19 @@ export default {
         return;
       }
       this.$refs["form"].validateField("mobileNo", (valid) => {
-        console.log("验证通过发起请求", valid);
         if (!valid) {
           axios({
             url: this.url + "api-auth/code/sendSms",
             method: "post",
-            data: { mobile: this.form.mobileNo },
+            data: qs.stringify({ mobile: this.form.mobileNo }),
             headers: {
               "Content-type": "application/x-www-form-urlencoded",
               "Access-Control-Allow-Origin": "*",
             },
           }).then((res) => {
+            console.log(res)
             if (res.data.code == 200) {
-              this.$message.success("发送成功");
+              this.time = 60
               const timer = setInterval(() => {
                 if (this.time > 0) {
                   this.time--;