模拟射箭添加环境判断
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch, onMounted } from "vue";
|
||||||
import BowPower from "@/components/BowPower.vue";
|
import BowPower from "@/components/BowPower.vue";
|
||||||
import StartCountdown from "@/components/StartCountdown.vue";
|
import StartCountdown from "@/components/StartCountdown.vue";
|
||||||
import { simulShootAPI } from "@/apis";
|
import { simulShootAPI } from "@/apis";
|
||||||
@@ -47,6 +47,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const showsimul = ref(false);
|
||||||
const latestOne = ref(null);
|
const latestOne = ref(null);
|
||||||
const prevScores = ref([]);
|
const prevScores = ref([]);
|
||||||
const prevBlueScores = ref([]);
|
const prevBlueScores = ref([]);
|
||||||
@@ -111,6 +112,12 @@ const simulShoot = async () => {
|
|||||||
const simulShoot2 = async () => {
|
const simulShoot2 = async () => {
|
||||||
if (device.value.deviceId) await simulShootAPI(device.value.deviceId, 1, 1);
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -185,7 +192,7 @@ const simulShoot2 = async () => {
|
|||||||
<view v-if="avatar" class="footer">
|
<view v-if="avatar" class="footer">
|
||||||
<image :src="avatar" mode="widthFix" />
|
<image :src="avatar" mode="widthFix" />
|
||||||
</view>
|
</view>
|
||||||
<view class="simul">
|
<view class="simul" v-if="showsimul">
|
||||||
<button @click="simulShoot">模拟</button>
|
<button @click="simulShoot">模拟</button>
|
||||||
<button @click="simulShoot2">射箭</button>
|
<button @click="simulShoot2">射箭</button>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const arrow = ref({});
|
|||||||
const power = ref(0);
|
const power = ref(0);
|
||||||
const distance = ref(0);
|
const distance = ref(0);
|
||||||
const debugInfo = ref("");
|
const debugInfo = ref("");
|
||||||
|
const showsimul = ref(false);
|
||||||
|
|
||||||
async function onReceiveMessage(messages = []) {
|
async function onReceiveMessage(messages = []) {
|
||||||
messages.forEach((msg) => {
|
messages.forEach((msg) => {
|
||||||
@@ -39,6 +40,9 @@ const simulShoot = async () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
checkConnection();
|
checkConnection();
|
||||||
uni.$on("socket-inbox", onReceiveMessage);
|
uni.$on("socket-inbox", onReceiveMessage);
|
||||||
|
const accountInfo = uni.getAccountInfoSync();
|
||||||
|
const envVersion = accountInfo.miniProgram.envVersion;
|
||||||
|
if (envVersion !== "release") showsimul.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
@@ -84,7 +88,12 @@ onUnmounted(() => {
|
|||||||
</view>
|
</view>
|
||||||
<!-- <view class="debug-text">{{ debugInfo }}</view> -->
|
<!-- <view class="debug-text">{{ debugInfo }}</view> -->
|
||||||
<view>
|
<view>
|
||||||
<view class="simul" @click="simulShoot" :style="{ color: '#fff' }">
|
<view
|
||||||
|
class="simul"
|
||||||
|
@click="simulShoot"
|
||||||
|
:style="{ color: '#fff' }"
|
||||||
|
v-if="showsimul"
|
||||||
|
>
|
||||||
模拟射箭
|
模拟射箭
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Reference in New Issue
Block a user