fix: 增加倒计时函数 和 时间过期页面

This commit is contained in:
zhangds 2024-03-25 18:54:04 +08:00
parent 415f50aba6
commit 9ab710d3b7
2 changed files with 80 additions and 0 deletions

View File

@ -40,3 +40,31 @@ const getQueryString = (name) => {
if (r != null) return unescape(r[2]); if (r != null) return unescape(r[2]);
return null; return null;
}; };
/**
* @param {*} timestamp
* @returns
*/
const pageOutTime = (timestamp) => {
if (timestamp) {
const now = new Date().getTime(); // 获取当前时间的时间戳
let diff = Number(timestamp) - now; // 计算差异(以毫秒为单位)
// 判断还剩多久
if (diff <= 0) {
// window.location.replace("/outtime.html");
console.log("时间已到");
return false;
} else {
// 将差异转换为小时、分钟、秒
const hours = Math.floor(diff / (1000 * 60 * 60));
diff -= hours * (1000 * 60 * 60);
const minutes = Math.floor(diff / (1000 * 60));
diff -= minutes * (1000 * 60);
const seconds = Math.floor(diff / 1000);
// 返回结果数组
return [hours, minutes, seconds];
}
}
};

52
outtime.html Normal file
View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,viewport-fit=cover">
<title>兑换码已过期</title>
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/index.css">
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/vue.min.js?v=1367936144322" type="text/javascript"
charset="utf-8"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/modelPop.js"></script>
</head>
<body>
<div id="app">
<!-- 弹出提示 -->
<model-pop :show.sync="popShow" :title="popTitle" :status="popStatus" :text="popText"
:show_close="true"></model-pop>
</div>
</body>
<script>
new Vue({
el: '#app',
data() {
return {
/* 提示框状态 */
popShow: false,
popTitle: '',
popText: '',
popStatus: 1 /*1 成功 2提示 3失败 */
}
},
components: {
modelPop
},
created() {
this.openErrorDialog("当前链接已过期");
},
methods: {
//错误弹出框
openErrorDialog(tip) {
this.popTitle = '温馨提示';
this.popText = tip;
this.popStatus = 3;
this.popShow = true;
}
},
})
</script>
</html>