update: 新增设备充电通知
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
const {
|
const {
|
||||||
updateUser,
|
updateUser,
|
||||||
updateOnline,
|
updateOnline,
|
||||||
|
showDeviceChargingDialog,
|
||||||
clearSessionState,
|
clearSessionState,
|
||||||
clearDevice
|
clearDevice
|
||||||
} = store;
|
} = store;
|
||||||
@@ -82,6 +83,10 @@
|
|||||||
uni.setStorageSync("calibration", false);
|
uni.setStorageSync("calibration", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onDeviceCharging() {
|
||||||
|
showDeviceChargingDialog();
|
||||||
|
}
|
||||||
|
|
||||||
function onDeviceShoot() {
|
function onDeviceShoot() {
|
||||||
// audioManager.play("射箭声音")
|
// audioManager.play("射箭声音")
|
||||||
}
|
}
|
||||||
@@ -119,6 +124,7 @@
|
|||||||
uni.$on("update-online", emitUpdateOnline);
|
uni.$on("update-online", emitUpdateOnline);
|
||||||
uni.$on("session-kicked-out", onSessionKickedOut);
|
uni.$on("session-kicked-out", onSessionKickedOut);
|
||||||
uni.$on("device-bind-invalid", onDeviceBindInvalid);
|
uni.$on("device-bind-invalid", onDeviceBindInvalid);
|
||||||
|
uni.$on("device-charging", onDeviceCharging);
|
||||||
if (typeof uni.offNetworkStatusChange === "function") {
|
if (typeof uni.offNetworkStatusChange === "function") {
|
||||||
uni.offNetworkStatusChange(onNetworkStatusChange);
|
uni.offNetworkStatusChange(onNetworkStatusChange);
|
||||||
}
|
}
|
||||||
@@ -144,6 +150,7 @@
|
|||||||
uni.$off("update-online", emitUpdateOnline);
|
uni.$off("update-online", emitUpdateOnline);
|
||||||
uni.$off("session-kicked-out", onSessionKickedOut);
|
uni.$off("session-kicked-out", onSessionKickedOut);
|
||||||
uni.$off("device-bind-invalid", onDeviceBindInvalid);
|
uni.$off("device-bind-invalid", onDeviceBindInvalid);
|
||||||
|
uni.$off("device-charging", onDeviceCharging);
|
||||||
if (typeof uni.offNetworkStatusChange === "function") {
|
if (typeof uni.offNetworkStatusChange === "function") {
|
||||||
uni.offNetworkStatusChange(onNetworkStatusChange);
|
uni.offNetworkStatusChange(onNetworkStatusChange);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import AppBackground from "@/components/AppBackground.vue";
|
|||||||
import Header from "@/components/Header.vue";
|
import Header from "@/components/Header.vue";
|
||||||
import ScreenHint from "@/components/ScreenHint.vue";
|
import ScreenHint from "@/components/ScreenHint.vue";
|
||||||
import BackToGame from "@/components/BackToGame.vue";
|
import BackToGame from "@/components/BackToGame.vue";
|
||||||
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
|
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
|
||||||
import { capsuleHeight, debounce } from "@/util";
|
import { capsuleHeight, debounce } from "@/util";
|
||||||
import { returnToBattle } from "@/utils/matchReturn";
|
import { returnToBattle } from "@/utils/matchReturn";
|
||||||
@@ -226,6 +227,7 @@ const goCalibration = async () => {
|
|||||||
<text>{{ loadingText || "加载中..." }}</text>
|
<text>{{ loadingText || "加载中..." }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<DeviceChargingDialog />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -29,6 +29,7 @@ export const MESSAGETYPES = {
|
|||||||
DeviceOnline: 4168086626,
|
DeviceOnline: 4168086626,
|
||||||
DeviceOffline: 4168086627,
|
DeviceOffline: 4168086627,
|
||||||
SomeoneIsReady: 4168086628,
|
SomeoneIsReady: 4168086628,
|
||||||
|
DeviceCharging: 4168086631, // 设备充电中
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MESSAGETYPESV2 = {
|
export const MESSAGETYPESV2 = {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { ref, computed, onMounted } from "vue";
|
|||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
import UserUpgrade from "@/components/UserUpgrade.vue";
|
import UserUpgrade from "@/components/UserUpgrade.vue";
|
||||||
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
import { getBattleAPI } from "@/apis";
|
import { getBattleAPI } from "@/apis";
|
||||||
import { topThreeColors, getBattleResultTips } from "@/constants";
|
import { topThreeColors, getBattleResultTips } from "@/constants";
|
||||||
import audioManager from "@/audioManager";
|
import audioManager from "@/audioManager";
|
||||||
@@ -287,6 +288,7 @@ const checkBowData = () => {
|
|||||||
<view @click="exit">返回</view>
|
<view @click="exit">返回</view>
|
||||||
</view>
|
</view>
|
||||||
<UserUpgrade />
|
<UserUpgrade />
|
||||||
|
<DeviceChargingDialog />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
|
|
||||||
import { capsuleHeight } from "@/util";
|
import { capsuleHeight } from "@/util";
|
||||||
|
|
||||||
@@ -55,6 +56,7 @@ const onScrollView = (e) => {
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<DeviceChargingDialog />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { ref } from "vue";
|
|||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import Signin from "@/components/Signin.vue";
|
import Signin from "@/components/Signin.vue";
|
||||||
import SButton from "@/components/SButton.vue";
|
import SButton from "@/components/SButton.vue";
|
||||||
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
import { tempBindOrgAPI } from "@/apis";
|
import { tempBindOrgAPI } from "@/apis";
|
||||||
|
|
||||||
const scene = ref("");
|
const scene = ref("");
|
||||||
@@ -129,6 +130,7 @@ onLoad((options) => {
|
|||||||
:onClose="closeSignin"
|
:onClose="closeSignin"
|
||||||
:onSuccess="handleLoginSuccess"
|
:onSuccess="handleLoginSuccess"
|
||||||
/>
|
/>
|
||||||
|
<DeviceChargingDialog />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import SButton from "@/components/SButton.vue";
|
|||||||
import BowTargetEdit from "@/components/BowTargetEdit.vue";
|
import BowTargetEdit from "@/components/BowTargetEdit.vue";
|
||||||
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
import ScreenHint2 from "@/components/ScreenHint2.vue";
|
||||||
import RingBarChart from "@/components/RingBarChart.vue";
|
import RingBarChart from "@/components/RingBarChart.vue";
|
||||||
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
import { getPointBookDetailAPI, getPointBookConfigAPI } from "@/apis";
|
import { getPointBookDetailAPI, getPointBookConfigAPI } from "@/apis";
|
||||||
|
|
||||||
const selectedIndex = ref(0);
|
const selectedIndex = ref(0);
|
||||||
@@ -238,6 +239,7 @@ const targetTypeName = computed(() => {
|
|||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</ScreenHint2>
|
</ScreenHint2>
|
||||||
|
<DeviceChargingDialog />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { computed, nextTick, onMounted, ref } from "vue";
|
import { computed, nextTick, onMounted, ref } from "vue";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import Avatar from "@/components/Avatar.vue";
|
import Avatar from "@/components/Avatar.vue";
|
||||||
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
import {
|
import {
|
||||||
getMvpRankList,
|
getMvpRankList,
|
||||||
getMyMvpRank,
|
getMyMvpRank,
|
||||||
@@ -524,6 +525,7 @@ const measureTabsMetrics = () => {
|
|||||||
{{ getRankUnit() }}
|
{{ getRankUnit() }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
|
<DeviceChargingDialog />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import AppBackground from "./AppBackground.vue";
|
|||||||
import Header from "./Header.vue";
|
import Header from "./Header.vue";
|
||||||
import ScreenHint from "./ScreenHint.vue";
|
import ScreenHint from "./ScreenHint.vue";
|
||||||
import BackToGame from "./BackToGame.vue";
|
import BackToGame from "./BackToGame.vue";
|
||||||
|
import DeviceChargingDialog from "@/components/DeviceChargingDialog.vue";
|
||||||
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
|
import {laserAimAPI, getBattleAPI, matchGameAPI} from "@/apis";
|
||||||
import { capsuleHeight, debounce } from "@/util";
|
import { capsuleHeight, debounce } from "@/util";
|
||||||
import { returnToBattle } from "@/utils/matchReturn";
|
import { returnToBattle } from "@/utils/matchReturn";
|
||||||
@@ -204,6 +205,7 @@ const goCalibration = async () => {
|
|||||||
<text>{{ loadingText || "加载中..." }}</text>
|
<text>{{ loadingText || "加载中..." }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<DeviceChargingDialog />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1339,7 +1339,6 @@ onBeforeUnmount(() => {
|
|||||||
:activeSector="precisionRandomBlock"
|
:activeSector="precisionRandomBlock"
|
||||||
:activeRing="precisionRandomRingArea"
|
:activeRing="precisionRandomRingArea"
|
||||||
:highlightRefreshToken="precisionTargetRefreshToken"
|
:highlightRefreshToken="precisionTargetRefreshToken"
|
||||||
:showSectorLabels="precisionBlocks > 0"
|
|
||||||
stable-shot-effect
|
stable-shot-effect
|
||||||
@shot-effect-complete="onShotEffectComplete"
|
@shot-effect-complete="onShotEffectComplete"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ export default defineStore("store", {
|
|||||||
tips: "", // 当前提示文案(用于 HeaderProgress 恢复状态,替代 uni.$emit 避免时序问题)
|
tips: "", // 当前提示文案(用于 HeaderProgress 恢复状态,替代 uni.$emit 避免时序问题)
|
||||||
},
|
},
|
||||||
dailyCount: getDefaultDailyCount(),
|
dailyCount: getDefaultDailyCount(),
|
||||||
|
deviceChargingDialogVisible: false,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
// 计算属性
|
// 计算属性
|
||||||
@@ -187,6 +188,12 @@ export default defineStore("store", {
|
|||||||
...(data || {}),
|
...(data || {}),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
showDeviceChargingDialog() {
|
||||||
|
this.deviceChargingDialogVisible = true;
|
||||||
|
},
|
||||||
|
hideDeviceChargingDialog() {
|
||||||
|
this.deviceChargingDialogVisible = false;
|
||||||
|
},
|
||||||
clearSessionState() {
|
clearSessionState() {
|
||||||
this.$patch({
|
this.$patch({
|
||||||
user: getDefaultUser(),
|
user: getDefaultUser(),
|
||||||
@@ -194,6 +201,7 @@ export default defineStore("store", {
|
|||||||
online: false,
|
online: false,
|
||||||
game: getDefaultGame(),
|
game: getDefaultGame(),
|
||||||
dailyCount: getDefaultDailyCount(),
|
dailyCount: getDefaultDailyCount(),
|
||||||
|
deviceChargingDialogVisible: false,
|
||||||
});
|
});
|
||||||
uni.removeStorageSync(PERSISTED_STORE_KEY);
|
uni.removeStorageSync(PERSISTED_STORE_KEY);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ function createWebSocket(token, onMessage) {
|
|||||||
uni.$emit("update-online");
|
uni.$emit("update-online");
|
||||||
} else if (msg.constructor === MESSAGETYPES.DeviceOffline) {
|
} else if (msg.constructor === MESSAGETYPES.DeviceOffline) {
|
||||||
uni.$emit("update-online");
|
uni.$emit("update-online");
|
||||||
|
} else if (msg.constructor === MESSAGETYPES.DeviceCharging) {
|
||||||
|
uni.$emit("device-charging");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user