diff --git a/project.config.json b/project.config.json index 7312eb9..dede78e 100644 --- a/project.config.json +++ b/project.config.json @@ -247,6 +247,14 @@ { "type": "folder", "value": "static/training-difficulty-design" + }, + { + "type": "folder", + "value": "static/coin" + }, + { + "type": "folder", + "value": "static/home-device" } ], "include": [] diff --git a/src/components/TargetCanvas.vue b/src/components/TargetCanvas.vue index 7026814..5d4e6e0 100644 --- a/src/components/TargetCanvas.vue +++ b/src/components/TargetCanvas.vue @@ -164,6 +164,8 @@ const defaultHighlightStyle = { color: "rgba(255, 228, 0, 0.6)", strokeColor: "rgba(254, 216, 71, 0.82)", lineWidthRatio: 0.003, + // 在最小线宽计算后应用倍数,确保不同靶面尺寸下按比例加粗。 + lineWidthScale: 1, }; // 合并默认靶纸样式和外部传入样式,ringColors 单独深合并。 @@ -319,7 +321,7 @@ const drawSectorHighlight = ( (angles.endAngle - angles.startAngle) * safeRevealProgress, style.color, style.strokeColor, - Math.max(1, targetRadius * style.lineWidthRatio) + Math.max(1, targetRadius * style.lineWidthRatio) * style.lineWidthScale ); }); }; diff --git a/src/manifest.json b/src/manifest.json index b7f45db..3c2453a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -298,6 +298,14 @@ { "type" : "folder", "value" : "static/training-difficulty-design" + }, + { + "type" : "folder", + "value" : "static/coin" + }, + { + "type" : "folder", + "value" : "static/home-device" } ] }, diff --git a/src/pages/training/components/BowTarget.vue b/src/pages/training/components/BowTarget.vue index ee3338c..5c507c3 100644 --- a/src/pages/training/components/BowTarget.vue +++ b/src/pages/training/components/BowTarget.vue @@ -546,6 +546,7 @@ onBeforeUnmount(() => { :showCrosshair="false" :showRingLabels="false" :highlightOnly="true" + :highlightStyle="{ strokeColor: '#00fffc', lineWidthScale: 3 }" :sectorCount="sectorCount" :activeSector="activeSector" :activeRings="activeRings" diff --git a/src/websocket.js b/src/websocket.js index e709cd5..ab9298c 100644 --- a/src/websocket.js +++ b/src/websocket.js @@ -103,23 +103,36 @@ function createWebSocket(token, onMessage) { } return; } - if (!data || typeof data !== "object") return; - if (data.type) { + if (data?.type) { if (ENABLE_REALTIME_MESSAGE_LOG) { console.log("收到 WebSocket 消息", getMessageTypeName(data.type)); } if (onMessage) onMessage({ ...(data.data || {}), type: data.type }); return; } - if (!Array.isArray(data.updates)) return; - if (onMessage) onMessage(data.updates); - const firstMessage = data.updates[0]; - if (firstMessage && ENABLE_REALTIME_MESSAGE_LOG) { - console.log( - "收到 WebSocket 更新", - getMessageTypeName(firstMessage.constructor), - { updateCount: data.updates.length } - ); + const updates = Array.isArray(data?.updates) ? data.updates : []; + if (!updates.length) return; + if (onMessage) onMessage(updates); + const msg = updates[0]; + if (msg) { + if (ENABLE_REALTIME_MESSAGE_LOG) { + console.log( + "收到 WebSocket 更新", + getMessageTypeName(msg.constructor), + { updateCount: data.updates.length } + ); + } + if (msg.constructor === MESSAGETYPES.RankUpdate) { + uni.setStorageSync("latestRank", msg.lvl); + } else if (msg.constructor === MESSAGETYPES.LvlUpdate) { + uni.setStorageSync("latestLvl", msg.lvl); + } else if (msg.constructor === MESSAGETYPES.DeviceOnline) { + uni.$emit("update-online", true); + } else if (msg.constructor === MESSAGETYPES.DeviceOffline) { + uni.$emit("update-online", false); + } else if (msg.constructor === MESSAGETYPES.DeviceCharging) { + uni.$emit("device-charging"); + } } data.updates.forEach((msg) => { if (msg) {