记录代码

		getcode() {
				let _tip = this.i18n.obtain
				console.log(_tip)
				console.log(this.codemessage)
				var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				if (this.codemessage != _tip) {
					return
				}
				if (this.formdata.userEmail && reg.test(this.formdata.userEmail)) {

					this._sendEmailCode(this.formdata.userEmail) //发送邮件方法
				} else {
					// this.$Message.warning(this.$t('login.pleaseEnterMailbox'))
					this.confirmwords = this.i18n.inputrealemail
					return
				}
				let count = 60
				var timer = setInterval(() => {
					if (count > 1) {
						this.codemessage = `${count}s`
						count--
					} else {
						clearInterval(timer)
						this.codemessage = this.i18n.obtain // 点击获取 || this.$t('message').obtain
					}
				}, 1000)
			},



//发送验证码另一种写法
	getCode(){ //获取验证码
			console.log(this.isPhone,this.phoneNum)
				if(!(/^1[3456789]\d{9}$/.test(this.phoneNum))&&this.isPhone){ 
					uni.showToast({
						icon:'none',
						title:'手机号格式错误',
						duration:2000
					})			
					return
				}
				var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				if (this.phoneNum && !reg.test(this.phoneNum)&&!this.isPhone) {
					uni.showToast({
						icon:'none',
						title:this.i18n.inputrealemail,
						duration:2000
					})			
					return
				} 
				if(this.getWord!=this.$t('message').VerificationCode&&this.getWord!='重新获取'){
					return
				}
				
				if(this.isPhone){
					uni.request({
					  url: this.$config.accounturl +`authority/app/code/${this.codeType}`,
					  data: {
					    phone:this.phoneNum
					  },
					  method: 'get',
					  success: (res) => {
					    if (res.data.code == 1) {
							uni.showToast({
							  icon: 'none',
							  title: this.i18n.nomalsuccess,
							});
							
					    } else {
					      uni.showToast({
					        icon: 'none',
					        title: res.data.message,
					      });
					    }
					  }
					})
				}else{
					this.$emit('sendemail')
				}
				//倒计时
				// let num = 60
				this.num = 60
				// this.getWord = 
				let timer = setInterval(()=>{
					this.num--
					// this.getWord = num +' s'
					if(this.num<=0){
						clearInterval(timer)
						// this.getWord =this.$t('message').VerificationCode
					}
				},1000)
			},


watch 监听data里的某一变量
  watch: {
    upgradeFlag () {
      this.eqUpgrade.files = null
      this.$refs.upgradeDom.resetFields()
    },
    'query.deviceSn' (val) {
      console.log(val, 'valval')
      if (!val) {
        this._getdevicePage()
      }
    }
  },





 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值