Commit 9fcdd4ff by Hantao

refactor(页面/组件): 移除未使用的静态资源并优化交互反馈

- 删除未引用的静态图片文件以减小包体积
- 移除多余的完成提示弹窗,避免交互干扰
- 优化油膜分离组件的进度条动画和触摸结束逻辑
- 改进垃圾清理组件的垃圾桶拖动交互,增加触摸取消处理
- 调整标题图片位置逻辑以适配新组件显示
parent 47aa4834
...@@ -22,7 +22,6 @@ const ASSETS = Object.freeze({ ...@@ -22,7 +22,6 @@ const ASSETS = Object.freeze({
const trashCanOffsetX = ref(0); const trashCanOffsetX = ref(0);
const trashCanStartX = ref(0); const trashCanStartX = ref(0);
const isDragging = ref(false); const isDragging = ref(false);
const isTrashCanEnlarged = ref(false);
// 垃圾清除状态 // 垃圾清除状态
const isOneRemoved = ref(false); const isOneRemoved = ref(false);
...@@ -38,7 +37,6 @@ const onTrashCanTouchStart = (e) => { ...@@ -38,7 +37,6 @@ const onTrashCanTouchStart = (e) => {
if (props.isTransitioning) return; if (props.isTransitioning) return;
isDragging.value = true; isDragging.value = true;
trashCanStartX.value = e.touches[0].clientX; trashCanStartX.value = e.touches[0].clientX;
isTrashCanEnlarged.value = true;
emit('hide-purification'); emit('hide-purification');
}; };
...@@ -67,12 +65,22 @@ const onTrashCanTouchMove = (e) => { ...@@ -67,12 +65,22 @@ const onTrashCanTouchMove = (e) => {
// 触摸结束 // 触摸结束
const onTrashCanTouchEnd = () => { const onTrashCanTouchEnd = () => {
isDragging.value = false; resetTrashCan();
isTrashCanEnlarged.value = false; };
// 触摸取消
const onTrashCanTouchCancel = () => {
resetTrashCan();
};
setTimeout(() => { // 重置垃圾桶位置
const resetTrashCan = () => {
if (isDragging.value) {
isDragging.value = false;
// 立即重置位置,不等待
trashCanOffsetX.value = 0; trashCanOffsetX.value = 0;
}, 300); }
}; };
// 检查并清除垃圾 // 检查并清除垃圾
...@@ -118,11 +126,11 @@ watch([isOneRemoved, isTwoRemoved], ([oneRemoved, twoRemoved]) => { ...@@ -118,11 +126,11 @@ watch([isOneRemoved, isTwoRemoved], ([oneRemoved, twoRemoved]) => {
<!-- 垃圾桶 --> <!-- 垃圾桶 -->
<image <image
class="item trashCan" class="item trashCan"
:class="{ enlarged: isTrashCanEnlarged }" :style="{ transform: `translateX(${trashCanOffsetX}rpx) scale(1.2)` }"
:style="{ transform: isTrashCanEnlarged ? `translateX(${trashCanOffsetX}rpx) scale(1.2)` : `translateX(${trashCanOffsetX}rpx)` }"
@touchstart="onTrashCanTouchStart" @touchstart="onTrashCanTouchStart"
@touchmove="onTrashCanTouchMove" @touchmove="onTrashCanTouchMove"
@touchend="onTrashCanTouchEnd" @touchend="onTrashCanTouchEnd"
@touchcancel="onTrashCanTouchCancel"
:src="ASSETS.trashCan" :src="ASSETS.trashCan"
mode="aspectFill" mode="aspectFill"
></image> ></image>
...@@ -212,10 +220,6 @@ watch([isOneRemoved, isTwoRemoved], ([oneRemoved, twoRemoved]) => { ...@@ -212,10 +220,6 @@ watch([isOneRemoved, isTwoRemoved], ([oneRemoved, twoRemoved]) => {
height: 110rpx; height: 110rpx;
z-index: 10; z-index: 10;
transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
&.enlarged {
/* transform removed */
}
} }
.itemArrow { .itemArrow {
...@@ -226,4 +230,4 @@ watch([isOneRemoved, isTwoRemoved], ([oneRemoved, twoRemoved]) => { ...@@ -226,4 +230,4 @@ watch([isOneRemoved, isTwoRemoved], ([oneRemoved, twoRemoved]) => {
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -5,7 +5,6 @@ import { ref, watch, defineEmits } from 'vue'; ...@@ -5,7 +5,6 @@ import { ref, watch, defineEmits } from 'vue';
const emit = defineEmits(['stage-complete']); const emit = defineEmits(['stage-complete']);
const ASSETS = Object.freeze({ const ASSETS = Object.freeze({
hand: '/static/first/hand.png',
purificationValue: '/static/first/purificationValue.png', purificationValue: '/static/first/purificationValue.png',
}); });
...@@ -66,14 +65,6 @@ const onHintTouchMove = (e) => { ...@@ -66,14 +65,6 @@ const onHintTouchMove = (e) => {
// 触摸结束 // 触摸结束
const onHintTouchEnd = () => { const onHintTouchEnd = () => {
isDragging.value = false; isDragging.value = false;
// 如果未完成,可以添加自动回弹效果
if (progressPercentage.value < 100 && !isCompleted.value) {
// 可选:自动回弹到当前位置的附近
// setTimeout(() => {
// hintPosition.value = progressPercentage.value
// }, 100)
}
}; };
// 检查进度并触发净化值显示 // 检查进度并触发净化值显示
...@@ -93,15 +84,6 @@ const checkProgressForPurification = () => { ...@@ -93,15 +84,6 @@ const checkProgressForPurification = () => {
// 触发完成事件 // 触发完成事件
emit('stage-complete'); emit('stage-complete');
// 完成时的额外处理
setTimeout(() => {
uni.showToast({
title: '油膜分离完成!',
icon: 'success',
duration: 2000,
});
}, 1000);
} }
}; };
...@@ -229,9 +211,8 @@ watch(progressPercentage, (newValue) => { ...@@ -229,9 +211,8 @@ watch(progressPercentage, (newValue) => {
left: 4rpx; left: 4rpx;
height: 44rpx; height: 44rpx;
border-radius: 76rpx; border-radius: 76rpx;
transition: width 0.1s ease;
z-index: 2; z-index: 2;
overflow: hidden; // 确保子元素不会超出边界 overflow: hidden;
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.2); box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.2);
// 斜杠图案层 // 斜杠图案层
......
...@@ -218,11 +218,6 @@ const transitionToAcidBaseNeutralization = () => { ...@@ -218,11 +218,6 @@ const transitionToAcidBaseNeutralization = () => {
setTimeout(() => { setTimeout(() => {
currentStage.value = 'acidBaseNeutralization'; currentStage.value = 'acidBaseNeutralization';
uni.hideLoading(); uni.hideLoading();
uni.showToast({
title: '已进入酸碱中和区',
icon: 'success',
duration: 1500,
});
}, 1000); }, 1000);
}; };
</script> </script>
...@@ -248,11 +243,11 @@ const transitionToAcidBaseNeutralization = () => { ...@@ -248,11 +243,11 @@ const transitionToAcidBaseNeutralization = () => {
<!-- 顶部标题容器 --> <!-- 顶部标题容器 -->
<view class="top"> <view class="top">
<image <image
class="topTitle" class="topTitle"
:src="currentTitle" :src="currentTitle"
:style="{ top: currentStage === 'acidBaseNeutralization' ? '6%' : '8%' }" :style="{ top: showCompleteComponent ? '14%' : (currentStage === 'acidBaseNeutralization' ? '6%' : '8%') }"
mode="aspectFill" mode="aspectFill"
></image> ></image>
</view> </view>
<!-- 根据当前阶段显示不同内容 --> <!-- 根据当前阶段显示不同内容 -->
...@@ -343,8 +338,8 @@ const transitionToAcidBaseNeutralization = () => { ...@@ -343,8 +338,8 @@ const transitionToAcidBaseNeutralization = () => {
.topTitle { .topTitle {
position: absolute; position: absolute;
width: 240rpx; width: 192rpx;
height: 128rpx; height: 108rpx;
} }
} }
...@@ -431,4 +426,4 @@ const transitionToAcidBaseNeutralization = () => { ...@@ -431,4 +426,4 @@ const transitionToAcidBaseNeutralization = () => {
} }
} }
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment