index.vue
4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!--
* @Date: 2026-02-05 19:48:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2026-02-05 20:09:34
* @FilePath: /lls_program/src/pages/CheckinMap/index.vue
* @Description: 便民地图列表页
-->
<template>
<view class="checkin-map-page">
<!-- 列表内容 -->
<view class="map-list">
<view v-for="item in mapList" :key="item.id" class="map-card" @tap="handleCardClick(item)">
<!-- 封面图 -->
<view class="card-cover">
<image :src="item.cover" mode="aspectFill" class="cover-image" />
</view>
<!-- 卡片内容 -->
<view class="card-content">
<text class="card-title">{{ item.title }}</text>
<view class="card-time-wrapper">
<text class="card-time-label">活动日期</text>
<text class="card-time">{{ item.timeRange }}</text>
</view>
<view class="enter-btn" @tap.stop="handleEnter(item)">
<text class="enter-btn-text">立即进入</text>
</view>
</view>
</view>
</view>
<BottomNav />
</view>
</template>
<script setup>
import { ref } from 'vue'
import Taro from '@tarojs/taro'
import BottomNav from '@/components/BottomNav.vue'
/**
* Mock 便民地图数据
*/
const mapList = ref([
{
id: 1,
title: '重阳登高打卡',
cover: 'https://picsum.photos/400/300?random=1',
timeRange: '2025.09.06~2025.10.31',
activityId: 'chongyang_2024',
},
{
id: 2,
title: '公园晨跑打卡',
cover: 'https://picsum.photos/400/300?random=2',
timeRange: '2025.09.01~2025.12.31',
activityId: 'morning_run_2024',
},
{
id: 3,
title: '社区健身打卡',
cover: 'https://picsum.photos/400/300?random=3',
timeRange: '2025.08.01~2025.12.31',
activityId: 'community_fitness',
},
{
id: 4,
title: '周末徒步打卡',
cover: 'https://picsum.photos/400/300?random=4',
timeRange: '2025.09.15~2025.11.30',
activityId: 'weekend_hike',
},
{
id: 5,
title: '秋日赏菊打卡',
cover: 'https://picsum.photos/400/300?random=5',
timeRange: '2025.10.15~2025.11.15',
activityId: 'autumn_chrysanthemum',
},
{
id: 6,
title: '古镇文化打卡',
cover: 'https://picsum.photos/400/300?random=6',
timeRange: '2025.10.01~2025.10.31',
activityId: 'ancient_town',
},
])
/**
* 处理卡片点击事件
* @param {Object} item - 卡片数据
*/
const handleCardClick = item => {
console.log('点击卡片:', item)
// 可以在这里添加预览或其他交互
}
/**
* 进入打卡活动
* @param {Object} item - 活动数据
*/
const handleEnter = item => {
console.log('进入活动:', item)
// 跳转到活动封面页,带上活动ID参数
Taro.navigateTo({
url: `/pages/ActivitiesCover/index?activityId=${item.activityId}&title=${encodeURIComponent(item.title)}`,
})
}
</script>
<style lang="less">
.checkin-map-page {
min-height: 100vh;
background-color: #54abae; /* 项目主色调 */
padding-bottom: 160px; /* 为底部导航留出空间 */
}
.page-header {
padding: 40px 30px 20px;
text-align: center;
}
.page-title {
font-size: 48px;
font-weight: bold;
color: #ffffff;
}
.map-list {
display: grid;
grid-template-columns: repeat(2, 1fr); /* 一行两个 */
gap: 20px;
padding: 20px 30px;
}
.map-card {
background-color: #ffffff;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: transform 0.2s;
}
.map-card:active {
transform: scale(0.98);
}
.card-cover {
width: 100%;
height: 360px;
overflow: hidden;
}
.cover-image {
width: 100%;
height: 100%;
}
.card-content {
padding: 20px;
display: flex;
flex-direction: column;
gap: 12px;
}
.card-title {
font-size: 28px;
font-weight: bold;
color: #1f2937;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.card-time-wrapper {
display: flex;
flex-direction: column;
gap: 4px;
}
.card-time-label {
font-size: 22px;
color: #9ca3af;
font-weight: 500;
}
.card-time {
font-size: 24px;
color: #1f2937;
font-weight: 600;
}
.enter-btn {
margin-top: 8px;
background-color: #54abae;
color: #ffffff;
padding: 16px;
border-radius: 8px;
text-align: center;
font-size: 26px;
font-weight: 500;
}
.enter-btn:active {
background-color: #4a979a;
}
.enter-btn-text {
color: #ffffff;
}
</style>