feat(community,faq): support dynamic community topics, notice, and FAQ center

这个提交包含在:
xcbyy
2026-10-10 10:04:49 +08:00
父节点 82ba59f373
当前提交 8845fbe7cb
共有 5 个文件被更改,包括 383 次插入 和 16 次删除

查看文件

@@ -21,6 +21,12 @@
</view>
</view>
<!-- 友圈置顶头条公告 (根据后台配置动态展示) -->
<view class="community-notice-bar" v-if="communityNotice && communityNotice.title">
<view class="notice-badge">{{ communityNotice.tag || '置顶公告' }}</view>
<text class="notice-title-text">{{ communityNotice.title }}:{{ communityNotice.content }}</text>
</view>
<!-- 分类筛选栏 (高能矢量Tab标签与标准HOT角标) -->
<view class="feed-tabs-wrap">
<scroll-view class="feed-scroll" scroll-x :show-scrollbar="false">
@@ -299,11 +305,20 @@ import SkeletonScreen from '@/components/SkeletonScreen.vue';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
import { getNavBarInfo } from '@/common/nav.js';
import { getPosts, createPost, likePost, getPostComments, addPostComment, applyPostParty, uploadImage } from '@/common/api.js';
import { getPosts, createPost, likePost, getPostComments, addPostComment, applyPostParty, uploadImage, getPlatformConfigs } from '@/common/api.js';
const isLoading = ref(true);
const currentThemeKey = ref(getCurrentThemeKey());
const navInfo = ref(getNavBarInfo());
const communityNotice = ref(null);
const availableTopics = ref([
'三里屯探店',
'铜锅涮肉AA',
'国服上分车队',
'饭搭子招募',
'工体纯K麦霸',
'同城搭子招募'
]);
const navStyle = computed(() => {
return {
@@ -334,6 +349,7 @@ onMounted(() => {
applyThemeToNativeUI(currentThemeKey.value);
uni.$on('theme-change', onThemeChanged);
loadInitialCommunity();
loadPlatformCommunityConfigs();
});
onShow(() => {
@@ -342,6 +358,7 @@ onShow(() => {
applyThemeToNativeUI(currentThemeKey.value);
uni.hideTabBar({ animation: false, fail: () => {} });
loadRemotePosts();
loadPlatformCommunityConfigs();
});
onUnmounted(() => {
@@ -359,6 +376,22 @@ const loadRemotePosts = async () => {
}
};
const loadPlatformCommunityConfigs = async () => {
try {
const configs = await getPlatformConfigs();
if (configs && typeof configs === 'object') {
if (configs.community_notice && configs.community_notice.title) {
communityNotice.value = configs.community_notice;
}
if (Array.isArray(configs.community_topics) && configs.community_topics.length > 0) {
availableTopics.value = configs.community_topics.map((t) => t.name || t);
}
}
} catch (e) {
console.warn('[Community] 获取平台话题公告异常降级:', e);
}
};
const feedTabs = ref([
{ key: 'all', name: '全部推荐', icon: ICONS.gameAll, hot: false },
@@ -588,15 +621,6 @@ const publishCategories = [
{ key: 'highlight', name: '生活随笔' }
];
const availableTopics = [
'三里屯探店',
'铜锅涮肉AA',
'王者上分',
'饭搭子招募',
'KTV麦霸',
'周末微醺'
];
const newPostForm = ref({
category: 'partner',
content: '',
@@ -865,6 +889,36 @@ const submitPublishPost = async () => {
}
}
.community-notice-bar {
display: flex;
align-items: center;
background: rgba(99, 102, 241, 0.12);
border: 1px solid rgba(99, 102, 241, 0.3);
border-radius: 12rpx;
padding: 12rpx 20rpx;
margin-bottom: 20rpx;
gap: 12rpx;
.notice-badge {
font-size: 20rpx;
font-weight: 700;
color: #FFFFFF;
background: linear-gradient(135deg, #F43F5E, #FB7185);
padding: 2rpx 12rpx;
border-radius: 6rpx;
flex-shrink: 0;
}
.notice-title-text {
font-size: 22rpx;
color: #CBD5E1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
}
}
.feed-tabs-wrap {
margin-bottom: 24rpx;
width: 100%;