2023-01-15 05:22:30 +00:00
|
|
|
<template>
|
|
|
|
<div class="time-capsule">
|
|
|
|
<div class="title">
|
2023-08-23 05:38:17 +00:00
|
|
|
<hourglass-full theme="two-tone" size="24" :fill="['#efefef', '#00000020']" />
|
2023-01-15 05:22:30 +00:00
|
|
|
<span>时光胶囊</span>
|
|
|
|
</div>
|
2023-08-23 05:38:17 +00:00
|
|
|
<span class="text">今日已经度过了 {{ timeData.day.elapsed }} 小时</span>
|
|
|
|
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.day.pass" />
|
|
|
|
<span class="text">本周已经度过了 {{ timeData.week.elapsed }} 天</span>
|
|
|
|
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.week.pass" />
|
|
|
|
<span class="text">本月已经度过了 {{ timeData.month.elapsed }} 天</span>
|
|
|
|
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.month.pass" />
|
|
|
|
<span class="text">今年已经度过了 {{ timeData.year.elapsed }} 个月</span>
|
|
|
|
<el-progress :text-inside="true" :stroke-width="20" :percentage="timeData.year.pass" />
|
2023-06-15 02:05:47 +00:00
|
|
|
<div v-if="startDate?.length >= 4 && store.siteStartShow">
|
2023-02-02 03:06:16 +00:00
|
|
|
<span class="text" v-html="startDateText" />
|
|
|
|
<!-- <el-progress
|
|
|
|
:show-text="false"
|
|
|
|
:indeterminate="true"
|
|
|
|
:stroke-width="6"
|
|
|
|
:percentage="80"
|
|
|
|
:duration="2"
|
|
|
|
/> -->
|
|
|
|
</div>
|
2023-01-15 05:22:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2023-08-26 08:03:07 +00:00
|
|
|
import { HourglassFull } from "@icon-park/vue-next";
|
|
|
|
import { getTimeCapsule, siteDateStatistics } from "@/utils/getTime.js";
|
|
|
|
import { mainStore } from "@/store";
|
2023-02-02 03:06:16 +00:00
|
|
|
const store = mainStore();
|
2023-01-15 05:22:30 +00:00
|
|
|
|
|
|
|
// 进度条数据
|
2023-04-21 08:37:08 +00:00
|
|
|
const timeData = ref(getTimeCapsule());
|
|
|
|
const startDate = ref(import.meta.env.VITE_SITE_START);
|
|
|
|
const startDateText = ref(null);
|
|
|
|
const timeInterval = ref(null);
|
2023-01-15 05:22:30 +00:00
|
|
|
|
|
|
|
onMounted(() => {
|
2023-04-21 08:37:08 +00:00
|
|
|
timeInterval.value = setInterval(() => {
|
2023-01-15 05:22:30 +00:00
|
|
|
timeData.value = getTimeCapsule();
|
2023-08-23 05:38:17 +00:00
|
|
|
if (startDate.value) startDateText.value = siteDateStatistics(new Date(startDate.value));
|
2023-01-15 05:22:30 +00:00
|
|
|
}, 1000);
|
|
|
|
});
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
2023-04-21 08:37:08 +00:00
|
|
|
clearInterval(timeInterval.value);
|
2023-01-15 05:22:30 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.time-capsule {
|
|
|
|
width: 100%;
|
|
|
|
.title {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
align-items: center;
|
|
|
|
margin: 0.2rem 0 1.5rem;
|
|
|
|
font-size: 1.1rem;
|
|
|
|
.i-icon {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-right: 6px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.text {
|
|
|
|
display: block;
|
|
|
|
margin: 1rem 0rem 0.5rem 0rem;
|
|
|
|
font-size: 0.95rem;
|
|
|
|
}
|
|
|
|
}
|
2023-03-10 07:51:18 +00:00
|
|
|
</style>
|