模拟射箭添加环境判断

This commit is contained in:
kron
2025-08-09 12:02:36 +08:00
parent 975f791dfb
commit ca6cb989c7
2 changed files with 19 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch } from "vue";
import { ref, watch, onMounted } from "vue";
import BowPower from "@/components/BowPower.vue";
import StartCountdown from "@/components/StartCountdown.vue";
import { simulShootAPI } from "@/apis";
@@ -47,6 +47,7 @@ const props = defineProps({
},
});
const showsimul = ref(false);
const latestOne = ref(null);
const prevScores = ref([]);
const prevBlueScores = ref([]);
@@ -111,6 +112,12 @@ const simulShoot = async () => {
const simulShoot2 = async () => {
if (device.value.deviceId) await simulShootAPI(device.value.deviceId, 1, 1);
};
onMounted(() => {
const accountInfo = uni.getAccountInfoSync();
const envVersion = accountInfo.miniProgram.envVersion;
if (envVersion !== "release") showsimul.value = true;
});
</script>
<template>
@@ -185,7 +192,7 @@ const simulShoot2 = async () => {
<view v-if="avatar" class="footer">
<image :src="avatar" mode="widthFix" />
</view>
<view class="simul">
<view class="simul" v-if="showsimul">
<button @click="simulShoot">模拟</button>
<button @click="simulShoot2">射箭</button>
</view>