From 477ea421a6ecd12645dd25b4d14fd1d67085f08f Mon Sep 17 00:00:00 2001
From: 白咕咕 <67865300+baimianxiao@users.noreply.github.com>
Date: Tue, 7 Nov 2023 01:28:02 +0800
Subject: 倒计时组件 (#72)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* 部署官网框架

* 部署官网框架

* 部署官网框架

* 修改标题

* 初步完成左侧倒计时组件

* favicon

---------

Co-authored-by: 白咕咕 <baiguguos@gmail.com>
---
 site/src/components/Left.vue | 78 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 site/src/components/Left.vue

(limited to 'site/src/components/Left.vue')

diff --git a/site/src/components/Left.vue b/site/src/components/Left.vue
new file mode 100644
index 0000000..342e49b
--- /dev/null
+++ b/site/src/components/Left.vue
@@ -0,0 +1,78 @@
+<script lang="ts">
+export default {
+  data(){
+    return{
+      day:0,
+      hour:0,
+      min:0,
+      sec:0,
+      timer:0
+    }
+  },
+  props:{
+    msg:{
+      type:String,
+      require:true
+    },
+    date:{
+      type:Date,
+      default:'2024-05-10T12:00:00Z'
+    }
+  },
+  methods:{
+    getTime(){
+      this.timer=window.setTimeout(()=>{
+        const date1 = new Date();
+        const date2 = new Date(this.date);
+        const timeDiff = Math.abs(date2.getTime() - date1.getTime());
+        this.day = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
+        this.hour = Math.floor(timeDiff / (1000 * 60 * 60)%24);
+        this.min = Math.floor((timeDiff / (1000 * 60)) % 60);
+        this.sec = Math.floor((timeDiff / 1000) % 60);
+        this.getTime()
+      },1000)
+    }
+  },
+  beforeMount() {
+    this.getTime()
+  }
+
+}
+</script>
+
+<template>
+  <div class="greetings">
+    <h1 class="green">{{ msg }}</h1>
+    <h3>
+      距离水系公测还有
+    </h3>
+    <h2>
+      {{ day }}d {{ hour }}h {{ min }}m {{ sec }}s
+    </h2>
+  </div>
+</template>
+
+<style scoped>
+h1 {
+  font-weight: 500;
+  font-size: 2.6rem;
+  position: relative;
+  top: -10px;
+}
+
+h3 {
+  font-size: 1.2rem;
+}
+
+.greetings h1,
+.greetings h3 {
+  text-align: center;
+}
+
+@media (min-width: 1024px) {
+  .greetings h1,
+  .greetings h3 {
+    text-align: left;
+  }
+}
+</style>
-- 
cgit v1.2.3-70-g09d2

