ng 斷定輸入的手機號是否正確

斷定輸入的手機號是否正確this

    infoConfirm(){
          if (!/^1[3456789]\d{9}$/.test(this.mobile)) {
              this.phoneInfo = true;
              return setTimeout(() => {
                  this.phoneInfo = false;
              }, 3000)
          }
          if (!this.codeNumber || !/^\d{4}$/.test(this.codeNumber.toString())) {
              this.codetip = true
              return setTimeout(() => {
                  this.codetip = false;   //信息提示框
              }, 3000)
          }

          this.playerService.getPhoneUrl(this.mobile, this.codeNumber).subscribe(
              res =>{
                console.log(res);
                if (parseInt(res.code) === 200) {
                    console.log(res.code);
                    this.phonePup = false  //信息提示框
                    console.log(this.phonePup);
                    // this.tokenUtil.setToken(res.data.token)    //以前的token驗證。能夠去掉
                }
             }
          )
      }
相關文章
相關標籤/搜索