Files
jiapuapp/pages/family/f01-family-feed.vue
T
2026-07-14 07:01:45 +08:00

70 lines
4.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- 页面编号F-01用途家族动态首页 -->
<template>
<view class="page-shell family-page">
<view class="family-top"><view><text class="top-kicker">家族共建</text><text class="page-name">家族记事</text></view><text class="publish" @click="publishFeed">发布动态</text></view>
<view v-if="loadError" class="error-copy">{{ loadError }}</view>
<view class="content-rail"><view v-for="item in sections" :key="item.type" class="rail-item" @click="openSection(item.type)"><text>{{ item.name }}</text><text>{{ item.detail }}</text></view></view>
<view class="feed-heading"><text class="section-title">家族近况</text><text class="feed-filter">全部动态</text></view>
<view class="feed-list"><view v-for="feed in feeds" :key="feed.id" class="feed-card paper-card"><view class="feed-meta"><text>{{ feed.type || feed.feedType || '动态' }}</text><text>{{ feed.date || feed.createTime || '' }}</text></view><text class="feed-title">{{ feed.title || '家族动态' }}</text><text class="feed-content">{{ feed.content || feed.feedContent }}</text><text class="feed-author">发布人:{{ feed.author || feed.creatorName || '族人' }}</text></view><view v-if="!feeds.length && !loadError" class="empty-copy">暂未发布家族动态</view></view>
<AppTabbar active="family" />
</view>
</template>
<script setup>
import { onMounted, ref } from 'vue'
import AppTabbar from '@/components/AppTabbar.vue'
import { appApi } from '@/utils/api.js'
import { genealogyContext } from '@/utils/genealogy-context.js'
const feeds = ref([])
const loadError = ref('')
const genealogyId = ref('')
const sections = [
{ type: 'article', name: '谱文', detail: '族史与家训' },
{ type: 'album', name: '相册', detail: '珍存旧影' },
{ type: 'ceremony', name: '祭祀', detail: '慎终追远' },
{ type: 'record', name: '族务', detail: '共同记事' }
]
onMounted(async () => {
genealogyId.value = genealogyContext.getCurrentGenealogyId()
if (!genealogyId.value) { loadError.value = '请先从“我的家谱”选择一个家谱。'; return }
try { feeds.value = await appApi.getFeeds(genealogyId.value) } catch (error) { loadError.value = error.message || '家族动态加载失败。' }
})
const openSection = (type) => {
const routes = {
article: '/pages/family/f04-article-list',
album: '/pages/family/f07-album-list',
ceremony: '/pages/records/r05-ritual-list',
record: '/pages/records/r10-memo-list'
}
uni.navigateTo({ url: `${routes[type]}?genealogyId=${genealogyId.value}` })
}
const publishFeed = () => {
if (!genealogyId.value) { uni.showToast({ title: '请先选择家谱', icon: 'none' }); return }
uni.navigateTo({ url: `/pages/family/f02-publish-feed?type=feed&genealogyId=${genealogyId.value}` })
}
</script>
<style scoped lang="scss">
.family-page { padding: 42rpx 28rpx 178rpx; }
.family-top { display: flex; align-items: flex-start; justify-content: space-between; }
.top-kicker { display: block; color: $brand-red; font-size: 22rpx; letter-spacing: 5rpx; }
.page-name { display: block; margin-top: 10rpx; color: $ink; font-family: serif; font-size: 52rpx; font-weight: 700; letter-spacing: 5rpx; }
.publish { margin-top: 22rpx; color: $brand-red; font-size: 26rpx; }
.error-copy { margin-top: 24rpx; color: $brand-red; font-size: 24rpx; }
.content-rail { display: flex; gap: 12rpx; margin-top: 34rpx; overflow-x: auto; }
.rail-item { min-width: 150rpx; padding: 18rpx; border: 1rpx solid $gold-soft; background: #fffaf0; }
.rail-item text { display: block; color: $ink; font-size: 28rpx; font-weight: 700; }
.rail-item text + text { margin-top: 8rpx; color: $ink-muted; font-size: 20rpx; font-weight: 400; }
.feed-heading { display: flex; justify-content: space-between; align-items: center; margin-top: 38rpx; }
.feed-filter { color: $brand-red; font-size: 24rpx; }
.feed-list { display: flex; flex-direction: column; gap: 18rpx; margin-top: 20rpx; }
.feed-card { padding: 28rpx; }
.feed-meta { display: flex; justify-content: space-between; color: $gold; font-size: 21rpx; }
.feed-title { display: block; margin-top: 16rpx; color: $ink; font-size: 32rpx; font-weight: 700; }
.feed-content { display: block; margin-top: 12rpx; color: $ink-muted; font-size: 25rpx; line-height: 1.65; }
.feed-author { display: block; margin-top: 16rpx; color: #9a8c78; font-size: 21rpx; }
.empty-copy { padding: 80rpx 0; color: $ink-muted; font-size: 26rpx; text-align: center; }
</style>