5e8e44f88f
commitf9e9899e0eAuthor: 浅念 <email@sample.com> Date: Fri Mar 28 11:10:56 2025 +0800 设置默认语言为英语 commit303121ba81Author: 浅念 <email@sample.com> Date: Fri Mar 28 11:00:05 2025 +0800 调用接口调整 commit37e0e55d96Author: 浅念 <email@sample.com> Date: Fri Mar 28 10:33:48 2025 +0800 线上接口地址 commit11dd7de521Author: 浅念 <email@sample.com> Date: Thu Mar 27 16:54:52 2025 +0800 修改样式 commit8ceb98b321Author: 浅念 <email@sample.com> Date: Thu Mar 27 16:47:04 2025 +0800 隐藏我的名片 commitf58e712684Author: 浅念 <email@sample.com> Date: Thu Mar 27 16:44:43 2025 +0800 样式调整 commit54ad6c9e37Author: 浅念 <email@sample.com> Date: Thu Mar 27 16:35:21 2025 +0800 修改语言包 commit526f934a75Author: 浅念 <email@sample.com> Date: Thu Mar 27 16:13:47 2025 +0800 标签功能 commit8583ff2543Author: 浅念 <email@sample.com> Date: Wed Mar 26 17:02:04 2025 +0800 标签管理页面 commitbe8674fd51Author: 浅念 <email@sample.com> Date: Tue Mar 25 17:29:37 2025 +0800 样式调整 commita5d5ce4e7cAuthor: 浅念 <email@sample.com> Date: Tue Mar 25 17:23:40 2025 +0800 倒计时组件 commitf88048b876Author: 浅念 <email@sample.com> Date: Tue Mar 25 17:19:43 2025 +0800 首页添加跟进提醒 commitf9a39d5aaaAuthor: 浅念 <email@sample.com> Date: Tue Mar 25 13:13:39 2025 +0800 提交 commite3abe0bf18Author: 浅念 <email@sample.com> Date: Tue Mar 25 13:12:24 2025 +0800 名片部分页面。地图定位。国家下拉搜索 回收站
104 lines
2.1 KiB
Vue
104 lines
2.1 KiB
Vue
<template>
|
|
<view class="countdown">
|
|
<view class="time green" v-if="!isend">
|
|
<image src="/static/image/gtime.png" mode=""></image>
|
|
<text v-if="showDays && timeObj.days > 0" >{{ timeObj.days }}{{$t('day')}} </text>
|
|
<text> {{ timeObj.hours | padZero }} : </text>
|
|
<text> {{ timeObj.minutes | padZero }} : </text>
|
|
<text> {{ timeObj.seconds | padZero }}</text>
|
|
</view>
|
|
<view class="time timered" v-else>
|
|
<image src="/static/image/redtime.png" mode=""></image>
|
|
<text>{{$t('timeout')}}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
// 倒计时总秒数
|
|
totalSeconds: {
|
|
type: Number,
|
|
required: true
|
|
},
|
|
// 是否显示天数
|
|
showDays: {
|
|
type: Boolean,
|
|
default: true
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
timeObj: {
|
|
days: 0,
|
|
hours: 0,
|
|
minutes: 0,
|
|
seconds: 0
|
|
},
|
|
isend:false,
|
|
timer: null,
|
|
totalSeconds1:this.totalSeconds
|
|
}
|
|
},
|
|
filters: {
|
|
padZero(value) {
|
|
return value.toString().padStart(2, '0');
|
|
}
|
|
},
|
|
mounted() {
|
|
if(this.totalSeconds>0){
|
|
this.runCountdown();
|
|
}else{
|
|
this.isend=true
|
|
}
|
|
},
|
|
methods: {
|
|
runCountdown() {
|
|
this.updateTime(this.totalSeconds1);
|
|
this.timer = setInterval(() => {
|
|
if (this.totalSeconds1 <= 0) {
|
|
clearInterval(this.timer);
|
|
this.isend=true
|
|
this.$emit('end');
|
|
return;
|
|
}
|
|
this.totalSeconds1--;
|
|
this.updateTime(this.totalSeconds1);
|
|
}, 1000);
|
|
},
|
|
updateTime(seconds) {
|
|
this.timeObj.days = Math.floor(seconds / (24 * 3600));
|
|
const remaining = seconds % (24 * 3600);
|
|
this.timeObj.hours = Math.floor(remaining / 3600);
|
|
this.timeObj.minutes = Math.floor((remaining % 3600) / 60);
|
|
this.timeObj.seconds = remaining % 60;
|
|
}
|
|
},
|
|
beforeDestroy() {
|
|
clearInterval(this.timer);
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss">
|
|
.countdown{
|
|
.time{
|
|
display: flex;
|
|
align-items: center;
|
|
text{
|
|
margin: 0px 2px;
|
|
}
|
|
}
|
|
image{
|
|
width: 18px;
|
|
height: 18px;
|
|
margin-right: 5px;
|
|
}
|
|
}
|
|
.green{
|
|
color: #27C89C;
|
|
}
|
|
.timered{
|
|
color: #FF4040;
|
|
}
|
|
</style> |