style(IndexCheckInPage): 格式化代码并调整样式
- 统一代码缩进和换行格式 - 调整样式部分的代码结构 - 保持功能不变的情况下优化代码可读性
Showing
1 changed file
with
40 additions
and
59 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-05-29 15:34:17 | 2 | * @Date: 2025-05-29 15:34:17 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-05-30 15:07:29 | 4 | + * @LastEditTime: 2025-05-30 15:11:36 |
| 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue | 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <AppLayout :hasTitle="false"> | 9 | <AppLayout :hasTitle="false"> |
| 10 | <van-config-provider :theme-vars="themeVars"> | 10 | <van-config-provider :theme-vars="themeVars"> |
| 11 | - <van-calendar | 11 | + <van-calendar title="每日打卡" :poppable="false" :show-confirm="false" :style="{ height: '24rem' }" |
| 12 | - title="每日打卡" | 12 | + switch-mode="year-month" color="#4caf50" :formatter="formatter" row-height="42" :show-mark="false" |
| 13 | - :poppable="false" | 13 | + @click-subtitle="onClickSubtitle"> |
| 14 | - :show-confirm="false" | ||
| 15 | - :style="{ height: '24rem' }" | ||
| 16 | - switch-mode="year-month" | ||
| 17 | - color="#4caf50" | ||
| 18 | - :formatter="formatter" | ||
| 19 | - row-height="42" | ||
| 20 | - :show-mark="false" | ||
| 21 | - @click-subtitle="onClickSubtitle" | ||
| 22 | - > | ||
| 23 | </van-calendar> | 14 | </van-calendar> |
| 24 | 15 | ||
| 25 | <div class="text-wrapper"> | 16 | <div class="text-wrapper"> |
| ... | @@ -47,7 +38,9 @@ | ... | @@ -47,7 +38,9 @@ |
| 47 | <van-progress :percentage="progress2" color="#4caf50" :show-pivot="false" /> | 38 | <van-progress :percentage="progress2" color="#4caf50" :show-pivot="false" /> |
| 48 | </div> | 39 | </div> |
| 49 | <div style="padding: 0.75rem 1rem;"> | 40 | <div style="padding: 0.75rem 1rem;"> |
| 50 | - <van-image round width="2.8rem" height="2.8rem" src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg" v-for="(item, index) in teamAvatars" :key="index" :style="{ marginLeft: index > 0 ? '-0.5rem' : '', border: '2px solid #FFF' }" /> | 41 | + <van-image round width="2.8rem" height="2.8rem" src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg" |
| 42 | + v-for="(item, index) in teamAvatars" :key="index" | ||
| 43 | + :style="{ marginLeft: index > 0 ? '-0.5rem' : '', border: '2px solid #FFF' }" /> | ||
| 51 | </div> | 44 | </div> |
| 52 | </div> | 45 | </div> |
| 53 | 46 | ||
| ... | @@ -85,42 +78,28 @@ | ... | @@ -85,42 +78,28 @@ |
| 85 | <div class="post-text">{{ post.content }}</div> | 78 | <div class="post-text">{{ post.content }}</div> |
| 86 | <div class="post-media"> | 79 | <div class="post-media"> |
| 87 | <div v-if="post.images.length" class="post-images"> | 80 | <div v-if="post.images.length" class="post-images"> |
| 88 | - <van-image | 81 | + <van-image width="100" height="100" v-for="(image, index) in post.images" :key="index" :src="image" |
| 89 | - width="100" | 82 | + @click="openImagePreview(index, post)" /> |
| 90 | - height="100" | ||
| 91 | - v-for="(image, index) in post.images" | ||
| 92 | - :key="index" | ||
| 93 | - :src="image" | ||
| 94 | - @click="openImagePreview(index, post)" | ||
| 95 | - /> | ||
| 96 | </div> | 83 | </div> |
| 97 | - <van-image-preview | 84 | + <van-image-preview v-if="currentPost" v-model:show="showImagePreview" :images="currentPost.images" |
| 98 | - v-if="currentPost" | 85 | + :start-position="startPosition" :show-index="true" @change="onChange" /> |
| 99 | - v-model:show="showImagePreview" | ||
| 100 | - :images="currentPost.images" | ||
| 101 | - :start-position="startPosition" | ||
| 102 | - :show-index="true" | ||
| 103 | - @change="onChange" | ||
| 104 | - /> | ||
| 105 | <!-- 视频封面和播放按钮 --> | 86 | <!-- 视频封面和播放按钮 --> |
| 106 | - <div v-if="post.video && !post.isPlaying" class="relative w-full rounded-lg overflow-hidden" style="aspect-ratio: 16/9;"> | 87 | + <div v-if="post.video && !post.isPlaying" class="relative w-full rounded-lg overflow-hidden" |
| 107 | - <img :src="post.videoCover || 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg'" :alt="post.content" class="w-full h-full object-cover" /> | 88 | + style="aspect-ratio: 16/9;"> |
| 89 | + <img :src="post.videoCover || 'https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg'" | ||
| 90 | + :alt="post.content" class="w-full h-full object-cover" /> | ||
| 108 | <div class="absolute inset-0 flex items-center justify-center cursor-pointer bg-black/20" | 91 | <div class="absolute inset-0 flex items-center justify-center cursor-pointer bg-black/20" |
| 109 | @click="startPlay(post)"> | 92 | @click="startPlay(post)"> |
| 110 | - <div class="w-16 h-16 rounded-full bg-black/50 flex items-center justify-center hover:bg-black/70 transition-colors"> | 93 | + <div |
| 94 | + class="w-16 h-16 rounded-full bg-black/50 flex items-center justify-center hover:bg-black/70 transition-colors"> | ||
| 111 | <van-icon name="play-circle-o" class="text-white" size="30" /> | 95 | <van-icon name="play-circle-o" class="text-white" size="30" /> |
| 112 | </div> | 96 | </div> |
| 113 | </div> | 97 | </div> |
| 114 | </div> | 98 | </div> |
| 115 | <!-- 视频播放器 --> | 99 | <!-- 视频播放器 --> |
| 116 | - <VideoPlayer | 100 | + <VideoPlayer v-if="post.video && post.isPlaying" :video-url="post.video" |
| 117 | - v-if="post.video && post.isPlaying" | 101 | + class="post-video rounded-lg overflow-hidden" ref="(el) => { if(el) videoPlayers.value.push(el) }" |
| 118 | - :video-url="post.video" | 102 | + @onPlay="(player) => handleVideoPlay(player, post)" @onPause="() => handleVideoPause(post)" /> |
| 119 | - class="post-video rounded-lg overflow-hidden" | ||
| 120 | - ref="(el) => { if(el) videoPlayers.value.push(el) }" | ||
| 121 | - @onPlay="(player) => handleVideoPlay(player, post)" | ||
| 122 | - @onPause="() => handleVideoPause(post)" | ||
| 123 | - /> | ||
| 124 | <AudioPlayer v-if="post.audio.length" :songs="post.audio" class="post-audio" /> | 103 | <AudioPlayer v-if="post.audio.length" :songs="post.audio" class="post-audio" /> |
| 125 | </div> | 104 | </div> |
| 126 | </div> | 105 | </div> |
| ... | @@ -318,7 +297,7 @@ const formatter = (day) => { | ... | @@ -318,7 +297,7 @@ const formatter = (day) => { |
| 318 | if (month === 5) { | 297 | if (month === 5) { |
| 319 | if (checkin_days.includes(date)) { | 298 | if (checkin_days.includes(date)) { |
| 320 | day.className = 'calendar-checkin'; | 299 | day.className = 'calendar-checkin'; |
| 321 | - day.type ='selected'; | 300 | + day.type = 'selected'; |
| 322 | } | 301 | } |
| 323 | } | 302 | } |
| 324 | 303 | ||
| ... | @@ -331,27 +310,28 @@ const onClickSubtitle = (evt) => { | ... | @@ -331,27 +310,28 @@ const onClickSubtitle = (evt) => { |
| 331 | </script> | 310 | </script> |
| 332 | 311 | ||
| 333 | <style lang="less"> | 312 | <style lang="less"> |
| 334 | - .calendar-checkin { | 313 | +.calendar-checkin { |
| 335 | - .van-calendar__selected-day { | 314 | + .van-calendar__selected-day { |
| 336 | - background: #a2d8a3 !important; | 315 | + background: #a2d8a3 !important; |
| 337 | - } | ||
| 338 | } | 316 | } |
| 317 | +} | ||
| 339 | 318 | ||
| 340 | - .text-wrapper { | 319 | +.text-wrapper { |
| 341 | - padding: 1rem; | 320 | + padding: 1rem; |
| 342 | - color: #4caf50; | 321 | + color: #4caf50; |
| 343 | - .text-header { | ||
| 344 | - font-size: 1.15rem; | ||
| 345 | - } | ||
| 346 | 322 | ||
| 347 | - .grade-percentage-main { | 323 | + .text-header { |
| 348 | - padding: 0.75rem 1rem; | 324 | + font-size: 1.15rem; |
| 349 | - } | ||
| 350 | - .class-percentage-main { | ||
| 351 | - padding: 0.75rem 1rem; | ||
| 352 | - } | ||
| 353 | } | 325 | } |
| 354 | -</style> | 326 | + |
| 327 | + .grade-percentage-main { | ||
| 328 | + padding: 0.75rem 1rem; | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + .class-percentage-main { | ||
| 332 | + padding: 0.75rem 1rem; | ||
| 333 | + } | ||
| 334 | +} | ||
| 355 | 335 | ||
| 356 | .post-card { | 336 | .post-card { |
| 357 | margin: 1rem 0; | 337 | margin: 1rem 0; |
| ... | @@ -415,3 +395,4 @@ const onClickSubtitle = (evt) => { | ... | @@ -415,3 +395,4 @@ const onClickSubtitle = (evt) => { |
| 415 | } | 395 | } |
| 416 | } | 396 | } |
| 417 | } | 397 | } |
| 398 | +</style> | ... | ... |
-
Please register or login to post a comment