From ac9851aab019d64b916919c9144bd6f59dc9f307 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Thu, 26 Oct 2023 13:55:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20=E5=B0=86=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=A3=80=E6=B5=8B=E4=B8=8A=E7=A7=BB=E5=88=B0=20app=20?= =?UTF-8?q?=E5=B1=82=20#45?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 25 +++++++++++++++++++++++++ src/pages/common/Home.vue | 14 -------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/App.vue b/src/App.vue index d1973ab2..3a650ef9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,11 +17,13 @@ import { useRouter } from "vue-router"; import TBackTop from "./components/app/t-backTop.vue"; import TSidebar from "./components/app/t-sidebar.vue"; +import showConfirm from "./components/func/confirm"; import showSnackbar from "./components/func/snackbar"; import { getEmojis } from "./plugins/Mys/request/getEmojis"; import TGSqlite from "./plugins/Sqlite"; import { useAppStore } from "./store/modules/app"; import { useUserStore } from "./store/modules/user"; +import { getBuildTime } from "./utils/TGBuild"; const appStore = useAppStore(); const isMain = ref(false); @@ -65,6 +67,7 @@ async function listenOnInit(): Promise { await emojiLoad(); await checkAppLoad(); await checkUserLoad(); + await checkUpdate(); }); return; } @@ -204,6 +207,28 @@ async function getDeepLink(): Promise { } }); } + +// 检测更新 +async function checkUpdate(): Promise { + const isProdEnv = import.meta.env.MODE === "production"; + const needUpdate = await TGSqlite.checkUpdate(); + if (needUpdate && isProdEnv) { + const confirm = await showConfirm({ + title: "检测到版本更新", + text: "请到设置页手动更新版本,即将弹出更新说明子页面", + }); + if (confirm) { + appStore.buildTime = getBuildTime(); + window.open("https://app.btmuli.ink/docs/Changelogs.html"); + } else { + showSnackbar({ + text: "请到设置页手动更新版本!", + color: "error", + timeout: 3000, + }); + } + } +}