support tablet

This commit is contained in:
Timi
2026-11-02 23:12:05 +08:00
parent c48b19bed5
commit d3879c9c77
123 changed files with 4153 additions and 2673 deletions
+87 -72
View File
@@ -1,5 +1,5 @@
<template>
<div class="page-layout navbar notify-list">
<div class="tui-page-layout tui-navbar notify-list">
<t-navbar
fixed
:z-index="20"
@@ -18,71 +18,85 @@
/>
</template>
</t-navbar>
<main v-can="corePermissionCodes.notify.read" class="page-content scroll column list">
<t-pull-down-refresh
class="pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="refresh"
@scrolltolower="loadMore"
>
<t-segmented
v-model="filterMode"
class="filter"
block
:options="filterOptions"
@change="switchFilter"
v-entrance-transition
/>
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line" theme="card">
<t-swipe-cell
v-for="item in pageResult.list"
:key="item.id"
class="item"
v-entrance-transition="{ step: 30 }"
>
<t-cell arrow hover @click="toDetail(item)">
<template #leftIcon>
<div class="icon" :class="{ unread: isUnread(item) }">
<t-icon name="notification" size="1.25rem" />
</div>
</template>
<template #title>
<div class="title">
<span v-text="getSubject(item)" />
</div>
</template>
<template #description>
<time-label :timestamp="item.sendAt" underline />
</template>
<template #note>
<t-tag
v-if="filterMode === 'all' && isUnread(item)"
class="unread-label"
<master-detail-page
v-can="corePermissionCodes.notify.read"
class="list"
:split="isWide"
:selected="!!selectedId"
:direction="paneDirection"
>
<template #master>
<t-pull-down-refresh
class="pull-refresh"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="refresh"
@scrolltolower="loadMore"
>
<t-segmented
v-model="filterMode"
class="filter"
block
:options="filterOptions"
@change="switchFilter"
v-entrance-transition
/>
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line" theme="card">
<t-swipe-cell
v-for="item in pageResult.list"
:key="item.id"
class="item"
v-entrance-transition="{ step: 30 }"
>
<t-cell arrow hover @click="toDetail(item)">
<template #leftIcon>
<div class="icon" :class="{ unread: isUnread(item) }">
<t-icon name="notification" size="1.25rem" />
</div>
</template>
<template #title>
<div class="title">
<span v-text="getSubject(item)" />
</div>
</template>
<template #description>
<time-label :timestamp="item.sendAt" underline />
</template>
<template #note>
<t-tag
v-if="filterMode === 'all' && isUnread(item)"
class="unread-label"
theme="danger"
size="small"
>未读</t-tag>
</template>
</t-cell>
<template #right>
<t-button
class="delete"
theme="danger"
size="small"
>未读</t-tag>
:loading="deletingId === item.id"
@click.stop="confirmDelete(item)"
>
删除
</t-button>
</template>
</t-cell>
<template #right>
<t-button
class="delete"
theme="danger"
:loading="deletingId === item.id"
@click.stop="confirmDelete(item)"
>
删除
</t-button>
</template>
</t-swipe-cell>
</t-cell-group>
<t-empty
v-else-if="!isLoading"
description="暂无站内通知"
</t-swipe-cell>
</t-cell-group>
<t-empty
v-else-if="!isLoading"
description="暂无站内通知"
/>
<center-tips :content="loadStateText" />
</t-pull-down-refresh>
</template>
<template #detail>
<user-notify-detail
:key="`detail-${selectedId}`"
:notify-id="selectedId"
/>
<center-tips :content="loadStateText" />
</t-pull-down-refresh>
</main>
</template>
</master-detail-page>
</div>
</template>
@@ -92,6 +106,8 @@ import { NotifyAPI, type NotifyDetail, type Page, type PageResult, useUserStore
import { DialogPlugin } from "tdesign-mobile-vue";
import { Message } from "@/utils/message";
import { corePermissionCodes } from "@/utils/permission";
import { MasterDetailPage, useMasterDetailPane } from "timi-tdesign-mobile";
import UserNotifyDetail from "@/pages/notify/UserNotifyDetail.vue";
@@ -106,7 +122,12 @@ defineOptions({
});
const pageSize = 20;
const router = useRouter();
// 选中项、切换方向、关闭逻辑、转屏、query 同步都在这里;站内通知没有内联编辑视图
const { selectedId, paneDirection, isWide, openDetail } = useMasterDetailPane({
path: "/notify",
detail: id => `/notify/${id}`
});
const userStore = useUserStore();
const canReadNotify = computed(() => userStore.hasPermissions(corePermissionCodes.notify.read));
@@ -305,13 +326,7 @@ function getSubject(item: NotifyDetail): string {
}
async function toDetail(item: NotifyDetail): Promise<void> {
if (!item.id) {
return;
}
await router.push({
name: "UserNotifyDetail",
params: { id: item.id }
});
openDetail(item.id || "");
}
// ---------- 生命周期 ----------
@@ -334,7 +349,7 @@ onMounted(async () => {
<style scoped lang="less">
.notify-list {
display: flex;
padding: calc(var(--app-nav-height) + 1rem) 0 1rem 0;
padding: calc(var(--tui-nav-height) + 1rem) 0 1rem 0;
min-height: 100%;
flex-direction: column;