当前位置:网站首页>Button countdown reminder
Button countdown reminder
2022-08-10 02:31:00 【seven joys a week】
// Reminder to send
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("Remind member to send");
}
.catch(() => {
});
} else {
time = 60 * 60 * 1000 - time;
const min = Math.floor(time / 1000 / 60); // minutes
const second = Math.floor(time / 1000);
second %= 60;
let msg = ``;
if (min > 0 && second > 0) {
msg = `${min}minutes${second}seconds and click again`;
} else if (min > 0 && second <= 0) {
msg = `${min} minutes later you can click again`;
} else if (min <= 0 && second> 0) {
msg = `${second} seconds later, you can click again`;
}
this.$u.toast(msg);
}
},
边栏推荐
猜你喜欢
随机推荐
2022金九银十工作潮,怎么样才能成功跳槽面试拿到高薪呢?
FILE结构体在stdio.h头文件源码里的详细代码
首次在我们的centos上安装MySQL
shell指定参数名传参
进程管理和任务管理
[QNX Hypervisor 2.2用户手册]10.14 smmu
Summary of Web Performance Testing Models
【内存管理概述 Objective-C语言】
The shell specifies the parameter name to pass the parameter
odoo公用变量或数组的使用
[LeetCode] Find the sum of the numbers from the root node to the leaf node
跨部门沟通的技巧
Chip Information|Semiconductor revenue growth expected to slow to 7%, Bluetooth chip demand still growing steadily
web开发概述
Shader Graph学习各种特效案例
oracle的数据导入导出
开发IM即时通讯容易吗?需要什么技术
Unity editor extension interface uses List
使用IDEA的PUSH常见问题
【web渗透】SSRF漏洞超详细讲解