add: app update page

This commit is contained in:
Timi
2026-11-08 02:04:16 +08:00
parent 78491232ee
commit d9aa24e48a
6 changed files with 212 additions and 169 deletions
+14 -1
View File
@@ -12,6 +12,7 @@
<section class="brand" v-entrance-transition>
<logo @click="handleLogoClick" />
<h1 v-text="appName" />
<p v-text="`版本 ${displayVersion}`" />
<p v-text="appDescription" />
</section>
<t-cell-group v-if="agreementItemList.length" theme="card" v-entrance-transition>
@@ -32,6 +33,13 @@
v-else
:description="isLoading ? '正在加载协议配置' : '暂无可用协议'"
/>
<t-cell-group v-if="updateSupported" theme="card" v-entrance-transition>
<t-cell title="版本更新" arrow hover @click="router.push({ name: 'AppUpdate' })">
<template #leftIcon>
<t-icon name="download" size="1.75rem" />
</template>
</t-cell>
</t-cell-group>
<footer class="footer" v-entrance-transition>
<p>技术支持:夜雨</p>
<p>联系技术:imyeyu@qq.com</p>
@@ -44,6 +52,8 @@
</template>
<script setup lang="ts">
import { version } from "../../../package.json";
import { useAppUpdate } from "@/composables/useAppUpdate";
import { SettingAPI } from "timi-web-api";
import Logo from "@/pages/user/component/Logo.vue";
import { getErrorMessage } from "@/utils/error";
@@ -63,6 +73,8 @@ defineOptions({
const appName = "糕店客户管理";
const appDescription = "面向门店的客户、登记、积分与经营管理工具";
const router = useRouter();
const { supported: updateSupported, currentVersion, loadCurrent } = useAppUpdate();
const displayVersion = computed(() => currentVersion.value && currentVersion.value !== "builtin" ? currentVersion.value : version);
const agreementItemList = ref<AgreementItem[]>([]);
const isLoading = ref(false);
@@ -127,7 +139,7 @@ async function loadSettings(): Promise<void> {
}
onMounted(async () => {
await loadSettings();
await Promise.all([loadSettings(), loadCurrent()]);
});
</script>
@@ -192,3 +204,4 @@ onMounted(async () => {
}
}
</style>