模拟射箭添加环境判断
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -20,6 +20,7 @@ const arrow = ref({});
|
||||
const power = ref(0);
|
||||
const distance = ref(0);
|
||||
const debugInfo = ref("");
|
||||
const showsimul = ref(false);
|
||||
|
||||
async function onReceiveMessage(messages = []) {
|
||||
messages.forEach((msg) => {
|
||||
@@ -39,6 +40,9 @@ const simulShoot = async () => {
|
||||
onMounted(() => {
|
||||
checkConnection();
|
||||
uni.$on("socket-inbox", onReceiveMessage);
|
||||
const accountInfo = uni.getAccountInfoSync();
|
||||
const envVersion = accountInfo.miniProgram.envVersion;
|
||||
if (envVersion !== "release") showsimul.value = true;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
@@ -84,7 +88,12 @@ onUnmounted(() => {
|
||||
</view>
|
||||
<!-- <view class="debug-text">{{ debugInfo }}</view> -->
|
||||
<view>
|
||||
<view class="simul" @click="simulShoot" :style="{ color: '#fff' }">
|
||||
<view
|
||||
class="simul"
|
||||
@click="simulShoot"
|
||||
:style="{ color: '#fff' }"
|
||||
v-if="showsimul"
|
||||
>
|
||||
模拟射箭
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user