当前位置:网站首页>按钮倒计时提醒
按钮倒计时提醒
2022-08-10 01:11:00 【一周七喜h】
// 提醒发送
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);
}
},
边栏推荐
猜你喜欢
随机推荐
web开发概述
【kali-密码攻击】(5.1.2)密码在线破解:Medusa
Unity editor extension interface uses List
【内存管理概述 Objective-C语言】
小程序开发的报价为什么有差别?需要多少钱?
el-input保留一位小数点
XSS详解及复现gallerycms字符长度限制短域名绕过
Interdepartmental Communication Skills
芯片资讯|半导体收入增长预计将放缓至 7%,蓝牙芯片需求依然稳步增长
Shader Graph学习各种特效案例
初步认识对象
Solve the problem of sed replacement text containing special characters such as "/" and "#"
Unity reports Unsafe code may only appear if compiling with /unsafe. Enable “Allow ‘unsafe’ code” in Pla
【论文笔记】基于深度学习的机器人抓取虚拟仿真实验教学系统
Solidity最强对手:MOVE语言及新公链崛起
[Turn] Typora_Markdown_ picture title (caption)
【论文粗读】(NeurIPS 2020) SwAV:对比聚类结果的无监督视觉特征学习
防勒索病毒现状分析
多线程之自定义线程池
【干货】集成学习原理总结