<template>
|
|
<view class="recommended-activities">
|
|
<view class="activities-header">
|
|
<view class="header-left">
|
|
<image class="header-icon" src="/static/推荐活动.png" mode="aspectFit"></image>
|
|
<!-- <text class="header-title">推荐活动</text> -->
|
|
</view>
|
|
<view class="more" @click="goToMoreActivities">
|
|
<text class="more-text">更多</text>
|
|
<uv-icon name="arrow-right" color="#999" size="12"></uv-icon>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="activity-list">
|
|
<view class="activity-item" v-for="(item, index) in activityList" :key="index" @click="viewActivityDetail(item)">
|
|
<image class="activity-image" :src="item.image" mode="aspectFill"></image>
|
|
<view class="activity-info">
|
|
<view class="title-row">
|
|
<view class="activity-badge">
|
|
<text class="badge-text">30分</text>
|
|
</view>
|
|
<text class="activity-title">{{item.title}}</text>
|
|
</view>
|
|
<view class="activity-location">
|
|
<uv-icon name="map-fill" size="14" color="#999"></uv-icon>
|
|
<text class="location-text">{{item.address}}</text>
|
|
</view>
|
|
<view class="activity-time">
|
|
<uv-icon name="calendar" size="14" color="#999"></uv-icon>
|
|
<text class="time-text">{{item.activityTime}}</text>
|
|
</view>
|
|
<view class="activity-participants">
|
|
<uv-icon name="account-fill" size="14" color="#999"></uv-icon>
|
|
<text class="participants-text">{{item.numActivity}}人已报名</text>
|
|
</view>
|
|
</view>
|
|
<view class="activity-action">
|
|
<uv-button type="primary" size="mini" :text="item.isApply ? '已报名' : (item.numActivity >= item.numLimit ? '已满人' : '报名中')" @click.stop="signUpActivity(item)"></uv-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'RecommendedActivities',
|
|
data() {
|
|
return {
|
|
activityList: [
|
|
{
|
|
id: 1,
|
|
title: '关爱自闭儿童活动',
|
|
image: '/static/bannerImage.png',
|
|
location: '七步沙社区文化中心',
|
|
time: '2025-06-12 14:30',
|
|
participants: 12
|
|
},
|
|
{
|
|
id: 1,
|
|
title: '关爱自闭儿童活动',
|
|
image: '/static/bannerImage.png',
|
|
location: '七步沙社区文化中心',
|
|
time: '2025-06-12 14:30',
|
|
participants: 12
|
|
},
|
|
{
|
|
id: 1,
|
|
title: '关爱自闭儿童活动',
|
|
image: '/static/bannerImage.png',
|
|
location: '七步沙社区文化中心',
|
|
time: '2025-06-12 14:30',
|
|
participants: 12
|
|
},
|
|
{
|
|
id: 1,
|
|
title: '关爱自闭儿童活动',
|
|
image: '/static/bannerImage.png',
|
|
location: '七步沙社区文化中心',
|
|
time: '2025-06-12 14:30',
|
|
participants: 12
|
|
},
|
|
|
|
]
|
|
}
|
|
},
|
|
methods: {
|
|
goToMoreActivities() {
|
|
// 跳转到更多活动页面
|
|
uni.navigateTo({
|
|
url: '/subPages/index/activities'
|
|
})
|
|
},
|
|
viewActivityDetail(activity) {
|
|
// 查看活动详情
|
|
uni.navigateTo({
|
|
url: `/subPages/index/activityDetail?id=${activity.id}`
|
|
})
|
|
},
|
|
signUpActivity(activity) {
|
|
// 报名活动
|
|
uni.navigateTo({
|
|
url: `/subPages/index/activityDetail?id=${activity.id}`
|
|
})
|
|
},
|
|
async getActivityList() {
|
|
const res = await this.$api.activity.queryActivityList({
|
|
pageNo: 1,
|
|
pageSize: 5,
|
|
isHot: 1
|
|
})
|
|
this.activityList = res.result.records
|
|
},
|
|
},
|
|
created() {
|
|
this.getActivityList()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.recommended-activities {
|
|
margin: 20rpx;
|
|
// background-color: #fff;
|
|
border-radius: 12rpx;
|
|
// padding: 20rpx;
|
|
|
|
.activities-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 10rpx;
|
|
padding-left: 20rpx;
|
|
.header-left {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.header-icon {
|
|
width: 158rpx;
|
|
height: 50rpx;
|
|
margin-right: 10rpx;
|
|
}
|
|
|
|
.header-title {
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
color: $uni-text-color;
|
|
}
|
|
}
|
|
|
|
.more {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.more-text {
|
|
font-size: 24rpx;
|
|
color: $uni-text-color-grey;
|
|
margin-right: 4rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.activity-list {
|
|
.activity-item {
|
|
display: flex;
|
|
margin-bottom: 30rpx;
|
|
background: #fff;
|
|
border-radius: 12rpx;
|
|
padding: 20rpx;
|
|
|
|
.activity-image {
|
|
width: 180rpx;
|
|
height: 180rpx;
|
|
border-radius: 8rpx;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.activity-info {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
|
|
.title-row {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 10rpx;
|
|
|
|
.activity-badge {
|
|
width: 31px;
|
|
height: 20px;
|
|
background: #218cdd;
|
|
border-radius: 3.5px;
|
|
margin-right: 7rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
.badge-text {
|
|
font-size: 18rpx;
|
|
color: #fff;
|
|
// font-weight: bold;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.activity-title {
|
|
font-size: 28rpx;
|
|
font-weight: bold;
|
|
color: $uni-text-color;
|
|
}
|
|
|
|
.activity-location, .activity-time, .activity-participants {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 6rpx;
|
|
|
|
.location-text, .time-text, .participants-text {
|
|
font-size: 24rpx;
|
|
color: $uni-text-color-grey;
|
|
margin-left: 6rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.activity-action {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
padding-bottom: 10rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
</style>
|