瀏覽代碼

增加验证码

s202226701053 6 月之前
父節點
當前提交
73eeb3ba30
共有 1 個文件被更改,包括 12 次插入12 次删除
  1. 12 12
      E-Cover-app/src/lib/user/modal-user-login-main/modal-user-login-main.component.ts

+ 12 - 12
E-Cover-app/src/lib/user/modal-user-login-main/modal-user-login-main.component.ts

@@ -59,18 +59,18 @@ export class ModalUserLoginMainComponent implements OnInit {
     //随机生成四位数的验证码
     this.trueVerCode = (Math.floor(Math.random() * 9000) + 1000).toString();
     console.log("获取验证码成功" + this.trueVerCode);
-    // const apiUrl = `http://api.smsbao.com/sms?u=peppa&p=94d5a383c32c4d85bfbfc2599e64a8dc&m=${this.phoneNumber}&c=${encodeURIComponent("【衣靠】您的验证码是" + this.trueVerCode)}`;
-    // console.log("请求地址:" + apiUrl);
-    // this.http.get(apiUrl).subscribe(response => {
-    //   if (response === '0') {
-    //     console.log("短信发送成功");
-    //     // 处理登录成功逻辑
-    //   } else {
-    //     console.error("短信发送失败", response);
-    //   }
-    // }, error => {
-    //   console.error("请求失败", error);
-    // });
+    const apiUrl = `http://api.smsbao.com/sms?u=peppa&p=94d5a383c32c4d85bfbfc2599e64a8dc&m=${this.phoneNumber}&c=${encodeURIComponent("【衣靠】您的验证码是" + this.trueVerCode)}`;
+    console.log("请求地址:" + apiUrl);
+    this.http.get(apiUrl).subscribe(response => {
+      if (response === '0') {
+        console.log("短信发送成功");
+        // 处理登录成功逻辑
+      } else {
+        console.error("短信发送失败", response);
+      }
+    }, error => {
+      console.error("请求失败", error);
+    });
   }
   phoneToHide(phone: string): string {
     //将手机号隐藏中间四位数字,只显示前三位和后四位