1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2025-07-05 02:59:23 +00:00
This commit is contained in:
SunWuyuan 2025-03-09 15:52:51 +08:00
parent cc950d1fc6
commit ebf3e9df94
No known key found for this signature in database
GPG Key ID: A6A54CF66F56BB64
2 changed files with 69 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<v-app-bar> <v-app-bar class="no-select">
<template #prepend> <template #prepend>
<v-app-bar-nav-icon icon="mdi-home" /> <v-app-bar-nav-icon icon="mdi-home" />
</template> </template>
@ -50,7 +50,7 @@
</v-app-bar> </v-app-bar>
<div class="d-flex"> <div class="d-flex">
<!-- 主要内容区域 --> <!-- 主要内容区域 -->
<v-container class="main-window flex-grow-1" fluid> <v-container class="main-window flex-grow-1 no-select" fluid>
<!-- 有内容的科目卡片 --> <!-- 有内容的科目卡片 -->
<div ref="gridContainer" class="grid-masonry"> <div ref="gridContainer" class="grid-masonry">
<TransitionGroup name="grid"> <TransitionGroup name="grid">
@ -66,7 +66,10 @@
<v-card <v-card
border border
height="100%" height="100%"
class="glow-track"
@click="!isEditingDisabled && openDialog(item.key)" @click="!isEditingDisabled && openDialog(item.key)"
@mousemove="handleMouseMove"
@touchmove="handleTouchMove"
> >
<v-card-title>{{ item.name }}</v-card-title> <v-card-title>{{ item.name }}</v-card-title>
<v-card-text :style="state.contentStyle"> <v-card-text :style="state.contentStyle">
@ -125,7 +128,7 @@
<!-- 出勤统计区域 --> <!-- 出勤统计区域 -->
<v-col <v-col
v-if="state.studentList && state.studentList.length" v-if="state.studentList && state.studentList.length"
class="attendance-area" class="attendance-area no-select"
cols="1" cols="1"
@click="setAttendanceArea()" @click="setAttendanceArea()"
> >
@ -943,6 +946,27 @@ export default {
value, value,
}; };
}, },
handleMouseMove(e) {
const card = e.currentTarget;
const rect = card.getBoundingClientRect();
const x = ((e.clientX - rect.left) / rect.width) * 100;
const y = ((e.clientY - rect.top) / rect.height) * 100;
card.style.setProperty('--x', `${x}%`);
card.style.setProperty('--y', `${y}%`);
},
handleTouchMove(e) {
if (e.touches.length === 1) {
const touch = e.touches[0];
const card = e.currentTarget;
const rect = card.getBoundingClientRect();
const x = ((touch.clientX - rect.left) / rect.width) * 100;
const y = ((touch.clientY - rect.top) / rect.height) * 100;
card.style.setProperty('--x', `${x}%`);
card.style.setProperty('--y', `${y}%`);
}
},
}, },
}; };
</script> </script>

View File

@ -77,6 +77,23 @@ $standard-accelerate: cubic-bezier(0.3, 0.0, 1.0, 1.0);
} }
} }
// 优化卡片触摸体验
.v-card {
touch-action: manipulation;
&:active {
transform: scale(0.99);
transition-duration: 80ms;
}
@media (pointer: coarse) {
&::before {
// 增加触摸反馈区域
margin: -8px;
}
}
}
// 修改对话框过渡动画 - 移除点击波纹效果 // 修改对话框过渡动画 - 移除点击波纹效果
.v-dialog { .v-dialog {
&::before { &::before {
@ -116,10 +133,32 @@ $standard-accelerate: cubic-bezier(0.3, 0.0, 1.0, 1.0);
// 按钮状态变化动画 // 按钮状态变化动画
.v-btn { .v-btn {
transition: background-color 250ms $standard-easing, transition: background-color 250ms $standard-easing,
transform 200ms $emphasized-decelerate; transform 150ms $emphasized-decelerate;
touch-action: manipulation;
min-height: 40px; // 确保触摸目标足够大
&:active { &:active {
transform: scale(0.96); transform: scale(0.98);
transition-duration: 100ms; transition-duration: 80ms;
}
@media (pointer: coarse) {
// 触摸设备上的特殊处理
padding: 8px 16px;
margin: 4px;
&::before {
// 增加触摸反馈区域
margin: -8px;
}
} }
} }
// 禁用文字选择
.no-select {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}