修改完成待测试

This commit is contained in:
2026-09-13 17:45:47 +08:00
parent 9ad572907b
commit bbc024f7f2
80 changed files with 3844 additions and 1672 deletions
+14 -89
View File
@@ -3,25 +3,16 @@
<ModulePageBackground module="family" />
<view class="family-page__header"
><PageHeader
root
title="家族动态"
custom-back
:action="hasValidContext ? '发布' : ''"
@back="requestBack"
@action="toPublish"
/></view>
<view class="feed-content">
<view class="feed-heading"
><text>家族圈</text><text>家宴通知与共同记忆</text></view
>
<view v-if="hasValidContext" class="feed-shortcuts"
><button
v-for="item in shortcuts"
:key="item.key"
class="feed-shortcut"
:aria-label="`打开${item.label}`"
@click="openSection(item.key)"
><text>{{ item.label }}</text></button
></view
>
<AppLoading
v-if="feedState === 'loading'"
text="正在读取家族动态"
@@ -57,15 +48,13 @@
><text>{{ stateCopy.action }}</text></view
>
</view>
<AppTabbar active="family" />
</view>
</template>
<script setup>
import { computed, ref } from "vue";
import { onLoad, onShow, onUnload } from "@dcloudio/uni-app";
import { onBackPress, onLoad, onShow, onUnload } from "@dcloudio/uni-app";
import AppLoading from "@/components/AppLoading.vue";
import AppTabbar from "@/components/AppTabbar.vue";
import FamilyFeedMedia from "@/components/family/FeedMedia.vue";
import ModulePageBackground from "@/components/ModulePageBackground.vue";
import PageHeader from "@/components/PageHeader.vue";
@@ -75,8 +64,7 @@ import {
} from "@/services/api/request-controller.js";
import { familyFeedApi } from "@/services/api/family-feed-service.js";
import { formatMinuteTimestamp } from "@/utils/display-time.js";
import { genealogyContext } from "@/utils/genealogy/context.js";
import { goRoot, openPage } from "@/utils/navigation/gateway.js";
import { goBack, handleBackPress, openPage } from "@/utils/navigation/gateway.js";
const genealogyId = ref("");
const hasValidContext = ref(false);
@@ -108,17 +96,6 @@ const feedPreview = (content) => {
const text = String(content || "").trim();
return text.length > 96 ? `${text.slice(0, 96).trimEnd()}` : text;
};
const shortcuts = [
{ key: "articles", label: "谱文" },
{ key: "albums", label: "相册" },
{ key: "rituals", label: "礼仪" },
{ key: "memos", label: "备忘" },
{ key: "benefactors", label: "家族恩人" },
{ key: "people", label: "人物录" },
{ key: "gifts", label: "贺礼簿" },
{ key: "merits", label: "功德录" },
{ key: "videos", label: "家族视频" },
];
const stateCopy = computed(() =>
!hasValidContext.value
? {
@@ -205,13 +182,7 @@ const loadMoreFeeds = async () => {
}
};
onLoad((query) => {
const supplied = Object.prototype.hasOwnProperty.call(
query || {},
"genealogyId",
);
genealogyId.value = supplied
? String(query.genealogyId || "")
: String(genealogyContext.getCurrentGenealogyId() || "");
genealogyId.value = String(query?.genealogyId || "");
hasValidContext.value = /^[1-9]\d*$/.test(genealogyId.value);
if (hasValidContext.value) void loadFeeds();
else feedState.value = "error";
@@ -230,33 +201,16 @@ onUnload(() => {
});
const toPublish = () =>
hasValidContext.value
? openPage("F02", { genealogyId: genealogyId.value, mode: "create" }, "F01")
: goRoot("G01");
? openPage("F02", { genealogyId: genealogyId.value, mode: "create" }, "F12")
: goBack();
const openFeed = (item) =>
openPage("F03", { genealogyId: genealogyId.value, feedId: item.id }, "F01");
const openSection = (key) => {
const routes = {
articles: "F04",
albums: "F07",
rituals: "R05",
memos: "R10",
benefactors: "R10",
people: "R01",
gifts: "R03",
merits: "R11",
videos: "F10",
};
return openPage(
routes[key],
{
genealogyId: genealogyId.value,
...(key === "benefactors" ? { memoType: "benefactor" } : {}),
},
"F01",
);
openPage("F03", { genealogyId: genealogyId.value, feedId: item.id }, "F12");
const handlePrimaryAction = () => {
if (!hasValidContext.value) return goBack();
return feedState.value === "error" ? loadFeeds() : toPublish();
};
const handlePrimaryAction = () =>
feedState.value === "error" ? loadFeeds() : toPublish();
const requestBack = () => goBack();
onBackPress((event) => handleBackPress(event, requestBack));
</script>
<style scoped lang="scss">
@@ -273,7 +227,7 @@ const handlePrimaryAction = () =>
}
.feed-content {
flex: 1;
padding: 24rpx 24rpx calc(190rpx + env(safe-area-inset-bottom));
padding: 24rpx 24rpx calc(48rpx + env(safe-area-inset-bottom));
}
.feed-heading text {
display: block;
@@ -289,29 +243,6 @@ const handlePrimaryAction = () =>
color: $ink-muted;
font-size: clamp(14px, 23rpx, 17px);
}
.feed-shortcuts {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12rpx;
margin-top: 18rpx;
}
.feed-shortcut {
box-sizing: border-box;
min-height: 48px;
margin: 0;
padding: 0;
border: 1rpx solid rgba(181, 137, 63, 0.45);
border-radius: 8rpx;
background: rgba(255, 252, 244, 0.58);
display: flex;
align-items: center;
justify-content: center;
}
.feed-shortcut text {
color: $ink;
font-size: clamp(14px, 22rpx, 17px);
font-weight: 700;
}
.feed-list {
margin-top: 22rpx;
}
@@ -347,12 +278,6 @@ const handlePrimaryAction = () =>
color: $ink-muted;
font-size: clamp(13px, 21rpx, 16px);
}
.feed-shortcut::after {
border: 0;
}
.feed-shortcut:active {
background: rgba(181, 137, 63, 0.1);
}
.feed-card__reason {
margin-top: 8rpx;
color: #9a6555;