|
|
@@ -47,11 +47,15 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 公告卡片 -->
|
|
|
- <view class="announcement-card" @click="handleAnnouncement">
|
|
|
+ <view class="announcement-card" @click="handleAnnouncement" v-if="currentAnnouncement">
|
|
|
<text class="announcement-tag">公告</text>
|
|
|
- <text class="announcement-content">恭喜高红娘成功助力丁先生和贾女士牵手成功!</text>
|
|
|
+ <text class="announcement-content">{{ currentAnnouncement.content }}</text>
|
|
|
<view class="arrow-right"></view>
|
|
|
</view>
|
|
|
+ <view class="announcement-card" v-else>
|
|
|
+ <text class="announcement-tag">公告</text>
|
|
|
+ <text class="announcement-content">暂无公告</text>
|
|
|
+ </view>
|
|
|
|
|
|
<!-- 功能菜单 -->
|
|
|
<view class="menu-grid">
|
|
|
@@ -96,7 +100,7 @@
|
|
|
</view>
|
|
|
<view class="likes-info">
|
|
|
<text class="heart-small">❤️</text>
|
|
|
- <text class="like-count">{{ item.success_couples || 0 }}</text>
|
|
|
+ <text class="like-count">{{ item.likes || 0 }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -137,11 +141,19 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- bestMatchmakers: []
|
|
|
+ bestMatchmakers: [],
|
|
|
+ announcements: [],
|
|
|
+ currentAnnouncementIndex: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ currentAnnouncement() {
|
|
|
+ return this.announcements.length > 0 ? this.announcements[this.currentAnnouncementIndex] : null
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
this.loadRankingData()
|
|
|
+ this.loadAnnouncements()
|
|
|
},
|
|
|
methods: {
|
|
|
// 加载排行榜数据(取前3名)
|
|
|
@@ -160,17 +172,36 @@ export default {
|
|
|
console.error('加载排行榜数据失败:', e)
|
|
|
}
|
|
|
},
|
|
|
- // 搜索
|
|
|
- handleSearch() {
|
|
|
- // 实现搜索功能
|
|
|
+ // 加载公告数据
|
|
|
+ async loadAnnouncements() {
|
|
|
+ try {
|
|
|
+ const res = await api.home.getNotices()
|
|
|
+ if (res && Array.isArray(res)) {
|
|
|
+ this.announcements = res
|
|
|
+ } else if (res && res.data && Array.isArray(res.data)) {
|
|
|
+ this.announcements = res.data
|
|
|
+ }
|
|
|
+ // 如果有多条公告,自动轮播
|
|
|
+ if (this.announcements.length > 1) {
|
|
|
+ this.startAnnouncementCarousel()
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('加载公告失败:', e)
|
|
|
+ }
|
|
|
},
|
|
|
- // 设置
|
|
|
- handleSettings() {
|
|
|
- // 实现设置功能
|
|
|
+ // 公告轮播
|
|
|
+ startAnnouncementCarousel() {
|
|
|
+ setInterval(() => {
|
|
|
+ this.currentAnnouncementIndex = (this.currentAnnouncementIndex + 1) % this.announcements.length
|
|
|
+ }, 5000)
|
|
|
},
|
|
|
// 公告点击
|
|
|
handleAnnouncement() {
|
|
|
- // 跳转到公告详情
|
|
|
+ if (this.currentAnnouncement) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/announcement/list'
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 导航到我的资源
|
|
|
navigateToMyResources() {
|