feat(HomePage): 添加热门搜索按钮和活动列表样式优化
在主页添加了热门搜索按钮,方便用户快速搜索相关内容。同时优化了活动列表的样式,包括背景颜色、图标和布局,提升用户体验。
Showing
2 changed files
with
114 additions
and
18 deletions
| ... | @@ -665,7 +665,7 @@ | ... | @@ -665,7 +665,7 @@ |
| 665 | "organizer_name": "百草园读书会", | 665 | "organizer_name": "百草园读书会", |
| 666 | "description": "诚挚邀请书友们参加《了不起的盖茨比》读书分享会。\n\n【活动内容】\n我们将共同探讨书中的核心思想,分享阅读感悟,碰撞思维火花。\n\n【活动安排】\n1. 开场与活动介绍(15分钟)2. 作品导读(30分钟)3. 分组讨论(45分钟)4. 交流分享(30分钟)5. 问答与总结(15分钟)\n\n【参与须知】\n参与者将通过视频会议软件连接,链接将在活动开始前发送。\n\n每一次阅读都是新的开始,每一次讨论都是思想的盛宴。", | 666 | "description": "诚挚邀请书友们参加《了不起的盖茨比》读书分享会。\n\n【活动内容】\n我们将共同探讨书中的核心思想,分享阅读感悟,碰撞思维火花。\n\n【活动安排】\n1. 开场与活动介绍(15分钟)2. 作品导读(30分钟)3. 分组讨论(45分钟)4. 交流分享(30分钟)5. 问答与总结(15分钟)\n\n【参与须知】\n参与者将通过视频会议软件连接,链接将在活动开始前发送。\n\n每一次阅读都是新的开始,每一次讨论都是思想的盛宴。", |
| 667 | "cover_image": "https://picsum.photos/seed/A0021/1600/900", | 667 | "cover_image": "https://picsum.photos/seed/A0021/1600/900", |
| 668 | - "start_time": "2025-05-04 07:13:57", | 668 | + "start_time": "2025-04-04 07:13:57", |
| 669 | "end_time": "2025-05-04 09:13:57", | 669 | "end_time": "2025-05-04 09:13:57", |
| 670 | "registration_start": "2025-04-16 21:13:57", | 670 | "registration_start": "2025-04-16 21:13:57", |
| 671 | "registration_end": "2025-05-03 21:13:57", | 671 | "registration_end": "2025-05-03 21:13:57", | ... | ... |
| ... | @@ -29,6 +29,20 @@ | ... | @@ -29,6 +29,20 @@ |
| 29 | </button> | 29 | </button> |
| 30 | </div> | 30 | </div> |
| 31 | </form> | 31 | </form> |
| 32 | + | ||
| 33 | + <div class="flex flex-wrap justify-center gap-2 text-sm"> | ||
| 34 | + <span class="text-gray-500">热门搜索:</span> | ||
| 35 | + <button @click="searchTerm = '小说'" | ||
| 36 | + class="bg-white px-3 py-1 rounded-full shadow-sm hover:shadow-md transition text-gray-700">小说</button> | ||
| 37 | + <button @click="searchTerm = '科普'" | ||
| 38 | + class="bg-white px-3 py-1 rounded-full shadow-sm hover:shadow-md transition text-gray-700">科普</button> | ||
| 39 | + <button @click="searchTerm = '心理学'" | ||
| 40 | + class="bg-white px-3 py-1 rounded-full shadow-sm hover:shadow-md transition text-gray-700">心理学</button> | ||
| 41 | + <button @click="searchTerm = '历史'" | ||
| 42 | + class="bg-white px-3 py-1 rounded-full shadow-sm hover:shadow-md transition text-gray-700">历史</button> | ||
| 43 | + <button @click="searchTerm = '线上'" | ||
| 44 | + class="bg-white px-3 py-1 rounded-full shadow-sm hover:shadow-md transition text-gray-700">线上</button> | ||
| 45 | + </div> | ||
| 32 | </div> | 46 | </div> |
| 33 | </div> | 47 | </div> |
| 34 | </section> | 48 | </section> |
| ... | @@ -52,33 +66,114 @@ | ... | @@ -52,33 +66,114 @@ |
| 52 | <!-- 活动列表 --> | 66 | <!-- 活动列表 --> |
| 53 | <template v-else> | 67 | <template v-else> |
| 54 | <!-- 进行中的活动 --> | 68 | <!-- 进行中的活动 --> |
| 55 | - <section v-if="ongoingActivities.length > 0" class="container mx-auto px-4 py-12"> | 69 | + <section v-if="ongoingActivities.length > 0" class="py-12 bg-white"> |
| 56 | - <h2 class="text-2xl font-bold text-gray-800 mb-8">正在进行的活动</h2> | 70 | + <div class="container mx-auto px-4"> |
| 71 | + <div class="flex justify-between items-center mb-6"> | ||
| 72 | + <h2 class="text-2xl font-bold text-gray-800"> | ||
| 73 | + <span className="inline-block w-3 h-3 bg-green-500 rounded-full mr-2"></span> | ||
| 74 | + 正在进行的活动 | ||
| 75 | + </h2> | ||
| 76 | + <router-link to="/activities" | ||
| 77 | + class="text-green-500 hover:text-green-600 font-medium flex items-center whitespace-nowrap min-w-[80px]">查看全部 | ||
| 78 | + <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 ml-1" viewBox="0 0 20 20" | ||
| 79 | + fill="currentColor"> | ||
| 80 | + <path fillRule="evenodd" | ||
| 81 | + d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" | ||
| 82 | + clipRule="evenodd" /> | ||
| 83 | + </svg> | ||
| 84 | + </router-link> | ||
| 85 | + </div> | ||
| 57 | <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | 86 | <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> |
| 58 | <ActivityCard v-for="activity in ongoingActivities" :key="activity.id" :activity="activity" /> | 87 | <ActivityCard v-for="activity in ongoingActivities" :key="activity.id" :activity="activity" /> |
| 59 | </div> | 88 | </div> |
| 89 | + </div> | ||
| 60 | </section> | 90 | </section> |
| 61 | 91 | ||
| 62 | <!-- 即将开始的活动 --> | 92 | <!-- 即将开始的活动 --> |
| 63 | - <section class="container mx-auto px-4 py-12"> | 93 | + <section class="py-12 bg-gray-50"> |
| 64 | - <div class="flex justify-between items-center mb-8"> | 94 | + <div class="container mx-auto px-4"> |
| 65 | - <h2 class="text-2xl font-bold text-gray-800">即将开始的活动</h2> | 95 | + <div class="flex justify-between items-center mb-6"> |
| 96 | + <h2 class="text-2xl font-bold text-gray-800"> | ||
| 97 | + <span class="inline-block w-3 h-3 bg-blue-500 rounded-full mr-2"></span> | ||
| 98 | + 即将开始的活动 | ||
| 99 | + </h2> | ||
| 100 | + <router-link to="/activities" | ||
| 101 | + class="text-green-500 hover:text-green-600 font-medium flex items-center whitespace-nowrap min-w-[80px]">查看全部 | ||
| 102 | + <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 ml-1" viewBox="0 0 20 20" | ||
| 103 | + fill="currentColor"> | ||
| 104 | + <path fillRule="evenodd" | ||
| 105 | + d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" | ||
| 106 | + clipRule="evenodd" /> | ||
| 107 | + </svg> | ||
| 108 | + </router-link> | ||
| 109 | + </div> | ||
| 110 | + | ||
| 111 | + <div v-if="upcomingActivities.length > 0" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | ||
| 112 | + <ActivityCard v-for="activity in upcomingActivities" :key="activity.id" :activity="activity" /> | ||
| 113 | + </div> | ||
| 114 | + | ||
| 115 | + <div v-else class="text-center py-12"> | ||
| 116 | + <p class="text-gray-600 mb-5">目前没有即将开始的活动</p> | ||
| 66 | <router-link to="/create-activity" | 117 | <router-link to="/create-activity" |
| 67 | class="px-6 py-2 bg-green-500 text-white rounded-full font-semibold hover:bg-green-600 transition duration-200"> | 118 | class="px-6 py-2 bg-green-500 text-white rounded-full font-semibold hover:bg-green-600 transition duration-200"> |
| 68 | - 创建活动 | 119 | + 创建一个活动 |
| 69 | </router-link> | 120 | </router-link> |
| 70 | </div> | 121 | </div> |
| 71 | - <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | ||
| 72 | - <ActivityCard v-for="activity in upcomingActivities" :key="activity.id" :activity="activity" /> | ||
| 73 | </div> | 122 | </div> |
| 74 | </section> | 123 | </section> |
| 75 | 124 | ||
| 76 | <!-- 往期活动 --> | 125 | <!-- 往期活动 --> |
| 77 | - <section class="container mx-auto px-4 py-12"> | 126 | + <section v-if="pastActivities.length > 0" class="py-12 bg-white"> |
| 78 | - <h2 class="text-2xl font-bold text-gray-800 mb-8">往期活动</h2> | 127 | + <div class="container mx-auto px-4"> |
| 79 | - <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | 128 | + <div class="flex justify-between items-center mb-6"> |
| 129 | + <h2 class="text-2xl font-bold text-gray-800"> | ||
| 130 | + <span className="inline-block w-3 h-3 bg-gray-400 rounded-full mr-2"></span> | ||
| 131 | + 精彩回顾 | ||
| 132 | + </h2> | ||
| 133 | + | ||
| 134 | + <router-link to="/activities" | ||
| 135 | + class="text-green-500 hover:text-green-600 font-medium flex items-center whitespace-nowrap min-w-[80px]">查看全部 | ||
| 136 | + <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 ml-1" viewBox="0 0 20 20" | ||
| 137 | + fill="currentColor"> | ||
| 138 | + <path fillRule="evenodd" | ||
| 139 | + d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" | ||
| 140 | + clipRule="evenodd" /> | ||
| 141 | + </svg> | ||
| 142 | + </router-link> | ||
| 143 | + </div> | ||
| 144 | + | ||
| 145 | + <div class="grid grid-cols-1 md:grid-cols-3 gap-4"> | ||
| 80 | <ActivityCard v-for="activity in pastActivities" :key="activity.id" :activity="activity" /> | 146 | <ActivityCard v-for="activity in pastActivities" :key="activity.id" :activity="activity" /> |
| 81 | </div> | 147 | </div> |
| 148 | + </div> | ||
| 149 | + </section> | ||
| 150 | + | ||
| 151 | + <!-- Join Us CTA --> | ||
| 152 | + <section class="py-16 bg-gradient-to-br from-green-500 to-blue-500 text-white"> | ||
| 153 | + <div class="container mx-auto px-4 text-center"> | ||
| 154 | + <h2 class="text-3xl font-bold mb-4">加入我们的读书社区</h2> | ||
| 155 | + <p class="text-xl mb-8 max-w-2xl mx-auto"> | ||
| 156 | + 无论您是爱书之人还是读书会组织者,都可以在这里找到志同道合的朋友 | ||
| 157 | + </p> | ||
| 158 | + <div class="flex flex-wrap justify-center gap-4"> | ||
| 159 | + <Button | ||
| 160 | + variant="secondary" | ||
| 161 | + size="lg" | ||
| 162 | + class="font-bold" | ||
| 163 | + @click="$router.push('/register')" | ||
| 164 | + > | ||
| 165 | + 注册账号 | ||
| 166 | + </Button> | ||
| 167 | + <Button | ||
| 168 | + variant="primary" | ||
| 169 | + size="lg" | ||
| 170 | + class="bg-white text-green-500 hover:bg-gray-100 hover:text-green-600 font-bold" | ||
| 171 | + @click="$router.push('/create-activity')" | ||
| 172 | + > | ||
| 173 | + 创建活动 | ||
| 174 | + </Button> | ||
| 175 | + </div> | ||
| 176 | + </div> | ||
| 82 | </section> | 177 | </section> |
| 83 | </template> | 178 | </template> |
| 84 | </template> | 179 | </template> |
| ... | @@ -89,6 +184,7 @@ | ... | @@ -89,6 +184,7 @@ |
| 89 | import { ref, watchEffect } from 'vue' | 184 | import { ref, watchEffect } from 'vue' |
| 90 | import activitiesData from '../data/activities.json' | 185 | import activitiesData from '../data/activities.json' |
| 91 | import ActivityCard from '../components/shared/ActivityCard.vue' | 186 | import ActivityCard from '../components/shared/ActivityCard.vue' |
| 187 | +import Button from '../components/shared/Button.vue' | ||
| 92 | 188 | ||
| 93 | const activities = ref(activitiesData.activities) | 189 | const activities = ref(activitiesData.activities) |
| 94 | const loading = ref(false) | 190 | const loading = ref(false) |
| ... | @@ -108,30 +204,30 @@ watchEffect(() => { | ... | @@ -108,30 +204,30 @@ watchEffect(() => { |
| 108 | // 筛选即将开始的活动 | 204 | // 筛选即将开始的活动 |
| 109 | upcomingActivities.value = activities.value | 205 | upcomingActivities.value = activities.value |
| 110 | .filter(activity => { | 206 | .filter(activity => { |
| 111 | - const startTime = new Date(activity.start_time.replace(' ', 'T')) | 207 | + const startTime = new Date(activity.start_time) |
| 112 | return startTime > now | 208 | return startTime > now |
| 113 | }) | 209 | }) |
| 114 | .sort((a, b) => { | 210 | .sort((a, b) => { |
| 115 | - return new Date(a.start_time.replace(' ', 'T')) - new Date(b.start_time.replace(' ', 'T')) | 211 | + return new Date(a.start_time) - new Date(b.start_time) |
| 116 | }) | 212 | }) |
| 117 | .slice(0, 6) | 213 | .slice(0, 6) |
| 118 | 214 | ||
| 119 | // 筛选进行中的活动 | 215 | // 筛选进行中的活动 |
| 120 | ongoingActivities.value = activities.value | 216 | ongoingActivities.value = activities.value |
| 121 | .filter(activity => { | 217 | .filter(activity => { |
| 122 | - const startTime = new Date(activity.start_time.replace(' ', 'T')) | 218 | + const startTime = new Date(activity.start_time) |
| 123 | - const endTime = new Date(activity.end_time.replace(' ', 'T')) | 219 | + const endTime = new Date(activity.end_time) |
| 124 | return startTime <= now && endTime >= now | 220 | return startTime <= now && endTime >= now |
| 125 | }) | 221 | }) |
| 126 | 222 | ||
| 127 | // 筛选往期活动 | 223 | // 筛选往期活动 |
| 128 | pastActivities.value = activities.value | 224 | pastActivities.value = activities.value |
| 129 | .filter(activity => { | 225 | .filter(activity => { |
| 130 | - const endTime = new Date(activity.end_time.replace(' ', 'T')) | 226 | + const endTime = new Date(activity.end_time) |
| 131 | return endTime < now | 227 | return endTime < now |
| 132 | }) | 228 | }) |
| 133 | .sort((a, b) => { | 229 | .sort((a, b) => { |
| 134 | - return new Date(b.end_time.replace(' ', 'T')) - new Date(a.end_time.replace(' ', 'T')) | 230 | + return new Date(b.end_time) - new Date(a.end_time) |
| 135 | }) | 231 | }) |
| 136 | .slice(0, 6) | 232 | .slice(0, 6) |
| 137 | } | 233 | } | ... | ... |
-
Please register or login to post a comment