224 lines
6.0 KiB
Vue
224 lines
6.0 KiB
Vue
<!-- 页面编号:R-06;用途:礼仪详情、参与者与受控状态。 -->
|
||
<template>
|
||
<view class="ritual-detail-page" :class="stateClasses">
|
||
<ModulePageBackground module="records" />
|
||
<view class="page-header">
|
||
<PageHeader
|
||
title="礼仪详情"
|
||
:action="ritualState === 'ready' ? '编辑' : ''"
|
||
@action="editRitual"
|
||
/>
|
||
</view>
|
||
<view v-if="ritualState === 'loading'" class="page-loading">
|
||
<AppLoading
|
||
text="正在读取礼仪详情"
|
||
description="请稍候,正在整理活动与参与信息。"
|
||
/>
|
||
</view>
|
||
<view v-else class="page-content">
|
||
<template v-if="ritualState === 'ready'">
|
||
<view class="detail-card">
|
||
<text>{{ ritualDetail.status }}</text>
|
||
<text>{{ ritualDetail.name }}</text>
|
||
<text>{{ ritualDetail.date }} · {{ ritualDetail.place }}</text>
|
||
<text>{{ ritualDetail.description }}</text>
|
||
</view>
|
||
<view class="participant-card">
|
||
<view>
|
||
<text>参与家人</text>
|
||
<text>{{ participants.length }} 人</text>
|
||
</view>
|
||
<view v-for="person in participants" :key="person.id">
|
||
<text>{{ person.name }}</text>
|
||
<text>{{ person.role }}</text>
|
||
</view>
|
||
</view>
|
||
<AppButton block label="编辑活动" @click="editRitual" />
|
||
</template>
|
||
<view v-else class="state-card">
|
||
<text>{{ stateCopy.title }}</text>
|
||
<text>{{ stateCopy.copy }}</text>
|
||
<AppButton
|
||
:type="ritualState === 'error' ? 'secondary' : 'primary'"
|
||
block
|
||
:label="ritualState === 'error' ? '重新查看' : '返回礼仪列表'"
|
||
@click="ritualState === 'error' ? restoreRitual() : backToRituals()"
|
||
/>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
<script setup>
|
||
import { computed, reactive, ref } from "vue";
|
||
import { onLoad } from "@dcloudio/uni-app";
|
||
import AppButton from "@/components/AppButton.vue";
|
||
import AppLoading from "@/components/AppLoading.vue";
|
||
import ModulePageBackground from "@/components/ModulePageBackground.vue";
|
||
import PageHeader from "@/components/PageHeader.vue";
|
||
const records = [
|
||
{
|
||
id: "501",
|
||
name: "清明祭祖",
|
||
status: "报名中",
|
||
date: "2025 年 4 月 4 日",
|
||
place: "汤氏宗祠",
|
||
description: "缅怀先祖,整理祭扫礼序,并由长辈讲述家族往事。",
|
||
},
|
||
{
|
||
id: "502",
|
||
name: "中秋家宴",
|
||
status: "筹备中",
|
||
date: "2025 年 9 月 17 日",
|
||
place: "祖居院落",
|
||
description: "家人团聚,共叙近况并整理年度家族影像。",
|
||
},
|
||
];
|
||
const ritualDetail = reactive({ ...records[0] });
|
||
const ritualId = ref("501");
|
||
const ritualState = ref("loading");
|
||
const participants = ref([
|
||
{ id: 1, name: "汤文正", role: "主理人" },
|
||
{ id: 2, name: "汤淑华", role: "家族长辈" },
|
||
{ id: 3, name: "汤文清", role: "影像记录" },
|
||
]);
|
||
const stateClasses = computed(() => ({
|
||
"ritual-state--expired": ritualState.value === "expired",
|
||
"ritual-state--privacy": ritualState.value === "privacy",
|
||
"ritual-state--error": ritualState.value === "error",
|
||
}));
|
||
const stateCopy = computed(
|
||
() =>
|
||
({
|
||
expired: {
|
||
title: "活动已失效",
|
||
copy: "这项礼仪活动已取消或结束归档,请返回列表查看其他活动。",
|
||
},
|
||
privacy: {
|
||
title: "活动信息未公开",
|
||
copy: "当前活动只向受邀家人展示,请返回礼仪列表。",
|
||
},
|
||
error: {
|
||
title: "礼仪详情暂不可用",
|
||
copy: "请稍后重新查看,已有活动不会受到影响。",
|
||
},
|
||
})[ritualState.value] || {},
|
||
);
|
||
onLoad((q) => {
|
||
ritualId.value = String(q.ritualId || "501");
|
||
const selected = records.find((x) => x.id === ritualId.value);
|
||
if (selected) Object.assign(ritualDetail, selected);
|
||
ritualState.value = ["loading", "expired", "privacy", "error"].includes(
|
||
q.state,
|
||
)
|
||
? q.state
|
||
: selected
|
||
? "ready"
|
||
: "expired";
|
||
});
|
||
const editRitual = () =>
|
||
uni.navigateTo({
|
||
url: `/pages/records/r07-ritual-editor?mode=edit&ritualId=${ritualId.value}`,
|
||
});
|
||
const restoreRitual = () => {
|
||
ritualState.value = "ready";
|
||
};
|
||
const backToRituals = () =>
|
||
uni.redirectTo({ url: "/pages/records/r05-ritual-list" });
|
||
</script>
|
||
<style scoped lang="scss">
|
||
@use "../../styles/adaptive-frame-profiles.scss" as adaptive;
|
||
|
||
.ritual-detail-page {
|
||
display: flex;
|
||
min-height: 100vh;
|
||
flex-direction: column;
|
||
background: $paper;
|
||
}
|
||
.page-header,
|
||
.page-loading,
|
||
.page-content {
|
||
z-index: 1;
|
||
}
|
||
.page-loading {
|
||
min-height: calc(100vh - 100rpx);
|
||
}
|
||
.page-content {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 16rpx;
|
||
padding: 18rpx 24rpx 72rpx;
|
||
}
|
||
.detail-card,
|
||
.participant-card,
|
||
.state-card {
|
||
box-sizing: border-box;
|
||
padding: 42rpx 46rpx;
|
||
@include adaptive.adaptive-records-content;
|
||
}
|
||
.detail-card > text {
|
||
display: block;
|
||
}
|
||
.detail-card > text:first-child {
|
||
color: $brand-red;
|
||
font-size: 21rpx;
|
||
}
|
||
.detail-card > text:nth-child(2) {
|
||
margin-top: 8rpx;
|
||
color: $ink;
|
||
font-size: 36rpx;
|
||
font-weight: 700;
|
||
}
|
||
.detail-card > text:nth-child(3) {
|
||
margin-top: 10rpx;
|
||
color: $ink-muted;
|
||
font-size: 23rpx;
|
||
}
|
||
.detail-card > text:last-child {
|
||
margin-top: 20rpx;
|
||
color: $ink;
|
||
font-size: 24rpx;
|
||
line-height: 1.7;
|
||
}
|
||
.participant-card > view {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: space-between;
|
||
gap: 8rpx 18rpx;
|
||
min-height: 52rpx;
|
||
align-items: center;
|
||
color: $ink;
|
||
font-size: 23rpx;
|
||
}
|
||
.participant-card > view:first-child {
|
||
color: $brand-red;
|
||
font-weight: 700;
|
||
}
|
||
.participant-card > view + view {
|
||
margin-top: 9rpx;
|
||
padding-top: 9rpx;
|
||
border-top: 1px solid rgba(136, 84, 42, 0.18);
|
||
}
|
||
.state-card {
|
||
min-height: 340rpx;
|
||
padding-top: 78rpx;
|
||
text-align: center;
|
||
}
|
||
.state-card > text {
|
||
display: block;
|
||
}
|
||
.state-card > text:first-child {
|
||
color: $ink;
|
||
font-size: 35rpx;
|
||
font-weight: 700;
|
||
}
|
||
.state-card > text:nth-child(2) {
|
||
margin-top: 18rpx;
|
||
color: $ink-muted;
|
||
font-size: 24rpx;
|
||
line-height: 1.65;
|
||
}
|
||
.state-card .app-button {
|
||
margin-top: 28rpx;
|
||
}
|
||
</style>
|