v1.3.1 #9

Merged
timi merged 14 commits from dev into master 2026-11-13 17:12:54 +00:00
3 changed files with 26 additions and 41 deletions
Showing only changes of commit af1c95c8dd - Show all commits
-3
View File
@@ -7,7 +7,6 @@
title="客户"
>
<template #right>
<app-update-button />
<navbar-notify-button />
</template>
</t-navbar>
@@ -32,7 +31,6 @@
<store-overview ref="storeOverviewRef" compact />
</template>
<template #right-actions>
<app-update-button />
<navbar-notify-button />
</template>
<template #right>
@@ -55,7 +53,6 @@ import { useLayout } from "timi-tdesign-mobile";
import PendingNoticeBar from "./component/PendingNoticeBar.vue";
import CustomerEntryPanel from "./component/CustomerEntryPanel.vue";
import NavbarNotifyButton from "./component/NavbarNotifyButton.vue";
import AppUpdateButton from "./component/AppUpdateButton.vue";
import StoreOverview from "./component/StoreOverview.vue";
import TabSplitView from "./component/TabSplitView.vue";
import { permissionCodes } from "@/utils/permission";
@@ -1,32 +0,0 @@
<template>
<t-button
v-if="visible"
aria-label="有新版本"
@click="router.push('/management/settings')"
theme="default"
shape="square"
variant="text"
size="small"
>
<t-badge dot :offset="[-4, 4]">
<t-icon name="download" size="1.25rem" />
</t-badge>
</t-button>
</template>
<script setup lang="ts">
import { useAppUpdate } from "@/composables/useAppUpdate";
defineOptions({
name: "AppUpdateButton"
});
const router = useRouter();
const { supported, latest, autoUpdate, hasUpdate } = useAppUpdate();
// 只在有更新且未开启自动更新时出现,开启自动更新后由启动弹窗负责提醒
const visible = computed(() => {
void latest.value;
return supported && hasUpdate() && !autoUpdate.value;
});
</script>
+26 -6
View File
@@ -1,13 +1,14 @@
<template>
<t-notice-bar
v-if="noticeContent.length"
v-if="noticeList.length"
:key="noticeContent.join(',')"
class="pending-notice"
theme="warning"
:visible="true"
direction="vertical"
:interval="4000"
:content="1 < noticeContent.length ? noticeContent : noticeContent[0]"
@change="currentIndex = $event"
@change="handleChange"
@click="openNotice"
>
<template #suffix-icon>
@@ -17,17 +18,32 @@
</template>
<script setup lang="ts">
import { useAppUpdate } from "@/composables/useAppUpdate";
import { usePendingNoticeStore } from "@/store/pendingNoticeStore";
const pendingNoticeStore = usePendingNoticeStore();
const router = useRouter();
const currentIndex = ref(0);
const noticeContent = computed(() => pendingNoticeStore.pendingNoticeList.map(notice => notice.content));
const { supported, latest, autoUpdate, hasUpdate } = useAppUpdate();
const noticeList = computed(() => {
const notices = [...pendingNoticeStore.pendingNoticeList];
if (supported && !autoUpdate.value && hasUpdate() && latest.value) {
notices.push({ content: `有可用新版本 v${latest.value.version} 更新`, name: "AppUpdate", query: {} });
}
return notices;
});
const noticeContent = computed(() => noticeList.value.map(notice => notice.content));
let currentIndex = 0;
watch(noticeContent, () => { currentIndex.value = 0; });
watch(noticeContent, () => {
currentIndex = 0;
});
function handleChange(index: number): void {
currentIndex = index;
}
async function openNotice(): Promise<void> {
const notice = pendingNoticeStore.pendingNoticeList[currentIndex.value];
const notice = noticeList.value[currentIndex];
if (notice) {
await router.push({ name: notice.name, query: notice.query });
}
@@ -38,6 +54,10 @@ async function openNotice(): Promise<void> {
.pending-notice {
margin-top: -1rem;
:deep(.t-swiper__container) {
transition-duration: .5s !important;
}
:deep(.t-swiper-nav__dots) {
display: none;
}