diff --git a/src/App.vue b/src/App.vue index 31486755..8848cd18 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,8 +13,8 @@ + diff --git a/src/utils/toolFunc.ts b/src/utils/toolFunc.ts new file mode 100644 index 00000000..0052bea8 --- /dev/null +++ b/src/utils/toolFunc.ts @@ -0,0 +1,21 @@ +/** + * @file utils toolFunc.ts + * @description 一些工具函数 + * @author BTMuli + * @since Beta v0.3.0 + */ + +/** + * @description 时间戳转换为时间字符串 + * @returns {string} 时间字符串 d天 hh:mm:ss + * @param time + */ +export function stamp2LastTime(time: number): string { + const day = Math.floor(time / (24 * 3600 * 1000)); + const hour = Math.floor((time % (24 * 3600 * 1000)) / (3600 * 1000)); + const minute = Math.floor((time % (3600 * 1000)) / (60 * 1000)); + const second = Math.floor((time % (60 * 1000)) / 1000); + return `${day === 0 ? "" : `${day}天`} ${hour.toFixed(0).padStart(2, "0")}:${minute + .toFixed(0) + .padStart(2, "0")}:${second.toFixed(0).padStart(2, "0")}`; +} diff --git a/src/views/t-anno-json.vue b/src/views/t-anno-json.vue index f270587a..f8c05d6d 100644 --- a/src/views/t-anno-json.vue +++ b/src/views/t-anno-json.vue @@ -14,7 +14,7 @@ import { ref, onMounted, reactive } from "vue"; import { useRoute } from "vue-router"; import JsonViewer from "vue-json-viewer"; import ToLoading from "../components/overlay/to-loading.vue"; -import TSwitchTheme from "../components/main/t-switchTheme.vue"; +import TSwitchTheme from "../components/app/t-switchTheme.vue"; // tauri import { appWindow } from "@tauri-apps/api/window"; // utils diff --git a/src/views/t-anno.vue b/src/views/t-anno.vue index edd646a0..6d52f00e 100644 --- a/src/views/t-anno.vue +++ b/src/views/t-anno.vue @@ -24,7 +24,7 @@ import { ref, onMounted, watch } from "vue"; import { useRoute } from "vue-router"; import ToLoading from "../components/overlay/to-loading.vue"; -import TSwitchTheme from "../components/main/t-switchTheme.vue"; +import TSwitchTheme from "../components/app/t-switchTheme.vue"; import TShareBtn from "../components/main/t-shareBtn.vue"; // tauri import { appWindow } from "@tauri-apps/api/window"; diff --git a/src/views/t-lottery.vue b/src/views/t-lottery.vue index d7814947..6792fcea 100644 --- a/src/views/t-lottery.vue +++ b/src/views/t-lottery.vue @@ -57,7 +57,7 @@ import { computed, onMounted, onUpdated, reactive, ref } from "vue"; import { useRoute } from "vue-router"; import JsonViewer from "vue-json-viewer"; import ToLoading from "../components/overlay/to-loading.vue"; -import TSwitchTheme from "../components/main/t-switchTheme.vue"; +import TSwitchTheme from "../components/app/t-switchTheme.vue"; // tauri import { appWindow } from "@tauri-apps/api/window"; // store diff --git a/src/views/t-post-json.vue b/src/views/t-post-json.vue index 04a8a3e2..9dbd954e 100644 --- a/src/views/t-post-json.vue +++ b/src/views/t-post-json.vue @@ -12,7 +12,7 @@ import { ref, onMounted, reactive } from "vue"; import { useRoute } from "vue-router"; import JsonViewer from "vue-json-viewer"; import ToLoading from "../components/overlay/to-loading.vue"; -import TSwitchTheme from "../components/main/t-switchTheme.vue"; +import TSwitchTheme from "../components/app/t-switchTheme.vue"; // tauri import { appWindow } from "@tauri-apps/api/window"; // plugins diff --git a/src/views/t-post.vue b/src/views/t-post.vue index ced2e750..c0732fdb 100644 --- a/src/views/t-post.vue +++ b/src/views/t-post.vue @@ -24,7 +24,7 @@ import { ref, onMounted, watch } from "vue"; import { useRoute } from "vue-router"; import ToLoading from "../components/overlay/to-loading.vue"; -import TSwitchTheme from "../components/main/t-switchTheme.vue"; +import TSwitchTheme from "../components/app/t-switchTheme.vue"; import TShareBtn from "../components/main/t-shareBtn.vue"; // tauri import { appWindow } from "@tauri-apps/api/window";