update: 新增设备充电通知

This commit is contained in:
2026-08-14 17:59:11 +08:00
parent e7f073ed7c
commit 2628a17b3f
13 changed files with 54 additions and 1 deletions
+7
View File
@@ -28,6 +28,7 @@
const {
updateUser,
updateOnline,
showDeviceChargingDialog,
clearSessionState,
clearDevice
} = store;
@@ -82,6 +83,10 @@
uni.setStorageSync("calibration", false);
}
function onDeviceCharging() {
showDeviceChargingDialog();
}
function onDeviceShoot() {
// audioManager.play("射箭声音")
}
@@ -119,6 +124,7 @@
uni.$on("update-online", emitUpdateOnline);
uni.$on("session-kicked-out", onSessionKickedOut);
uni.$on("device-bind-invalid", onDeviceBindInvalid);
uni.$on("device-charging", onDeviceCharging);
if (typeof uni.offNetworkStatusChange === "function") {
uni.offNetworkStatusChange(onNetworkStatusChange);
}
@@ -144,6 +150,7 @@
uni.$off("update-online", emitUpdateOnline);
uni.$off("session-kicked-out", onSessionKickedOut);
uni.$off("device-bind-invalid", onDeviceBindInvalid);
uni.$off("device-charging", onDeviceCharging);
if (typeof uni.offNetworkStatusChange === "function") {
uni.offNetworkStatusChange(onNetworkStatusChange);
}
+2
View File
@@ -5,6 +5,7 @@ import AppBackground from "@/components/AppBackground.vue";
import Header from "@/components/Header.vue";
import ScreenHint from "@/components/ScreenHint.vue";
import BackToGame from "@/components/BackToGame.vue";
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
import { capsuleHeight, debounce } from "@/util";
import { returnToBattle } from "@/utils/matchReturn";
@@ -226,6 +227,7 @@ const goCalibration = async () => {
<text>{{ loadingText || "加载中..." }}</text>
</view>
</view>
<DeviceChargingDialog />
</view>
</template>
+22
View File
@@ -0,0 +1,22 @@
<script setup>
import { storeToRefs } from "pinia";
import ModalDialog from "@/components/ModalDialog.vue";
import useStore from "@/store";
const chargingNotice =
"检测到智能弓箭已开始充电,为保护电池,设备即将自动关机。\n(注意:此时拔出充电线将会重启设备。)";
const store = useStore();
const { deviceChargingDialogVisible } = storeToRefs(store);
const { hideDeviceChargingDialog } = store;
</script>
<template>
<ModalDialog
:show="deviceChargingDialogVisible"
:content="chargingNotice"
:show-cancel="false"
confirm-text="我知道了"
:on-confirm="hideDeviceChargingDialog"
/>
</template>
+1
View File
@@ -29,6 +29,7 @@ export const MESSAGETYPES = {
DeviceOnline: 4168086626,
DeviceOffline: 4168086627,
SomeoneIsReady: 4168086628,
DeviceCharging: 4168086631, // 设备充电中
};
export const MESSAGETYPESV2 = {
+2
View File
@@ -3,6 +3,7 @@ import { ref, computed, onMounted } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Avatar from "@/components/Avatar.vue";
import UserUpgrade from "@/components/UserUpgrade.vue";
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
import { getBattleAPI } from "@/apis";
import { topThreeColors, getBattleResultTips } from "@/constants";
import audioManager from "@/audioManager";
@@ -287,6 +288,7 @@ const checkBowData = () => {
<view @click="exit">返回</view>
</view>
<UserUpgrade />
<DeviceChargingDialog />
</view>
</template>
+2
View File
@@ -1,6 +1,7 @@
<script setup>
import { ref, onMounted } from "vue";
import SButton from "@/components/SButton.vue";
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
import { capsuleHeight } from "@/util";
@@ -55,6 +56,7 @@ const onScrollView = (e) => {
/>
</view>
</scroll-view>
<DeviceChargingDialog />
</view>
</template>
+2
View File
@@ -3,6 +3,7 @@ import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Signin from "@/components/Signin.vue";
import SButton from "@/components/SButton.vue";
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
import { tempBindOrgAPI } from "@/apis";
const scene = ref("");
@@ -129,6 +130,7 @@ onLoad((options) => {
:onClose="closeSignin"
:onSuccess="handleLoginSuccess"
/>
<DeviceChargingDialog />
</view>
</template>
+2
View File
@@ -5,6 +5,7 @@ import SButton from "@/components/SButton.vue";
import BowTargetEdit from "@/components/BowTargetEdit.vue";
import ScreenHint2 from "@/components/ScreenHint2.vue";
import RingBarChart from "@/components/RingBarChart.vue";
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
import { getPointBookDetailAPI, getPointBookConfigAPI } from "@/apis";
const selectedIndex = ref(0);
@@ -238,6 +239,7 @@ const targetTypeName = computed(() => {
</block>
</view>
</ScreenHint2>
<DeviceChargingDialog />
</view>
</template>
+2
View File
@@ -2,6 +2,7 @@
import { computed, nextTick, onMounted, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Avatar from "@/components/Avatar.vue";
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
import {
getMvpRankList,
getMyMvpRank,
@@ -524,6 +525,7 @@ const measureTabsMetrics = () => {
{{ getRankUnit() }}
</text>
</view>
<DeviceChargingDialog />
</view>
</template>
@@ -5,6 +5,7 @@ import AppBackground from "./AppBackground.vue";
import Header from "./Header.vue";
import ScreenHint from "./ScreenHint.vue";
import BackToGame from "./BackToGame.vue";
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
import { capsuleHeight, debounce } from "@/util";
import { returnToBattle } from "@/utils/matchReturn";
@@ -204,6 +205,7 @@ const goCalibration = async () => {
<text>{{ loadingText || "加载中..." }}</text>
</view>
</view>
<DeviceChargingDialog />
</view>
</template>
-1
View File
@@ -1339,7 +1339,6 @@ onBeforeUnmount(() => {
:activeSector="precisionRandomBlock"
:activeRing="precisionRandomRingArea"
:highlightRefreshToken="precisionTargetRefreshToken"
:showSectorLabels="precisionBlocks > 0"
stable-shot-effect
@shot-effect-complete="onShotEffectComplete"
/>
+8
View File
@@ -109,6 +109,7 @@ export default defineStore("store", {
tips: "", // 当前提示文案(用于 HeaderProgress 恢复状态,替代 uni.$emit 避免时序问题)
},
dailyCount: getDefaultDailyCount(),
deviceChargingDialogVisible: false,
}),
// 计算属性
@@ -187,6 +188,12 @@ export default defineStore("store", {
...(data || {}),
};
},
showDeviceChargingDialog() {
this.deviceChargingDialogVisible = true;
},
hideDeviceChargingDialog() {
this.deviceChargingDialogVisible = false;
},
clearSessionState() {
this.$patch({
user: getDefaultUser(),
@@ -194,6 +201,7 @@ export default defineStore("store", {
online: false,
game: getDefaultGame(),
dailyCount: getDefaultDailyCount(),
deviceChargingDialogVisible: false,
});
uni.removeStorageSync(PERSISTED_STORE_KEY);
setTimeout(() => {
+2
View File
@@ -97,6 +97,8 @@ function createWebSocket(token, onMessage) {
uni.$emit("update-online");
} else if (msg.constructor === MESSAGETYPES.DeviceOffline) {
uni.$emit("update-online");
} else if (msg.constructor === MESSAGETYPES.DeviceCharging) {
uni.$emit("device-charging");
}
}
});