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
+38 -5
View File
@@ -1,11 +1,11 @@
<template>
<div class="page-layout navbar">
<div class="tui-page-layout tui-navbar">
<t-navbar
fixed
:z-index="20"
title="通知详情"
left-arrow
@left-click="$router.back()"
@left-click="goBack"
>
<template #right>
<t-button
@@ -18,7 +18,7 @@
/>
</template>
</t-navbar>
<main class="page-content scroll column bg-white">
<main class="tui-page-content scroll column bg-white">
<div v-can="corePermissionCodes.notify.read" class="notify-detail">
<notify-content
v-if="detail"
@@ -42,6 +42,7 @@ import { DialogPlugin } from "tdesign-mobile-vue";
import { getAttachmentReadURL } from "@/utils/attachment";
import { corePermissionCodes } from "@/utils/permission";
import { Message } from "@/utils/message.ts";
import { useExpandToMaster, usePane } from "timi-tdesign-mobile";
import NotifyContent from "@/pages/notify/component/NotifyContent.vue";
@@ -50,9 +51,37 @@ import NotifyContent from "@/pages/notify/component/NotifyContent.vue";
import { getErrorMessage } from "@/utils/error";
const props = withDefaults(defineProps<{
/** 指定通知 ID 时忽略路由参数,用于平板主从分栏的内联渲染。 */
notifyId?: string;
}>(), {
notifyId: ""
});
const route = useRoute();
const router = useRouter();
function resolveId(): string {
return props.notifyId || String(route.params.id || "");
}
// 竖屏整页进来后转成横屏:回到列表页并恢复右栏选中,而不是继续停在整页详情
useExpandToMaster({
path: "/notify",
id: () => resolveId()
});
/** 非空说明当前被内联在主从分栏的右栏里 */
const pane = usePane();
function goBack(): void {
if (pane) {
pane.close();
return;
}
void router.back();
}
defineOptions({
name: "UserNotifyDetail"
});
@@ -67,7 +96,7 @@ let loadToken = 0;
async function loadDetail(): Promise<void> {
const requestToken = loadToken + 1;
loadToken = requestToken;
const detailId = String(route.params.id || "");
const detailId = resolveId();
if (!detailId) {
detail.value = undefined;
return;
@@ -124,6 +153,10 @@ async function deleteDetail(detailId: string): Promise<void> {
try {
await NotifyAPI.deleteInternal(detailId);
Message.success("通知已删除");
if (pane) {
pane.close();
return;
}
await router.replace({ name: "UserNotifyList" });
} catch (error) {
Message.error(getErrorMessage(error, "通知删除失败"));
@@ -161,7 +194,7 @@ function resolveAttachmentUrl(attachmentId: string): string {
// ---------- 生命周期 ----------
watch(() => route.params.id, async () => {
watch(() => [props.notifyId, route.params.id], async () => {
await loadDetail();
}, { immediate: true });