hookehuyr

feat(打卡): 在打卡详情页添加日期参数并支持编辑模式

在跳转打卡详情页时添加当前日期参数,确保数据正确显示
为打卡详情页添加编辑模式判断,禁用非当前类型的切换
......@@ -40,8 +40,11 @@
<div
v-for="option in attachmentTypeOptions"
:key="option.key"
@click="switchType(option.key)"
:class="['tab-item', { active: activeType === option.key }]"
@click="!isEditMode ? switchType(option.key) : null"
:class="['tab-item', {
active: activeType === option.key,
disabled: isEditMode && activeType !== option.key
}]"
>
<van-icon
:name="getIconName(option.key)"
......@@ -154,6 +157,9 @@ const taskDetail = ref({})
// 作品类型选项
const attachmentTypeOptions = ref([])
// 是否为编辑模式
const isEditMode = computed(() => route.query.status === 'edit')
/**
* 返回上一页
*/
......@@ -231,7 +237,12 @@ const getTaskDetail = async (month) => {
*/
onMounted(async () => {
// 获取任务详情
getTaskDetail(dayjs().format('YYYY-MM'))
const current_date = route.query.date;
if (current_date) {
getTaskDetail(dayjs(current_date).format('YYYY-MM'));
} else {
getTaskDetail(dayjs().format('YYYY-MM'));
}
// 获取作品类型数据
try {
......@@ -353,6 +364,16 @@ onMounted(async () => {
font-weight: 600;
}
}
&.disabled {
opacity: 0.5;
cursor: not-allowed;
&:hover {
border-color: #e8f5e8;
background-color: #fafffe;
}
}
}
.tab-text {
......
<!--
* @Date: 2025-05-29 15:34:17
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-30 17:58:09
* @LastEditTime: 2025-09-30 18:03:55
* @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue
* @Description: 文件描述
-->
......@@ -540,10 +540,12 @@ const handleCheckinTypeClick = (type) => {
* 跳转到打卡详情页面
*/
const goToCheckinDetailPage = () => {
const current_date = route.query.date || dayjs().format('YYYY-MM-DD');
router.push({
path: '/checkin/detail',
query: {
id: route.query.id
id: route.query.id,
date: current_date
}
})
}
......