diff --git a/src/App.vue b/src/App.vue index c852548..08b356c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -22,7 +22,8 @@ const { updateUser, updateOnline, - clearSessionState + clearSessionState, + clearDevice } = store; watch( @@ -63,6 +64,11 @@ updateOnline(data.online); } + function onDeviceBindInvalid() { + clearDevice(); + uni.setStorageSync("calibration", false); + } + function onDeviceShoot() { // audioManager.play("射箭声音") } @@ -78,6 +84,7 @@ uni.$on("update-user", emitUpdateUser); uni.$on("update-online", emitUpdateOnline); uni.$on("session-kicked-out", onSessionKickedOut); + uni.$on("device-bind-invalid", onDeviceBindInvalid); const token = uni.getStorageSync( `${uni.getAccountInfoSync().miniProgram.envVersion}_token` ); @@ -91,6 +98,7 @@ uni.$off("update-user", emitUpdateUser); uni.$off("update-online", emitUpdateOnline); uni.$off("session-kicked-out", onSessionKickedOut); + uni.$off("device-bind-invalid", onDeviceBindInvalid); websocket.closeWebSocket(); }); diff --git a/src/apis.js b/src/apis.js index f980cc0..93c4c7f 100644 --- a/src/apis.js +++ b/src/apis.js @@ -70,6 +70,15 @@ function request(method, url, data = {}) { resolve({binded: true}); return; } + if (message === "BIND_FAILD") { + uni.$emit("device-bind-invalid"); + uni.showToast({ + title: "设备绑定状态已失效,请重新绑定", + icon: "none", + }); + reject({type: "DEVICE_BIND_INVALID", message}); + return; + } if (message === "ERROR_ORDER_UNPAY") { uni.showToast({ title: "当前有未支付订单", diff --git a/src/components/PlayerScore.vue b/src/components/PlayerScore.vue index 54fea32..e18bf7e 100644 --- a/src/components/PlayerScore.vue +++ b/src/components/PlayerScore.vue @@ -15,6 +15,12 @@ const props = defineProps({ }); const rowCount = new Array(6).fill(0); + +const getRingText = (arrow) => { + if (!arrow) return "-"; + if (arrow.ringX && arrow.ring) return "X环"; + return arrow.ring ? `${arrow.ring}环` : "-"; +};