Compare commits
18
Commits
14f9ccd1ef
..
test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9699f1356f | ||
|
|
aa33a931b1 | ||
|
|
f044a95872 | ||
|
|
318b952a9b | ||
|
|
14437bb5a7 | ||
|
|
f16b486a89 | ||
|
|
6c69e14630 | ||
|
|
34118d59d3 | ||
|
|
b82474913a | ||
|
|
9d9f005ca3 | ||
|
|
605a0b2d91 | ||
|
|
c9bfa6792b | ||
|
|
b0ddf147aa | ||
|
|
3caa53d4be | ||
|
|
f4f63954eb | ||
|
|
b89744802a | ||
|
|
fd6be25ba5 | ||
|
|
bad3c8ff9a |
+4
-8
@@ -4,6 +4,10 @@
|
||||
"libVersion": "3.7.7",
|
||||
"packOptions": {
|
||||
"ignore": [
|
||||
{
|
||||
"type": "folder",
|
||||
"value": "static/coin"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"value": "static/common/dialog-light.png"
|
||||
@@ -243,14 +247,6 @@
|
||||
{
|
||||
"type": "folder",
|
||||
"value": "static/training-difficulty-design"
|
||||
},
|
||||
{
|
||||
"type": "folder",
|
||||
"value": "static/coin"
|
||||
},
|
||||
{
|
||||
"type": "folder",
|
||||
"value": "static/home-device"
|
||||
}
|
||||
],
|
||||
"include": []
|
||||
|
||||
+4
-8
@@ -55,6 +55,10 @@
|
||||
"appid" : "wxa8f5989dcd45cc23",
|
||||
"packOptions" : {
|
||||
"ignore" : [
|
||||
{
|
||||
"type" : "folder",
|
||||
"value" : "static/coin"
|
||||
},
|
||||
{
|
||||
"type" : "file",
|
||||
"value" : "static/common/dialog-light.png"
|
||||
@@ -294,14 +298,6 @@
|
||||
{
|
||||
"type" : "folder",
|
||||
"value" : "static/training-difficulty-design"
|
||||
},
|
||||
{
|
||||
"type" : "folder",
|
||||
"value" : "static/coin"
|
||||
},
|
||||
{
|
||||
"type" : "folder",
|
||||
"value" : "static/home-device"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
{
|
||||
"path": "pages/audio-test"
|
||||
},
|
||||
{
|
||||
"path": "pages/calibration"
|
||||
},
|
||||
{
|
||||
"path": "pages/about-us"
|
||||
},
|
||||
@@ -60,12 +57,6 @@
|
||||
{
|
||||
"path": "pages/match-page"
|
||||
},
|
||||
{
|
||||
"path": "pages/my-device"
|
||||
},
|
||||
{
|
||||
"path": "pages/device-intro"
|
||||
},
|
||||
{
|
||||
"path": "pages/user"
|
||||
},
|
||||
@@ -107,12 +98,6 @@
|
||||
},
|
||||
{
|
||||
"path": "pages/mine-bow-data"
|
||||
},
|
||||
{
|
||||
"path": "pages/ota-wifi",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"globalStyle": {
|
||||
|
||||
+32
-25
@@ -93,42 +93,49 @@ function createWebSocket(token, onMessage) {
|
||||
"/addons/shoot/otaResult",
|
||||
];
|
||||
if (passthroughEvents.includes(event)) {
|
||||
if ((code == null || Number(code) === 0) && onMessage && data && typeof data === "object") {
|
||||
if (
|
||||
(code == null || Number(code) === 0) &&
|
||||
onMessage &&
|
||||
data &&
|
||||
typeof data === "object"
|
||||
) {
|
||||
onMessage({ event, data, code, timestamp });
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (data?.type) {
|
||||
if (!data || typeof data !== "object") return;
|
||||
if (data.type) {
|
||||
if (ENABLE_REALTIME_MESSAGE_LOG) {
|
||||
console.log("收到 WebSocket 消息", getMessageTypeName(data.type));
|
||||
}
|
||||
if (onMessage) onMessage({ ...(data.data || {}), type: data.type });
|
||||
return;
|
||||
}
|
||||
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");
|
||||
}
|
||||
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 }
|
||||
);
|
||||
}
|
||||
data.updates.forEach((msg) => {
|
||||
if (msg) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
socketTask.onError((err) => {
|
||||
|
||||
Reference in New Issue
Block a user