|
|
- <template>
- <view class="page">
- <!-- 导航栏 -->
-
- <!-- 签到列表 -->
- <view class="content">
- <view v-if="checkinList.length > 0" class="list">
- <view v-for="item in checkinList" :key="item.id" class="activity-item" @click="checkinActivity(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">{{ item.score }}分</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="签到码"
- ></uv-button>
- </view>
- </view>
- </view>
- <view v-else class="empty">
- <uv-empty mode="data" text="暂无可签到活动"></uv-empty>
- </view>
- </view>
-
-
- </view>
- </template>
-
- <script>
- export default {
- data() {
- return {
-
- checkinList: [
-
- ],
- pageNo: 1,
- pageSize: 10
- }
- },
- methods: {
-
- // 跳转到签到码界面
- checkinActivity(item) {
- uni.navigateTo({
- url: `/subPages/my/checkinCode?id=${item.id}`
- })
- },
- initData() {
- this.checkinList = []
- this.pageNo = 1
- },
- // 获取活动
- async getCheckinList() {
- const res = await this.$api.activity.queryActivityList({
- status: 0,
- pageNo: this.pageNo,
- pageSize: this.pageSize
- })
- if (res.result.records.length) {
- // this.checkinList = [...this.checkinList, ...res.result.records]
- this.checkinList.push(...res.result.records)
- this.pageNo++
- }else {
- uni.showToast({
- title: '暂无签到活动',
- icon: 'none'
- })
- }
- }
- },
- onShow() {
- this.initData()
- this.getCheckinList()
- },
- onReachBottom() {
- // this.initData()
- this.getCheckinList()
- },
- async onPullDownRefresh() {
- this.initData()
- await this.getCheckinList()
- uni.stopPullDownRefresh()
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .page {
- background-color: #f5f5f5;
- min-height: 100vh;
- }
-
- .content {
- padding: 20rpx;
- }
-
- .list {
- display: flex;
- flex-direction: column;
- gap: 20rpx;
- }
-
- .activity-item {
- display: flex;
- margin-bottom: 30rpx;
- background: #fff;
- border-radius: 12rpx;
- padding: 20rpx;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
- }
-
- .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: 62rpx;
- height: 40rpx;
- background: #218cdd;
- border-radius: 7rpx;
- margin-right: 14rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
-
- .badge-text {
- font-size: 18rpx;
- color: #fff;
- }
-
- .activity-title {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- line-height: 1.4;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- }
-
- .activity-location, .activity-time, .activity-participants {
- display: flex;
- align-items: center;
- margin-bottom: 6rpx;
- }
-
- .location-text, .time-text, .participants-text {
- font-size: 24rpx;
- color: #999;
- margin-left: 6rpx;
- }
-
- .activity-action {
- display: flex;
- align-items: flex-end;
- padding-bottom: 10rpx;
- }
-
- .empty {
- margin-top: 200rpx;
- }
- </style>
|