hookehuyr

refactor(profile): 移除会员等级和ID显示注释

refactor(settings): 注释掉视频上传和课程学习入口
feat(checkin): 优化日历组件并添加日期路由功能
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-06-06 21:26:30 4 + * @LastEditTime: 2025-06-09 11:32:31
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 :title="taskDetail.title" :poppable="false" :show-confirm="false" :style="{ height: '24rem' }" 11 + <van-calendar ref="myRefCalendar" :title="taskDetail.title" :poppable="false" :show-confirm="false" :style="{ height: '24rem' }"
12 - switch-mode="year-month" color="#4caf50" :formatter="formatter" row-height="42" :show-mark="false" 12 + switch-mode="year-month" color="#4caf50" :formatter="formatter" row-height="50" :show-mark="false"
13 @select="onSelectDay" 13 @select="onSelectDay"
14 @click-subtitle="onClickSubtitle"> 14 @click-subtitle="onClickSubtitle">
15 </van-calendar> 15 </van-calendar>
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
156 <script setup> 156 <script setup>
157 import { ref, onBeforeUnmount } from 'vue' 157 import { ref, onBeforeUnmount } from 'vue'
158 import { useRoute, useRouter } from 'vue-router' 158 import { useRoute, useRouter } from 'vue-router'
159 -import { showConfirmDialog, showSuccessToast, showFailToast } from 'vant'; 159 +import { showConfirmDialog, showSuccessToast, showFailToast, showLoadingToast } from 'vant';
160 import AppLayout from "@/components/layout/AppLayout.vue"; 160 import AppLayout from "@/components/layout/AppLayout.vue";
161 import FrostedGlass from "@/components/ui/FrostedGlass.vue"; 161 import FrostedGlass from "@/components/ui/FrostedGlass.vue";
162 import VideoPlayer from "@/components/ui/VideoPlayer.vue"; 162 import VideoPlayer from "@/components/ui/VideoPlayer.vue";
...@@ -170,6 +170,8 @@ const route = useRoute() ...@@ -170,6 +170,8 @@ const route = useRoute()
170 const router = useRouter() 170 const router = useRouter()
171 useTitle(route.meta.title); 171 useTitle(route.meta.title);
172 172
173 +const myRefCalendar = ref(null);
174 +
173 // 存储所有视频播放器的引用 175 // 存储所有视频播放器的引用
174 const videoPlayers = ref([]); 176 const videoPlayers = ref([]);
175 177
...@@ -326,6 +328,7 @@ const stopAllVideos = () => { ...@@ -326,6 +328,7 @@ const stopAllVideos = () => {
326 const themeVars = { 328 const themeVars = {
327 calendarSelectedDayBackground: '#4caf50', 329 calendarSelectedDayBackground: '#4caf50',
328 calendarHeaderShadow: 'rgba(0, 0, 0, 0.1)', 330 calendarHeaderShadow: 'rgba(0, 0, 0, 0.1)',
331 + calendarInfoLineHeight: '0.3rem',
329 } 332 }
330 333
331 const progress1 = ref(0); 334 const progress1 = ref(0);
...@@ -359,12 +362,14 @@ const formatter = (day) => { ...@@ -359,12 +362,14 @@ const formatter = (day) => {
359 if (checkin_days.includes(date)) { 362 if (checkin_days.includes(date)) {
360 day.className = 'calendar-checkin'; 363 day.className = 'calendar-checkin';
361 day.type = 'selected'; 364 day.type = 'selected';
365 + day.bottomInfo = '已签到'
362 } 366 }
363 } 367 }
364 // 选中今天的日期 368 // 选中今天的日期
365 if (dayjs(day.date).isSame(new Date(), 'day')) { 369 if (dayjs(day.date).isSame(new Date(), 'day')) {
366 day.className = 'calendar-today'; 370 day.className = 'calendar-today';
367 day.type ='selected'; 371 day.type ='selected';
372 + day.bottomInfo = '今日'
368 } 373 }
369 374
370 return day; 375 return day;
...@@ -375,6 +380,14 @@ const onSelectDay = (day) => { ...@@ -375,6 +380,14 @@ const onSelectDay = (day) => {
375 getTaskDetail(dayjs(day).format('YYYY-MM')); 380 getTaskDetail(dayjs(day).format('YYYY-MM'));
376 // 获取打卡动态列表 381 // 获取打卡动态列表
377 initUploadTaskList(dayjs(day).format('YYYY-MM-DD')); 382 initUploadTaskList(dayjs(day).format('YYYY-MM-DD'));
383 + // 修改浏览器地址把当前的date加入地址栏, 页面不刷新
384 + router.push({
385 + path: route.path,
386 + query: {
387 + ...route.query,
388 + date: dayjs(day).format('YYYY-MM-DD')
389 + }
390 + })
378 } 391 }
379 392
380 const onClickSubtitle = (evt) => { 393 const onClickSubtitle = (evt) => {
...@@ -505,18 +518,31 @@ const getTaskDetail = async (month) => { ...@@ -505,18 +518,31 @@ const getTaskDetail = async (month) => {
505 } 518 }
506 519
507 const initUploadTaskList = async (date) => { 520 const initUploadTaskList = async (date) => {
521 + const toast = showLoadingToast({
522 + message: '加载中...',
523 + forbidClick: true,
524 + });
508 const { code, data } = await getUploadTaskListAPI({ task_id: route.query.id, date, limit: 999 }); 525 const { code, data } = await getUploadTaskListAPI({ task_id: route.query.id, date, limit: 999 });
509 if (code) { 526 if (code) {
510 console.warn(data?.checkin_list); 527 console.warn(data?.checkin_list);
511 // 整理数据结构 528 // 整理数据结构
512 checkinDataList.value = formatData(data) 529 checkinDataList.value = formatData(data)
530 + toast.close();
513 } 531 }
514 } 532 }
515 533
516 onMounted(async () => { 534 onMounted(async () => {
517 - getTaskDetail(dayjs().format('YYYY-MM')); 535 + const current_date = route.query.date;
518 - // 获取打卡动态列表 536 + if (current_date) {
519 - initUploadTaskList(dayjs().format('YYYY-MM-DD')); 537 + getTaskDetail(dayjs(current_date).format('YYYY-MM'));
538 + // 获取打卡动态列表
539 + initUploadTaskList(current_date);
540 + myRefCalendar.value?.reset(new Date(current_date));
541 + } else {
542 + getTaskDetail(dayjs().format('YYYY-MM'));
543 + // 获取打卡动态列表
544 + initUploadTaskList(dayjs().format('YYYY-MM-DD'));
545 + }
520 }) 546 })
521 547
522 const formatData = (data) => { 548 const formatData = (data) => {
......
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
20 /> 20 />
21 </div> 21 </div>
22 <h2 class="text-2xl font-bold mb-1">{{ profile.name }}</h2> 22 <h2 class="text-2xl font-bold mb-1">{{ profile.name }}</h2>
23 - <div class="flex items-center text-sm text-gray-600"> 23 + <!-- <div class="flex items-center text-sm text-gray-600">
24 <span>会员等级: 普通会员</span> 24 <span>会员等级: 普通会员</span>
25 <span class="mx-2">|</span> 25 <span class="mx-2">|</span>
26 - <span>ID: 88361425</span> 26 + <span>ID: {{ profile.id }}</span>
27 - </div> 27 + </div> -->
28 </div> 28 </div>
29 </div> 29 </div>
30 30
......
1 <!-- 1 <!--
2 * @Date: 2025-03-24 13:04:21 2 * @Date: 2025-03-24 13:04:21
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-05-23 18:23:28 4 + * @LastEditTime: 2025-06-09 11:36:07
5 * @FilePath: /mlaj/src/views/profile/SettingsPage.vue 5 * @FilePath: /mlaj/src/views/profile/SettingsPage.vue
6 * @Description: 用户设置页面 6 * @Description: 用户设置页面
7 --> 7 -->
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
55 </div> --> 55 </div> -->
56 56
57 <!-- 视频上传 --> 57 <!-- 视频上传 -->
58 - <div class="p-4" @click="router.push('/upload_video')"> 58 + <!-- <div class="p-4" @click="router.push('/upload_video')">
59 <div class="flex items-center justify-between"> 59 <div class="flex items-center justify-between">
60 <div> 60 <div>
61 <h3 class="text-base font-medium text-gray-900">视频上传</h3> 61 <h3 class="text-base font-medium text-gray-900">视频上传</h3>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
63 </div> 63 </div>
64 <ChevronRightIcon class="w-5 h-5 text-gray-400" /> 64 <ChevronRightIcon class="w-5 h-5 text-gray-400" />
65 </div> 65 </div>
66 - </div> 66 + </div> -->
67 67
68 <!-- 音频播放 --> 68 <!-- 音频播放 -->
69 <!-- <div class="p-4" @click="router.push('/profile/settings/audio')"> 69 <!-- <div class="p-4" @click="router.push('/profile/settings/audio')">
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
77 </div> --> 77 </div> -->
78 78
79 <!-- 课程学习 --> 79 <!-- 课程学习 -->
80 - <div class="p-4" @click="router.push('/study')"> 80 + <!-- <div class="p-4" @click="router.push('/study')">
81 <div class="flex items-center justify-between"> 81 <div class="flex items-center justify-between">
82 <div> 82 <div>
83 <h3 class="text-base font-medium text-gray-900">课程学习</h3> 83 <h3 class="text-base font-medium text-gray-900">课程学习</h3>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
85 </div> 85 </div>
86 <ChevronRightIcon class="w-5 h-5 text-gray-400" /> 86 <ChevronRightIcon class="w-5 h-5 text-gray-400" />
87 </div> 87 </div>
88 - </div> 88 + </div> -->
89 </div> 89 </div>
90 </FrostedGlass> 90 </FrostedGlass>
91 </div> 91 </div>
......