diff --git a/src/App.vue b/src/App.vue index df21a35..ff0ca8b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -235,16 +235,14 @@ button::after { display: flex; align-items: center; justify-content: center; - margin-top: 5px; + margin-top: 20rpx; } .see-more > text { color: #39a8ff; - margin-top: 2px; font-size: 13px; } .see-more > image { width: 15px; - margin-top: 2px; } @font-face { diff --git a/src/components/BowTargetEdit.vue b/src/components/BowTargetEdit.vue index ef6c06e..e6c7a6a 100644 --- a/src/components/BowTargetEdit.vue +++ b/src/components/BowTargetEdit.vue @@ -28,6 +28,7 @@ const dragStartPos = ref({ x: 0, y: 0 }); const capsuleHeight = ref(0); const scale = ref(1); const scrollTop = ref(0); +const selected = ref(null); let lastMoveTime = 0; // 点击靶纸创建新的点 @@ -160,39 +161,42 @@ const getNewPos = () => { return { left: "calc(50% - 12px)", bottom: "-12px" }; }; +const setEditArrow = (data) => { + selected.value = data; + // if (data === null) { + // arrow.value = null; + // scale.value = 1; + // scrollTop.value = 0; + // return; + // } + // if (props.id === 7 || props.id === 9) { + // scale.value = 1.4; + // const viewportH = rect.value.width; // 容器高度等于宽度(100vw) + // const contentH = scale.value * rect.value.width; // 内容高度 + // const clickYInContainer = contentH * data.y - rect.value.top; + // let target = clickYInContainer * scale.value - viewportH / 2; + // target = Math.max(0, Math.min(contentH - viewportH, target)); + // setTimeout(() => { + // scrollTop.value = target > 180 ? target + 10 : target; + // }, 200); + // } + // arrow.value = { + // ...data, + // x: data.x * scale.value, + // y: data.y * scale.value, + // }; +}; + onMounted(async () => { const menuBtnInfo = uni.getMenuButtonBoundingClientRect(); capsuleHeight.value = menuBtnInfo.top - 9; const result = await getElementRect(".container"); rect.value = result; - uni.$on("set-edit-arrow", (data) => { - if (data === null) { - arrow.value = null; - scale.value = 1; - scrollTop.value = 0; - return; - } - if (props.id === 7 || props.id === 9) { - scale.value = 1.4; - const viewportH = rect.value.width; // 容器高度等于宽度(100vw) - const contentH = scale.value * rect.value.width; // 内容高度 - const clickYInContainer = contentH * data.y - rect.value.top; - let target = clickYInContainer * scale.value - viewportH / 2; - target = Math.max(0, Math.min(contentH - viewportH, target)); - setTimeout(() => { - scrollTop.value = target > 180 ? target + 10 : target; - }, 200); - } - arrow.value = { - ...data, - x: data.x * scale.value, - y: data.y * scale.value, - }; - }); + uni.$on("set-edit-arrow", setEditArrow); }); onBeforeUnmount(() => { - uni.$off("set-edit-arrow"); + uni.$off("set-edit-arrow", setEditArrow); }); @@ -220,7 +224,9 @@ onBeforeUnmount(() => { { {{ data.averageRing || "-" }} - + 平均环数