• 按钮倒计时提醒


     

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

  • 相关阅读:
    安卓ro.serialno产生的整个流程
    Html 标题标签h1-h6详解和细节分析
    LeetCode_二分搜索_中等_436.寻找右区间
    google的chromedriver最新版下载地址
    About 11.6 This Week
    FPGA实现AXI4总线的读写_如何写axi4逻辑
    让开发回归简单模式-基类封装
    解析ASEMI代理瑞萨R7S721031VCFP#AA1芯片及其优势
    内置式永磁同步电机复矢量电流调节器设计
    数据结构-排序
  • 原文地址:https://blog.csdn.net/qq_43962582/article/details/125994331