按钮倒计时提醒

 

// 提醒发送
    remindSend() {
      // firstClickTime最好是后端返回的参数
      // 苹果手机不兼容 new Data() 所以要先获取手机型号
 
      uni.getSystemInfo({
        success: (res)=>{
          if(res.platform == "ios") {
            this.firstClickTime = new Date(this.detail.remindTime.replace(/-/g,                     
            "/")).getTime() || 0
          } else {
            this.firstClickTime = new Date(this.detail.remindTime).getTime() || 0
          }
        }
      });
      this.currentClickTime = +new Date();
      let time = this.currentClickTime - this.firstClickTime;
      if (time >= 60 * 60 * 1000) {
        this.$http
          .post("/app/appmasssendingtask/remindSend", null, {
            params: {
              id: this.id,
            },
          })
          .then((res) => {
            if (res?.code == 0) {
              this.$u.toast("已提醒成员发送");
            }
          })
          .catch(() => {
          });
      } else {
        time = 60 * 60 * 1000 - time;
        const min = Math.floor(time / 1000 / 60); // 分钟
        const second = Math.floor(time / 1000);
        second %= 60;
        let msg = ``;
        if (min > 0 && second > 0) {
          msg = `${min}分钟${second}秒后可以再次点击`;
        } else if (min > 0 && second <= 0) {
          msg = `${min}分钟后可以再次点击`;
        } else if (min <= 0 && second > 0) {
          msg = `${second}秒后可以再次点击`;
        }
        this.$u.toast(msg);
      }
    },

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值