修改模拟射箭

This commit is contained in:
kron
2025-07-05 18:51:27 +08:00
parent 2e8f63b17e
commit 620ab246b9
2 changed files with 10 additions and 4 deletions

View File

@@ -201,7 +201,7 @@ export const simulShootAPI = (device_id, x, y) => {
const data = {
device_id,
};
if (x && y) {
if (x !== undefined && y !== undefined) {
data.x = x;
data.y = y;
}

View File

@@ -111,6 +111,9 @@ function calcRealY(num) {
const simulShoot = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId);
};
const simulShoot2 = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId, 1, 1);
};
</script>
<template>
@@ -179,8 +182,9 @@ const simulShoot = async () => {
<view v-if="avatar" class="footer">
<image :src="avatar" mode="widthFix" />
</view>
<view class="simul" @click="simulShoot" :style="{ color: '#fff' }">
模拟射箭
<view class="simul">
<button @click="simulShoot">模拟</button>
<button @click="simulShoot2">射箭</button>
</view>
<StartCountdown :start="startCount" />
</view>
@@ -262,7 +266,9 @@ const simulShoot = async () => {
position: absolute;
bottom: 20px;
right: 20px;
color: #fff;
margin-left: 20px;
}
.simul > button {
color: #fff;
}
</style>