hookehuyr

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

refactor(settings): 注释掉视频上传和课程学习入口
feat(checkin): 优化日历组件并添加日期路由功能
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-06-06 21:26:30
* @LastEditTime: 2025-06-09 11:32:31
* @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
* @Description: 文件描述
-->
<template>
<AppLayout :hasTitle="false">
<van-config-provider :theme-vars="themeVars">
<van-calendar :title="taskDetail.title" :poppable="false" :show-confirm="false" :style="{ height: '24rem' }"
switch-mode="year-month" color="#4caf50" :formatter="formatter" row-height="42" :show-mark="false"
<van-calendar ref="myRefCalendar" :title="taskDetail.title" :poppable="false" :show-confirm="false" :style="{ height: '24rem' }"
switch-mode="year-month" color="#4caf50" :formatter="formatter" row-height="50" :show-mark="false"
@select="onSelectDay"
@click-subtitle="onClickSubtitle">
</van-calendar>
......@@ -156,7 +156,7 @@
<script setup>
import { ref, onBeforeUnmount } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { showConfirmDialog, showSuccessToast, showFailToast } from 'vant';
import { showConfirmDialog, showSuccessToast, showFailToast, showLoadingToast } from 'vant';
import AppLayout from "@/components/layout/AppLayout.vue";
import FrostedGlass from "@/components/ui/FrostedGlass.vue";
import VideoPlayer from "@/components/ui/VideoPlayer.vue";
......@@ -170,6 +170,8 @@ const route = useRoute()
const router = useRouter()
useTitle(route.meta.title);
const myRefCalendar = ref(null);
// 存储所有视频播放器的引用
const videoPlayers = ref([]);
......@@ -326,6 +328,7 @@ const stopAllVideos = () => {
const themeVars = {
calendarSelectedDayBackground: '#4caf50',
calendarHeaderShadow: 'rgba(0, 0, 0, 0.1)',
calendarInfoLineHeight: '0.3rem',
}
const progress1 = ref(0);
......@@ -359,12 +362,14 @@ const formatter = (day) => {
if (checkin_days.includes(date)) {
day.className = 'calendar-checkin';
day.type = 'selected';
day.bottomInfo = '已签到'
}
}
// 选中今天的日期
if (dayjs(day.date).isSame(new Date(), 'day')) {
day.className = 'calendar-today';
day.type ='selected';
day.bottomInfo = '今日'
}
return day;
......@@ -375,6 +380,14 @@ const onSelectDay = (day) => {
getTaskDetail(dayjs(day).format('YYYY-MM'));
// 获取打卡动态列表
initUploadTaskList(dayjs(day).format('YYYY-MM-DD'));
// 修改浏览器地址把当前的date加入地址栏, 页面不刷新
router.push({
path: route.path,
query: {
...route.query,
date: dayjs(day).format('YYYY-MM-DD')
}
})
}
const onClickSubtitle = (evt) => {
......@@ -505,18 +518,31 @@ const getTaskDetail = async (month) => {
}
const initUploadTaskList = async (date) => {
const toast = showLoadingToast({
message: '加载中...',
forbidClick: true,
});
const { code, data } = await getUploadTaskListAPI({ task_id: route.query.id, date, limit: 999 });
if (code) {
console.warn(data?.checkin_list);
// 整理数据结构
checkinDataList.value = formatData(data)
toast.close();
}
}
onMounted(async () => {
const current_date = route.query.date;
if (current_date) {
getTaskDetail(dayjs(current_date).format('YYYY-MM'));
// 获取打卡动态列表
initUploadTaskList(current_date);
myRefCalendar.value?.reset(new Date(current_date));
} else {
getTaskDetail(dayjs().format('YYYY-MM'));
// 获取打卡动态列表
initUploadTaskList(dayjs().format('YYYY-MM-DD'));
}
})
const formatData = (data) => {
......
......@@ -20,11 +20,11 @@
/>
</div>
<h2 class="text-2xl font-bold mb-1">{{ profile.name }}</h2>
<div class="flex items-center text-sm text-gray-600">
<!-- <div class="flex items-center text-sm text-gray-600">
<span>会员等级: 普通会员</span>
<span class="mx-2">|</span>
<span>ID: 88361425</span>
</div>
<span>ID: {{ profile.id }}</span>
</div> -->
</div>
</div>
......
<!--
* @Date: 2025-03-24 13:04:21
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-05-23 18:23:28
* @LastEditTime: 2025-06-09 11:36:07
* @FilePath: /mlaj/src/views/profile/SettingsPage.vue
* @Description: 用户设置页面
-->
......@@ -55,7 +55,7 @@
</div> -->
<!-- 视频上传 -->
<div class="p-4" @click="router.push('/upload_video')">
<!-- <div class="p-4" @click="router.push('/upload_video')">
<div class="flex items-center justify-between">
<div>
<h3 class="text-base font-medium text-gray-900">视频上传</h3>
......@@ -63,7 +63,7 @@
</div>
<ChevronRightIcon class="w-5 h-5 text-gray-400" />
</div>
</div>
</div> -->
<!-- 音频播放 -->
<!-- <div class="p-4" @click="router.push('/profile/settings/audio')">
......@@ -77,7 +77,7 @@
</div> -->
<!-- 课程学习 -->
<div class="p-4" @click="router.push('/study')">
<!-- <div class="p-4" @click="router.push('/study')">
<div class="flex items-center justify-between">
<div>
<h3 class="text-base font-medium text-gray-900">课程学习</h3>
......@@ -85,7 +85,7 @@
</div>
<ChevronRightIcon class="w-5 h-5 text-gray-400" />
</div>
</div>
</div> -->
</div>
</FrostedGlass>
</div>
......