Browse Source

feat: 添加更新时区

SongZihuan 4 months ago
parent
commit
642e1612ea

File diff suppressed because it is too large
+ 0 - 0
docs/assets/index-530f3a52.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets/index-616d622e.css


File diff suppressed because it is too large
+ 0 - 0
docs/assets/index-7a8341c8.js


File diff suppressed because it is too large
+ 0 - 0
docs/assets/index-89b1b679.js


+ 1 - 1
docs/index.html

@@ -13,7 +13,7 @@
             overflow: auto;
         }
     </style>
-  <script type="module" crossorigin src="/assets/index-6d6f7881.js"></script>
+  <script type="module" crossorigin src="/assets/index-89b1b679.js"></script>
   <link rel="modulepreload" crossorigin href="/assets/vue-3aa8a031.js">
   <link rel="stylesheet" href="/assets/index-82840275.css">
 </head>

+ 1 - 1
src/utils/build_time.json

@@ -1 +1 @@
-{"compile_time":1734714081898}
+{"compile_time":1734715139895,"time_zone":"Asia/Shanghai"}

+ 5 - 1
src/utils/build_time.ts

@@ -2,4 +2,8 @@ import build_time from "@/utils/build_time.json"
 
 export const get_build_time = (): Date => {
     return build_time.compile_time ? new Date(build_time.compile_time) : new Date()
-}
+}
+
+export const get_build_time_zone = (): string => {
+    return build_time.time_zone ? build_time.time_zone : ""
+}

+ 3 - 2
src/views/index.vue

@@ -1,10 +1,11 @@
 <script setup lang="ts">
 import {ElDivider} from "element-plus"
-import {get_build_time} from "@/utils/build_time"
+import {get_build_time, get_build_time_zone} from "@/utils/build_time"
 import {formatDate} from "@/utils/time"
 import ToGithub from "@/components/togithub.vue";
 
 const build_time = ref(formatDate(get_build_time()))
+const build_time_zone = ref(get_build_time_zone())
 
 </script>
 
@@ -152,7 +153,7 @@ const build_time = ref(formatDate(get_build_time()))
 
       <div class="bottom">
         <p class="text more_line_text">
-          本页面最后更新于:{{ build_time }}。
+          本页面最后更新于:{{ build_time }} {{ build_time_zone }}
         </p>
       </div>
     </div>

+ 2 - 1
vite.config.ts

@@ -5,7 +5,8 @@ import fs from 'fs'
 import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
 
 fs.writeFile("./src/utils/build_time.json", JSON.stringify({
-  "compile_time": new Date().getTime()
+  "compile_time": new Date().getTime(),
+  "time_zone": Intl.DateTimeFormat().resolvedOptions().timeZone,
 }), () => {})
 
 // vite项目运行自动检查eslint

Some files were not shown because too many files changed in this diff