2025-10-29 15:17:22 +08:00
|
|
|
<script setup>
|
2025-10-29 18:07:42 +08:00
|
|
|
import { ref, onMounted, onBeforeUnmount } from "vue";
|
2025-10-29 15:17:22 +08:00
|
|
|
import Container from "@/components/Container.vue";
|
|
|
|
|
import SButton from "@/components/SButton.vue";
|
|
|
|
|
|
|
|
|
|
import { laserAimAPI, laserCloseAPI } from "@/apis";
|
2025-10-29 18:07:42 +08:00
|
|
|
import { MESSAGETYPES } from "@/constants";
|
|
|
|
|
import audioManager from "@/audioManager";
|
2025-10-29 15:17:22 +08:00
|
|
|
|
|
|
|
|
const guides = [
|
|
|
|
|
{
|
|
|
|
|
title: "保持5米站距",
|
|
|
|
|
src: "https://static.shelingxingqiu.com/attachment/2025-10-29/dduexjgrdx5j4saxvu.png",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "摆出拉弓姿势",
|
|
|
|
|
src: "https://static.shelingxingqiu.com/attachment/2025-10-29/dduexjgrd9ziw2yh2c.png",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "调整瞄准器",
|
|
|
|
|
src: "https://static.shelingxingqiu.com/attachment/2025-10-29/dduexjgrcxf9wjaiv4.png",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2025-10-29 18:07:42 +08:00
|
|
|
const done = ref(false);
|
|
|
|
|
|
2025-10-29 15:17:22 +08:00
|
|
|
const onComplete = async () => {
|
|
|
|
|
await laserCloseAPI();
|
|
|
|
|
uni.navigateBack();
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-29 18:07:42 +08:00
|
|
|
function onReceiveMessage(messages = []) {
|
|
|
|
|
messages.forEach((msg) => {
|
|
|
|
|
if (msg.constructor === MESSAGETYPES.Calibration) {
|
|
|
|
|
done.value = true;
|
|
|
|
|
uni.setStorageSync("calibration", true);
|
|
|
|
|
audioManager.play("激光已校准");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-29 15:17:22 +08:00
|
|
|
onMounted(async () => {
|
2025-10-29 18:07:42 +08:00
|
|
|
uni.$on("socket-inbox", onReceiveMessage);
|
2025-10-29 15:17:22 +08:00
|
|
|
await laserAimAPI();
|
|
|
|
|
});
|
2025-10-29 18:07:42 +08:00
|
|
|
|
|
|
|
|
onBeforeUnmount(async () => {
|
|
|
|
|
uni.$off("socket-inbox", onReceiveMessage);
|
|
|
|
|
await laserCloseAPI();
|
|
|
|
|
});
|
2025-10-29 15:17:22 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<Container title="校准智能弓">
|
|
|
|
|
<view class="container">
|
|
|
|
|
<view v-for="(guide, index) in guides" :key="guide.title" class="guide">
|
|
|
|
|
<view>
|
|
|
|
|
<text>{{ index + 1 }}</text>
|
|
|
|
|
<text>{{ guide.title }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
<image :src="guide.src" mode="widthFix" />
|
|
|
|
|
</view>
|
|
|
|
|
<text>请完成以上步骤校准智能弓</text>
|
2025-10-29 18:07:42 +08:00
|
|
|
<SButton
|
|
|
|
|
:onClick="onComplete"
|
|
|
|
|
width="60vw"
|
|
|
|
|
:rounded="40"
|
|
|
|
|
:disabled="!done"
|
|
|
|
|
>
|
2025-10-29 15:17:22 +08:00
|
|
|
我已校准
|
|
|
|
|
</SButton>
|
|
|
|
|
</view>
|
|
|
|
|
</Container>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.container {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
.guide {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
color: #ffffff;
|
|
|
|
|
margin-bottom: 15rpx;
|
|
|
|
|
}
|
|
|
|
|
.guide > view {
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin: 25rpx 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
.guide > view > text:first-child {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
background: #e89024;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
width: 32rpx;
|
|
|
|
|
height: 32rpx;
|
|
|
|
|
line-height: 32rpx;
|
|
|
|
|
display: block;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-right: 15rpx;
|
|
|
|
|
}
|
|
|
|
|
.guide > image {
|
|
|
|
|
width: 630rpx;
|
|
|
|
|
height: 250rpx;
|
|
|
|
|
}
|
|
|
|
|
.container > text {
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
color: #fff9;
|
|
|
|
|
margin: 30rpx;
|
|
|
|
|
}
|
|
|
|
|
</style>
|