• 按钮倒计时提醒


     

    // 提醒发送
        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);
          }
        },

  • 相关阅读:
    SAP BC TSV_TNEW_PAGE_ALLOC_FAILED
    【Docker-k8s学习和实战】(五)深入理解docker镜像原理
    C++用条件变量实现线程安全的queue容器
    【HTML学生作业网页】基于HTML+CSS+JavaScript仿南京师范大学泰州学院(11页)
    SAP服务器文件管理
    远程控制与遥控器控制耦合
    TypeScript基础
    消息队列与快递柜之间的奇妙关系
    Jenkins+Docker+SpringCloud微服务持续集成(中)
    【刷题】LC 148. 排序链表
  • 原文地址:https://blog.csdn.net/qq_43962582/article/details/125994331