14 Commits
Author SHA1 Message Date
zhangyi bad3c8ff9a Merge branch 'feat-training' into test 2026-09-23 10:50:06 +08:00
zhangyi 9ad2c5e12e update:优化稳定训练 2026-09-23 10:35:11 +08:00
zhangyi 9de435a369 update:优化稳定训练 2026-09-22 17:36:06 +08:00
zhangyi 5357f131de update:优化精准稳定 2026-09-22 15:15:16 +08:00
zhangyi 7093d3e4e5 update:替换网络图片 2026-09-22 10:00:26 +08:00
zhangyi e98e5129d2 update:优化特效 2026-09-22 09:37:37 +08:00
zhangyi 01e8f6c6da update:优化ota状态共享 2026-09-21 16:22:05 +08:00
zhangyi 4bd7599cc0 update:新增ota 2026-09-21 14:56:43 +08:00
zhangyi b060d8f987 update:提交我的设备改版 2026-09-17 18:23:41 +08:00
zhangyi 46cbd37102 Merge branch 'test' into feat-shebei 2026-09-15 18:15:12 +08:00
zhangyi d4d690cb8e update:更新protocol 2026-09-15 18:12:39 +08:00
zhangyi b51813dd33 update:优化设备页 2026-09-15 17:56:36 +08:00
zhangyi a11e7f7532 Merge branch 'fix-audio' into feat-shebei 2026-09-15 15:49:26 +08:00
zhangyi 03fa2f4d48 update:代码备份 2026-09-15 15:39:46 +08:00
150 changed files with 5093 additions and 1605 deletions
-5
View File
@@ -264,11 +264,6 @@ function buildSchema({ messageName, definition, messages, enumNames }) {
} }
const repeated = rule === "repeated"; const repeated = rule === "repeated";
if (repeated && !isMessage && !["string", "bytes"].includes(kind)) {
throw new Error(
`${messageName}.${fieldKey} 是 packed scalar repeated,当前通用解码器尚不支持`
);
}
const field = isMessage const field = isMessage
? { name: fieldName, kind: "message", type: typeName } ? { name: fieldName, kind: "message", type: typeName }
+22 -10
View File
@@ -8,9 +8,6 @@
} from "@dcloudio/uni-app"; } from "@dcloudio/uni-app";
import websocket from "@/websocket"; import websocket from "@/websocket";
import matchWebsocket from "@/matchWebsocket"; import matchWebsocket from "@/matchWebsocket";
import {
getDeviceBatteryAPI
} from "@/apis";
import { import {
MESSAGETYPES MESSAGETYPES
} from "@/constants"; } from "@/constants";
@@ -27,7 +24,9 @@
} = storeToRefs(store); } = storeToRefs(store);
const { const {
updateUser, updateUser,
updateOnline, updateDeviceStatus,
setDeviceOnline,
clearDeviceStatus,
showDeviceChargingDialog, showDeviceChargingDialog,
clearSessionState, clearSessionState,
clearDevice clearDevice
@@ -69,13 +68,19 @@
}); });
} }
async function emitUpdateOnline() { function emitUpdateOnline(nextOnline) {
const data = await getDeviceBatteryAPI();
const wasOnline = Boolean(online.value); const wasOnline = Boolean(online.value);
const nextOnline = Boolean(data.online); setDeviceOnline(nextOnline === true);
updateOnline(nextOnline); if (!device.value.deviceId || wasOnline === (nextOnline === true)) return;
if (!device.value.deviceId || wasOnline === nextOnline) return; audioManager.play(nextOnline === true ? "设备已连接" : "设备连接已断开");
audioManager.play(nextOnline ? "设备已连接" : "设备连接已断开"); }
function onDeviceStatusPush(status) {
updateDeviceStatus(status);
}
function onShootSocketDisconnected() {
clearDeviceStatus();
} }
function onDeviceBindInvalid() { function onDeviceBindInvalid() {
@@ -111,6 +116,10 @@
} }
function onShootWsMsg(content) { function onShootWsMsg(content) {
if (content?.event === "/addons/shoot/battery") {
onDeviceStatusPush(content.data);
return;
}
if(content.type === 'shoot-trigger'){ if(content.type === 'shoot-trigger'){
onDeviceShoot() onDeviceShoot()
} }
@@ -122,6 +131,7 @@
void audioManager.warmButton(); void audioManager.warmButton();
uni.$on("update-user", emitUpdateUser); uni.$on("update-user", emitUpdateUser);
uni.$on("update-online", emitUpdateOnline); uni.$on("update-online", emitUpdateOnline);
uni.$on("shoot-socket-disconnected", onShootSocketDisconnected);
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); uni.$on("device-charging", onDeviceCharging);
@@ -148,6 +158,7 @@
onHide(() => { onHide(() => {
uni.$off("update-user", emitUpdateUser); uni.$off("update-user", emitUpdateUser);
uni.$off("update-online", emitUpdateOnline); uni.$off("update-online", emitUpdateOnline);
uni.$off("shoot-socket-disconnected", onShootSocketDisconnected);
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); uni.$off("device-charging", onDeviceCharging);
@@ -157,6 +168,7 @@
matchWebsocket.closeMatchWebSocket({ matchWebsocket.closeMatchWebSocket({
reason: "app-hide" reason: "app-hide"
}); });
clearDeviceStatus();
websocket.closeWebSocket(); websocket.closeWebSocket();
}); });
</script> </script>
+34 -17
View File
@@ -28,7 +28,8 @@ try {
const ADDONS_BASE_URL = BASE_URL.replace(/\/api\/shoot$/, "/api/shoot"); const ADDONS_BASE_URL = BASE_URL.replace(/\/api\/shoot$/, "/api/shoot");
const API_ROOT_URL = BASE_URL.replace(/\/api\/shoot$/, ""); const API_ROOT_URL = BASE_URL.replace(/\/api\/shoot$/, "");
// 统一处理业务接口请求,包含登录态、业务错误和特定接口空响应兼容。 // 统一处理业务接口请求,包含登录态、业务错误和特定接口空响应兼容。
function request(method, url, data = {}, baseUrl = BASE_URL, successCodes = [0]) { function request(method, url, data = {}, baseUrl = BASE_URL, successCodes = [0], options = {}) {
const {timeout = 10000, showErrorToast = true} = options;
const token = uni.getStorageSync( const token = uni.getStorageSync(
`${uni.getAccountInfoSync().miniProgram.envVersion}_token` `${uni.getAccountInfoSync().miniProgram.envVersion}_token`
); );
@@ -40,8 +41,16 @@ function request(method, url, data = {}, baseUrl = BASE_URL, successCodes = [0])
method, method,
header, header,
data, data,
timeout: 10000, timeout,
success: (res) => { success: (res) => {
if (
url === "/user/hardwareBox/connectWifi" &&
res.statusCode === 200 &&
typeof res.data?.success === "boolean"
) {
resolve(res.data);
return;
}
const acceptsEmptyResponse = [ const acceptsEmptyResponse = [
"/user/hardwareBox/connectWifi", "/user/hardwareBox/connectWifi",
"/user/device/unbindByQrcodeId", "/user/device/unbindByQrcodeId",
@@ -111,10 +120,12 @@ function request(method, url, data = {}, baseUrl = BASE_URL, successCodes = [0])
icon: "none", icon: "none",
}); });
} }
uni.showToast({ if (showErrorToast) {
title: message, uni.showToast({
icon: "none", title: message,
}); icon: "none",
});
}
reject(error); reject(error);
return; return;
} }
@@ -122,7 +133,7 @@ function request(method, url, data = {}, baseUrl = BASE_URL, successCodes = [0])
} }
}, },
fail: (err) => { fail: (err) => {
handleRequestError(err, url); if (showErrorToast) handleRequestError(err, url);
reject(err); reject(err);
}, },
}); });
@@ -281,6 +292,14 @@ export const getMyDevicesAPI = () => {
return request("GET", "/user/device/getBindings"); return request("GET", "/user/device/getBindings");
}; };
export const getDeviceDetailAPI = (deviceId) => {
return request("GET", `/user/device/getDetail?deviceId=${encodeURIComponent(deviceId)}`);
};
export const updateDeviceAliasAPI = (deviceId, alias) => {
return request("POST", "/user/device/updateAlias", {deviceId, alias});
};
export const createPractiseAPI = (arrows, time, target) => { export const createPractiseAPI = (arrows, time, target) => {
return request("POST", "/user/practice/create", { return request("POST", "/user/practice/create", {
shootNumber: arrows, shootNumber: arrows,
@@ -561,13 +580,16 @@ export const laserCloseAPI = async () => {
return request("POST", "/user/device/closeAim"); return request("POST", "/user/device/closeAim");
}; };
export const getDeviceBatteryAPI = async () => {
return request("GET", "/user/device/battery");
};
// 设备连接指定 WiFi,只下发 WiFi 凭证,不触发 OTA 升级。 // 设备连接指定 WiFi,只下发 WiFi 凭证,不触发 OTA 升级。
export const connectDeviceWifiAPI = async (ssid, password) => { export const connectDeviceWifiAPI = async (ssid, password) => {
return request("POST", "/user/hardwareBox/connectWifi", {ssid, password}); return request(
"POST",
"/user/hardwareBox/connectWifi",
{ssid, password},
BASE_URL,
[0],
{timeout: 20000, showErrorToast: false}
);
}; };
// 获取硬件盒子版本信息,用于判断当前设备是否需要 OTA 升级。 // 获取硬件盒子版本信息,用于判断当前设备是否需要 OTA 升级。
@@ -580,11 +602,6 @@ export const sendHardwareBoxUpdateAPI = async (data) => {
return request("POST", "/user/hardwareBox/sendUpdate", data); return request("POST", "/user/hardwareBox/sendUpdate", data);
}; };
// 根据任务 ID 获取硬件盒子 OTA 更新状态。
export const getHardwareBoxTaskStatusAPI = async (taskId) => {
return request("GET", `/user/hardwareBox/taskStatus?taskId=${taskId}`);
};
export const addNoteAPI = async (id, remark) => { export const addNoteAPI = async (id, remark) => {
return request("POST", "/user/score/sheet/remark", {id, remark}); return request("POST", "/user/score/sheet/remark", {id, remark});
}; };
+3 -3
View File
@@ -2,7 +2,7 @@ export const AUDIO_INTERRUPTION_BEGIN_EVENT = "audio-interruption-begin";
export const AUDIO_INTERRUPTION_END_EVENT = "audio-interruption-end"; export const AUDIO_INTERRUPTION_END_EVENT = "audio-interruption-end";
export const RHYTHM_SHOOT_WINDOW_AUDIO_KEY = "请射箭"; export const RHYTHM_SHOOT_WINDOW_AUDIO_KEY = "请射箭";
export const STABILITY_START_AUDIO_KEY = export const STABILITY_START_AUDIO_KEY =
"请在计时结束前能量条达到百分百"; "请在计时结束时能量条达到标记区域";
export const STABILITY_ENERGY_50_AUDIO_KEY = "加油!到达50%啦"; export const STABILITY_ENERGY_50_AUDIO_KEY = "加油!到达50%啦";
export const STABILITY_ENERGY_70_AUDIO_KEY = export const STABILITY_ENERGY_70_AUDIO_KEY =
"70%啦!还差一点,胜利就在眼前"; "70%啦!还差一点,胜利就在眼前";
@@ -12,7 +12,7 @@ const TRAINING_START_AUDIO_KEY_MAP = Object.freeze({
endurance: "请于计时前完成累计环数和箭量", endurance: "请于计时前完成累计环数和箭量",
precision: "请射箭命中高亮区域", precision: "请射箭命中高亮区域",
rhythm: "请在读条推进到标记区间内射箭", rhythm: "请在读条推进到标记区间内射箭",
stability: "请在计时结束前能量条达到百分百", stability: STABILITY_START_AUDIO_KEY,
}); });
export const getTrainingStartAudioKey = (trainingType, fallback = "") => export const getTrainingStartAudioKey = (trainingType, fallback = "") =>
@@ -176,7 +176,7 @@ export const audioFils = {
练习开始: 练习开始:
"https://static.shelingxingqiu.com/attachment/2025-11-14/de88w0lmmt43nnfmoi.mp3", "https://static.shelingxingqiu.com/attachment/2025-11-14/de88w0lmmt43nnfmoi.mp3",
[STABILITY_START_AUDIO_KEY]: [STABILITY_START_AUDIO_KEY]:
"https://static.shelingxingqiu.com/shootaudio/%E8%AF%B7%E5%9C%A8%E8%AE%A1%E6%97%B6%E7%BB%93%E6%9D%9F%E5%89%8D%E8%83%BD%E9%87%8F%E6%9D%A1%E8%BE%BE%E5%88%B0%E7%99%BE%E5%88%86%E7%99%BE.MP3", "https://static.shelingxingqiu.com/shootmini/static/audio0820/%E8%AF%B7%E5%9C%A8%E8%AE%A1%E6%97%B6%E7%BB%93%E6%9D%9F%E6%97%B6%E8%83%BD%E9%87%8F%E6%9D%A1%E8%BE%BE%E5%88%B0%E6%A0%87%E8%AE%B0%E5%8C%BA%E5%9F%9F.MP3",
[STABILITY_ENERGY_50_AUDIO_KEY]: [STABILITY_ENERGY_50_AUDIO_KEY]:
"https://static.shelingxingqiu.com/shootmini/static/audio0820/%E5%8A%A0%E6%B2%B9%EF%BC%81%E5%88%B0%E8%BE%BE50%25%E5%95%A6.MP3", "https://static.shelingxingqiu.com/shootmini/static/audio0820/%E5%8A%A0%E6%B2%B9%EF%BC%81%E5%88%B0%E8%BE%BE50%25%E5%95%A6.MP3",
[STABILITY_ENERGY_70_AUDIO_KEY]: [STABILITY_ENERGY_70_AUDIO_KEY]:
+10 -13
View File
@@ -451,7 +451,7 @@ export const generateShareImage = async (canvasId, data) => {
hasPoint ? 756 : 402 hasPoint ? 756 : 402
); );
renderText(ctx, "扫码打卡", 13, "#FFA118", 142, hasPoint ? 777 : 422); renderText(ctx, "扫码打卡", 13, "#FFA118", 142, hasPoint ? 777 : 422);
const pointImg = await loadCanvasImage(canvas, "../static/point.png"); const pointImg = await loadCanvasImage(canvas, "https://static.shelingxingqiu.com/shootmini/static/point.png");
ctx.drawImage(pointImg, 120, hasPoint ? 765 : 410, 18, 14); ctx.drawImage(pointImg, 120, hasPoint ? 765 : 410, 18, 14);
// 2D 即时绘制,无需 ctx.draw() // 2D 即时绘制,无需 ctx.draw()
} catch (e) { } catch (e) {
@@ -635,7 +635,7 @@ export function renderScores(ctx, arrows = [], bgImg) {
); );
} else { } else {
ctx.drawImage( ctx.drawImage(
"/static/score-bg.png", "https://static.shelingxingqiu.com/shootmini/static/score-bg.png",
16 + (i % 9) * 30, 16 + (i % 9) * 30,
290 + Math.ceil((i + 1) / 9) * 30, 290 + Math.ceil((i + 1) / 9) * 30,
27, 27,
@@ -657,7 +657,7 @@ export function renderScores(ctx, arrows = [], bgImg) {
ctx.drawImage(bgImg, 24 + rowIndex * 42, i > 5 ? 362 : 320, 38, 38); ctx.drawImage(bgImg, 24 + rowIndex * 42, i > 5 ? 362 : 320, 38, 38);
} else { } else {
ctx.drawImage( ctx.drawImage(
"/static/score-bg.png", "https://static.shelingxingqiu.com/shootmini/static/score-bg.png",
24 + rowIndex * 42, 24 + rowIndex * 42,
i > 5 ? 362 : 320, i > 5 ? 362 : 320,
38, 38,
@@ -708,10 +708,7 @@ export async function sharePractiseData(canvasId, type, user, data) {
// 头像与段位框属于装饰图片,缺失时使用兜底或跳过,避免阻断分享。 // 头像与段位框属于装饰图片,缺失时使用兜底或跳过,避免阻断分享。
const loadProfileImage = async (src, fallbackSrc = "", label = "") => { const loadProfileImage = async (src, fallbackSrc = "", label = "") => {
const normalizedSrc = const normalizedSrc = typeof src === "string" ? src : "";
typeof src === "string" && src.startsWith("../static/")
? src.slice(2)
: src;
if (normalizedSrc) { if (normalizedSrc) {
try { try {
const path = await loadImage(normalizedSrc); const path = await loadImage(normalizedSrc);
@@ -725,20 +722,20 @@ export async function sharePractiseData(canvasId, type, user, data) {
const avatarImgPromise = loadProfileImage( const avatarImgPromise = loadProfileImage(
user?.avatar, user?.avatar,
"/static/user-icon.png", "https://static.shelingxingqiu.com/shootmini/static/user-icon.png",
"avatar" "avatar"
); );
const lvlImgPromise = loadProfileImage(user?.lvlImage, "", "level"); const lvlImgPromise = loadProfileImage(user?.lvlImage, "", "level");
let titleImageSrc = "/static/first-try-title.png"; let titleImageSrc = "https://static.shelingxingqiu.com/shootmini/static/first-try-title.png";
if (type == 2) { if (type == 2) {
titleImageSrc = "/static/practise-one-title.png"; titleImageSrc = "https://static.shelingxingqiu.com/shootmini/static/practise-one-title.png";
} else if (type == 3) { } else if (type == 3) {
titleImageSrc = "/static/practise-two-title.png"; titleImageSrc = "https://static.shelingxingqiu.com/shootmini/static/practise-two-title.png";
} }
const titleImgPromise = loadCanvasImage(canvas, titleImageSrc); const titleImgPromise = loadCanvasImage(canvas, titleImageSrc);
const scoreBgImgPromise = loadCanvasImage(canvas, "/static/score-bg.png"); const scoreBgImgPromise = loadCanvasImage(canvas, "https://static.shelingxingqiu.com/shootmini/static/score-bg.png");
const qrCodeImgPromise = loadCanvasImage(canvas, "/static/qr-code.png"); const qrCodeImgPromise = loadCanvasImage(canvas, "https://static.shelingxingqiu.com/shootmini/static/qr-code.png");
const [avatarImg, lvlImg, titleImg, scoreBgImg, qrCodeImg] = const [avatarImg, lvlImg, titleImg, scoreBgImg, qrCodeImg] =
await Promise.all([ await Promise.all([
+7
View File
@@ -81,6 +81,13 @@ const props = defineProps({
src="https://static.shelingxingqiu.com/shootmini/static/app-bg9.png" src="https://static.shelingxingqiu.com/shootmini/static/app-bg9.png"
mode="widthFix" mode="widthFix"
/> />
<!-- 我的设备未绑定/绑定成功页面背景 -->
<image
class="bg-image"
v-if="type === 12"
src="https://static.shelingxingqiu.com/shootmini/static/device-assets/my-device-unbound-background.png"
mode="widthFix"
/>
<image <image
class="bg-image" class="bg-image"
v-if="type === 10" v-if="type === 10"
+2 -2
View File
@@ -1,6 +1,6 @@
<script setup> <script setup>
const tabs = [ const tabs = [
{ image: "../static/tab-vip.png" }, { image: "https://static.shelingxingqiu.com/shootmini/static/tab-vip.png" },
{ image: "https://static.shelingxingqiu.com/shootmini/static/tab-point-book.png" }, { image: "https://static.shelingxingqiu.com/shootmini/static/tab-point-book.png" },
{ image: "https://static.shelingxingqiu.com/shootmini/static/tab-mall.png" }, { image: "https://static.shelingxingqiu.com/shootmini/static/tab-mall.png" },
]; ];
@@ -18,7 +18,7 @@ function handleTabClick(index) {
} }
if (index === 2) { if (index === 2) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/device-intro", url: "/pages/device/device-intro",
}); });
} }
} }
+4 -4
View File
@@ -77,25 +77,25 @@ watch(
/> />
<image <image
v-if="rank === 1" v-if="rank === 1"
src="../static/champ1.png" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<image <image
v-if="rank === 2" v-if="rank === 2"
src="../static/champ2.png" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<image <image
v-if="rank === 3" v-if="rank === 3"
src="../static/champ3.png" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<view v-if="rank > 3" class="rank-view">{{ rank }}</view> <view v-if="rank > 3" class="rank-view">{{ rank }}</view>
<image <image
:src="src || '../static/user-icon.png'" :src="src || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
:mode="imageMode" :mode="imageMode"
:style="avatarImageStyle" :style="avatarImageStyle"
class="avatar-image" class="avatar-image"
+1 -1
View File
@@ -104,7 +104,7 @@ onBeforeUnmount(() => {
<block v-else-if="game.roomID"> <block v-else-if="game.roomID">
<text>返回房间</text> <text>返回房间</text>
</block> </block>
<image src="../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
</template> </template>
+2 -2
View File
@@ -72,7 +72,7 @@ const isMember = (player = {}) => player.vip === true || player.sVip === true;
</view> </view>
<image <image
v-if="winner === 1" v-if="winner === 1"
src="../static/winner-badge.png" src="https://static.shelingxingqiu.com/shootmini/static/winner-badge.png"
mode="widthFix" mode="widthFix"
class="left-winner-badge" class="left-winner-badge"
/> />
@@ -100,7 +100,7 @@ const isMember = (player = {}) => player.vip === true || player.sVip === true;
</view> </view>
<image <image
v-if="winner === 2" v-if="winner === 2"
src="../static/winner-badge.png" src="https://static.shelingxingqiu.com/shootmini/static/winner-badge.png"
mode="widthFix" mode="widthFix"
class="right-winner-badge" class="right-winner-badge"
/> />
+1 -1
View File
@@ -58,7 +58,7 @@ const props = defineProps({
</view> </view>
</view> </view>
<view @click="onClose"> <view @click="onClose">
<image src="../static/close-white.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-white.png" mode="widthFix" />
</view> </view>
</view> </view>
<view :style="{ width: '100%', marginBottom: '20px' }"> <view :style="{ width: '100%', marginBottom: '20px' }">
+6 -35
View File
@@ -1,44 +1,15 @@
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount } from "vue"; import useStore from "@/store";
import { getDeviceBatteryAPI } from "@/apis"; import { storeToRefs } from "pinia";
const power = ref(0); const store = useStore();
const timer = ref(null); const { deviceBattery: power } = storeToRefs(store);
let disposed = false;
let requestInFlight = false;
const refreshPower = async () => {
if (disposed || requestInFlight) return;
requestInFlight = true;
try {
const data = await getDeviceBatteryAPI();
if (!disposed) power.value = data.battery;
} catch (_) {
// 电量轮询失败时等待下一轮,避免产生未处理的 Promise 拒绝。
} finally {
requestInFlight = false;
}
};
onMounted(async () => {
await refreshPower();
if (disposed) return;
timer.value = setInterval(() => {
void refreshPower();
}, 1000 * 10);
});
onBeforeUnmount(() => {
disposed = true;
clearInterval(timer.value);
timer.value = null;
});
</script> </script>
<template> <template>
<view class="container"> <view class="container">
<image src="../static/b-power.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/b-power.png" mode="widthFix" />
<view>电量{{ power || 1 }}%</view> <view>{{ power === null ? "电量--" : `电量${power}%` }}</view>
</view> </view>
</template> </template>
+3 -3
View File
@@ -527,7 +527,7 @@ onBeforeUnmount(() => {
<view :class="['target', { 'target--shake': targetShaking }]"> <view :class="['target', { 'target--shake': targetShaking }]">
<view v-if="angle !== null" class="arrow-dir" :style="arrowStyle"> <view v-if="angle !== null" class="arrow-dir" :style="arrowStyle">
<view :style="{ background: circleColor }"> <view :style="{ background: circleColor }">
<image src="../static/dot-circle.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/dot-circle.png" mode="widthFix" />
</view> </view>
</view> </view>
<view v-if="stop" class="stop-sign">中场休息</view> <view v-if="stop" class="stop-sign">中场休息</view>
@@ -565,7 +565,7 @@ onBeforeUnmount(() => {
<image <image
v-if="pMode && isSvip && bow.ring > 0 && !shouldHideRedHit(index)" v-if="pMode && isSvip && bow.ring > 0 && !shouldHideRedHit(index)"
class="svip-hit-bg" class="svip-hit-bg"
src="../static/vip/svip-xuan.png" src="https://static.shelingxingqiu.com/shootmini/static/vip/svip-xuan.png"
:style="getSvipHitBgStyle(bow)" :style="getSvipHitBgStyle(bow)"
mode="aspectFit" mode="aspectFit"
/> />
@@ -585,7 +585,7 @@ onBeforeUnmount(() => {
<image <image
v-if="pMode && isSvip && bow.ring > 0 && !shouldHideBlueHit(index)" v-if="pMode && isSvip && bow.ring > 0 && !shouldHideBlueHit(index)"
class="svip-hit-bg" class="svip-hit-bg"
src="../static/vip/svip-xuan.png" src="https://static.shelingxingqiu.com/shootmini/static/vip/svip-xuan.png"
:style="getSvipHitBgStyle(bow)" :style="getSvipHitBgStyle(bow)"
mode="aspectFit" mode="aspectFit"
/> />
+3 -3
View File
@@ -266,16 +266,16 @@ onBeforeUnmount(() => {
@touchstart.stop="confirmAdd" @touchstart.stop="confirmAdd"
:style="{ ...getNewPos() }" :style="{ ...getNewPos() }"
> >
<image src="../static/arrow-edit-save.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/arrow-edit-save.png" mode="widthFix" />
</view> </view>
<view class="edit-btn delete-btn" @touchstart.stop="deleteArrow"> <view class="edit-btn delete-btn" @touchstart.stop="deleteArrow">
<image src="../static/arrow-edit-delete.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/arrow-edit-delete.png" mode="widthFix" />
</view> </view>
<view <view
class="edit-btn drag-btn" class="edit-btn drag-btn"
@touchstart.stop="startDrag($event)" @touchstart.stop="startDrag($event)"
> >
<image src="../static/arrow-edit-move.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/arrow-edit-move.png" mode="widthFix" />
</view> </view>
</view> </view>
</view> </view>
+4 -4
View File
@@ -29,14 +29,14 @@ const props = defineProps({
font-size: 24rpx; font-size: 24rpx;
} }
.normal { .normal {
background-image: url("../static/bubble-tip.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip.png");
width: 157rpx; width: 157rpx;
height: 105rpx; height: 105rpx;
padding-top: 10px; padding-top: 10px;
padding-left: 30rpx; padding-left: 30rpx;
} }
.normal2 { .normal2 {
background-image: url("../static/bubble-tip4.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip4.png");
width: 190rpx; width: 190rpx;
height: 105rpx; height: 105rpx;
padding-top: 10px; padding-top: 10px;
@@ -46,14 +46,14 @@ const props = defineProps({
z-index: 1; z-index: 1;
} }
.long { .long {
background-image: url("../static/bubble-tip2.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip2.png");
width: 370rpx; width: 370rpx;
height: 70rpx; height: 70rpx;
top: -50%; top: -50%;
left: 49%; left: 49%;
} }
.short { .short {
background-image: url("../static/bubble-tip3.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip3.png");
width: 300rpx; width: 300rpx;
height: 70rpx; height: 70rpx;
top: -50%; top: -50%;
+1 -1
View File
@@ -124,7 +124,7 @@ const cancelMatching = async () => {
const goCalibration = async () => { const goCalibration = async () => {
await laserAimAPI(); await laserAimAPI();
uni.navigateTo({ uni.navigateTo({
url: "/pages/calibration", url: "/pages/device/calibration",
}); });
}; };
</script> </script>
+399
View File
@@ -0,0 +1,399 @@
<script setup>
import { computed } from "vue";
const props = defineProps({
variant: {
type: String,
default: "home",
validator: (value) => ["home", "detail"].includes(value),
},
});
// 固定粒子分布营造随机感,避免每次进入页面时因运行时随机数产生位置跳变。
const sparkSeeds = [
[1, "dot", 18, 98, -28, 5, 5, 2.3, 0.4],
[2, "streak", 23, 90, -38, 4, 18, 2, 1.1, true],
[3, "dot", 28, 112, -17, 6, 6, 2.8, 1.9, true],
[4, "dot", 32, 104, -12, 12, 12, 2.6, 0.7, true, true],
[5, "dot", 36, 88, -24, 4, 4, 1.8, 1.4],
[6, "streak", 40, 116, -8, 4, 20, 2.4, 2.2, true],
[7, "dot", 44, 96, -16, 7, 7, 2.1, 0.2],
[8, "dot", 48, 120, -4, 5, 5, 2.9, 1.3, true],
[9, "dot", 51, 110, 3, 14, 14, 3, 2.7, true, true],
[10, "streak", 54, 92, 8, 4, 22, 1.9, 0.8],
[11, "dot", 58, 105, 14, 6, 6, 2.5, 1.6, true],
[12, "dot", 62, 86, 21, 4, 4, 2, 0.5],
[13, "dot", 66, 114, 10, 7, 7, 2.7, 2.1, true],
[14, "streak", 70, 96, 28, 4, 18, 2.2, 1],
[15, "dot", 74, 108, 20, 11, 11, 2.8, 2.4, true, true],
[16, "dot", 80, 90, 35, 5, 5, 2.3, 0.3, true],
[17, "dot", 21, 118, -8, 4, 4, 2.6, 1.7],
[18, "streak", 27, 84, -31, 3, 16, 1.8, 0.6, true],
[19, "dot", 34, 122, -3, 6, 6, 2.9, 2.3, true],
[20, "dot", 42, 102, 5, 5, 5, 2.2, 0.9],
[21, "dot", 47, 88, -10, 13, 13, 2.7, 1.5, true, true],
[22, "streak", 56, 120, 16, 4, 21, 2.5, 2.6, true],
[23, "dot", 64, 100, 24, 7, 7, 2.4, 0.1],
[24, "dot", 72, 84, 38, 5, 5, 2, 1.2, true],
[25, "dot", 82, 116, 12, 4, 4, 2.8, 2],
[26, "dot", 68, 124, 7, 10, 10, 3.1, 2.9, true, true],
[27, "streak", 77, 98, 33, 4, 19, 2.1, 0.7, true],
[28, "dot", 29, 94, -20, 7, 7, 2.5, 1.4],
[29, "dot", 53, 126, 0, 5, 5, 2.3, 2.2, true],
[30, "dot", 60, 108, 18, 6, 6, 2.6, 0.4],
];
const deviceSparks = computed(() => {
const isDetail = props.variant === "detail";
const sizeScale = isDetail ? 1.25 : 1;
const bottomOffset = isDetail ? 120 : 0;
return sparkSeeds.map(([
id,
type,
left,
bottom,
angle,
width,
height,
duration,
delay,
long = false,
large = false,
]) => ({
id,
type,
long,
large,
trackStyle: {
left: `${left}%`,
bottom: `${bottom + bottomOffset}rpx`,
transform: `rotate(${angle}deg)`,
},
sparkStyle: {
width: `${width * sizeScale}rpx`,
height: `${height * sizeScale}rpx`,
marginLeft: `${-(width * sizeScale) / 2}rpx`,
animationDuration: `${duration}s`,
animationDelay: `-${delay}s`,
},
}));
});
</script>
<template>
<view
class="device-online-effects"
:class="`device-online-effects--${variant}`"
>
<view class="device-online-rays-stage">
<view class="device-online-rays-orbit">
<view class="device-online-ray device-online-ray--1" />
<view class="device-online-ray device-online-ray--2" />
<view class="device-online-ray device-online-ray--3" />
<view class="device-online-ray device-online-ray--4" />
<view class="device-online-ray device-online-ray--5" />
<view class="device-online-ray device-online-ray--6" />
<view class="device-online-ray device-online-ray--7" />
</view>
</view>
<view class="device-online-particles">
<view
v-for="spark in deviceSparks"
:key="spark.id"
class="device-online-spark-track"
:style="spark.trackStyle"
>
<view
class="device-online-spark"
:class="[
`device-online-spark--${spark.type}`,
{
'device-online-spark--long': spark.long,
'device-online-spark--large': spark.large,
}
]"
:style="spark.sparkStyle"
/>
</view>
</view>
</view>
</template>
<style scoped lang="scss">
.device-online-effects {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 3;
overflow: hidden;
pointer-events: none;
}
/* 光束沿底座椭圆轨迹扫动,用位移、明暗和横向缩放表达前后纵深。 */
.device-online-rays-stage {
position: absolute;
left: 0;
bottom: 112rpx;
width: 100%;
height: 140rpx;
overflow: hidden;
transform-origin: 50% 100%;
}
.device-online-rays-orbit {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
transform-origin: 50% 100%;
animation: device-rays-rotate 6s ease-in-out infinite;
}
.device-online-ray {
position: absolute;
bottom: 0;
left: 50%;
width: 48rpx;
height: 132rpx;
margin-left: -24rpx;
transform-origin: 50% 100%;
border-radius: 50% 50% 12% 12%;
background: linear-gradient(
180deg,
rgba(255, 255, 244, 0) 0%,
rgba(255, 254, 239, 0.1) 36%,
rgba(255, 248, 215, 0.22) 72%,
rgba(255, 232, 151, 0.36) 100%
);
}
.device-online-ray--1 {
opacity: 0.55;
transform: rotate(-55deg);
}
.device-online-ray--2 {
width: 68rpx;
margin-left: -34rpx;
opacity: 0.72;
transform: rotate(-36deg);
}
.device-online-ray--3 {
width: 42rpx;
margin-left: -21rpx;
opacity: 0.6;
transform: rotate(-18deg);
}
.device-online-ray--4 {
width: 76rpx;
margin-left: -38rpx;
opacity: 0.82;
}
.device-online-ray--5 {
width: 46rpx;
margin-left: -23rpx;
opacity: 0.64;
transform: rotate(19deg);
}
.device-online-ray--6 {
width: 64rpx;
margin-left: -32rpx;
opacity: 0.7;
transform: rotate(38deg);
}
.device-online-ray--7 {
width: 44rpx;
margin-left: -22rpx;
opacity: 0.56;
transform: rotate(56deg);
}
.device-online-particles {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.device-online-spark-track {
position: absolute;
width: 0;
height: 0;
transform-origin: center bottom;
}
.device-online-spark {
position: absolute;
bottom: 0;
left: 0;
background: #fff6bd;
box-shadow: 0 0 6rpx rgba(255, 225, 112, 0.65);
animation: device-spark-rise 2.4s linear infinite;
}
.device-online-spark--dot {
border-radius: 50%;
}
.device-online-spark--streak {
border-radius: 50%;
background: linear-gradient(
180deg,
rgba(255, 255, 235, 0) 0%,
rgba(255, 250, 205, 0.75) 45%,
#ffe379 100%
);
}
.device-online-spark--long {
animation-name: device-spark-rise-long;
}
.device-online-spark--large {
background: #fffbdc;
box-shadow:
0 0 10rpx rgba(255, 243, 174, 0.95),
0 0 20rpx rgba(255, 207, 74, 0.72);
}
.device-online-effects--detail .device-online-rays-stage {
bottom: 215rpx;
height: 190rpx;
transform: scaleX(1.35);
}
.device-online-effects--detail .device-online-ray {
height: 180rpx;
}
.device-online-effects--detail .device-online-rays-orbit {
animation-name: device-rays-rotate-detail;
}
.device-online-effects--detail .device-online-spark {
animation-name: device-spark-rise-detail;
}
.device-online-effects--detail .device-online-spark--long {
animation-name: device-spark-rise-detail-long;
}
@keyframes device-spark-rise {
0% {
opacity: 0;
transform: translateY(8rpx) scale(0.45);
}
16% {
opacity: 1;
}
72% {
opacity: 0.62;
}
100% {
opacity: 0;
transform: translateY(-148rpx) scale(1);
}
}
@keyframes device-spark-rise-long {
0% {
opacity: 0;
transform: translateY(8rpx) scale(0.4);
}
16% {
opacity: 1;
}
72% {
opacity: 0.55;
}
100% {
opacity: 0;
transform: translateY(-176rpx) scale(1);
}
}
@keyframes device-spark-rise-detail {
0% {
opacity: 0;
transform: translateY(12rpx) scale(0.45);
}
16% {
opacity: 1;
}
72% {
opacity: 0.62;
}
100% {
opacity: 0;
transform: translateY(-225rpx) scale(1);
}
}
@keyframes device-spark-rise-detail-long {
0% {
opacity: 0;
transform: translateY(12rpx) scale(0.4);
}
16% {
opacity: 1;
}
72% {
opacity: 0.55;
}
100% {
opacity: 0;
transform: translateY(-270rpx) scale(1);
}
}
@keyframes device-rays-rotate {
0%,
100% {
opacity: 0.48;
transform: translate(-42rpx, 4rpx) skewX(-8deg) scaleX(0.82);
}
25% {
opacity: 0.88;
transform: translate(0, 0) skewX(0deg) scaleX(1.05);
}
50% {
opacity: 0.48;
transform: translate(42rpx, 4rpx) skewX(8deg) scaleX(0.82);
}
75% {
opacity: 0.24;
transform: translate(0, 10rpx) skewX(0deg) scaleX(0.68);
}
}
@keyframes device-rays-rotate-detail {
0%,
100% {
opacity: 0.48;
transform: translate(-62rpx, 6rpx) skewX(-8deg) scaleX(0.82);
}
25% {
opacity: 0.88;
transform: translate(0, 0) skewX(0deg) scaleX(1.05);
}
50% {
opacity: 0.48;
transform: translate(62rpx, 6rpx) skewX(8deg) scaleX(0.82);
}
75% {
opacity: 0.24;
transform: translate(0, 14rpx) skewX(0deg) scaleX(0.68);
}
}
</style>
+1 -1
View File
@@ -203,7 +203,7 @@ onMounted(async () => {
<button hover-class="none"> <button hover-class="none">
<image <image
v-if="!noArrow" v-if="!noArrow"
src="../static/arrow-grey.png" src="https://static.shelingxingqiu.com/shootmini/static/arrow-grey.png"
mode="widthFix" mode="widthFix"
:style="{ transform: expand ? 'rotateX(180deg)' : 'rotateX(0deg)' }" :style="{ transform: expand ? 'rotateX(180deg)' : 'rotateX(0deg)' }"
/> />
+2 -2
View File
@@ -10,8 +10,8 @@ defineProps({
}, },
}); });
const bubbleTypes = [ const bubbleTypes = [
"../static/long-bubble.png", "https://static.shelingxingqiu.com/shootmini/static/long-bubble.png",
"../static/long-bubble-middle.png", "https://static.shelingxingqiu.com/shootmini/static/long-bubble-middle.png",
"https://static.shelingxingqiu.com/shootmini/static/long-bubble-tall.png", "https://static.shelingxingqiu.com/shootmini/static/long-bubble-tall.png",
]; ];
</script> </script>
+5 -5
View File
@@ -115,10 +115,10 @@ onBeforeUnmount(() => {
<template> <template>
<view class="container"> <view class="container">
<view class="back-btn" @click="onClick"> <view class="back-btn" @click="onClick">
<image v-if="whiteBackArrow" src="../static/back.png" mode="widthFix" /> <image v-if="whiteBackArrow" src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
<image <image
v-if="!whiteBackArrow" v-if="!whiteBackArrow"
src="../static/back-black.png" src="https://static.shelingxingqiu.com/shootmini/static/back-black.png"
mode="widthFix" mode="widthFix"
/> />
</view> </view>
@@ -156,12 +156,12 @@ onBeforeUnmount(() => {
<text v-else class="truncate">{{ user.nickName }}</text> <text v-else class="truncate">{{ user.nickName }}</text>
<image <image
v-if="heat" v-if="heat"
:src="`../static/hot${heat}.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/hot${heat}.png`"
mode="widthFix" mode="widthFix"
/> />
</block> </block>
<block v-else> <block v-else>
<image src="../static/user-icon.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/user-icon.png" mode="widthFix" />
<text>新来的弓箭手你好呀~</text> <text>新来的弓箭手你好呀~</text>
</block> </block>
</view> </view>
@@ -229,7 +229,7 @@ onBeforeUnmount(() => {
:style="battleRoomBtnStyle" :style="battleRoomBtnStyle"
> >
<text class="battle-room-number__text">房号: {{ game.roomNumber }}</text> <text class="battle-room-number__text">房号: {{ game.roomNumber }}</text>
<image src="../static/share2.png" mode="widthFix" class="battle-room-number__icon" /> <image src="https://static.shelingxingqiu.com/shootmini/static/share2.png" mode="widthFix" class="battle-room-number__icon" />
</button> </button>
</view> </view>
</template> </template>
+1 -1
View File
@@ -146,7 +146,7 @@ onBeforeUnmount(() => {
<text>{{ (tips || "").replace(/你/g, "").replace(/重回/g, "") }}</text> <text>{{ (tips || "").replace(/你/g, "").replace(/重回/g, "") }}</text>
<text v-if="totalShot > 0"> ({{ currentShot }}/{{ totalShot }}) </text> <text v-if="totalShot > 0"> ({{ currentShot }}/{{ totalShot }}) </text>
<button v-if="!!tips" hover-class="none" @click="updateSound"> <button v-if="!!tips" hover-class="none" @click="updateSound">
<image :src="`../static/sound${sound ? '' : '-off'}-yellow.png`" mode="widthFix" /> <image :src="`https://static.shelingxingqiu.com/shootmini/static/sound${sound ? '' : '-off'}-yellow.png`" mode="widthFix" />
</button> </button>
</view> </view>
</template> </template>
+37
View File
@@ -1,4 +1,6 @@
<script setup> <script setup>
import IconButton from "./IconButton.vue";
const props = defineProps({ const props = defineProps({
show: { show: {
type: Boolean, type: Boolean,
@@ -28,6 +30,14 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
confirmDisabled: {
type: Boolean,
default: false,
},
showClose: {
type: Boolean,
default: false,
},
onCancel: { onCancel: {
type: Function, type: Function,
default: null, default: null,
@@ -36,6 +46,10 @@ const props = defineProps({
type: Function, type: Function,
default: null, default: null,
}, },
onClose: {
type: Function,
default: null,
},
}); });
const handleCancel = () => { const handleCancel = () => {
@@ -43,8 +57,13 @@ const handleCancel = () => {
}; };
const handleConfirm = () => { const handleConfirm = () => {
if (props.confirmDisabled) return;
props.onConfirm?.(); props.onConfirm?.();
}; };
const handleClose = () => {
props.onClose?.();
};
</script> </script>
<template> <template>
@@ -89,6 +108,7 @@ const handleConfirm = () => {
<view <view
v-if="showConfirm" v-if="showConfirm"
class="dialog-button confirm" class="dialog-button confirm"
:class="{ disabled: confirmDisabled }"
@click="handleConfirm" @click="handleConfirm"
> >
<text>{{ confirmText }}</text> <text>{{ confirmText }}</text>
@@ -96,6 +116,13 @@ const handleConfirm = () => {
</view> </view>
</view> </view>
<view v-if="showClose" class="dialog-close">
<IconButton
src="https://static.shelingxingqiu.com/shootmini/static/close-gold-outline.png"
:width="30"
:onClick="handleClose"
/>
</view>
</view> </view>
</view> </view>
</template> </template>
@@ -108,6 +135,7 @@ const handleConfirm = () => {
top: 0; top: 0;
left: 0; left: 0;
background-color: rgba(0, 0, 0, 0.62); background-color: rgba(0, 0, 0, 0.62);
flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
z-index: 999; z-index: 999;
@@ -116,6 +144,7 @@ const handleConfirm = () => {
.modal-wrap { .modal-wrap {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column;
width: 549rpx; width: 549rpx;
min-height: 318rpx;; min-height: 318rpx;;
padding-top: 168rpx; padding-top: 168rpx;
@@ -222,6 +251,14 @@ const handleConfirm = () => {
background-color: #ffda3f; background-color: #ffda3f;
} }
.dialog-button.confirm.disabled {
opacity: 0.62;
}
.dialog-close {
margin-top: 28rpx;
}
@keyframes rotateLight { @keyframes rotateLight {
from { from {
transform: translateX(-50%) rotate(0deg); transform: translateX(-50%) rotate(0deg);
+57 -28
View File
@@ -1,10 +1,11 @@
<script setup> <script setup>
import { computed } from "vue"; import { computed } from "vue";
import { getDeviceBatteryAPI } from "@/apis"; import useStore from "@/store";
import { storeToRefs } from "pinia";
const OTA_MIN_BATTERY = 50;
const OTA_LOW_BATTERY_TEXT = "电量不足 50%,暂不支持 OTA 升级";
const OTA_OFFLINE_TEXT = "请先开启智能弓"; const OTA_OFFLINE_TEXT = "请先开启智能弓";
const store = useStore();
const { deviceStatus } = storeToRefs(store);
const props = defineProps({ const props = defineProps({
visible: { visible: {
@@ -23,6 +24,10 @@ const props = defineProps({
type: Number, type: Number,
default: 40, default: 40,
}, },
phase: {
type: String,
default: "",
},
// 副标题:如“新版本将优化智能弓体验” // 副标题:如“新版本将优化智能弓体验”
description: { description: {
type: String, type: String,
@@ -47,28 +52,22 @@ const isSuccess = computed(() => props.state === "update_success");
const isFailure = computed(() => props.state === "update_failure"); const isFailure = computed(() => props.state === "update_failure");
// Clamp progress to keep the progress bar width within its container. // Clamp progress to keep the progress bar width within its container.
const progressValue = computed(() => Math.min(100, Math.max(0, Number(props.progress) || 0))); const progressValue = computed(() => Math.min(100, Math.max(0, Number(props.progress) || 0)));
const progressPhaseText = computed(() => {
const phaseText = {
started: "正在准备固件更新",
downloading: "正在下载固件",
installing: "正在安装固件",
};
return phaseText[props.phase] || "正在进行固件更新";
});
// 点击立即更新前先校验设备在线状态,再校验设备电量。 // 点击立即更新前先校验设备在线状态。
const handleUpdateClick = async () => { const handleUpdateClick = () => {
try { if (deviceStatus.value?.online !== true) {
const deviceStatus = await getDeviceBatteryAPI(); uni.showToast({
if (deviceStatus?.online !== true) { title: OTA_OFFLINE_TEXT,
uni.showToast({ icon: "none",
title: OTA_OFFLINE_TEXT, });
icon: "none",
});
return;
}
if (Number(deviceStatus?.battery) <= OTA_MIN_BATTERY) {
uni.showToast({
title: OTA_LOW_BATTERY_TEXT,
icon: "none",
});
return;
}
} catch (err) {
emit("update");
return; return;
} }
emit("update"); emit("update");
@@ -140,10 +139,10 @@ const handleUpdateClick = async () => {
<!-- 更新成功:图片左边距 34rpx,文案左边距 44rpx,按钮浮动底部居中 --> <!-- 更新成功:图片左边距 34rpx,文案左边距 44rpx,按钮浮动底部居中 -->
<block v-else-if="isSuccess"> <block v-else-if="isSuccess">
<image src="https://static.shelingxingqiu.com/shootmini/static/ota/update-ok.png" mode="aspectFit" class="result-title-img" style="width: 220rpx; height: 62rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/ota/update-ok.png" mode="aspectFit" class="result-title-img" style="width: 220rpx; height: 62rpx;" />
<text class="dialog-desc">请关机并重启智能弓</text> <text class="dialog-desc">固件更新已完成</text>
<view class="btn-group-result"> <view class="btn-group-result">
<view class="primary-btn" @click="emit('done')"> <view class="primary-btn" @click="emit('done')">
<text class="primary-btn-text">完成</text> <text class="primary-btn-text">关闭</text>
</view> </view>
</view> </view>
</block> </block>
@@ -152,9 +151,14 @@ const handleUpdateClick = async () => {
<block v-else-if="isProgress"> <block v-else-if="isProgress">
<image src="https://static.shelingxingqiu.com/shootmini/static/ota/update_progress.png" mode="aspectFit" class="result-title-img" style="width: 220rpx; height: 62rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/ota/update_progress.png" mode="aspectFit" class="result-title-img" style="width: 220rpx; height: 62rpx;" />
<view class="progress-wrap"> <view class="progress-wrap">
<view class="progress-meta">
<text class="progress-phase">{{ progressPhaseText }}</text>
<text class="progress-value">{{ Math.floor(progressValue) }}%</text>
</view>
<view class="progress-track"> <view class="progress-track">
<view class="progress-fill" :style="{ width: `${progressValue}%` }"></view> <view class="progress-fill" :style="{ width: `${progressValue}%` }"></view>
</view> </view>
<text class="progress-warning">请勿离开当前页面!</text>
</view> </view>
</block> </block>
@@ -181,7 +185,7 @@ const handleUpdateClick = async () => {
class="ota-close-below" class="ota-close-below"
@click="emit('close')" @click="emit('close')"
> >
<image src="../static/sicon/close.png" mode="aspectFit" style="width: 56rpx; height: 56rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/sicon/close.png" mode="aspectFit" style="width: 56rpx; height: 56rpx;" />
</view> </view>
</view> </view>
</template> </template>
@@ -404,9 +408,26 @@ const handleUpdateClick = async () => {
} }
.progress-wrap { .progress-wrap {
width: 394rpx; width: 394rpx;
margin-top: 40rpx; margin-top: 28rpx;
margin-left: 44rpx; margin-left: 44rpx;
} }
.progress-meta {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 16rpx;
color: #ffffff;
font-size: 24rpx;
line-height: 34rpx;
}
.progress-phase {
flex: 1;
}
.progress-value {
flex-shrink: 0;
margin-left: 16rpx;
color: #fed847;
}
.progress-track { .progress-track {
width: 100%; width: 100%;
height: 18rpx; height: 18rpx;
@@ -419,6 +440,14 @@ const handleUpdateClick = async () => {
background-color: #FED847; background-color: #FED847;
border-radius: 999rpx; border-radius: 999rpx;
} }
.progress-warning {
display: block;
margin-top: 16rpx;
color: rgba(255, 255, 255, 0.88);
font-size: 22rpx;
line-height: 32rpx;
text-align: center;
}
/* 关闭按钮(位于弹窗下方) */ /* 关闭按钮(位于弹窗下方) */
.ota-close-below { .ota-close-below {
+2 -2
View File
@@ -40,10 +40,10 @@ const getMemberNicknameClass = (player = {}) => [
opacity: opacity:
(scores[0] || []).length + (scores[1] || []).length === 12 ? 1 : 0, (scores[0] || []).length + (scores[1] || []).length === 12 ? 1 : 0,
}" }"
src="../static/checked-green.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green.png"
mode="widthFix" mode="widthFix"
/> />
<image :src="player.avatar || '../static/user-icon.png'" mode="widthFix" /> <image :src="player.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'" mode="widthFix" />
<view <view
v-if="isMember(player)" v-if="isMember(player)"
:class="['player-score-name', ...getMemberNicknameClass(player)]" :class="['player-score-name', ...getMemberNicknameClass(player)]"
+4 -4
View File
@@ -30,25 +30,25 @@ const rowCount = new Array(6).fill(0);
<view> <view>
<image <image
v-if="rank === 1" v-if="rank === 1"
src="../static/champ1.png" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<image <image
v-if="rank === 2" v-if="rank === 2"
src="../static/champ2.png" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<image <image
v-if="rank === 3" v-if="rank === 3"
src="../static/champ3.png" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<view v-if="rank > 3" class="rank-view">{{ rank }}</view> <view v-if="rank > 3" class="rank-view">{{ rank }}</view>
<image <image
:src="avatar || '../static/user-icon.png'" :src="avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
mode="widthFix" mode="widthFix"
:style="{ borderColor: topThreeColors[rank - 1] || '#fff' }" :style="{ borderColor: topThreeColors[rank - 1] || '#fff' }"
/> />
+4 -4
View File
@@ -38,7 +38,7 @@ const seats = new Array(props.total).fill(1);
<image src="https://static.shelingxingqiu.com/shootmini/static/player-bg.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/player-bg.png" mode="widthFix" />
<view v-if="players[index] && players[index].name" class="avatar"> <view v-if="players[index] && players[index].name" class="avatar">
<Avatar <Avatar
:src="players[index].avatar || '../static/user-icon.png'" :src="players[index].avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
:size="40" :size="40"
/> />
<text <text
@@ -47,7 +47,7 @@ const seats = new Array(props.total).fill(1);
> >
</view> </view>
<view v-else class="player-unknow"> <view v-else class="player-unknow">
<image src="../static/question-mark.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/question-mark.png" mode="widthFix" />
</view> </view>
<view <view
v-if="players[index] && players[index].name && isMember(players[index])" v-if="players[index] && players[index].name && isMember(players[index])"
@@ -72,7 +72,7 @@ const seats = new Array(props.total).fill(1);
</text> </text>
<view v-if="index === 0" class="founder">管理员</view> <view v-if="index === 0" class="founder">管理员</view>
<!-- <image <!-- <image
:src="`../static/player-${index + 1}.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/player-${index + 1}.png`"
mode="widthFix" mode="widthFix"
class="player-bg" class="player-bg"
/> --> /> -->
@@ -83,7 +83,7 @@ const seats = new Array(props.total).fill(1);
class="remove-player" class="remove-player"
@click="() => removePlayer(players[index])" @click="() => removePlayer(players[index])"
> >
<image src="../static/close-white.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-white.png" mode="widthFix" />
</button> </button>
</view> </view>
</view> </view>
+5 -5
View File
@@ -55,12 +55,12 @@ const onClick = async () => {
<template> <template>
<view class="rank-item" :style="{ borderWidth: borderWidth + 'rpx' }"> <view class="rank-item" :style="{ borderWidth: borderWidth + 'rpx' }">
<image v-if="data.rank === 1" src="../static/point-no1.png" /> <image v-if="data.rank === 1" src="https://static.shelingxingqiu.com/shootmini/static/point-no1.png" />
<image v-else-if="data.rank === 2" src="../static/point-no2.png" /> <image v-else-if="data.rank === 2" src="https://static.shelingxingqiu.com/shootmini/static/point-no2.png" />
<image v-else-if="data.rank === 3" src="../static/point-no3.png" /> <image v-else-if="data.rank === 3" src="https://static.shelingxingqiu.com/shootmini/static/point-no3.png" />
<text v-else>{{ data.rank || "" }}</text> <text v-else>{{ data.rank || "" }}</text>
<view> <view>
<Avatar :src="data.avatar || '../static/user-icon.png'" :size="36" /> <Avatar :src="data.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'" :size="36" />
<view> <view>
<view v-if="isMember(data)" :class="getMemberNicknameClass(data)"> <view v-if="isMember(data)" :class="getMemberNicknameClass(data)">
<text class="member-nickname__text">{{ data.name }}</text> <text class="member-nickname__text">{{ data.name }}</text>
@@ -87,7 +87,7 @@ const onClick = async () => {
<button hover-class="none" @click="onClick"> <button hover-class="none" @click="onClick">
<text>{{ likeCount }}</text> <text>{{ likeCount }}</text>
<image <image
:src="`../static/like-${like ? 'on' : 'off'}.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/like-${like ? 'on' : 'off'}.png`"
mode="widthFix" mode="widthFix"
/> />
</button> </button>
+1 -1
View File
@@ -113,7 +113,7 @@ onMounted(async () => {
@click="checked = !checked" @click="checked = !checked"
:style="{ marginBottom: !checked ? '20rpx' : '0' }" :style="{ marginBottom: !checked ? '20rpx' : '0' }"
> >
<image v-if="checked" src="../static/checked.png" mode="widthFix" /> <image v-if="checked" src="https://static.shelingxingqiu.com/shootmini/static/checked.png" mode="widthFix" />
<view v-else></view> <view v-else></view>
<text>我想给建议(选填)</text> <text>我想给建议(选填)</text>
</view> </view>
+1 -1
View File
@@ -69,7 +69,7 @@ const onBtnClick = debounce(async () => {
<slot /> <slot />
</block> </block>
<block v-else> <block v-else>
<image src="../static/btn-loading.png" mode="widthFix" class="loading" /> <image src="https://static.shelingxingqiu.com/shootmini/static/btn-loading.png" mode="widthFix" class="loading" />
</block> </block>
</button> </button>
</template> </template>
+1 -1
View File
@@ -60,7 +60,7 @@ watch(
mode="widthFix" mode="widthFix"
/> />
<view class="close-btn" @click="onClose" v-if="!noBg"> <view class="close-btn" @click="onClose" v-if="!noBg">
<image src="../static/close-yellow.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-yellow.png" mode="widthFix" />
</view> </view>
<slot></slot> <slot></slot>
</view> </view>
+2 -2
View File
@@ -71,7 +71,7 @@ watch(
margin: 100 / (total * 2) + 'px', margin: 100 / (total * 2) + 'px',
}" }"
> >
<image src="../static/score-bg.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/score-bg.png" mode="widthFix" />
<text <text
:style="{ fontWeight: arrows[index] !== undefined ? 'bold' : 'normal' }" :style="{ fontWeight: arrows[index] !== undefined ? 'bold' : 'normal' }"
>{{ >{{
@@ -93,7 +93,7 @@ watch(
padding: 1vw 0; padding: 1vw 0;
} }
.score-item { .score-item {
/* background-image: url("../static/score-bg.png"); /* background-image: url("https://static.shelingxingqiu.com/shootmini/static/score-bg.png");
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; */ background-position: center; */
+3 -3
View File
@@ -100,7 +100,7 @@ const openCoachComment = () => {
<button @click="() => (showBowData = true)"> <button @click="() => (showBowData = true)">
<text>查看靶纸</text> <text>查看靶纸</text>
<image <image
src="../static/enter-arrow-blue.png" src="https://static.shelingxingqiu.com/shootmini/static/enter-arrow-blue.png"
mode="widthFix" mode="widthFix"
:style="{ width: '20px' }" :style="{ width: '20px' }"
/> />
@@ -116,13 +116,13 @@ const openCoachComment = () => {
<block v-if="validArrows === total"> <block v-if="validArrows === total">
<IconButton <IconButton
name="分享" name="分享"
src="../static/share.png" src="https://static.shelingxingqiu.com/shootmini/static/share.png"
:onClick="onClickShare" :onClick="onClickShare"
/> />
<IconButton <IconButton
v-if="isMember" v-if="isMember"
name="教练点评" name="教练点评"
src="../static/review.png" src="https://static.shelingxingqiu.com/shootmini/static/review.png"
:onClick="openCoachComment" :onClick="openCoachComment"
/> />
</block> </block>
+1 -1
View File
@@ -49,7 +49,7 @@ const getContentHeight = () => {
</view> </view>
<IconButton <IconButton
v-if="!!onClose" v-if="!!onClose"
src="../static/close-gold-outline.png" src="https://static.shelingxingqiu.com/shootmini/static/close-gold-outline.png"
:width="30" :width="30"
:onClick="onClose" :onClick="onClose"
/> />
+1 -1
View File
@@ -25,7 +25,7 @@ const props = defineProps({
</view> </view>
<IconButton <IconButton
v-if="!!onClose" v-if="!!onClose"
src="../static/close-white-outline.png" src="https://static.shelingxingqiu.com/shootmini/static/close-white-outline.png"
:width="30" :width="30"
:onClick="onClose" :onClick="onClose"
/> />
+1 -1
View File
@@ -207,7 +207,7 @@ onBeforeUnmount(() => {
<text>{{ tipContent }}</text> <text>{{ tipContent }}</text>
<button hover-class="none" @click="updateSound"> <button hover-class="none" @click="updateSound">
<image <image
:src="`../static/sound${sound ? '' : '-off'}-yellow.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/sound${sound ? '' : '-off'}-yellow.png`"
mode="widthFix" mode="widthFix"
/> />
</button> </button>
+5 -8
View File
@@ -12,12 +12,11 @@ import {
getHomeData, getHomeData,
getPhoneNumberAPI, getPhoneNumberAPI,
getPhoneNumberAPIv2, getPhoneNumberAPIv2,
getDeviceBatteryAPI,
} from "@/apis"; } from "@/apis";
import useStore from "@/store"; import useStore from "@/store";
const store = useStore(); const store = useStore();
const { updateUser, updateDevice, updateOnline, clearDevice } = store; const { updateUser, updateDevice, clearDevice } = store;
const props = defineProps({ const props = defineProps({
show: { show: {
@@ -125,8 +124,6 @@ async function doLogin() {
devices.bindings[0].deviceId, devices.bindings[0].deviceId,
devices.bindings[0].deviceName devices.bindings[0].deviceName
); );
const data = await getDeviceBatteryAPI();
updateOnline(data.online);
} else { } else {
clearDevice(); clearDevice();
} }
@@ -181,7 +178,7 @@ onShow(() => {
<text v-else :style="{ color: noBg ? '#666' : '#fff9' }" <text v-else :style="{ color: noBg ? '#666' : '#fff9' }"
>点击获取</text >点击获取</text
> >
<image src="../static/enter.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/enter.png" mode="widthFix" />
</button> </button>
</view> </view>
<view class="avatar" :style="{ borderColor: noBg ? '#E3E3E3' : '#fff3' }"> <view class="avatar" :style="{ borderColor: noBg ? '#E3E3E3' : '#fff3' }">
@@ -196,7 +193,7 @@ onShow(() => {
<text v-else :style="{ color: noBg ? '#666' : '#fff9' }" <text v-else :style="{ color: noBg ? '#666' : '#fff9' }"
>点击获取</text >点击获取</text
> >
<image src="../static/enter.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/enter.png" mode="widthFix" />
</button> </button>
</view> </view>
<view <view
@@ -220,7 +217,7 @@ onShow(() => {
</block> </block>
<block v-else> <block v-else>
<image <image
src="../static/btn-loading.png" src="https://static.shelingxingqiu.com/shootmini/static/btn-loading.png"
mode="widthFix" mode="widthFix"
class="loading" class="loading"
/> />
@@ -231,7 +228,7 @@ onShow(() => {
v-if="!agree" v-if="!agree"
:style="{ borderColor: noBg ? '#E3E3E3' : '#fff' }" :style="{ borderColor: noBg ? '#E3E3E3' : '#fff' }"
/> />
<image v-if="agree" src="../static/checked.png" mode="widthFix" /> <image v-if="agree" src="https://static.shelingxingqiu.com/shootmini/static/checked.png" mode="widthFix" />
<view> <view>
<text>已同意并阅读</text> <text>已同意并阅读</text>
<view <view
+50 -28
View File
@@ -46,10 +46,10 @@ const props = defineProps({
type: Number, type: Number,
default: 0, default: 0,
}, },
// 指定环数,1 到 10;无效值表示高亮整个区域。 // 指定一个或多个环数,空数组表示高亮整个区域。
activeRing: { activeRings: {
type: Number, type: Array,
default: 0, default: () => [],
}, },
// 每次变化时以固定低帧数重新展开当前高亮扇区;默认关闭。 // 每次变化时以固定低帧数重新展开当前高亮扇区;默认关闭。
highlightRefreshToken: { highlightRefreshToken: {
@@ -192,6 +192,25 @@ const getPositiveInteger = (value) => {
return Number.isInteger(numberValue) && numberValue > 0 ? numberValue : 0; return Number.isInteger(numberValue) && numberValue > 0 ? numberValue : 0;
}; };
// 过滤、去重并合并连续环,避免 3、4 环同时高亮时绘制中间描边。
const getActiveRingRanges = (ringCount) => {
const rings = [...new Set(
(Array.isArray(props.activeRings) ? props.activeRings : [])
.map(getPositiveInteger)
.filter((ring) => ring >= 1 && ring <= ringCount)
)].sort((first, second) => first - second);
return rings.reduce((ranges, ring) => {
const lastRange = ranges[ranges.length - 1];
if (lastRange && ring === lastRange.end + 1) {
lastRange.end = ring;
} else {
ranges.push({ start: ring, end: ring });
}
return ranges;
}, []);
};
// 正上方作为第一区起始边界,Canvas 角度递增方向即为顺时针。 // 正上方作为第一区起始边界,Canvas 角度递增方向即为顺时针。
const getSectorAngles = (sector, sectorCount) => { const getSectorAngles = (sector, sectorCount) => {
const count = getPositiveInteger(sectorCount); const count = getPositiveInteger(sectorCount);
@@ -256,7 +275,7 @@ const drawTargetRings = (ctx, centerX, centerY, targetRadius, config) => {
} }
}; };
// 高亮后端指定区域;activeRing 有效时只高亮该区域内的单个环。 // 高亮后端指定区域;activeRings 非空时高亮该区域内的一个或多个环。
const drawSectorHighlight = ( const drawSectorHighlight = (
ctx, ctx,
centerX, centerX,
@@ -274,32 +293,35 @@ const drawSectorHighlight = (
); );
if (safeRevealProgress <= 0) return; if (safeRevealProgress <= 0) return;
const ring = getPositiveInteger(props.activeRing); const ringRanges = getActiveRingRanges(config.ringCount);
const hasActiveRing = ring >= 1 && ring <= config.ringCount; const highlightRanges = ringRanges.length > 0
const innerRadius = hasActiveRing ? ringRanges
? targetRadius * ((config.ringCount - ring) / config.ringCount) : [{ start: 1, end: config.ringCount }];
: 0;
const outerRadius = hasActiveRing
? targetRadius * ((config.ringCount + 1 - ring) / config.ringCount)
: targetRadius;
const style = { const style = {
...defaultHighlightStyle, ...defaultHighlightStyle,
...props.highlightStyle, ...props.highlightStyle,
}; };
drawAnnularSector( highlightRanges.forEach((range) => {
ctx, const innerRadius =
centerX, targetRadius * ((config.ringCount - range.end) / config.ringCount);
centerY, const outerRadius =
innerRadius, targetRadius * ((config.ringCount + 1 - range.start) / config.ringCount);
outerRadius,
angles.startAngle, drawAnnularSector(
angles.startAngle + ctx,
(angles.endAngle - angles.startAngle) * safeRevealProgress, centerX,
style.color, centerY,
style.strokeColor, innerRadius,
Math.max(1, targetRadius * style.lineWidthRatio) outerRadius,
); angles.startAngle,
angles.startAngle +
(angles.endAngle - angles.startAngle) * safeRevealProgress,
style.color,
style.strokeColor,
Math.max(1, targetRadius * style.lineWidthRatio)
);
});
}; };
// 从正上方开始顺时针绘制所有区域边界。 // 从正上方开始顺时针绘制所有区域边界。
@@ -420,7 +442,7 @@ const getDrawKey = (width, height) => {
showRingLabels: props.showRingLabels, showRingLabels: props.showRingLabels,
sectorCount: props.sectorCount, sectorCount: props.sectorCount,
activeSector: props.activeSector, activeSector: props.activeSector,
activeRing: props.activeRing, activeRings: props.activeRings,
showSectorLabels: props.showSectorLabels, showSectorLabels: props.showSectorLabels,
targetStyleConfig: props.targetStyleConfig, targetStyleConfig: props.targetStyleConfig,
crosshairStyle: props.crosshairStyle, crosshairStyle: props.crosshairStyle,
@@ -591,7 +613,7 @@ watch(
props.showRingLabels, props.showRingLabels,
props.sectorCount, props.sectorCount,
props.activeSector, props.activeSector,
props.activeRing, props.activeRings,
props.highlightRefreshToken, props.highlightRefreshToken,
props.showSectorLabels, props.showSectorLabels,
props.highlightOnly, props.highlightOnly,
+1 -1
View File
@@ -81,7 +81,7 @@ const handleConfirm = () => {
<view class="header-title-line-right"></view> <view class="header-title-line-right"></view>
</view> </view>
<view class="close-btn" @click="onClose"> <view class="close-btn" @click="onClose">
<image src="../static/close-yellow.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-yellow.png" mode="widthFix" />
</view> </view>
</view> </view>
<view class="target-options"> <view class="target-options">
+2 -2
View File
@@ -65,7 +65,7 @@ watch(
<template> <template>
<view class="container"> <view class="container">
<image <image
:src="isRed ? '../static/flag-red.png' : '../static/flag-blue.png'" :src="isRed ? 'https://static.shelingxingqiu.com/shootmini/static/flag-red.png' : 'https://static.shelingxingqiu.com/shootmini/static/flag-blue.png'"
class="flag" class="flag"
:style="{ :style="{
[isRed ? 'left' : 'right']: '10rpx', [isRed ? 'left' : 'right']: '10rpx',
@@ -86,7 +86,7 @@ watch(
[isRed ? 'left' : 'right']: getPos(item.id) + 'rpx', [isRed ? 'left' : 'right']: getPos(item.id) + 'rpx',
}" }"
> >
<image :src="item.avatar || '../static/user-icon.png'" mode="widthFix" /> <image :src="item.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'" mode="widthFix" />
<text <text
v-if="isFirst(item.id)" v-if="isFirst(item.id)"
:style="{ backgroundColor: isRed ? '#ff6060' : '#5fadff' }" :style="{ backgroundColor: isRed ? '#ff6060' : '#5fadff' }"
+4 -4
View File
@@ -95,7 +95,7 @@ watch(
</view> </view>
<!-- <image <!-- <image
class="user-name-image" class="user-name-image"
src="../static/vip1.png" src="https://static.shelingxingqiu.com/shootmini/static/vip1.png"
mode="widthFix" mode="widthFix"
/> --> /> -->
</view> </view>
@@ -117,7 +117,7 @@ watch(
<view v-if="showRank === true" class="rank-info" @click="toRankListPage"> <view v-if="showRank === true" class="rank-info" @click="toRankListPage">
<image <image
class="rank-info-image" class="rank-info-image"
src="../static/global-rank.png" src="https://static.shelingxingqiu.com/shootmini/static/global-rank.png"
mode="widthFix" mode="widthFix"
/> />
<block v-if="user.ranking > 0 && rankData.rank.length"> <block v-if="user.ranking > 0 && rankData.rank.length">
@@ -136,12 +136,12 @@ watch(
</block> </block>
<block v-else> <block v-else>
<view class="signin" @click="onSignin"> <view class="signin" @click="onSignin">
<image src="../static/user-icon.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/user-icon.png" mode="widthFix" />
<view> <view>
<text>新来的弓箭手你好呀~</text> <text>新来的弓箭手你好呀~</text>
<view> <view>
<text>登录</text> <text>登录</text>
<image src="../static/enter-arrow-blue.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/enter-arrow-blue.png" mode="widthFix" />
</view> </view>
</view> </view>
</view> </view>
+1 -1
View File
@@ -25,7 +25,7 @@ defineProps({
<view> <view>
<slot></slot> <slot></slot>
<view v-if="onClick !== null"> <view v-if="onClick !== null">
<image src="../static/enter.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/enter.png" mode="widthFix" />
</view> </view>
</view> </view>
</view> </view>
+2 -2
View File
@@ -52,7 +52,7 @@ onBeforeUnmount(() => {
<template> <template>
<view class="content" :style="{ display: show ? 'flex' : 'none' }"> <view class="content" :style="{ display: show ? 'flex' : 'none' }">
<view v-if="showRank" class="up-rank"> <view v-if="showRank" class="up-rank">
<image :src="user.avatar || '../static/user-icon.png'" mode="widthFix" /> <image :src="user.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'" mode="widthFix" />
<image :src="nextRankImage" mode="widthFix" /> <image :src="nextRankImage" mode="widthFix" />
<image class="bg-effect" src="https://static.shelingxingqiu.com/shootmini/static/shining-bg.png" mode="widthFix" /> <image class="bg-effect" src="https://static.shelingxingqiu.com/shootmini/static/shining-bg.png" mode="widthFix" />
<image <image
@@ -75,7 +75,7 @@ onBeforeUnmount(() => {
/> />
</view> </view>
<view class="text-content"> <view class="text-content">
<image src="../static/update-text-bg.png" /> <image src="https://static.shelingxingqiu.com/shootmini/static/update-text-bg.png" />
<text>恭喜你升级到</text> <text>恭喜你升级到</text>
<text>{{ showRank ? nextRankTitle : `射灵${lvl}级` }}</text> <text>{{ showRank ? nextRankTitle : `射灵${lvl}级` }}</text>
<text>!</text> <text>!</text>
+227
View File
@@ -0,0 +1,227 @@
import { computed, ref } from "vue";
import { sendHardwareBoxUpdateAPI } from "@/apis";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const OTA_PROGRESS_EVENT = "/addons/shoot/otaProgress";
const OTA_RESULT_EVENT = "/addons/shoot/otaResult";
const UPDATE_TIMEOUT = 10 * 60 * 1000;
const phaseTextMap = {
started: "正在准备固件更新",
downloading: "正在下载固件",
installing: "正在安装固件",
};
// OTA 状态由首页、WiFi 设置页和我的设备页共享,页面切换后仍可继续接收进度。
const updating = ref(false);
const progress = ref(0);
const phase = ref("started");
const resultVisible = ref(false);
const resultStatus = ref("");
const resultReason = ref("");
let deviceRef = null;
let updateRunId = 0;
let targetVersion = "";
let lastFinishedVersion = "";
let timeoutTimer = null;
let successCallback = null;
let socketListening = false;
const phaseText = computed(
() => phaseTextMap[phase.value] || "正在进行固件更新"
);
const resultTitle = computed(() =>
resultStatus.value === "success" ? "固件更新完成" : "固件更新失败"
);
const resultContent = computed(() => {
if (resultStatus.value === "success") return "固件更新已完成";
return resultReason.value || "更新失败,请检查设备及网络后重试";
});
const clearTimers = () => {
clearTimeout(timeoutTimer);
timeoutTimer = null;
};
const resetActiveUpdate = () => {
clearTimers();
successCallback = null;
};
const finishUpdate = (status, reason = "", runId = updateRunId) => {
if (runId !== updateRunId || !updating.value) return;
const onSuccess = successCallback;
resetActiveUpdate();
updating.value = false;
resultStatus.value = status;
resultReason.value = reason;
lastFinishedVersion = targetVersion;
if (status === "success") {
progress.value = 100;
phase.value = "installing";
onSuccess?.();
}
resultVisible.value = true;
};
const isCurrentDeviceMessage = (data) => {
const messageDeviceId = String(data?.deviceId || "");
const currentDeviceId = String(deviceRef?.value?.deviceId || "");
return !messageDeviceId || !currentDeviceId || messageDeviceId === currentDeviceId;
};
const isCurrentVersionMessage = (data) => {
const messageVersion = String(data?.versionNumber || "");
return !messageVersion || !targetVersion || messageVersion === targetVersion;
};
// 页面切换导致弹窗关闭后,使用下一条进度消息恢复当前 OTA 会话。
const recoverUpdateFromMessage = (data) => {
updateRunId += 1;
const runId = updateRunId;
targetVersion = String(data?.versionNumber || "");
lastFinishedVersion = "";
successCallback = null;
resultVisible.value = false;
resultStatus.value = "";
resultReason.value = "";
progress.value = 0;
phase.value = "started";
updating.value = true;
clearTimers();
timeoutTimer = setTimeout(() => {
finishUpdate("failed", "固件更新超时,请稍后重试", runId);
}, UPDATE_TIMEOUT);
};
function handleSocketMessage(message) {
if (Number(message?.code ?? 0) !== 0) return;
if (![OTA_PROGRESS_EVENT, OTA_RESULT_EVENT].includes(message?.event)) return;
if (!isCurrentDeviceMessage(message.data)) return;
const messageVersion = String(message.data?.versionNumber || "");
if (message.event === OTA_PROGRESS_EVENT) {
if (!updating.value) {
if (
lastFinishedVersion &&
(!messageVersion || messageVersion === lastFinishedVersion)
) {
return;
}
recoverUpdateFromMessage(message.data);
} else if (!isCurrentVersionMessage(message.data)) {
return;
}
const nextProgress = Math.min(
100,
Math.max(0, Number(message.data?.progress) || 0)
);
progress.value = Math.max(progress.value, nextProgress);
if (phaseTextMap[message.data?.phase]) {
phase.value = message.data.phase;
}
return;
}
if (!updating.value) {
if (
lastFinishedVersion &&
(!messageVersion || messageVersion === lastFinishedVersion)
) {
return;
}
recoverUpdateFromMessage(message.data);
} else if (!isCurrentVersionMessage(message.data)) {
return;
}
if (message.data?.status === "success") {
finishUpdate("success");
} else if (message.data?.status === "failed") {
finishUpdate("failed", message.data?.reason || "");
}
}
const startSocketListening = () => {
if (socketListening) return;
uni.$on("socket-inbox", handleSocketMessage);
socketListening = true;
};
export const useOtaUpdate = () => {
const store = useStore();
const { device } = storeToRefs(store);
deviceRef = device;
startSocketListening();
const startUpdate = async ({
versionNumber,
resourceUrl,
wifiSsid = "",
wifiPassword = "",
onSuccess,
}) => {
if (updating.value) return false;
updateRunId += 1;
const runId = updateRunId;
targetVersion = String(versionNumber || "");
lastFinishedVersion = "";
successCallback = onSuccess || null;
resultVisible.value = false;
resultStatus.value = "";
resultReason.value = "";
progress.value = 0;
phase.value = "started";
updating.value = true;
clearTimers();
timeoutTimer = setTimeout(() => {
finishUpdate("failed", "固件更新超时,请稍后重试", runId);
}, UPDATE_TIMEOUT);
try {
const updateResult = await sendHardwareBoxUpdateAPI({
versionNumber: targetVersion,
wifiSsid,
wifiPassword,
resourceUrl,
});
if (runId !== updateRunId || !updating.value) return false;
if (!updateResult?.taskId) {
finishUpdate("failed", "固件更新任务创建失败,请稍后重试", runId);
return false;
}
return true;
} catch (error) {
if (runId === updateRunId) {
finishUpdate(
"failed",
error?.message || "固件更新请求失败,请稍后重试",
runId
);
}
return false;
}
};
const closeResult = () => {
resultVisible.value = false;
};
return {
updating,
progress,
phase,
phaseText,
resultVisible,
resultStatus,
resultTitle,
resultContent,
startUpdate,
closeResult,
};
};
+28 -19
View File
@@ -21,9 +21,6 @@
{ {
"path": "pages/audio-test" "path": "pages/audio-test"
}, },
{
"path": "pages/calibration"
},
{ {
"path": "pages/about-us" "path": "pages/about-us"
}, },
@@ -60,12 +57,6 @@
{ {
"path": "pages/match-page" "path": "pages/match-page"
}, },
{
"path": "pages/my-device"
},
{
"path": "pages/device-intro"
},
{ {
"path": "pages/user" "path": "pages/user"
}, },
@@ -105,16 +96,10 @@
{ {
"path": "pages/melee-bow-data" "path": "pages/melee-bow-data"
}, },
{ {
"path": "pages/mine-bow-data" "path": "pages/mine-bow-data"
}, }
{ ],
"path": "pages/ota-wifi",
"style": {
"navigationStyle": "custom"
}
}
],
"globalStyle": { "globalStyle": {
"backgroundColor": "@bgColor", "backgroundColor": "@bgColor",
"backgroundColorBottom": "@bgColorBottom", "backgroundColorBottom": "@bgColorBottom",
@@ -159,6 +144,30 @@
{ {
"root": "pages/device", "root": "pages/device",
"pages": [ "pages": [
{
"path": "my-device"
},
{
"path": "device-qrcode"
},
{
"path": "device-bind-success"
},
{
"path": "device-bind-failure"
},
{
"path": "device-intro"
},
{
"path": "ota-wifi",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "calibration"
},
{ {
"path": "unbind-device" "path": "unbind-device"
} }
+7 -7
View File
@@ -156,7 +156,7 @@ const checkBowData = () => {
<view class="battle-winner"> <view class="battle-winner">
<image src="https://static.shelingxingqiu.com/shootmini/static/shining-bg.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/shining-bg.png" mode="widthFix" />
<image <image
:src="ifWin ? '../static/you-win.png' : '../static/you-lost.png'" :src="ifWin ? 'https://static.shelingxingqiu.com/shootmini/static/you-win.png' : 'https://static.shelingxingqiu.com/shootmini/static/you-lost.png'"
mode="widthFix" mode="widthFix"
class="scale-in" class="scale-in"
/> />
@@ -193,37 +193,37 @@ const checkBowData = () => {
<image <image
v-if="player.rank === 1" v-if="player.rank === 1"
class="player-bg" class="player-bg"
src="../static/melee-player-bg1.png" src="https://static.shelingxingqiu.com/shootmini/static/melee-player-bg1.png"
mode="aspectFill" mode="aspectFill"
/> />
<image <image
v-if="player.rank === 2" v-if="player.rank === 2"
class="player-bg" class="player-bg"
src="../static/melee-player-bg2.png" src="https://static.shelingxingqiu.com/shootmini/static/melee-player-bg2.png"
mode="aspectFill" mode="aspectFill"
/> />
<image <image
v-if="player.rank === 3" v-if="player.rank === 3"
class="player-bg" class="player-bg"
src="../static/melee-player-bg3.png" src="https://static.shelingxingqiu.com/shootmini/static/melee-player-bg3.png"
mode="aspectFill" mode="aspectFill"
/> />
<image <image
v-if="player.rank === 1" v-if="player.rank === 1"
class="player-crown" class="player-crown"
src="../static/champ1.png" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png"
mode="widthFix" mode="widthFix"
/> />
<image <image
v-if="player.rank === 2" v-if="player.rank === 2"
class="player-crown" class="player-crown"
src="../static/champ2.png" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png"
mode="widthFix" mode="widthFix"
/> />
<image <image
v-if="player.rank === 3" v-if="player.rank === 3"
class="player-crown" class="player-crown"
src="../static/champ3.png" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png"
mode="widthFix" mode="widthFix"
/> />
<view v-if="player.rank > 3" class="view-crown">{{ <view v-if="player.rank > 3" class="view-crown">{{
+8 -8
View File
@@ -587,7 +587,7 @@ onBeforeUnmount(() => {
<text v-else class="room-player-name">{{ owner.name }}</text> <text v-else class="room-player-name">{{ owner.name }}</text>
</view> </view>
<view v-else class="no-player" :style="{ transform: 'translateY(-60px)' }"> <view v-else class="no-player" :style="{ transform: 'translateY(-60px)' }">
<image src="../static/question-mark.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/question-mark.png" mode="widthFix" />
</view> </view>
<image src="https://static.shelingxingqiu.com/shootmini/static/versus.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/versus.png" mode="widthFix" />
<view v-if="opponent.id" class="player" :style="{ transform: 'translateY(60px)' }"> <view v-if="opponent.id" class="player" :style="{ transform: 'translateY(60px)' }">
@@ -607,11 +607,11 @@ onBeforeUnmount(() => {
<text v-else class="room-player-name">{{ opponent.name }}</text> <text v-else class="room-player-name">{{ opponent.name }}</text>
<button v-if="owner.id === user.id" hover-class="none" class="remove-player" <button v-if="owner.id === user.id" hover-class="none" class="remove-player"
@click="() => removePlayer(opponent)"> @click="() => removePlayer(opponent)">
<image src="../static/close-white.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-white.png" mode="widthFix" />
</button> </button>
</view> </view>
<view class="no-player" v-else> <view class="no-player" v-else>
<image src="../static/question-mark.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/question-mark.png" mode="widthFix" />
</view> </view>
</view> </view>
</view> </view>
@@ -627,7 +627,7 @@ onBeforeUnmount(() => {
<!-- 仅房主可见踢人按钮,且不能踢自己 --> <!-- 仅房主可见踢人按钮,且不能踢自己 -->
<button v-if="owner.id !== item.id && item.id && owner.id === user.id" hover-class="none" class="remove-player" <button v-if="owner.id !== item.id && item.id && owner.id === user.id" hover-class="none" class="remove-player"
@click="() => removePlayer(item)" :style="{ top: '-10rpx', right: '-10rpx' }"> @click="() => removePlayer(item)" :style="{ top: '-10rpx', right: '-10rpx' }">
<image src="../static/close-white.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-white.png" mode="widthFix" />
</button> </button>
</view> </view>
</view> </view>
@@ -636,7 +636,7 @@ onBeforeUnmount(() => {
<view> <view>
<view v-for="(item, index) in redTeam" :key="index" class="choose-side-left-item"> <view v-for="(item, index) in redTeam" :key="index" class="choose-side-left-item">
<button hover-class="none" v-if="item.id === user.id" @click="chooseTeam(0)"> <button hover-class="none" v-if="item.id === user.id" @click="chooseTeam(0)">
<image src="../static/close-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-grey.png" mode="widthFix" />
</button> </button>
<view <view
v-if="item.id && isMember(item)" v-if="item.id && isMember(item)"
@@ -653,7 +653,7 @@ onBeforeUnmount(() => {
<text :style="{ opacity: !!item.state ? 1 : 0 }">已准备</text> <text :style="{ opacity: !!item.state ? 1 : 0 }">已准备</text>
</view> </view>
<button v-else hover-class="none" @click="chooseTeam(2)"> <button v-else hover-class="none" @click="chooseTeam(2)">
<image src="../static/add-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/add-grey.png" mode="widthFix" />
</button> </button>
</view> </view>
</view> </view>
@@ -664,7 +664,7 @@ onBeforeUnmount(() => {
<text :style="{ opacity: !!item.state ? 1 : 0 }">已准备</text> <text :style="{ opacity: !!item.state ? 1 : 0 }">已准备</text>
</view> </view>
<button v-else hover-class="none" @click="chooseTeam(1)"> <button v-else hover-class="none" @click="chooseTeam(1)">
<image src="../static/add-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/add-grey.png" mode="widthFix" />
</button> </button>
<view <view
v-if="item.id && isMember(item)" v-if="item.id && isMember(item)"
@@ -677,7 +677,7 @@ onBeforeUnmount(() => {
</view> </view>
<text v-else class="truncate">{{ item.name || "我要加入" }}</text> <text v-else class="truncate">{{ item.name || "我要加入" }}</text>
<button hover-class="none" v-if="item.id === user.id" @click="chooseTeam(0)"> <button hover-class="none" v-if="item.id === user.id" @click="chooseTeam(0)">
<image src="../static/close-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-grey.png" mode="widthFix" />
</button> </button>
</view> </view>
</view> </view>
@@ -0,0 +1,86 @@
import { bindDeviceAPIV2 } from "@/apis";
export function useDeviceBinding({
token,
confirmBindTip,
binding,
updateDevice,
deviceDetails,
}) {
const showBindFailurePage = () => {
uni.hideToast();
uni.navigateTo({
url: "/pages/device/device-bind-failure",
fail: (error) => {
console.error("打开绑定失败页失败", error);
uni.showToast({ title: "二维码不正确,请重新扫码", icon: "none" });
},
});
};
const handleScan = () => {
uni.scanCode({
onlyFromCamera: true,
scanType: ["qrCode"],
success: (result) => {
if (!result?.result) {
showBindFailurePage();
return;
}
token.value = result.result;
confirmBindTip.value = true;
},
fail: (error) => {
const message = String(error?.errMsg || error?.message || "");
if (/cancel|取消/i.test(message)) return;
showBindFailurePage();
},
});
};
const confirmBind = async () => {
if (!token.value || binding.value) return;
binding.value = true;
try {
const result = await bindDeviceAPIV2(token.value);
confirmBindTip.value = false;
if (result?.binded) {
uni.showToast({
title: "设备已绑定其他账号,请解绑后再绑定",
icon: "none",
});
return;
}
const deviceId = String(result?.deviceId || "").trim();
const deviceName = String(result?.name || result?.deviceName || "").trim();
if (!deviceId || !deviceName) {
confirmBindTip.value = false;
token.value = "";
showBindFailurePage();
return;
}
const applyBoundDevice = () => {
updateDevice(deviceId, deviceName);
deviceDetails.value = result || {};
};
uni.navigateTo({
url: `/pages/device/device-bind-success?deviceId=${encodeURIComponent(deviceId)}`,
success: applyBoundDevice,
fail: (navigationError) => {
applyBoundDevice();
console.error("打开绑定成功页失败", navigationError);
uni.showToast({ title: "绑定成功,请返回查看设备", icon: "none" });
},
});
} catch (error) {
console.error("绑定设备失败", error);
confirmBindTip.value = false;
token.value = "";
showBindFailurePage();
} finally {
binding.value = false;
}
};
return { confirmBind, handleScan, showBindFailurePage };
}
@@ -0,0 +1,207 @@
import { computed, ref } from "vue";
import {
getDeviceDetailAPI,
getMyDevicesAPI,
unbindDeviceAPI,
} from "@/apis";
export const DEVICE_NAME_STORAGE_KEY = "device_name_overrides";
export function useDeviceStatus({
user,
device,
deviceStatus,
online,
updateDevice,
clearDevice,
unbindDialogVisible,
}) {
const deviceDetails = ref({});
let deviceDetailRequestVersion = 0;
const isDeviceOnline = computed(
() => deviceStatus.value.online === true || online.value === true
);
const isDeviceCharging = computed(
() => isDeviceOnline.value && deviceStatus.value.charging === true
);
const statusText = computed(() => {
if (!isDeviceOnline.value) return "未连接";
return isDeviceCharging.value ? "已连接(充电中)" : "已连接";
});
const statusClass = computed(() =>
isDeviceOnline.value ? "device-status--online" : "device-status--offline"
);
const battery = computed(() => {
const rawValue = deviceStatus.value.battery ?? deviceStatus.value.power;
if (rawValue === null || rawValue === undefined || rawValue === "") return null;
const value = Number(rawValue);
return Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : null;
});
const batteryText = computed(() =>
battery.value === null ? "暂无数据" : `${battery.value}%`
);
const onlineDurationText = computed(() => {
const rawDuration = deviceStatus.value.onlineDuration;
if (rawDuration == null || String(rawDuration).trim() === "") return "--";
const seconds = Number(rawDuration);
if (!Number.isFinite(seconds) || seconds < 0) return "--";
// WS 推送秒数,页面按完整分钟展示累计使用时间。
const totalMinutes = Math.floor(seconds / 60);
const hours = Math.floor(totalMinutes / 60);
const minutes = totalMinutes % 60;
return hours > 0 ? `${hours}小时${minutes}分钟` : `${minutes}分钟`;
});
const networkType = computed(() =>
String(deviceStatus.value.netType ?? "").trim().toLowerCase()
);
const networkText = computed(() => {
const netType = networkType.value;
if (netType === "wifi") return "WiFi";
if (netType === "4g") return "4G";
return isDeviceOnline.value ? "在线" : "未连接";
});
const maskedDeviceId = computed(() => {
const id = String(device.value.deviceId || "");
if (!id) return "暂无设备编号";
if (id.length <= 3) return id;
return `${"*".repeat(Math.min(5, id.length - 3))}${id.slice(-3)}`;
});
const deviceRows = computed(() => [
{ label: "设备型号", value: deviceDetails.value.model || "射灵智能弓" },
{ label: "当前电量", value: batteryText.value },
{ label: "连接方式", value: networkText.value },
{ label: "设备编号", value: maskedDeviceId.value },
]);
const getDeviceNameOverrides = () => {
const value = uni.getStorageSync(DEVICE_NAME_STORAGE_KEY);
return value && typeof value === "object" ? value : {};
};
const refreshDeviceDetails = async () => {
const deviceId = device.value.deviceId;
if (!deviceId) return;
const requestVersion = ++deviceDetailRequestVersion;
try {
const detailResponse = await getDeviceDetailAPI(deviceId);
const detail = detailResponse?.detail || detailResponse?.data?.detail;
if (
!detail ||
typeof detail !== "object" ||
requestVersion !== deviceDetailRequestVersion ||
device.value.deviceId !== deviceId
) {
return;
}
deviceDetails.value = {
...deviceDetails.value,
...detail,
deviceModelName: detail.deviceModelName ?? "",
bindTime: String(
detail.bindTime ?? deviceDetails.value.bindTime ?? ""
).trim(),
qrCodeUrl: String(
detail.qrCodeUrl ?? deviceDetails.value.qrCodeUrl ?? ""
).trim(),
};
} catch (error) {
// 实时刷新失败时保留当前页面数据,等待下次通知或页面重新显示。
console.log("刷新设备详情失败", error);
}
};
const syncDeviceBinding = async () => {
if (!user.value.id) return;
try {
const devices = await getMyDevicesAPI();
if (Array.isArray(devices?.bindings) && devices.bindings.length > 0) {
const currentDevice = devices.bindings[0];
const nameOverrides = getDeviceNameOverrides();
// 二维码和绑定时间仅取详情接口,绑定列表不能作为这两项的回退数据。
let latestDevice = {
...currentDevice,
deviceModelName: "",
bindTime: "",
qrCodeUrl: "",
};
try {
const detailResponse = await getDeviceDetailAPI(currentDevice.deviceId);
const detail = detailResponse?.detail || detailResponse?.data?.detail;
if (detail && typeof detail === "object") {
latestDevice = {
...currentDevice,
...detail,
deviceModelName: detail.deviceModelName ?? "",
bindTime: String(detail.bindTime ?? "").trim(),
qrCodeUrl: String(detail.qrCodeUrl ?? "").trim(),
deviceName:
detail.deviceAlias || detail.deviceName || currentDevice.deviceName,
};
}
} catch (error) {
// 详情接口失败时保留绑定关系,二维码和绑定时间仍保持为空。
console.log("获取设备详情失败", error);
}
deviceDetails.value = latestDevice;
updateDevice(
latestDevice.deviceId,
nameOverrides[latestDevice.deviceId] ||
latestDevice.deviceAlias ||
latestDevice.deviceName ||
latestDevice.name ||
"我的智能弓"
);
return;
}
clearDevice();
deviceDetailRequestVersion += 1;
deviceDetails.value = {};
} catch (error) {
console.log("同步设备绑定失败", error);
}
};
const unbindDevice = async () => {
if (!device.value.deviceId) return;
try {
await unbindDeviceAPI(device.value.deviceId);
uni.setStorageSync("calibration", false);
clearDevice();
deviceDetailRequestVersion += 1;
deviceDetails.value = {};
unbindDialogVisible.value = false;
uni.showToast({ title: "解绑成功", icon: "success" });
} catch (error) {
console.error("解绑设备失败", error);
if (error?.type === "DEVICE_BIND_INVALID") {
clearDevice();
unbindDialogVisible.value = false;
}
}
};
return {
batteryText,
deviceDetails,
deviceRows,
getDeviceNameOverrides,
isDeviceCharging,
isDeviceOnline,
maskedDeviceId,
networkText,
networkType,
onlineDurationText,
refreshDeviceDetails,
statusClass,
statusText,
syncDeviceBinding,
unbindDevice,
};
}
+156
View File
@@ -0,0 +1,156 @@
<script setup>
import Container from "@/components/Container.vue";
// 失败页由设备页进入,返回时优先回到上一页;页面栈异常时兜底回到设备页。
const goBackToDevicePage = () => {
const pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack({ delta: 1 });
return;
}
uni.redirectTo({ url: "/pages/device/my-device" });
};
// 返回设备页后沿用原有扫码绑定流程,不在结果页重复处理二维码数据。
const retryScan = () => {
const pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack({
delta: 1,
success: () => uni.$emit("device-bind-retry-scan"),
});
return;
}
uni.redirectTo({ url: "/pages/device/my-device?retryScan=1" });
};
</script>
<template>
<view class="device-bind-failure-page">
<Container
:bgType="12"
bgColor="transparent"
:onBack="goBackToDevicePage"
headerClass="bind-failure-header"
:scroll="false"
:usePageScroll="true"
>
<view class="bind-failure-page">
<view class="bind-failure-scene">
<view class="bind-failure-hero-wrap">
<view class="bind-failure-hero-shadow"></view>
<image
class="bind-failure-hero"
src="https://static.shelingxingqiu.com/shootmini/static/device-assets/device-bind-failure-hero.png"
mode="aspectFit"
/>
</view>
<view class="bind-failure-message">
<text>二维码不正确,</text>
<text>仅支持扫描射灵智能弓箭的设备二维码。</text>
</view>
<view class="bind-failure-retry" @click="$clickSound(retryScan)">
<text>重新扫码</text>
</view>
</view>
</view>
</Container>
</view>
</template>
<style scoped lang="scss">
.device-bind-failure-page {
position: relative;
min-height: 100vh;
background: transparent;
}
.bind-failure-header {
position: relative;
z-index: 20;
pointer-events: auto;
}
/* 与绑定成功页共用固定画布,页面内的视觉尺寸全部按 375 宽设计稿换算为 rpx。 */
.bind-failure-page {
position: fixed;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100vh;
overflow: hidden;
pointer-events: none;
}
.bind-failure-scene {
position: relative;
width: 100%;
height: 100%;
}
.bind-failure-hero-wrap,
.bind-failure-message,
.bind-failure-retry {
position: absolute;
}
.bind-failure-hero-wrap {
top: 568rpx;
left: 244rpx;
width: 260rpx;
height: 222rpx;
}
.bind-failure-hero-shadow {
position: absolute;
left: 22rpx;
bottom: 0;
width: 238rpx;
height: 40rpx;
border-radius: 50%;
background: rgba(0, 0, 0, 0.3);
}
.bind-failure-hero {
position: absolute;
top: 0;
left: 0;
width: 260rpx;
height: 222rpx;
}
.bind-failure-message {
top: 824rpx;
left: 122rpx;
display: flex;
width: 504rpx;
min-height: 80rpx;
flex-direction: column;
align-items: center;
color: #ffffff;
font-family: PingFang SC-Regular;
font-size: 28rpx;
font-weight: normal;
line-height: 40rpx;
text-align: center;
white-space: nowrap;
}
.bind-failure-retry {
top: 960rpx;
left: 195rpx;
display: flex;
width: 360rpx;
height: 70rpx;
box-sizing: border-box;
align-items: center;
justify-content: center;
border: 2rpx solid #ffd947;
border-radius: 78rpx;
color: #ffd947;
font-size: 26rpx;
line-height: 26rpx;
pointer-events: auto;
}
</style>
+248
View File
@@ -0,0 +1,248 @@
<script setup>
import { computed, ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import { getDeviceDetailAPI, getHomeData } from "@/apis";
const bindResult = ref({
isFirstBind: false,
expireDate: "",
});
const bindSuccessHero = computed(() =>
bindResult.value.isFirstBind
? "https://static.shelingxingqiu.com/shootmini/static/device-assets/device-bind-success-hero-first.png"
: "https://static.shelingxingqiu.com/shootmini/static/device-assets/device-bind-success-hero-nonfirst.png"
);
const bindRewardExpireDate = computed(() => bindResult.value.expireDate);
// 与会员页使用相同的到期时间格式,设备详情接口本身不提供会员有效期。
const formatVipDate = (value) => {
if (!value) return "";
const numericValue = Number(value);
const timestamp = Number.isNaN(numericValue)
? new Date(value).getTime()
: numericValue < 1000000000000
? numericValue * 1000
: numericValue;
const date = new Date(timestamp);
if (Number.isNaN(date.getTime())) return "";
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
};
const loadBindResult = async (deviceId) => {
if (!deviceId) return;
try {
const data = await getDeviceDetailAPI(deviceId);
if (data?.detail?.isFirstBind !== true) return;
bindResult.value.isFirstBind = true;
try {
const homeData = await getHomeData();
bindResult.value.expireDate = formatVipDate(
homeData?.user?.normalVipExpiredAt
);
} catch (error) {
console.error("获取赠送会员有效期失败", error);
}
} catch (error) {
console.error("获取设备详情失败", error);
}
};
const toFirstTryPage = () => {
uni.navigateTo({ url: "/pages/first-try" });
};
// 成功页由设备页 navigateTo 进入,优先返回上一页;页面栈异常时兜底回到设备页。
const goBackToDevicePage = () => {
const pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack({ delta: 1 });
return;
}
uni.redirectTo({ url: "/pages/device/my-device" });
};
onLoad((options = {}) => {
bindResult.value = {
isFirstBind: false,
expireDate: "",
};
void loadBindResult(options.deviceId);
});
</script>
<template>
<view class="device-bind-success-page">
<Container
:bgType="12"
bgColor="transparent"
:onBack="goBackToDevicePage"
headerClass="bind-success-header"
:scroll="false"
:usePageScroll="true"
>
<view class="bind-success-page">
<view
class="bind-success-scene"
:class="{ 'bind-success-scene--first': bindResult.isFirstBind }"
>
<image
class="bind-success-confetti"
src="https://static.shelingxingqiu.com/shootmini/static/device-assets/device-bind-success-confetti.png"
mode="aspectFit"
/>
<image class="bind-success-hero" :src="bindSuccessHero" mode="aspectFit" />
<image
class="bind-success-title-image"
src="https://static.shelingxingqiu.com/shootmini/static/device-assets/device-bind-success-title.png"
mode="aspectFit"
/>
<view v-if="bindResult.isFirstBind" class="bind-reward-card">
<image
class="bind-reward-gift"
src="https://static.shelingxingqiu.com/shootmini/static/device-assets/device-bind-success-reward-gift.png"
mode="aspectFit"
/>
<text class="bind-reward-text">
新设备首次绑定礼包:
<text class="bind-reward-highlight">6个月射灵会员</text>
已自动发放至本账号<text v-if="bindRewardExpireDate">,有效期{{ bindRewardExpireDate }}</text>。
</text>
</view>
<view class="bind-success-tutorial" @click="$clickSound(toFirstTryPage)">
<text>立即查看新手教程</text>
</view>
</view>
</view>
</Container>
</view>
</template>
<style scoped lang="scss">
.device-bind-success-page {
position: relative;
min-height: 100vh;
background: transparent;
}
.bind-success-header {
position: relative;
z-index: 20;
pointer-events: auto;
}
/* 绑定结果页使用固定画布,背景和前景素材按蓝湖 375 x 812 画布定位。 */
.bind-success-page {
position: fixed;
top: 0;
left: 0;
z-index: 1;
width: 100%;
height: 100vh;
overflow: hidden;
pointer-events: none;
}
.bind-success-scene {
position: relative;
width: 100%;
height: 100%;
}
.bind-success-confetti,
.bind-success-hero,
.bind-success-title-image,
.bind-reward-card,
.bind-success-tutorial {
position: absolute;
}
.bind-success-confetti {
top: 488rpx;
left: 78rpx;
width: 588rpx;
height: 508rpx;
}
.bind-success-hero {
top: 568rpx;
left: 244rpx;
width: 260rpx;
height: 222rpx;
}
.bind-success-scene--first .bind-success-confetti {
top: 314rpx;
}
.bind-success-scene--first .bind-success-hero {
top: 400rpx;
}
.bind-success-title-image {
top: 828rpx;
left: 216rpx;
width: 316rpx;
height: 70rpx;
}
.bind-success-scene--first .bind-success-title-image {
top: 660rpx;
}
.bind-reward-card {
top: 768rpx;
left: 170rpx;
width: 508rpx;
height: 152rpx;
box-sizing: border-box;
padding: 16rpx 16rpx 16rpx 90rpx;
border-radius: 16rpx 64rpx 16rpx 64rpx;
background: rgba(0, 0, 0, 0.6);
}
.bind-reward-gift {
position: absolute;
top: -18rpx;
left: -100rpx;
width: 178rpx;
height: 176rpx;
}
.bind-reward-text {
display: block;
width: 380rpx;
height: 120rpx;
color: #ffffff;
font-family: PingFang SC-Regular;
font-size: 28rpx;
font-weight: normal;
line-height: 40rpx;
}
.bind-reward-highlight {
color: #ffd947;
}
.bind-success-tutorial {
top: 960rpx;
left: 195rpx;
display: flex;
width: 360rpx;
height: 70rpx;
box-sizing: border-box;
align-items: center;
justify-content: center;
border: 2rpx solid #ffd947;
border-radius: 78rpx;
color: #ffd947;
font-size: 26rpx;
line-height: 26rpx;
pointer-events: auto;
}
</style>
@@ -38,7 +38,7 @@ const onScrollView = (e) => {
mode="widthFix" mode="widthFix"
/> />
<navigator open-type="navigateBack"> <navigator open-type="navigateBack">
<image class="header-back" src="../static/back.png" mode="widthFix" /> <image class="header-back" src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</navigator> </navigator>
<text <text
:style="{ opacity: addBg ? 1 : 0, color: '#fff', fontWeight: 'bold' }" :style="{ opacity: addBg ? 1 : 0, color: '#fff', fontWeight: 'bold' }"
+192
View File
@@ -0,0 +1,192 @@
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import { getDeviceDetailAPI } from "@/apis";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { device } = storeToRefs(store);
const deviceId = ref("");
const qrImageUrl = ref("");
const qrSaved = ref(false);
const loading = ref(true);
const loadQrCode = async () => {
if (!deviceId.value) {
loading.value = false;
return;
}
try {
const response = await getDeviceDetailAPI(deviceId.value);
const detail = response?.detail || response?.data?.detail;
qrImageUrl.value = String(detail?.qrCodeUrl ?? "").trim();
} catch (error) {
console.error("获取设备二维码失败", error);
qrImageUrl.value = "";
} finally {
loading.value = false;
}
};
const saveQrCode = async () => {
if (!qrImageUrl.value) return;
let filePath = qrImageUrl.value;
try {
if (/^https?:\/\//.test(filePath)) {
filePath = await new Promise((resolve, reject) => {
uni.downloadFile({
url: filePath,
success: (result) =>
result.statusCode === 200
? resolve(result.tempFilePath)
: reject(new Error("二维码下载失败")),
fail: reject,
});
});
}
await new Promise((resolve, reject) => {
uni.saveImageToPhotosAlbum({ success: resolve, fail: reject, filePath });
});
qrSaved.value = true;
uni.showToast({ title: "已保存至相册", icon: "success" });
} catch (error) {
uni.showToast({ title: "请长按二维码保存", icon: "none" });
}
};
onLoad((options = {}) => {
try {
deviceId.value = decodeURIComponent(options.deviceId || "") || device.value.deviceId || "";
} catch (error) {
deviceId.value = device.value.deviceId || "";
}
void loadQrCode();
});
</script>
<template>
<Container :bgType="12" :scroll="false">
<view class="qr-page">
<view class="qr-corner qr-corner--top"></view>
<view class="qr-corner qr-corner--bottom"></view>
<view class="qr-canvas">
<text v-if="loading" class="qr-empty">二维码加载中...</text>
<template v-else-if="qrImageUrl">
<image class="qr-image" :src="qrImageUrl" mode="aspectFit" show-menu-by-longpress />
<text v-if="qrSaved" class="qr-device-id">设备ID:{{ deviceId }}</text>
<view v-else class="qr-save-button" @click="saveQrCode">
<text>保存至相册</text>
</view>
<text class="qr-description">
该二维码为当前绑定弓箭的二维码,你可以截图保存到相册,以便当二维码丢失或不在身边时,可以扫描二维码进行设备绑定。
</text>
<text class="qr-note">注:解除绑定后将无法查看该二维码。</text>
</template>
<text v-else class="qr-empty">暂无设备二维码</text>
</view>
</view>
</Container>
</template>
<style scoped>
.qr-page {
position: relative;
width: 100%;
height: 100%;
min-height: 0;
box-sizing: border-box;
overflow: hidden;
background: transparent;
}
.qr-corner {
position: absolute;
width: 300rpx;
height: 300rpx;
background: #ffeb00;
}
.qr-corner--top {
top: -220rpx;
right: -170rpx;
transform: rotate(42deg);
}
.qr-corner--bottom {
bottom: -220rpx;
left: -170rpx;
transform: rotate(42deg);
}
.qr-canvas {
position: relative;
z-index: 1;
display: flex;
width: 100%;
height: 100%;
min-height: 0;
box-sizing: border-box;
flex-direction: column;
align-items: center;
padding: 260rpx 62rpx 70rpx;
}
.qr-image {
width: 432rpx;
height: 432rpx;
box-sizing: border-box;
background: #ffffff;
}
.qr-save-button {
display: flex;
width: 360rpx;
height: 72rpx;
align-items: center;
justify-content: center;
margin-top: 34rpx;
border: 1rpx solid #e8c840;
border-radius: 36rpx;
color: #ffe846;
font-size: 26rpx;
}
.qr-device-id,
.qr-empty {
color: rgba(255, 255, 255, 0.72);
font-size: 26rpx;
line-height: 40rpx;
text-align: center;
}
.qr-device-id {
margin-top: 24rpx;
}
.qr-empty {
margin-top: 140rpx;
}
.qr-description,
.qr-note {
width: 100%;
color: rgba(255, 255, 255, 0.6);
font-size: 22rpx;
line-height: 36rpx;
text-align: center;
}
.qr-description {
margin-top: 42rpx;
}
.qr-note {
margin-top: 12rpx;
color: rgba(255, 232, 70, 0.7);
}
</style>
File diff suppressed because it is too large Load Diff
@@ -1,24 +1,21 @@
<script setup> <script setup>
import { ref, computed, onMounted, onUnmounted } from "vue"; import { ref, computed, onMounted, onUnmounted } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app"; import { onLoad, onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import ScreenHint from "@/components/ScreenHint.vue"; import ScreenHint from "@/components/ScreenHint.vue";
import ModalDialog from "@/components/ModalDialog.vue";
import OtaModal from "@/components/OtaModal.vue";
import { import {
connectDeviceWifiAPI, connectDeviceWifiAPI,
getDeviceBatteryAPI,
getHardwareBoxTaskStatusAPI,
getHardwareBoxVersionAPI, getHardwareBoxVersionAPI,
sendHardwareBoxUpdateAPI,
} from "@/apis"; } from "@/apis";
import { useOtaUpdate } from "@/composables/useOtaUpdate";
const STATES = { const STATES = {
SCANNING: "SCANNING", SCANNING: "SCANNING",
LIST: "LIST", LIST: "LIST",
CONNECTING: "CONNECTING", CONNECTING: "CONNECTING",
CONNECTED: "CONNECTED", CONNECTED: "CONNECTED",
UPDATING: "UPDATING",
DONE: "DONE",
FAILED: "FAILED",
}; };
const isIOS = uni.getDeviceInfo().osName === "ios"; const isIOS = uni.getDeviceInfo().osName === "ios";
@@ -38,27 +35,37 @@ const keyboardHeight = ref(0);
const showPassword = ref(false); const showPassword = ref(false);
// 刷新防抖标志:扫描进行中为 true,禁止重复点击;扫描结束(成功/失败)后重置为 false。 // 刷新防抖标志:扫描进行中为 true,禁止重复点击;扫描结束(成功/失败)后重置为 false。
const isRefreshing = ref(false); const isRefreshing = ref(false);
const isStartingUpdate = ref(false); const fromFirmwareUpdate = ref(false);
const routeOtaInfo = ref({ const routeOtaInfo = ref({
versionNumber: "", versionNumber: "",
resourceUrl: "", resourceUrl: "",
}); });
const countdownVisible = ref(false);
const progress = ref(0); const countdownSeconds = ref(3);
let progressTimer = null; const firmwareMessageVisible = ref(false);
let timeoutTimer = null; const firmwareMessage = ref("");
let statusTimer = null; let countdownTimer = null;
let wifiConnectTimer = null;
let wifiConnectRequestId = 0; let wifiConnectRequestId = 0;
let wifiConnectPollCount = 0;
const WIFI_CONNECT_POLL_INTERVAL = 2000;
const WIFI_CONNECT_MAX_POLL_COUNT = 30;
const WIFI_CONNECT_FAILED_TEXT = "连接失败,请检查WiFi密码或WiFi状态"; const WIFI_CONNECT_FAILED_TEXT = "连接失败,请检查WiFi密码或WiFi状态";
const OTA_MIN_BATTERY = 50;
const OTA_LOW_BATTERY_TEXT = "电量不足 50%,暂不支持 OTA 升级";
// 控制授权拒绝弹窗显示/隐藏 // 控制授权拒绝弹窗显示/隐藏
const wifiAuthDeniedVisible = ref(false); const wifiAuthDeniedVisible = ref(false);
const {
updating: otaUpdating,
progress: otaProgress,
phase: otaPhase,
resultVisible: otaResultVisible,
resultStatus: otaResultStatus,
resultTitle: otaResultTitle,
resultContent: otaResultContent,
startUpdate: startOtaUpdate,
closeResult: closeOtaResult,
} = useOtaUpdate();
const countdownButtonText = computed(
() => `${Math.max(1, countdownSeconds.value)}秒后开始`
);
// 判断 WiFi 列表失败是否由用户拒绝授权引起(兼容 errno:103 及各平台 errMsg 变体)。 // 判断 WiFi 列表失败是否由用户拒绝授权引起(兼容 errno:103 及各平台 errMsg 变体)。
const isWifiPermissionDenied = (err) => { const isWifiPermissionDenied = (err) => {
if (err?.errno === 103) return true; if (err?.errno === 103) return true;
@@ -207,7 +214,7 @@ const startScanning = () => {
// 选择列表中的 WiFi,并打开密码输入弹窗。 // 选择列表中的 WiFi,并打开密码输入弹窗。
const selectWifi = (wifi) => { const selectWifi = (wifi) => {
cancelWifiConnectPolling(); cancelWifiConnectWaiting();
connectingWifi.value = wifi; connectingWifi.value = wifi;
connectInput.value = { ssid: wifi.SSID, password: "" }; connectInput.value = { ssid: wifi.SSID, password: "" };
connectMode.value = wifi.secure ? "secure" : "open"; connectMode.value = wifi.secure ? "secure" : "open";
@@ -217,7 +224,7 @@ const selectWifi = (wifi) => {
// 选择手动输入 WiFi,并打开手动输入弹窗。 // 选择手动输入 WiFi,并打开手动输入弹窗。
const selectOther = () => { const selectOther = () => {
cancelWifiConnectPolling(); cancelWifiConnectWaiting();
connectingWifi.value = null; connectingWifi.value = null;
connectInput.value = { ssid: "", password: "" }; connectInput.value = { ssid: "", password: "" };
connectMode.value = "manual"; connectMode.value = "manual";
@@ -225,9 +232,9 @@ const selectOther = () => {
currentState.value = STATES.CONNECTING; currentState.value = STATES.CONNECTING;
}; };
// 关闭连接弹窗,并停止当前 WiFi 连接轮询。 // 关闭连接弹窗,并停止等待当前 WiFi 连接结果。
const closeConnectSheet = () => { const closeConnectSheet = () => {
cancelWifiConnectPolling(); cancelWifiConnectWaiting();
connectError.value = ""; connectError.value = "";
currentState.value = connectedWifi.value ? STATES.CONNECTED : STATES.LIST; currentState.value = connectedWifi.value ? STATES.CONNECTED : STATES.LIST;
}; };
@@ -257,89 +264,30 @@ const wifiListScrollHeight = computed(() => {
return `${Math.min(itemCount * 92, maxHeight)}rpx`; return `${Math.min(itemCount * 92, maxHeight)}rpx`;
}); });
// 清理 WiFi 连接轮询定时器。 // 取消当前 WiFi 连接请求的页面等待状态,并忽略可能迟到的响应。
const clearWifiConnectTimer = () => { const cancelWifiConnectWaiting = () => {
clearTimeout(wifiConnectTimer);
wifiConnectTimer = null;
wifiConnectPollCount = 0;
};
// 取消当前 WiFi 连接轮询,并恢复弹窗提交状态。
const cancelWifiConnectPolling = () => {
wifiConnectRequestId += 1; wifiConnectRequestId += 1;
clearWifiConnectTimer();
connectStatusText.value = ""; connectStatusText.value = "";
isSubmittingWifi.value = false; isSubmittingWifi.value = false;
uni.hideLoading(); uni.hideLoading();
}; };
// 判断设备电量接口返回的 online/netType 字段,确定设备是否已通过 WiFi 在线。 // 把接口失败和传输异常转换为连接弹窗内的用户提示。
// 返回值含义:true → WiFi 在线成功;"net_fail" → 设备走 4g 失败;false → 未就绪,需继续轮询。 const getWifiConnectErrorText = (error) => {
const isDeviceConnectedByWifi = (deviceStatus) => { const message = error?.message || "";
// online 不为 true → 设备不在线,需继续轮询 if (message.includes("请先开启智能弓")) return "请先开启智能弓";
if (deviceStatus?.online !== true) return false; if (message.includes("超时") || error?.errMsg?.includes("timeout")) {
const netType = String(deviceStatus?.netType || "").toLowerCase(); return "等待设备响应超时,请重试";
// online:true + netType:4g → 设备已切 4g,WiFi 连接失败 }
if (netType === "4g") return "net_fail"; if (error?.errMsg) return "网络异常,请检查网络后重试";
// online:true + netType:wifi → WiFi 连接成功 return message || WIFI_CONNECT_FAILED_TEXT;
// online:true + netType:"" → 设备在线但 netType 暂未上报,继续轮询等待
return netType === "wifi";
}; };
// 轮询设备电量接口,等待设备切到 WiFi 在线;netType:4g 快速失败,超时 30 次后放弃。 // 提交 WiFi 配置,并以接口返回的设备最终连接结果更新页面。
const waitForDeviceWifiConnected = (requestId) => {
return new Promise((resolve) => {
const poll = async () => {
if (requestId !== wifiConnectRequestId) {
resolve(false);
return;
}
wifiConnectPollCount += 1;
try {
const deviceStatus = await getDeviceBatteryAPI();
if (requestId !== wifiConnectRequestId) {
resolve(false);
return;
}
const connResult = isDeviceConnectedByWifi(deviceStatus);
// online:true + netType:wifi → 成功
if (connResult === true) {
resolve(true);
return;
}
// online:true + netType:4g → 立即失败(设备已切 4g,WiFi 连不上)
if (connResult === "net_fail") {
resolve(false);
return;
}
// online:false + netType:"" → 继续轮询
// online:true + netType:"" → 忽略,继续轮询(netType 暂未上报)
} catch (err) {
if (requestId !== wifiConnectRequestId) {
resolve(false);
return;
}
}
if (wifiConnectPollCount >= WIFI_CONNECT_MAX_POLL_COUNT) {
resolve(false);
return;
}
wifiConnectTimer = setTimeout(poll, WIFI_CONNECT_POLL_INTERVAL);
};
poll();
});
};
// 提交 WiFi 配置给游戏设备,并轮询确认设备真实连上 WiFi 后再展示成功。
const submitDeviceWifiConfig = async ({ ssid, password }) => { const submitDeviceWifiConfig = async ({ ssid, password }) => {
if (isSubmittingWifi.value) return; if (isSubmittingWifi.value) return;
wifiConnectRequestId += 1; wifiConnectRequestId += 1;
const requestId = wifiConnectRequestId; const requestId = wifiConnectRequestId;
clearWifiConnectTimer();
isSubmittingWifi.value = true; isSubmittingWifi.value = true;
connectStatusText.value = "WiFi连接中..."; connectStatusText.value = "WiFi连接中...";
uni.showLoading({ uni.showLoading({
@@ -347,10 +295,9 @@ const submitDeviceWifiConfig = async ({ ssid, password }) => {
mask: true, mask: true,
}); });
try { try {
await connectDeviceWifiAPI(ssid, password); const connectResult = await connectDeviceWifiAPI(ssid, password);
const isConnected = await waitForDeviceWifiConnected(requestId);
if (requestId !== wifiConnectRequestId) return; if (requestId !== wifiConnectRequestId) return;
if (!isConnected) { if (connectResult?.success !== true) {
connectError.value = WIFI_CONNECT_FAILED_TEXT; connectError.value = WIFI_CONNECT_FAILED_TEXT;
return; return;
} }
@@ -362,14 +309,15 @@ const submitDeviceWifiConfig = async ({ ssid, password }) => {
}; };
connectError.value = ""; connectError.value = "";
currentState.value = STATES.CONNECTED; currentState.value = STATES.CONNECTED;
if (fromFirmwareUpdate.value) {
openFirmwareCountdown();
}
} catch (err) { } catch (err) {
if (requestId === wifiConnectRequestId) { if (requestId === wifiConnectRequestId) {
connectError.value = connectError.value = getWifiConnectErrorText(err);
err?.code === -1 && err?.message ? err.message : WIFI_CONNECT_FAILED_TEXT;
} }
} finally { } finally {
if (requestId === wifiConnectRequestId) { if (requestId === wifiConnectRequestId) {
clearWifiConnectTimer();
connectStatusText.value = ""; connectStatusText.value = "";
isSubmittingWifi.value = false; isSubmittingWifi.value = false;
uni.hideLoading(); uni.hideLoading();
@@ -387,81 +335,7 @@ const joinNetwork = () => {
submitDeviceWifiConfig({ ssid, password }); submitDeviceWifiConfig({ ssid, password });
}; };
// 清理 OTA 更新相关定时器,避免页面退出或状态结束后继续执行。 // 获取 OTA 更新版本信息,正常使用入口传参,缺失时再请求后端兜底。
const clearUpdateTimers = () => {
clearInterval(progressTimer);
clearTimeout(timeoutTimer);
clearTimeout(statusTimer);
progressTimer = null;
timeoutTimer = null;
statusTimer = null;
};
// 启动本地进度条动画,真实完成状态以后端任务轮询结果为准。
const startProgressAnimation = () => {
clearInterval(progressTimer);
progressTimer = setInterval(() => {
if (progress.value >= 90) {
clearInterval(progressTimer);
return;
}
const increment = Math.max(0.5, 2 - progress.value / 60);
progress.value = Math.min(90, progress.value + increment);
}, 500);
};
// 将 OTA 更新流程标记为失败并切换到失败页面。
const failUpdate = () => {
clearUpdateTimers();
isStartingUpdate.value = false;
currentState.value = STATES.FAILED;
};
// 将 OTA 更新流程标记为成功,进度补到 100% 后进入完成页面。
const completeUpdate = () => {
clearUpdateTimers();
isStartingUpdate.value = false;
progress.value = 100;
setTimeout(() => {
currentState.value = STATES.DONE;
}, 300);
};
// 轮询 OTA 更新任务状态,状态为处理中则继续轮询,成功或失败则结束流程。
const pollUpdateTaskStatus = (taskId) => {
clearTimeout(statusTimer);
statusTimer = setTimeout(async () => {
try {
const taskStatus = await getHardwareBoxTaskStatusAPI(taskId);
const status = Number(taskStatus?.status);
if (status === 2) {
completeUpdate();
return;
}
if (status === 3) {
failUpdate();
return;
}
if (status === 0 || status === 1) {
pollUpdateTaskStatus(taskId);
return;
}
failUpdate();
} catch (err) {
failUpdate();
}
}, 3000);
};
// 判断设备是否满足 OTA 更新条件,不满足时返回精确提示文案。
const getUpdateDisabledReason = (deviceStatus) => {
if (deviceStatus?.online !== true) return "请先开启智能弓";
if (Number(deviceStatus?.battery) <= OTA_MIN_BATTERY) return OTA_LOW_BATTERY_TEXT;
if (String(deviceStatus?.netType || "").toLowerCase() !== "wifi") return "设备当前未连接 WiFi,请先连接 WiFi 后再更新";
return "";
};
// 获取 OTA 更新版本信息,优先使用首页跳转传入的数据,没有传参时再请求后端版本接口。
const getOtaVersionInfo = async () => { const getOtaVersionInfo = async () => {
if (routeOtaInfo.value.versionNumber && routeOtaInfo.value.resourceUrl) { if (routeOtaInfo.value.versionNumber && routeOtaInfo.value.resourceUrl) {
return { return {
@@ -473,101 +347,43 @@ const getOtaVersionInfo = async () => {
return getHardwareBoxVersionAPI(); return getHardwareBoxVersionAPI();
}; };
// 点击开始更新时先判断设备状态和版本信息,满足条件才发送 OTA 指令并开始轮询任务状态。 const startFirmwareUpdate = async () => {
const startUpdate = async () => { if (!fromFirmwareUpdate.value || !connectedWifi.value || otaUpdating.value) return;
if (isStartingUpdate.value) return;
if (!connectedWifi.value) return;
isStartingUpdate.value = true;
try { try {
const deviceStatus = await getDeviceBatteryAPI(); const versionInfo = await getOtaVersionInfo();
const disabledReason = getUpdateDisabledReason(deviceStatus);
if (disabledReason) {
isStartingUpdate.value = false;
uni.showToast({
title: disabledReason,
icon: "none",
});
return;
}
let versionInfo;
try {
versionInfo = await getOtaVersionInfo();
} catch (err) {
isStartingUpdate.value = false;
uni.showToast({
title: "获取更新版本失败,请重试",
icon: "none",
});
return;
}
if (!versionInfo?.needUpdate) { if (!versionInfo?.needUpdate) {
isStartingUpdate.value = false; firmwareMessage.value = "当前已是最新版本";
uni.showToast({ firmwareMessageVisible.value = true;
title: "当前已是最新版本",
icon: "none",
});
return; return;
} }
await startOtaUpdate({
currentState.value = STATES.UPDATING;
progress.value = 0;
startProgressAnimation();
timeoutTimer = setTimeout(() => {
if (currentState.value === STATES.UPDATING) {
failUpdate();
}
}, 5 * 60 * 1000);
const updateResult = await sendHardwareBoxUpdateAPI({
versionNumber: versionInfo.versionNumber, versionNumber: versionInfo.versionNumber,
wifiSsid: connectedWifi.value.SSID, wifiSsid: connectedWifi.value.SSID,
wifiPassword: connectedWifi.value.password || "", wifiPassword: connectedWifi.value.password || "",
resourceUrl: versionInfo.resourceUrl, resourceUrl: versionInfo.resourceUrl,
}); });
if (!updateResult?.taskId) { } catch (error) {
failUpdate(); firmwareMessage.value = "获取更新版本失败,请重试";
return; firmwareMessageVisible.value = true;
}
pollUpdateTaskStatus(updateResult.taskId);
} catch (err) {
failUpdate();
} }
}; };
// WebSocket 成功回调保留兜底能力,触发后直接按更新完成处理。 const clearFirmwareCountdown = () => {
const handleWsDone = () => { clearInterval(countdownTimer);
completeUpdate(); countdownTimer = null;
}; };
// WebSocket 失败回调保留兜底能力,触发后直接按更新失败处理。 const openFirmwareCountdown = () => {
const handleWsFail = () => { clearFirmwareCountdown();
failUpdate(); countdownSeconds.value = 3;
}; countdownVisible.value = true;
countdownTimer = setInterval(() => {
// 处理更新完成返回,兼容首页 OTA 弹窗入口和设备页普通入口。 countdownSeconds.value -= 1;
const handleDone = () => { if (countdownSeconds.value > 0) return;
const pages = getCurrentPages(); clearFirmwareCountdown();
const prevPage = pages[pages.length - 2]; countdownVisible.value = false;
const prevVm = prevPage?.$vm; void startFirmwareUpdate();
}, 1000);
if (prevVm && "otaState" in prevVm && "otaVisible" in prevVm) {
prevVm.otaState = "update_success";
prevVm.otaVisible = true;
}
uni.navigateBack({ delta: 1 });
};
const handleRetry = () => {
if (connectedWifi.value) {
currentState.value = STATES.CONNECTED;
} else {
startScanning();
}
}; };
// 监听系统输入法高度,用于让底部弹窗避开键盘遮挡。 // 监听系统输入法高度,用于让底部弹窗避开键盘遮挡。
@@ -585,8 +401,9 @@ const togglePasswordVisibility = () => {
}); });
}; };
// 页面加载时接收首页传入的 OTA 版本号和固件地址。 // 页面加载时识别普通 WiFi 入口和固件更新入口。
onLoad((options = {}) => { onLoad((options = {}) => {
fromFirmwareUpdate.value = options.source === "firmware-update";
routeOtaInfo.value = { routeOtaInfo.value = {
versionNumber: decodeURIComponent(options.versionNumber || ""), versionNumber: decodeURIComponent(options.versionNumber || ""),
resourceUrl: decodeURIComponent(options.resourceUrl || ""), resourceUrl: decodeURIComponent(options.resourceUrl || ""),
@@ -612,8 +429,8 @@ onUnmounted(() => {
if (typeof uni.offKeyboardHeightChange === "function") { if (typeof uni.offKeyboardHeightChange === "function") {
uni.offKeyboardHeightChange(handleKeyboardHeightChange); uni.offKeyboardHeightChange(handleKeyboardHeightChange);
} }
cancelWifiConnectPolling(); cancelWifiConnectWaiting();
clearUpdateTimers(); clearFirmwareCountdown();
wx.offGetWifiList && wx.offGetWifiList(); wx.offGetWifiList && wx.offGetWifiList();
}); });
</script> </script>
@@ -650,16 +467,16 @@ onUnmounted(() => {
</view> </view>
<view v-if="currentState === 'CONNECTED'" class="wifi-list-card connected-wifi-card"> <view v-if="currentState === 'CONNECTED'" class="wifi-list-card connected-wifi-card">
<view class="wifi-item connected-wifi-item"> <view class="wifi-item connected-wifi-item">
<image class="check-icon" src="../static/sicon/check.png" mode="aspectFit" /> <image class="check-icon" src="https://static.shelingxingqiu.com/shootmini/static/sicon/check.png" mode="aspectFit" />
<text class="wifi-ssid connected-wifi-ssid">{{ connectedWifi?.SSID }}</text> <text class="wifi-ssid connected-wifi-ssid">{{ connectedWifi?.SSID }}</text>
<view class="wifi-icons connected-wifi-icons"> <view class="wifi-icons connected-wifi-icons">
<image <image
v-if="connectedWifi?.secure" v-if="connectedWifi?.secure"
class="security-icon" class="security-icon"
src="../static/sicon/pwd.png" src="https://static.shelingxingqiu.com/shootmini/static/sicon/pwd.png"
mode="aspectFit" mode="aspectFit"
/> />
<image class="signal-icon" src="../static/sicon/wifi.png" mode="aspectFit" /> <image class="signal-icon" src="https://static.shelingxingqiu.com/shootmini/static/sicon/wifi.png" mode="aspectFit" />
</view> </view>
</view> </view>
</view> </view>
@@ -668,7 +485,7 @@ onUnmounted(() => {
<view class="section-label-row"> <view class="section-label-row">
<text class="section-label">网络</text> <text class="section-label">网络</text>
<image <image
src="../static/sicon/refresh.png" src="https://static.shelingxingqiu.com/shootmini/static/sicon/refresh.png"
mode="aspectFit" mode="aspectFit"
:style="{ width: '34rpx', height: '34rpx', marginLeft: '8rpx', opacity: isRefreshing ? 0.3 : 0.7 }" :style="{ width: '34rpx', height: '34rpx', marginLeft: '8rpx', opacity: isRefreshing ? 0.3 : 0.7 }"
@click="startScanning" @click="startScanning"
@@ -699,10 +516,10 @@ onUnmounted(() => {
<image <image
v-if="wifi.secure" v-if="wifi.secure"
class="security-icon" class="security-icon"
src="../static/sicon/pwd.png" src="https://static.shelingxingqiu.com/shootmini/static/sicon/pwd.png"
mode="aspectFit" mode="aspectFit"
/> />
<image class="signal-icon" src="../static/sicon/wifi.png" mode="aspectFit" /> <image class="signal-icon" src="https://static.shelingxingqiu.com/shootmini/static/sicon/wifi.png" mode="aspectFit" />
</view> </view>
</view> </view>
<view class="wifi-item" @click="selectOther"> <view class="wifi-item" @click="selectOther">
@@ -711,46 +528,6 @@ onUnmounted(() => {
</block> </block>
</scroll-view> </scroll-view>
<!-- CONNECTED:开始更新按钮 -->
<view v-if="currentState === 'CONNECTED'" class="bottom-btn-area connected-bottom-btn-area">
<view class="primary-btn update-btn" @click="startUpdate">
<text class="primary-btn-text">开始更新</text>
</view>
</view>
</view>
<!-- UPDATING -->
<view v-else-if="currentState === 'UPDATING'" class="center-page">
<image src="https://static.shelingxingqiu.com/shootmini/static/ota/target-char.png" mode="aspectFit" style="width: 194rpx; height: 164rpx;" />
<text class="page-title" style="margin-top: 24rpx;">更新中,请稍等片刻...</text>
<view class="progress-wrap">
<view class="progress-track">
<view class="progress-fill" :style="{ width: progress + '%' }"></view>
</view>
<text class="progress-pct">{{ Math.floor(progress) }}%</text>
</view>
</view>
<!-- DONE -->
<view v-else-if="currentState === 'DONE'" class="center-page">
<image src="https://static.shelingxingqiu.com/shootmini/static/ota/check-char.png" mode="aspectFit" style="width: 194rpx; height: 166rpx;" />
<text class="page-title" style="margin-top: 24rpx;">更新完成</text>
<text class="page-desc-white">请关机并重启智能弓</text>
<view class="primary-btn done-btn" style="margin-top:20px" @click="handleDone">
<text class="primary-btn-text">完成</text>
</view>
</view>
<!-- FAILED -->
<view v-else-if="currentState === 'FAILED'" class="center-page">
<image src="https://static.shelingxingqiu.com/shootmini/static/ota/close-char.png" mode="aspectFit" style="width: 194rpx; height: 164rpx;" />
<text class="page-title fail-title" style="margin-top: 24rpx;">更新失败</text>
<text class="page-desc-white">请确保:</text>
<text class="page-desc-white">1、智能弓已开启</text>
<text class="page-desc-white">2、网路连接稳定</text>
<view class="primary-btn done-btn" style="margin-top: 40rpx;" @click="handleRetry">
<text class="primary-btn-text">重试</text>
</view>
</view> </view>
<!-- CONNECTING 底部弹窗 --> <!-- CONNECTING 底部弹窗 -->
@@ -763,7 +540,7 @@ onUnmounted(() => {
<block v-if="connectMode === 'secure'"> <block v-if="connectMode === 'secure'">
<view class="sheet-header"> <view class="sheet-header">
<view class="sheet-nav-btn" @click="closeConnectSheet"> <view class="sheet-nav-btn" @click="closeConnectSheet">
<image src="../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
</view> </view>
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text> <text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
<view <view
@@ -771,7 +548,7 @@ onUnmounted(() => {
:class="{ 'nav-disabled': joinDisabled }" :class="{ 'nav-disabled': joinDisabled }"
@click="joinNetwork" @click="joinNetwork"
> >
<image src="../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
</view> </view>
</view> </view>
<view class="input-row-card"> <view class="input-row-card">
@@ -789,7 +566,7 @@ onUnmounted(() => {
<!-- 密码显示/隐藏切换按钮 --> <!-- 密码显示/隐藏切换按钮 -->
<view class="pwd-eye-btn" @click="togglePasswordVisibility"> <view class="pwd-eye-btn" @click="togglePasswordVisibility">
<image <image
:src="showPassword ? '../static/sicon/eye-on.png' : '../static/sicon/eye-off.png'" :src="showPassword ? 'https://static.shelingxingqiu.com/shootmini/static/sicon/eye-on.png' : 'https://static.shelingxingqiu.com/shootmini/static/sicon/eye-off.png'"
mode="aspectFit" mode="aspectFit"
style="width: 40rpx; height: 40rpx;" style="width: 40rpx; height: 40rpx;"
/> />
@@ -803,11 +580,11 @@ onUnmounted(() => {
<block v-else-if="connectMode === 'open'"> <block v-else-if="connectMode === 'open'">
<view class="sheet-header"> <view class="sheet-header">
<view class="sheet-nav-btn" @click="closeConnectSheet"> <view class="sheet-nav-btn" @click="closeConnectSheet">
<image src="../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
</view> </view>
<text class="sheet-title">加入"{{ connectInput.ssid }}"</text> <text class="sheet-title">加入"{{ connectInput.ssid }}"</text>
<view class="sheet-nav-btn" @click="joinNetwork"> <view class="sheet-nav-btn" @click="joinNetwork">
<image src="../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
</view> </view>
</view> </view>
<text v-if="connectStatusText" class="connect-status">{{ connectStatusText }}</text> <text v-if="connectStatusText" class="connect-status">{{ connectStatusText }}</text>
@@ -819,7 +596,7 @@ onUnmounted(() => {
<block v-else-if="connectMode === 'manual'"> <block v-else-if="connectMode === 'manual'">
<view class="sheet-header"> <view class="sheet-header">
<view class="sheet-nav-btn" @click="closeConnectSheet"> <view class="sheet-nav-btn" @click="closeConnectSheet">
<image src="../static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/sicon/arrow-left.png" mode="aspectFit" style="width: 40rpx; height: 40rpx;" />
</view> </view>
<text class="sheet-title">加入无线网络</text> <text class="sheet-title">加入无线网络</text>
<view <view
@@ -827,7 +604,7 @@ onUnmounted(() => {
:class="{ 'nav-disabled': joinDisabled }" :class="{ 'nav-disabled': joinDisabled }"
@click="joinNetwork" @click="joinNetwork"
> >
<image src="../static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" /> <image src="https://static.shelingxingqiu.com/shootmini/static/sicon/check.png" mode="aspectFit" style="width: 28rpx; height: 24rpx;" />
</view> </view>
</view> </view>
<view class="input-row-card"> <view class="input-row-card">
@@ -854,7 +631,7 @@ onUnmounted(() => {
<!-- 密码显示/隐藏切换按钮 --> <!-- 密码显示/隐藏切换按钮 -->
<view class="pwd-eye-btn" @click="togglePasswordVisibility"> <view class="pwd-eye-btn" @click="togglePasswordVisibility">
<image <image
:src="showPassword ? '../static/sicon/eye-on.png' : '../static/sicon/eye-off.png'" :src="showPassword ? 'https://static.shelingxingqiu.com/shootmini/static/sicon/eye-on.png' : 'https://static.shelingxingqiu.com/shootmini/static/sicon/eye-off.png'"
mode="aspectFit" mode="aspectFit"
style="width: 40rpx; height: 40rpx;" style="width: 40rpx; height: 40rpx;"
/> />
@@ -883,6 +660,46 @@ onUnmounted(() => {
</view> </view>
</view> </view>
</ScreenHint> </ScreenHint>
<ModalDialog
:show="countdownVisible"
title="WiFi连接成功"
content="3秒后将自动开始更新"
:confirmText="countdownButtonText"
:showCancel="false"
:confirmDisabled="true"
></ModalDialog>
<OtaModal
:visible="otaUpdating"
state="update_progress"
:progress="otaProgress"
:phase="otaPhase"
/>
<OtaModal
:visible="otaResultVisible && otaResultStatus === 'success'"
state="update_success"
@done="closeOtaResult"
/>
<ModalDialog
:show="otaResultVisible && otaResultStatus === 'failed'"
:title="otaResultTitle"
:content="otaResultContent"
confirmText="关闭"
:showCancel="false"
:onConfirm="closeOtaResult"
></ModalDialog>
<ModalDialog
:show="firmwareMessageVisible"
title="固件更新"
:content="firmwareMessage"
confirmText="关闭"
:showCancel="false"
:onConfirm="() => (firmwareMessageVisible = false)"
></ModalDialog>
</Container> </Container>
</template> </template>
+2 -2
View File
@@ -168,7 +168,7 @@ const meleeRankList = computed(() => {
*/ */
function getMeleeRankBgSrc(rank) { function getMeleeRankBgSrc(rank) {
const names = ["one", "two", "three"]; const names = ["one", "two", "three"];
return `../static/friend-battle-result/rank-${names[rank - 1]}.svg`; return `https://static.shelingxingqiu.com/shootmini/static/friend-battle-result/rank-${names[rank - 1]}.svg`;
} }
/** /**
@@ -485,7 +485,7 @@ function goBack() {
<image <image
v-if="item.rank <= 3" v-if="item.rank <= 3"
class="rank-badge-img" class="rank-badge-img"
:src="`../static/champ${item.rank}.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/champ${item.rank}.png`"
mode="aspectFit" mode="aspectFit"
/> />
<view v-else class="rank-badge-default"> <view v-else class="rank-badge-default">
+5 -5
View File
@@ -190,10 +190,10 @@ onLoad(async (options) => {
<view> <view>
<view class="stars"> <view class="stars">
<block v-for="i in 5" :key="i"> <block v-for="i in 5" :key="i">
<image v-if="data.totalWinningRate >= i * 0.2" src="../static/star-full.png" mode="widthFix" /> <image v-if="data.totalWinningRate >= i * 0.2" src="https://static.shelingxingqiu.com/shootmini/static/star-full.png" mode="widthFix" />
<image v-else-if="data.totalWinningRate >= (i - 1) * 0.2 + 0.1" src="../static/star-half.png" <image v-else-if="data.totalWinningRate >= (i - 1) * 0.2 + 0.1" src="https://static.shelingxingqiu.com/shootmini/static/star-half.png"
mode="widthFix" /> mode="widthFix" />
<image v-else src="../static/star-empty.png" mode="widthFix" /> <image v-else src="https://static.shelingxingqiu.com/shootmini/static/star-empty.png" mode="widthFix" />
</block> </block>
</view> </view>
<text>挑战难度</text> <text>挑战难度</text>
@@ -201,7 +201,7 @@ onLoad(async (options) => {
</view> </view>
</view> </view>
<view class="founded-room"> <view class="founded-room">
<image src="../static/founded-room.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/founded-room.png" mode="widthFix" />
<view> <view>
<input placeholder="输入房间号" v-model="roomNumber" placeholder-style="color: #ccc" /> <input placeholder="输入房间号" v-model="roomNumber" placeholder-style="color: #ccc" />
<view @click="$clickSound(() => enterRoom(roomNumber))">进入房间</view> <view @click="$clickSound(() => enterRoom(roomNumber))">进入房间</view>
@@ -214,7 +214,7 @@ onLoad(async (options) => {
<image :src="user.avatar" mode="widthFix" /> <image :src="user.avatar" mode="widthFix" />
<image src="https://static.shelingxingqiu.com/shootmini/static/versus.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/versus.png" mode="widthFix" />
<view> <view>
<image src="../static/question-mark.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/question-mark.png" mode="widthFix" />
</view> </view>
</view> </view>
<view> <view>
+538 -261
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -132,7 +132,7 @@ const checkBowData = (selected) => {
<text>大乱斗</text> <text>大乱斗</text>
<view @click="checkBowData"> <view @click="checkBowData">
<text>查看靶纸</text> <text>查看靶纸</text>
<image src="../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
</view> </view>
<PlayerScore2 <PlayerScore2
@@ -155,7 +155,7 @@ const checkBowData = (selected) => {
<text>{{ round.ifGold ? "决金箭" : `第${index + 1}轮` }}</text> <text>{{ round.ifGold ? "决金箭" : `第${index + 1}轮` }}</text>
<view @click="() => checkBowData(index)"> <view @click="() => checkBowData(index)">
<text>查看靶纸</text> <text>查看靶纸</text>
<image src="../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
</view> </view>
<view <view
@@ -171,7 +171,7 @@ const checkBowData = (selected) => {
borderColor: '#64BAFF', borderColor: '#64BAFF',
transform: `translateX(-${index * 15}px)`, transform: `translateX(-${index * 15}px)`,
}" }"
:src="p.avatar || '../static/user-icon.png'" :src="p.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
:key="index" :key="index"
mode="widthFix" mode="widthFix"
/> />
+2 -2
View File
@@ -81,7 +81,7 @@ onLoad(async (options) => {
> >
<image <image
v-if="player.userId === currentUser.userId" v-if="player.userId === currentUser.userId"
src="../static/player-bg2.png" src="https://static.shelingxingqiu.com/shootmini/static/player-bg2.png"
:style="{ :style="{
width: `${Math.max(100 / players.length, 18)}vw`, width: `${Math.max(100 / players.length, 18)}vw`,
}" }"
@@ -203,7 +203,7 @@ onLoad(async (options) => {
flex-wrap: wrap; flex-wrap: wrap;
} }
.score-item { .score-item {
background-image: url("../static/score-bg.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/score-bg.png");
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
+18 -18
View File
@@ -31,15 +31,15 @@ const memberTypes = [
themeClass: "vip-page--normal", themeClass: "vip-page--normal",
heroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-title.png", heroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-title.png",
activeHeroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-title2.png", activeHeroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-title2.png",
orderIcon: "../../static/vip/vip-order.png", orderIcon: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-order.png",
heroBadge: "../../static/vip/normal-hero-badge.png", heroBadge: "https://static.shelingxingqiu.com/shootmini/static/vip/normal-hero-badge.png",
buttonClass: "activate-btn--normal", buttonClass: "activate-btn--normal",
benefits: [ benefits: [
{ label: "黄金昵称", icon: "../../static/vip/vip-badge.png" }, { label: "黄金昵称", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-badge.png" },
{ label: "教练点评", icon: "../../static/vip/vip-comment.png" }, { label: "教练点评", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-comment.png" },
{ label: "专享VIP客服", icon: "../../static/vip/vip-service.png" }, { label: "专享VIP客服", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-service.png" },
{ label: "排位赛\n每日+20次", icon: "../../static/vip/vip-rank.png" }, { label: "排位赛\n每日+20次", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-rank.png" },
{ label: "约战\n每日+20次", icon: "../../static/vip/vip-battle.png" }, { label: "约战\n每日+20次", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/vip-battle.png" },
], ],
}, },
{ {
@@ -52,18 +52,18 @@ const memberTypes = [
themeClass: "vip-page--super", themeClass: "vip-page--super",
heroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-title.png", heroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-title.png",
activeHeroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-title2.png", activeHeroCard: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-title2.png",
orderIcon: "../../static/vip/svip-order.png", orderIcon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-order.png",
heroBadge: "../../static/vip/super-hero-badge.png", heroBadge: "https://static.shelingxingqiu.com/shootmini/static/vip/super-hero-badge.png",
buttonClass: "activate-btn--super", buttonClass: "activate-btn--super",
benefits: [ benefits: [
{ label: "专属落点标识", icon: "../../static/vip/svip-point.png" }, { label: "专属落点标识", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-point.png" },
{ label: "专属命中效果", icon: "../../static/vip/svip-hit.png" }, { label: "专属命中效果", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-hit.png" },
{ label: "专属射箭效果", icon: "../../static/vip/svip-arrow.png" }, { label: "专属射箭效果", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-arrow.png" },
{ label: "炫彩昵称", icon: "../../static/vip/svip-badge.png" }, { label: "炫彩昵称", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-badge.png" },
{ label: "教练点评", icon: "../../static/vip/svip-comment.png" }, { label: "教练点评", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-comment.png" },
{ label: "约战无限制", icon: "../../static/vip/svip-battle.png" }, { label: "约战无限制", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-battle.png" },
{ label: "排位赛无限制", icon: "../../static/vip/svip-rank.png" }, { label: "排位赛无限制", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-rank.png" },
{ label: "专享SVIP客服", icon: "../../static/vip/svip-service.png" }, { label: "专享SVIP客服", icon: "https://static.shelingxingqiu.com/shootmini/static/vip/svip-service.png" },
], ],
}, },
]; ];
@@ -446,7 +446,7 @@ onShow(loadVipConfig);
<text>套餐说明</text> <text>套餐说明</text>
<image <image
class="package-header__icon" class="package-header__icon"
src="../../static/enter.png" src="https://static.shelingxingqiu.com/shootmini/static/enter.png"
mode="aspectFit" mode="aspectFit"
/> />
</view> </view>
+1 -1
View File
@@ -31,7 +31,7 @@ import Container from "@/components/Container.vue";
<view class="table-wrap"> <view class="table-wrap">
<view class="intro-toast"> <view class="intro-toast">
<image class="intro-toast__bg" src="../../static/vip/intro-toast.png" mode="scaleToFill" /> <image class="intro-toast__bg" src="https://static.shelingxingqiu.com/shootmini/static/vip/intro-toast.png" mode="scaleToFill" />
<text class="intro-toast__text">初次绑定设备赠送6个月</text> <text class="intro-toast__text">初次绑定设备赠送6个月</text>
</view> </view>
<view class="benefit-table"> <view class="benefit-table">
-526
View File
@@ -1,526 +0,0 @@
<script setup>
import { computed, ref } from "vue";
import { onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import ScreenHint from "@/components/ScreenHint.vue";
import SButton from "@/components/SButton.vue";
import {
bindDeviceAPI,
getMyDevicesAPI,
unbindDeviceAPI,
laserAimAPI, bindDeviceAPIV2,
} from "@/apis";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const showTip = ref(false);
const confirmBindTip = ref(false);
const addDevice = ref();
const store = useStore();
const { updateDevice, clearDevice } = store;
const { user, device } = storeToRefs(store);
const justBind = ref(false);
const calibration = ref(false);
const token = ref(null);
const isSVip = computed(() => user.value.sVip === true);
const isVip = computed(() => user.value.vip === true && !isSVip.value);
// 扫描二维码方法
const handleScan = () => {
// 调用扫码API
uni.scanCode({
// 只支持扫码二维码
onlyFromCamera: true,
scanType: ["qrCode"],
success: async (res) => {
try {
// const base64Decode = (str) => {
// // 将 base64 转换为 utf8 字符串
// const bytes = wx.base64ToArrayBuffer(str);
// return String.fromCharCode.apply(null, new Uint8Array(bytes));
// };
//
// addDevice.value = JSON.parse(base64Decode(res.result));
token.value = res.result;
confirmBindTip.value = true;
} catch (err) {
uni.showToast({
title: "无效二维码",
icon: "none",
duration: 2000,
});
}
},
fail: (err) => {
console.error("扫码失败:", err);
uni.showToast({
title: "扫码失败",
icon: "error",
});
},
});
};
const confirmBind = async () => {
if (!justBind.value && token.value) {
const result = await bindDeviceAPIV2(token.value);
confirmBindTip.value = false;
if (result.binded) {
return uni.showToast({
title: "设备已绑定其他账号,请解绑后再绑定",
icon: "none",
});
}
updateDevice(result.deviceId, result.name);
justBind.value = true;
uni.showToast({
title: "绑定成功",
icon: "success",
});
}
};
const toFristTryPage = () => {
uni.navigateTo({
url: "/pages/first-try",
});
};
const unbindDevice = async () => {
try {
await unbindDeviceAPI(device.value.deviceId);
} catch (error) {
if (error?.type === "DEVICE_BIND_INVALID") {
uni.setStorageSync("calibration", false);
clearDevice();
}
return;
}
uni.setStorageSync("calibration", false);
uni.showToast({
title: "解绑成功",
icon: "success",
});
clearDevice();
};
/** 连接wifi跳转到wifi列表页面 */
const joinWifi = () => {
uni.navigateTo({ url: "/pages/ota-wifi" });
};
const toDeviceIntroPage = () => {
uni.navigateTo({
url: "/pages/device-intro",
});
};
const backToHome = () => {
uni.navigateBack();
};
const copyEmail = () => {
uni.setClipboardData({
data: "shelingxingqiu@163.com",
success: () => {
uni.showToast({
title: "邮箱已复制",
icon: "success",
});
},
});
};
const goCalibration = async () => {
await laserAimAPI();
uni.navigateTo({
url: "/pages/calibration",
});
};
const syncDeviceBinding = async () => {
if (!user.value.id) return;
try {
const devices = await getMyDevicesAPI();
if (devices.bindings && devices.bindings.length) {
updateDevice(devices.bindings[0].deviceId, devices.bindings[0].deviceName);
} else {
clearDevice();
}
} catch (error) {
console.log("sync device binding error", error);
}
};
onShow(async () => {
calibration.value = uni.getStorageSync("calibration");
await syncDeviceBinding();
});
</script>
<template>
<Container title="弓箭绑定">
<view v-if="!device.deviceId" class="scan-code">
<button hover-class="none" @click="$clickSound(handleScan)">
<image src="https://static.shelingxingqiu.com/shootmini/static/scan.png" mode="widthFix" />
</button>
<button hover-class="none" @click="showTip = true">
<text>扫</text>
<text :style="{ color: '#fed847' }">射灵弓箭</text>
<text>上的二维码</text>
<image src="../static/s-question-mark-white.png" mode="widthFix" />
</button>
<text>射灵智能弓箭,三模传感系统与独创靶环算法,</text>
<text>毫秒级在线实时对战,让你拥有全球约战的乐趣!</text>
<button hover-class="none" @click="toDeviceIntroPage">
<image src="https://static.shelingxingqiu.com/shootmini/static/have-no-device.png" mode="widthFix" />
</button>
<ScreenHint
mode="square"
:show="showTip"
:onClose="() => (showTip = false)"
>
<view class="scan-tips">
<text>扫码绑定设灵弓箭</text>
<image
src="https://static.shelingxingqiu.com/attachment/2025-08-05/dbuacrelri7jr3axiy.png"
mode="widthFix"
/>
<text>【注】已被绑定的弓箭无法再次绑定。</text>
<view>
<text>如有任何疑问,请随时联系:</text>
<button hover-class="none" @click="copyEmail">
shelingxingqiu@163.com
</button>
</view>
</view>
</ScreenHint>
<ScreenHint
:show="confirmBindTip"
:onClose="() => (confirmBindTip = false)"
>
<view class="confirm-bind">
<text
>智能弓箭和系统账号需一一对应,你确定要将<text
:style="{ color: '#fed847' }"
>当前登录用户账号</text
>绑定<text :style="{ color: '#fed847' }">这把弓箭</text>吗?
绑定后不可随意更换。</text
>
<view>
<view @click="confirmBind">确认绑定</view>
<view @click="() => (confirmBindTip = false)">取消</view>
</view>
</view>
</ScreenHint>
</view>
<view v-if="justBind" class="just-bind">
<view
class="device-binded"
:style="{ marginBottom: calibration ? '250rpx' : '100rpx' }"
>
<view>
<image src="https://static.shelingxingqiu.com/shootmini/static/device-icon.png" mode="widthFix" />
<text>{{ device.deviceName }}</text>
<view class="calibration" v-if="calibration">
<button hover-class="none" @click="goCalibration">
<text>重新校准</text>
<image src="../static/enter-arrow-blue.png" mode="widthFix" />
</button>
<view>
<image src="../static/calibration-tip.png" mode="widthFix" />
<text>如有场地/距离变化,需重新校准以保证智能弓射箭精准度</text>
</view>
</view>
</view>
<image src="../static/bind-success.png" mode="widthFix" />
<view>
<image
:src="user.avatar || '../static/user-icon.png'"
mode="widthFix"
:style="{ borderRadius: '50%' }"
/>
<view
:class="[
'member-nickname',
isVip ? 'member-nickname--vip' : '',
isSVip ? 'member-nickname--svip' : '',
]"
>
<text class="member-nickname__text">{{ user.nickName }}</text>
<text v-if="isSVip" class="member-nickname__shine">{{
user.nickName
}}</text>
</view>
</view>
</view>
<!-- <block v-if="calibration"> -->
<view>
<text>恭喜,你的弓箭和账号已成功绑定!</text>
<text :style="{ color: '#fed847' }">已赠送6个月射灵世界会员</text>
</view>
<!-- <SButton :onClick="goCalibration" width="60vw" :rounded="40">
开启智能弓进行校准
</SButton>
<text :style="{ marginTop: '20rpx', fontSize: '24rpx', color: '#fff9' }"
>校准时弓箭激光将开启,请勿直视激光</text
> -->
<view>
<SButton
:onClick="backToHome"
backgroundColor="#fff3"
color="#fff"
width="60vw"
:rounded="40"
>返回首页</SButton
>
</view>
<view :style="{ marginTop: '15px' }">
<SButton :onClick="toFristTryPage" width="60vw" :rounded="40">进入新手试炼</SButton>
</view>
<!-- </block> -->
<!-- <block v-else>
</block> -->
</view>
<view v-if="device.deviceId && !justBind" class="has-device">
<view class="device-binded">
<view>
<image src="https://static.shelingxingqiu.com/shootmini/static/device-icon.png" mode="widthFix" />
<text>{{ device.deviceName }}</text>
<view class="calibration">
<button hover-class="none" @click="goCalibration">
<text>去校准</text>
<image src="../static/enter-arrow-blue.png" mode="widthFix" />
</button>
<view>
<image src="../static/calibration-tip.png" mode="widthFix" />
<text
>首次绑定智能弓或场地/距离变化时,应进行校准以确保射箭精度</text
>
</view>
</view>
</view>
<image src="../static/bind.png" mode="widthFix" />
<view>
<image
:src="user.avatar || '../static/user-icon.png'"
mode="widthFix"
:style="{ borderRadius: '50%' }"
/>
<view
:class="[
'member-nickname',
isVip ? 'member-nickname--vip' : '',
isSVip ? 'member-nickname--svip' : '',
]"
>
<text class="member-nickname__text">{{ user.nickName }}</text>
<text v-if="isSVip" class="member-nickname__shine">{{
user.nickName
}}</text>
</view>
</view>
</view>
<view :style="{ marginTop: '240rpx' }">
<SButton :onClick="() => $clickSound(unbindDevice)" width="80vw" :rounded="40"
>解绑</SButton
>
</view>
<view :style="{ marginTop: '20rpx' }">
<SButton :onClick="() => $clickSound(joinWifi)" width="80vw" :rounded="40"
>设备连接WIFI</SButton
>
</view>
</view>
</Container>
</template>
<style scoped>
.scan-code,
.just-bind,
.has-device {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
width: 100%;
height: 100%;
}
.scan-code {
justify-content: flex-start;
}
.scan-code > button:first-child {
margin-top: 22%;
}
.scan-code > button:first-child > image {
width: 300rpx;
}
.scan-code > button:nth-child(2) {
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
color: #ffffff;
margin: 50rpx;
}
.scan-code > button:nth-child(2) > image {
width: 28rpx;
margin-left: 10rpx;
}
.scan-code > text {
font-size: 24rpx;
color: #fff9;
}
.scan-code > button:nth-child(5) {
margin-top: 25%;
}
.scan-code > button:nth-child(5) > image {
width: 380rpx;
}
.scan-tips {
display: flex;
flex-direction: column;
font-size: 14px;
width: 90%;
margin-top: 20%;
}
.scan-tips > text {
margin-bottom: 2px;
color: #fff;
font-size: 24rpx;
}
.scan-tips > text:first-child {
color: #fed847;
margin-bottom: 10px;
font-size: 32rpx;
}
.scan-tips > view {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.scan-tips > view:last-child {
margin-top: 5px;
font-size: 26rpx;
}
.scan-tips > view:last-child > button {
font-size: 30rpx;
color: #39a8ff;
}
.scan-tips > image {
width: 100%;
margin-bottom: 10px;
}
.confirm-bind {
color: #fff9;
font-size: 14px;
}
.confirm-bind > view:last-child {
display: flex;
justify-content: space-between;
margin-top: 10px;
}
.confirm-bind > view:last-child > view {
width: 48%;
border-radius: 20px;
background-color: #fed847;
color: #000;
line-height: 40px;
text-align: center;
}
.confirm-bind > view:last-child > view:nth-child(2) {
color: #fff;
background-color: #fff3;
}
.device-binded {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 14px;
margin-top: 200rpx;
}
.device-binded > view {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
font-size: 26rpx;
}
.device-binded > view > image {
width: 140rpx;
height: 140rpx;
margin-bottom: 5px;
border-radius: 12px;
}
.device-binded > view > text {
width: 120px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
}
.device-binded .member-nickname {
justify-content: center;
width: 120px;
}
.device-binded .member-nickname__text,
.device-binded .member-nickname__shine {
font-size: 26rpx;
text-align: center;
}
.device-binded > image {
width: 100rpx;
margin: 0 20px;
}
.has-device,
.just-bind {
justify-content: flex-start;
}
.has-device > view:nth-child(2),
.just-bind > view:nth-child(2) {
color: #fff9;
display: flex;
flex-direction: column;
align-items: center;
font-size: 28rpx;
margin-bottom: 100rpx;
}
.has-device > view:nth-child(2) > text,
.just-bind > view:nth-child(2) > text {
margin: 5px;
}
.calibration {
position: absolute;
bottom: -145rpx;
left: 20rpx;
}
.calibration > button {
font-size: 26rpx;
color: #287fff;
display: flex;
align-items: center;
padding-bottom: 15rpx;
padding-left: 50rpx;
}
.calibration > button > image {
width: 28rpx;
height: 28rpx;
}
.calibration > view {
position: relative;
font-size: 22rpx;
color: #fff9;
padding-top: 34rpx;
padding-left: 35rpx;
width: 322rpx;
}
.calibration > view > image {
position: absolute;
top: 0;
left: 0;
width: 370rpx;
}
</style>
+3 -3
View File
@@ -116,7 +116,7 @@ onLoad((options) => {
<view class="contest-header"> <view class="contest-header">
<text>{{ getName(item) }}</text> <text>{{ getName(item) }}</text>
<text>{{ item.createTime }}</text> <text>{{ item.createTime }}</text>
<image src="../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
<BattleHeader <BattleHeader
:players="item.teams[0] ? item.teams[0].players : []" :players="item.teams[0] ? item.teams[0].players : []"
@@ -139,7 +139,7 @@ onLoad((options) => {
<view class="contest-header"> <view class="contest-header">
<text>{{ getName(item) }}</text> <text>{{ getName(item) }}</text>
<text>{{ item.createTime }}</text> <text>{{ item.createTime }}</text>
<image src="../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
<BattleHeader <BattleHeader
:players="item.teams[0] ? item.teams[0].players : []" :players="item.teams[0] ? item.teams[0].players : []"
@@ -164,7 +164,7 @@ onLoad((options) => {
>{{ item.trainingTypeText }} >{{ item.trainingTypeText }}
{{ formatPractiseTime(item.createTime) }}</text {{ formatPractiseTime(item.createTime) }}</text
> >
<image src="../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
</ScrollList> </ScrollList>
</swiper-item> </swiper-item>
+2 -2
View File
@@ -130,7 +130,7 @@ onLoad((options) => {
<view v-else-if="status === 'login'" class="state login-state"> <view v-else-if="status === 'login'" class="state login-state">
<image <image
class="login-icon" class="login-icon"
src="../static/org-bind/login-icon.png" src="https://static.shelingxingqiu.com/shootmini/static/org-bind/login-icon.png"
mode="aspectFit" mode="aspectFit"
/> />
<text class="login-title">{{ <text class="login-title">{{
@@ -151,7 +151,7 @@ onLoad((options) => {
/> />
<image <image
class="success-badge" class="success-badge"
src="../static/org-bind/green-gou.png" src="https://static.shelingxingqiu.com/shootmini/static/org-bind/green-gou.png"
mode="aspectFit" mode="aspectFit"
/> />
</view> </view>
+3 -3
View File
@@ -115,7 +115,7 @@ const targetTypeName = computed(() => {
/> />
<view class="header"> <view class="header">
<image <image
:src="record.user.avatar || '../static/user-icon.png'" :src="record.user.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
mode="widthFix" mode="widthFix"
class="avatar" class="avatar"
/> />
@@ -136,7 +136,7 @@ const targetTypeName = computed(() => {
> >
<text>落点稳定性</text> <text>落点稳定性</text>
<image <image
src="../static/s-question-mark.png" src="https://static.shelingxingqiu.com/shootmini/static/s-question-mark.png"
mode="widthFix" mode="widthFix"
class="question-mark" class="question-mark"
/> />
@@ -165,7 +165,7 @@ const targetTypeName = computed(() => {
<text>落点分布</text> <text>落点分布</text>
<!-- <button hover-class="none" @click="() => openTip(2)"> <!-- <button hover-class="none" @click="() => openTip(2)">
<image <image
src="../static/s-question-mark.png" src="https://static.shelingxingqiu.com/shootmini/static/s-question-mark.png"
mode="widthFix" mode="widthFix"
class="question-mark" class="question-mark"
/> />
+3 -3
View File
@@ -203,7 +203,7 @@ onShareTimeline(async () => {
> >
<text>落点稳定性</text> <text>落点稳定性</text>
<image <image
src="../static/s-question-mark.png" src="https://static.shelingxingqiu.com/shootmini/static/s-question-mark.png"
mode="widthFix" mode="widthFix"
class="question-mark" class="question-mark"
/> />
@@ -232,7 +232,7 @@ onShareTimeline(async () => {
v-if="user.id === record.user.id" v-if="user.id === record.user.id"
> >
<image <image
:src="`../static/${notes ? 'has' : 'add'}-note.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/${notes ? 'has' : 'add'}-note.png`"
mode="widthFix" mode="widthFix"
/> />
<text>{{ notes ? "我的备注" : "添加备注" }}</text> <text>{{ notes ? "我的备注" : "添加备注" }}</text>
@@ -243,7 +243,7 @@ onShareTimeline(async () => {
<text>落点分布</text> <text>落点分布</text>
<!-- <button hover-class="none" @click="() => openTip(2)"> <!-- <button hover-class="none" @click="() => openTip(2)">
<image <image
src="../static/s-question-mark.png" src="https://static.shelingxingqiu.com/shootmini/static/s-question-mark.png"
mode="widthFix" mode="widthFix"
class="question-mark" class="question-mark"
/> />
+1 -1
View File
@@ -146,7 +146,7 @@ onLoad((options) => {
<text>第 {{ currentGroup }} 组</text> <text>第 {{ currentGroup }} 组</text>
</view> </view>
<view @click="deleteArrow"> <view @click="deleteArrow">
<image src="../static/delete.png" /> <image src="https://static.shelingxingqiu.com/shootmini/static/delete.png" />
<text>删除</text> <text>删除</text>
</view> </view>
</view> </view>
+8 -8
View File
@@ -97,19 +97,19 @@ onShow(() => {
<text :style="{ color: bowType.name ? '#000' : '#999' }">{{ <text :style="{ color: bowType.name ? '#000' : '#999' }">{{
bowType.name || "请选择" bowType.name || "请选择"
}}</text> }}</text>
<image src="../static/arrow-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/arrow-grey.png" mode="widthFix" />
</view> </view>
<view @click="() => openSelector(1)"> <view @click="() => openSelector(1)">
<text :style="{ color: distance ? '#000' : '#999' }">{{ <text :style="{ color: distance ? '#000' : '#999' }">{{
distance ? distance + " 米" : "请选择" distance ? distance + " 米" : "请选择"
}}</text> }}</text>
<image src="../static/arrow-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/arrow-grey.png" mode="widthFix" />
</view> </view>
<view @click="() => openSelector(2)"> <view @click="() => openSelector(2)">
<text :style="{ color: bowtargetType.name ? '#000' : '#999' }">{{ <text :style="{ color: bowtargetType.name ? '#000' : '#999' }">{{
bowtargetType.name || "请选择" bowtargetType.name || "请选择"
}}</text> }}</text>
<image src="../static/arrow-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/arrow-grey.png" mode="widthFix" />
</view> </view>
</view> </view>
<view class="point-records"> <view class="point-records">
@@ -121,7 +121,7 @@ onShow(() => {
<view class="swipe-right" @click="onRemoveDraft"> <view class="swipe-right" @click="onRemoveDraft">
<image <image
class="swipe-icon" class="swipe-icon"
src="../static/delete-white.png" src="https://static.shelingxingqiu.com/shootmini/static/delete-white.png"
mode="widthFix" mode="widthFix"
/> />
</view> </view>
@@ -131,11 +131,11 @@ onShow(() => {
<text>{{ pointDraft.distance }}米</text> <text>{{ pointDraft.distance }}米</text>
<text>{{ pointDraft.bowtargetType.name }}</text> <text>{{ pointDraft.bowtargetType.name }}</text>
<view> <view>
<image src="../static/draft-icon.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/draft-icon.png" mode="widthFix" />
<text>本地草稿</text> <text>本地草稿</text>
<view> <view>
<text>计分待完成</text> <text>计分待完成</text>
<image src="../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
</view> </view>
</view> </view>
@@ -148,7 +148,7 @@ onShow(() => {
<view class="swipe-right" @click="onRemoveRecord(item)"> <view class="swipe-right" @click="onRemoveRecord(item)">
<image <image
class="swipe-icon" class="swipe-icon"
src="../static/delete-white.png" src="https://static.shelingxingqiu.com/shootmini/static/delete-white.png"
mode="widthFix" mode="widthFix"
/> />
</view> </view>
@@ -172,7 +172,7 @@ onShow(() => {
> >
<view class="selector"> <view class="selector">
<button hover-class="none" @click="() => (showModal = false)"> <button hover-class="none" @click="() => (showModal = false)">
<image src="../static/close-grey.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-grey.png" mode="widthFix" />
</button> </button>
<EditOption <EditOption
v-show="selectorIndex === 0" v-show="selectorIndex === 0"
+1 -1
View File
@@ -78,7 +78,7 @@ onMounted(async () => {
@click="shareImage" @click="shareImage"
v-if="user.id" v-if="user.id"
> >
<image src="../static/share-icon.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/share-icon.png" mode="widthFix" />
</button> </button>
<canvas <canvas
class="share-canvas" class="share-canvas"
+13 -13
View File
@@ -215,12 +215,12 @@ onShareTimeline(() => {
<view class="container"> <view class="container">
<view class="daily-signin"> <view class="daily-signin">
<view> <view>
<image src="../static/week-check.png" /> <image src="https://static.shelingxingqiu.com/shootmini/static/week-check.png" />
</view> </view>
<view :class="data.weeksCheckIn[0] ? 'checked' : ''"> <view :class="data.weeksCheckIn[0] ? 'checked' : ''">
<image <image
v-if="data.weeksCheckIn[0]" v-if="data.weeksCheckIn[0]"
src="../static/checked-green2.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green2.png"
mode="widthFix" mode="widthFix"
/> />
<view v-else></view> <view v-else></view>
@@ -229,7 +229,7 @@ onShareTimeline(() => {
<view :class="data.weeksCheckIn[1] ? 'checked' : ''"> <view :class="data.weeksCheckIn[1] ? 'checked' : ''">
<image <image
v-if="data.weeksCheckIn[1]" v-if="data.weeksCheckIn[1]"
src="../static/checked-green2.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green2.png"
mode="widthFix" mode="widthFix"
/> />
<view v-else></view> <view v-else></view>
@@ -238,7 +238,7 @@ onShareTimeline(() => {
<view :class="data.weeksCheckIn[2] ? 'checked' : ''"> <view :class="data.weeksCheckIn[2] ? 'checked' : ''">
<image <image
v-if="data.weeksCheckIn[2]" v-if="data.weeksCheckIn[2]"
src="../static/checked-green2.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green2.png"
mode="widthFix" mode="widthFix"
/> />
<view v-else></view> <view v-else></view>
@@ -247,7 +247,7 @@ onShareTimeline(() => {
<view :class="data.weeksCheckIn[3] ? 'checked' : ''"> <view :class="data.weeksCheckIn[3] ? 'checked' : ''">
<image <image
v-if="data.weeksCheckIn[3]" v-if="data.weeksCheckIn[3]"
src="../static/checked-green2.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green2.png"
mode="widthFix" mode="widthFix"
/> />
<view v-else></view> <view v-else></view>
@@ -256,7 +256,7 @@ onShareTimeline(() => {
<view :class="data.weeksCheckIn[4] ? 'checked' : ''"> <view :class="data.weeksCheckIn[4] ? 'checked' : ''">
<image <image
v-if="data.weeksCheckIn[4]" v-if="data.weeksCheckIn[4]"
src="../static/checked-green2.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green2.png"
mode="widthFix" mode="widthFix"
/> />
<view v-else></view> <view v-else></view>
@@ -265,7 +265,7 @@ onShareTimeline(() => {
<view :class="data.weeksCheckIn[5] ? 'checked' : ''"> <view :class="data.weeksCheckIn[5] ? 'checked' : ''">
<image <image
v-if="data.weeksCheckIn[5]" v-if="data.weeksCheckIn[5]"
src="../static/checked-green2.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green2.png"
mode="widthFix" mode="widthFix"
/> />
<view v-else></view> <view v-else></view>
@@ -274,7 +274,7 @@ onShareTimeline(() => {
<view :class="data.weeksCheckIn[6] ? 'checked' : ''"> <view :class="data.weeksCheckIn[6] ? 'checked' : ''">
<image <image
v-if="data.weeksCheckIn[6]" v-if="data.weeksCheckIn[6]"
src="../static/checked-green2.png" src="https://static.shelingxingqiu.com/shootmini/static/checked-green2.png"
mode="widthFix" mode="widthFix"
/> />
<view v-else></view> <view v-else></view>
@@ -330,16 +330,16 @@ onShareTimeline(() => {
</view> </view>
<view> <view>
<button hover-class="none" @click="$clickSound(toRecordPage)" class="image-btn"> <button hover-class="none" @click="$clickSound(toRecordPage)" class="image-btn">
<image src="../static/record-btn.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/record-btn.png" mode="widthFix" />
</button> </button>
<button hover-class="none" @click="$clickSound(startScoring)" class="image-btn"> <button hover-class="none" @click="$clickSound(startScoring)" class="image-btn">
<image src="../static/start-scoring.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/start-scoring.png" mode="widthFix" />
</button> </button>
</view> </view>
</view> </view>
</view> </view>
<view class="title" :style="{ marginBottom: 0 }"> <view class="title" :style="{ marginBottom: 0 }">
<image src="../static/point-book-title1.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/point-book-title1.png" mode="widthFix" />
</view> </view>
<image <image
src="https://static.shelingxingqiu.com/attachment/2025-12-31/dfc9dxrpyf4exh4rhd.png" src="https://static.shelingxingqiu.com/attachment/2025-12-31/dfc9dxrpyf4exh4rhd.png"
@@ -379,7 +379,7 @@ onShareTimeline(() => {
</view> </view>
<RingBarChart :data="data.ringRate" v-if="user.id" /> <RingBarChart :data="data.ringRate" v-if="user.id" />
<view class="title" v-if="user.id"> <view class="title" v-if="user.id">
<image src="../static/point-book-title2.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/point-book-title2.png" mode="widthFix" />
</view> </view>
<view class="top-list"> <view class="top-list">
<view class="rank-title-bar"> <view class="rank-title-bar">
@@ -397,7 +397,7 @@ onShareTimeline(() => {
:style="{ marginBottom: isIOS ? '10rpx' : 0 }" :style="{ marginBottom: isIOS ? '10rpx' : 0 }"
> >
<text>查看完整榜单</text> <text>查看完整榜单</text>
<image src="../static/enter-arrow-blue.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/enter-arrow-blue.png" mode="widthFix" />
</view> </view>
</view> </view>
<Signin <Signin
+7 -7
View File
@@ -356,7 +356,7 @@ const measureTabsMetrics = () => {
mode="widthFix" mode="widthFix"
/> />
<navigator open-type="navigateBack"> <navigator open-type="navigateBack">
<image class="header-back" src="../static/back.png" mode="widthFix" /> <image class="header-back" src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</navigator> </navigator>
<text :style="{ opacity: addBg ? 1 : 0 }">本赛季排行榜</text> <text :style="{ opacity: addBg ? 1 : 0 }">本赛季排行榜</text>
</view> </view>
@@ -415,37 +415,37 @@ const measureTabsMetrics = () => {
<image <image
v-if="index === 0" v-if="index === 0"
class="player-bg" class="player-bg"
src="../static/melee-player-bg1.png" src="https://static.shelingxingqiu.com/shootmini/static/melee-player-bg1.png"
mode="aspectFill" mode="aspectFill"
/> />
<image <image
v-if="index === 1" v-if="index === 1"
class="player-bg" class="player-bg"
src="../static/melee-player-bg2.png" src="https://static.shelingxingqiu.com/shootmini/static/melee-player-bg2.png"
mode="aspectFill" mode="aspectFill"
/> />
<image <image
v-if="index === 2" v-if="index === 2"
class="player-bg" class="player-bg"
src="../static/melee-player-bg3.png" src="https://static.shelingxingqiu.com/shootmini/static/melee-player-bg3.png"
mode="aspectFill" mode="aspectFill"
/> />
<image <image
v-if="index === 0" v-if="index === 0"
class="player-crown" class="player-crown"
src="../static/champ1.png" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png"
mode="widthFix" mode="widthFix"
/> />
<image <image
v-if="index === 1" v-if="index === 1"
class="player-crown" class="player-crown"
src="../static/champ2.png" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png"
mode="widthFix" mode="widthFix"
/> />
<image <image
v-if="index === 2" v-if="index === 2"
class="player-crown" class="player-crown"
src="../static/champ3.png" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png"
mode="widthFix" mode="widthFix"
/> />
<view v-if="index > 2" class="view-crown"> <view v-if="index > 2" class="view-crown">
+21 -21
View File
@@ -331,27 +331,27 @@ onShow(async () => {
<image class="star" src="https://static.shelingxingqiu.com/shootmini/static/rank/star.png" mode="widthFix" /> <image class="star" src="https://static.shelingxingqiu.com/shootmini/static/rank/star.png" mode="widthFix" />
</view> </view>
<image <image
src="../static/rank/battle1v1.svg" src="https://static.shelingxingqiu.com/shootmini/static/rank/battle1v1.svg"
mode="widthFix" mode="widthFix"
@click.stop="$clickSound(() => toMatchPage(1, 2))" @click.stop="$clickSound(() => toMatchPage(1, 2))"
/> />
<image <image
src="../static/rank/battle2v2.svg" src="https://static.shelingxingqiu.com/shootmini/static/rank/battle2v2.svg"
mode="widthFix" mode="widthFix"
@click.stop="$clickSound(() => toMatchPage(2, 4))" @click.stop="$clickSound(() => toMatchPage(2, 4))"
/> />
<image <image
src="../static/rank/battle3v3.svg" src="https://static.shelingxingqiu.com/shootmini/static/rank/battle3v3.svg"
mode="widthFix" mode="widthFix"
@click.stop="$clickSound(() => toMatchPage(3, 6))" @click.stop="$clickSound(() => toMatchPage(3, 6))"
/> />
<image <image
src="../static/rank/battle5.svg" src="https://static.shelingxingqiu.com/shootmini/static/rank/battle5.svg"
mode="widthFix" mode="widthFix"
@click.stop="$clickSound(() => toMatchPage(4, 5))" @click.stop="$clickSound(() => toMatchPage(4, 5))"
/> />
<image <image
src="../static/rank/battle10.svg" src="https://static.shelingxingqiu.com/shootmini/static/rank/battle10.svg"
mode="widthFix" mode="widthFix"
@click.stop="$clickSound(() => toMatchPage(5, 10))" @click.stop="$clickSound(() => toMatchPage(5, 10))"
/> />
@@ -390,7 +390,7 @@ onShow(async () => {
<image <image
class="triangle-icon" class="triangle-icon"
v-show="seasonData.length > 1" v-show="seasonData.length > 1"
src="../static/rank/triangle.png" src="https://static.shelingxingqiu.com/shootmini/static/rank/triangle.png"
mode="widthFix" mode="widthFix"
/> />
<view class="season-list" v-if="showSeasonList"> <view class="season-list" v-if="showSeasonList">
@@ -410,7 +410,7 @@ onShow(async () => {
</text> </text>
<image <image
v-if="item.seasonName === seasonName" v-if="item.seasonName === seasonName"
src="../static/rank/triangle.png" src="https://static.shelingxingqiu.com/shootmini/static/rank/triangle.png"
mode="widthFix" mode="widthFix"
/> />
</view> </view>
@@ -437,7 +437,7 @@ onShow(async () => {
</text> </text>
</view> </view>
<view class="my-rank-score"> <view class="my-rank-score">
<image src="../static/rank/bubble-tip.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/rank/bubble-tip.png" mode="widthFix" />
<text>积分:{{ seasonStats.score }}</text> <text>积分:{{ seasonStats.score }}</text>
</view> </view>
</view> </view>
@@ -500,7 +500,7 @@ onShow(async () => {
查看我的比赛记录 查看我的比赛记录
<image <image
style="width: 30rpx; vertical-align: -2px" style="width: 30rpx; vertical-align: -2px"
src="../static/enter.png" src="https://static.shelingxingqiu.com/shootmini/static/enter.png"
mode="widthFix" mode="widthFix"
/> />
</view> </view>
@@ -531,12 +531,12 @@ onShow(async () => {
:style="{ backgroundColor: index % 2 === 0 ? '#9898981f' : 'transparent' }" :style="{ backgroundColor: index % 2 === 0 ? '#9898981f' : 'transparent' }"
class="rank-item" class="rank-item"
> >
<image v-if="index === 0" src="../static/champ1.png" mode="widthFix" /> <image v-if="index === 0" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png" mode="widthFix" />
<image v-if="index === 1" src="../static/champ2.png" mode="widthFix" /> <image v-if="index === 1" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png" mode="widthFix" />
<image v-if="index === 2" src="../static/champ3.png" mode="widthFix" /> <image v-if="index === 2" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png" mode="widthFix" />
<view v-if="index > 2">{{ index + 1 }}</view> <view v-if="index > 2">{{ index + 1 }}</view>
<image <image
:src="item.avatar || '../static/user-icon.png'" :src="item.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
mode="widthFix" mode="widthFix"
:style="{ borderColor: index < 3 ? topThreeColors[index] : '' }" :style="{ borderColor: index < 3 ? topThreeColors[index] : '' }"
/> />
@@ -560,12 +560,12 @@ onShow(async () => {
:style="{ backgroundColor: index % 2 === 0 ? '#9898981f' : 'transparent' }" :style="{ backgroundColor: index % 2 === 0 ? '#9898981f' : 'transparent' }"
class="rank-item" class="rank-item"
> >
<image v-if="index === 0" src="../static/champ1.png" mode="widthFix" /> <image v-if="index === 0" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png" mode="widthFix" />
<image v-if="index === 1" src="../static/champ2.png" mode="widthFix" /> <image v-if="index === 1" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png" mode="widthFix" />
<image v-if="index === 2" src="../static/champ3.png" mode="widthFix" /> <image v-if="index === 2" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png" mode="widthFix" />
<view v-if="index > 2">{{ index + 1 }}</view> <view v-if="index > 2">{{ index + 1 }}</view>
<image <image
:src="item.avatar || '../static/user-icon.png'" :src="item.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
mode="widthFix" mode="widthFix"
:style="{ borderColor: index < 3 ? topThreeColors[index] : '' }" :style="{ borderColor: index < 3 ? topThreeColors[index] : '' }"
/> />
@@ -589,12 +589,12 @@ onShow(async () => {
:style="{ backgroundColor: index % 2 === 0 ? '#9898981f' : 'transparent' }" :style="{ backgroundColor: index % 2 === 0 ? '#9898981f' : 'transparent' }"
class="rank-item" class="rank-item"
> >
<image v-if="index === 0" src="../static/champ1.png" mode="widthFix" /> <image v-if="index === 0" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png" mode="widthFix" />
<image v-if="index === 1" src="../static/champ2.png" mode="widthFix" /> <image v-if="index === 1" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png" mode="widthFix" />
<image v-if="index === 2" src="../static/champ3.png" mode="widthFix" /> <image v-if="index === 2" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png" mode="widthFix" />
<view v-if="index > 2">{{ index + 1 }}</view> <view v-if="index > 2">{{ index + 1 }}</view>
<image <image
:src="item.avatar || '../static/user-icon.png'" :src="item.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
mode="widthFix" mode="widthFix"
:style="{ borderColor: index < 3 ? topThreeColors[index] : '' }" :style="{ borderColor: index < 3 ? topThreeColors[index] : '' }"
/> />
+4 -4
View File
@@ -59,25 +59,25 @@ watch(
/> />
<image <image
v-if="rank === 1" v-if="rank === 1"
src="../../../static/champ1.png" src="https://static.shelingxingqiu.com/shootmini/static/champ1.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<image <image
v-if="rank === 2" v-if="rank === 2"
src="../../../static/champ2.png" src="https://static.shelingxingqiu.com/shootmini/static/champ2.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<image <image
v-if="rank === 3" v-if="rank === 3"
src="../../../static/champ3.png" src="https://static.shelingxingqiu.com/shootmini/static/champ3.png"
mode="widthFix" mode="widthFix"
class="avatar-rank" class="avatar-rank"
/> />
<view v-if="rank > 3" class="rank-view">{{ rank }}</view> <view v-if="rank > 3" class="rank-view">{{ rank }}</view>
<image <image
:src="src || '../../../static/user-icon.png'" :src="src || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'"
mode="widthFix" mode="widthFix"
:style="{ :style="{
width: size + 'px', width: size + 'px',
@@ -104,7 +104,7 @@ onBeforeUnmount(() => {
<block v-else-if="game.roomID"> <block v-else-if="game.roomID">
<text>返回房间</text> <text>返回房间</text>
</block> </block>
<image src="../../../static/back.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
</view> </view>
</template> </template>
@@ -72,7 +72,7 @@ const isMember = (player = {}) => player.vip === true || player.sVip === true;
</view> </view>
<image <image
v-if="winner === 1" v-if="winner === 1"
src="../../../static/winner-badge.png" src="https://static.shelingxingqiu.com/shootmini/static/winner-badge.png"
mode="widthFix" mode="widthFix"
class="left-winner-badge" class="left-winner-badge"
/> />
@@ -100,7 +100,7 @@ const isMember = (player = {}) => player.vip === true || player.sVip === true;
</view> </view>
<image <image
v-if="winner === 2" v-if="winner === 2"
src="../../../static/winner-badge.png" src="https://static.shelingxingqiu.com/shootmini/static/winner-badge.png"
mode="widthFix" mode="widthFix"
class="right-winner-badge" class="right-winner-badge"
/> />
+6 -35
View File
@@ -1,44 +1,15 @@
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount } from "vue"; import useStore from "@/store";
import { getDeviceBatteryAPI } from "@/apis"; import { storeToRefs } from "pinia";
const power = ref(0); const store = useStore();
const timer = ref(null); const { deviceBattery: power } = storeToRefs(store);
let disposed = false;
let requestInFlight = false;
const refreshPower = async () => {
if (disposed || requestInFlight) return;
requestInFlight = true;
try {
const data = await getDeviceBatteryAPI();
if (!disposed) power.value = data.battery;
} catch (_) {
// 电量轮询失败时等待下一轮,避免产生未处理的 Promise 拒绝。
} finally {
requestInFlight = false;
}
};
onMounted(async () => {
await refreshPower();
if (disposed) return;
timer.value = setInterval(() => {
void refreshPower();
}, 1000 * 10);
});
onBeforeUnmount(() => {
disposed = true;
clearInterval(timer.value);
timer.value = null;
});
</script> </script>
<template> <template>
<view class="container"> <view class="container">
<image src="../../../static/b-power.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/b-power.png" mode="widthFix" />
<view>电量{{ power || 1 }}%</view> <view>{{ power === null ? "电量--" : `电量${power}%` }}</view>
</view> </view>
</template> </template>
@@ -523,7 +523,7 @@ onBeforeUnmount(() => {
<view :class="['target', { 'target--shake': targetShaking }]"> <view :class="['target', { 'target--shake': targetShaking }]">
<view v-if="angle !== null" class="arrow-dir" :style="arrowStyle"> <view v-if="angle !== null" class="arrow-dir" :style="arrowStyle">
<view :style="{ background: circleColor }"> <view :style="{ background: circleColor }">
<image src="../../../static/dot-circle.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/dot-circle.png" mode="widthFix" />
</view> </view>
</view> </view>
<view v-if="stop" class="stop-sign">中场休息</view> <view v-if="stop" class="stop-sign">中场休息</view>
@@ -568,7 +568,7 @@ onBeforeUnmount(() => {
!shouldHideRedHit(index) !shouldHideRedHit(index)
" "
class="svip-hit-bg" class="svip-hit-bg"
src="../../../static/vip/svip-xuan.png" src="https://static.shelingxingqiu.com/shootmini/static/vip/svip-xuan.png"
:style="getSvipHitBgStyle(bow)" :style="getSvipHitBgStyle(bow)"
mode="aspectFit" mode="aspectFit"
/> />
@@ -593,7 +593,7 @@ onBeforeUnmount(() => {
!shouldHideBlueHit(index) !shouldHideBlueHit(index)
" "
class="svip-hit-bg" class="svip-hit-bg"
src="../../../static/vip/svip-xuan.png" src="https://static.shelingxingqiu.com/shootmini/static/vip/svip-xuan.png"
:style="getSvipHitBgStyle(bow)" :style="getSvipHitBgStyle(bow)"
mode="aspectFit" mode="aspectFit"
/> />
@@ -111,7 +111,7 @@ const cancelMatching = async () => {
const goCalibration = async () => { const goCalibration = async () => {
await laserAimAPI(); await laserAimAPI();
uni.navigateTo({ uni.navigateTo({
url: "/pages/calibration", url: "/pages/device/calibration",
}); });
}; };
</script> </script>
+2 -2
View File
@@ -10,8 +10,8 @@ defineProps({
}, },
}); });
const bubbleTypes = [ const bubbleTypes = [
"../../../static/long-bubble.png", "https://static.shelingxingqiu.com/shootmini/static/long-bubble.png",
"../../../static/long-bubble-middle.png", "https://static.shelingxingqiu.com/shootmini/static/long-bubble-middle.png",
"https://static.shelingxingqiu.com/shootmini/static/long-bubble-tall.png", "https://static.shelingxingqiu.com/shootmini/static/long-bubble-tall.png",
]; ];
</script> </script>
+5 -5
View File
@@ -108,10 +108,10 @@ onBeforeUnmount(() => {
<template> <template>
<view class="container"> <view class="container">
<view class="back-btn" @click="onClick"> <view class="back-btn" @click="onClick">
<image v-if="whiteBackArrow" src="../../../static/back.png" mode="widthFix" /> <image v-if="whiteBackArrow" src="https://static.shelingxingqiu.com/shootmini/static/back.png" mode="widthFix" />
<image <image
v-if="!whiteBackArrow" v-if="!whiteBackArrow"
src="../../../static/back-black.png" src="https://static.shelingxingqiu.com/shootmini/static/back-black.png"
mode="widthFix" mode="widthFix"
/> />
</view> </view>
@@ -131,12 +131,12 @@ onBeforeUnmount(() => {
<text class="truncate">{{ user.nickName }}</text> <text class="truncate">{{ user.nickName }}</text>
<image <image
v-if="heat" v-if="heat"
:src="`../../../static/hot${heat}.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/hot${heat}.png`"
mode="widthFix" mode="widthFix"
/> />
</block> </block>
<block v-else> <block v-else>
<image src="../../../static/user-icon.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/user-icon.png" mode="widthFix" />
<text>新来的弓箭手你好呀~</text> <text>新来的弓箭手你好呀~</text>
</block> </block>
</view> </view>
@@ -203,7 +203,7 @@ onBeforeUnmount(() => {
:style="battleRoomBtnStyle" :style="battleRoomBtnStyle"
> >
<text class="battle-room-number__text">房号: {{ game.roomNumber }}</text> <text class="battle-room-number__text">房号: {{ game.roomNumber }}</text>
<image src="../../../static/share2.png" mode="widthFix" class="battle-room-number__icon" /> <image src="https://static.shelingxingqiu.com/shootmini/static/share2.png" mode="widthFix" class="battle-room-number__icon" />
</button> </button>
</view> </view>
</template> </template>
@@ -56,7 +56,7 @@ onBeforeUnmount(() => {
<text>{{ (tips || "").replace(/你/g, "").replace(/重回/g, "") }}</text> <text>{{ (tips || "").replace(/你/g, "").replace(/重回/g, "") }}</text>
<text v-if="totalShot > 0"> ({{ currentShot }}/{{ totalShot }}) </text> <text v-if="totalShot > 0"> ({{ currentShot }}/{{ totalShot }}) </text>
<button v-if="!!tips" hover-class="none" @click="updateSound"> <button v-if="!!tips" hover-class="none" @click="updateSound">
<image :src="`../../../static/sound${sound ? '' : '-off'}-yellow.png`" mode="widthFix" /> <image :src="`https://static.shelingxingqiu.com/shootmini/static/sound${sound ? '' : '-off'}-yellow.png`" mode="widthFix" />
</button> </button>
</view> </view>
</template> </template>
+1 -1
View File
@@ -69,7 +69,7 @@ const onBtnClick = debounce(async () => {
<slot /> <slot />
</block> </block>
<block v-else> <block v-else>
<image src="../../../static/btn-loading.png" mode="widthFix" class="loading" /> <image src="https://static.shelingxingqiu.com/shootmini/static/btn-loading.png" mode="widthFix" class="loading" />
</block> </block>
</button> </button>
</template> </template>
+1 -1
View File
@@ -60,7 +60,7 @@ watch(
mode="widthFix" mode="widthFix"
/> />
<view class="close-btn" @click="onClose" v-if="!noBg"> <view class="close-btn" @click="onClose" v-if="!noBg">
<image src="../../../static/close-yellow.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-yellow.png" mode="widthFix" />
</view> </view>
<slot></slot> <slot></slot>
</view> </view>
@@ -49,7 +49,7 @@ const getContentHeight = () => {
</view> </view>
<IconButton <IconButton
v-if="!!onClose" v-if="!!onClose"
src="../../../static/close-gold-outline.png" src="https://static.shelingxingqiu.com/shootmini/static/close-gold-outline.png"
:width="30" :width="30"
:onClick="onClose" :onClick="onClose"
/> />
@@ -80,7 +80,7 @@ watch(
<template> <template>
<view class="container"> <view class="container">
<image <image
:src="isRed ? '../../../static/flag-red.png' : '../../../static/flag-blue.png'" :src="isRed ? 'https://static.shelingxingqiu.com/shootmini/static/flag-red.png' : 'https://static.shelingxingqiu.com/shootmini/static/flag-blue.png'"
class="flag" class="flag"
:style="{ :style="{
[isRed ? 'left' : 'right']: '10rpx', [isRed ? 'left' : 'right']: '10rpx',
@@ -101,7 +101,7 @@ watch(
[isRed ? 'left' : 'right']: getPos(item.id) + 'rpx', [isRed ? 'left' : 'right']: getPos(item.id) + 'rpx',
}" }"
> >
<image :src="item.avatar || '../../../static/user-icon.png'" mode="widthFix" /> <image :src="item.avatar || 'https://static.shelingxingqiu.com/shootmini/static/user-icon.png'" mode="widthFix" />
<text <text
v-if="isFirst(item.id)" v-if="isFirst(item.id)"
:style="{ backgroundColor: isRed ? '#ff6060' : '#5fadff' }" :style="{ backgroundColor: isRed ? '#ff6060' : '#5fadff' }"
+1 -1
View File
@@ -151,7 +151,7 @@ const onClickTab = (index) => {
min-width: 26%; min-width: 26%;
} }
.score-item { .score-item {
background-image: url("../../static/score-bg.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/score-bg.png");
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
+1 -1
View File
@@ -141,7 +141,7 @@ const onClickTab = (index) => {
min-width: 26%; min-width: 26%;
} }
.score-item { .score-item {
background-image: url("../static/score-bg.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/score-bg.png");
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
+1 -1
View File
@@ -59,7 +59,7 @@ const props = defineProps({
</view> </view>
</view> </view>
<view @click="onClose"> <view @click="onClose">
<image src="/static/close-white.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/close-white.png" mode="widthFix" />
</view> </view>
</view> </view>
<view :style="{ width: '100%', marginBottom: '20px' }"> <view :style="{ width: '100%', marginBottom: '20px' }">
+6 -6
View File
@@ -84,9 +84,9 @@ const props = defineProps({
type: Number, type: Number,
default: 0, default: 0,
}, },
activeRing: { activeRings: {
type: Number, type: Array,
default: 0, default: () => [],
}, },
showSectorLabels: { showSectorLabels: {
type: Boolean, type: Boolean,
@@ -548,7 +548,7 @@ onBeforeUnmount(() => {
:highlightOnly="true" :highlightOnly="true"
:sectorCount="sectorCount" :sectorCount="sectorCount"
:activeSector="activeSector" :activeSector="activeSector"
:activeRing="activeRing" :activeRings="activeRings"
:highlightRefreshToken="highlightRefreshToken" :highlightRefreshToken="highlightRefreshToken"
:showSectorLabels="showSectorLabels" :showSectorLabels="showSectorLabels"
/> />
@@ -604,7 +604,7 @@ onBeforeUnmount(() => {
!shouldHideLatestHit(entry.index) !shouldHideLatestHit(entry.index)
" "
class="svip-hit-bg" class="svip-hit-bg"
src="../../../static/vip/svip-xuan.png" src="https://static.shelingxingqiu.com/shootmini/static/vip/svip-xuan.png"
:style="getSvipHitBgStyle(entry.shot)" :style="getSvipHitBgStyle(entry.shot)"
mode="aspectFit" mode="aspectFit"
/> />
@@ -877,7 +877,7 @@ onBeforeUnmount(() => {
width: calc(100% - 20px); width: calc(100% - 20px);
padding: 0 10px; padding: 0 10px;
display: flex; display: flex;
margin-top: -40px; margin-top: 15px;
justify-content: flex-end; justify-content: flex-end;
} }
.footer > image { .footer > image {
+4 -4
View File
@@ -29,14 +29,14 @@ const props = defineProps({
font-size: 24rpx; font-size: 24rpx;
} }
.normal { .normal {
background-image: url("../static/bubble-tip.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip.png");
width: 157rpx; width: 157rpx;
height: 105rpx; height: 105rpx;
padding-top: 10px; padding-top: 10px;
padding-left: 30rpx; padding-left: 30rpx;
} }
.normal2 { .normal2 {
background-image: url("../static/bubble-tip4.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip4.png");
width: 190rpx; width: 190rpx;
height: 105rpx; height: 105rpx;
padding-top: 10px; padding-top: 10px;
@@ -46,14 +46,14 @@ const props = defineProps({
z-index: 1; z-index: 1;
} }
.long { .long {
background-image: url("../static/bubble-tip2.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip2.png");
width: 370rpx; width: 370rpx;
height: 70rpx; height: 70rpx;
top: -50%; top: -50%;
left: 49%; left: 49%;
} }
.short { .short {
background-image: url("../static/bubble-tip3.png"); background-image: url("https://static.shelingxingqiu.com/shootmini/static/bubble-tip3.png");
width: 300rpx; width: 300rpx;
height: 70rpx; height: 70rpx;
top: -50%; top: -50%;
+2 -2
View File
@@ -28,8 +28,8 @@ const props = defineProps({
}); });
const items = ref(new Array(props.total).fill(9)); const items = ref(new Array(props.total).fill(9));
const bgImages = [ const bgImages = [
"../static/complete-light1.png", "https://static.shelingxingqiu.com/shootmini/static/complete-light1.png",
"../static/complete-light2.png", "https://static.shelingxingqiu.com/shootmini/static/complete-light2.png",
]; ];
const getDisplayText = (arrow) => { const getDisplayText = (arrow) => {
if (!arrow) return "-"; if (!arrow) return "-";
+25 -55
View File
@@ -73,11 +73,7 @@ const props = defineProps({
type: Number, type: Number,
default: 0, default: 0,
}, },
energyPercent: { energyCostPerSec: {
type: Number,
default: 0,
},
energyReqPercent: {
type: Number, type: Number,
default: 0, default: 0,
}, },
@@ -187,17 +183,10 @@ const progressPercent = computed(() => {
return Math.max(0, Math.min(100, (remain.value / props.total) * 100)); return Math.max(0, Math.min(100, (remain.value / props.total) * 100));
}); });
const stabilityEnergyPercent = computed(() => const stabilityEnergyCostText = computed(() => {
Math.max(0, Math.min(100, Number(props.energyPercent) || 0)) const value = Math.max(0, Number(props.energyCostPerSec) || 0);
); return Number.isInteger(value) ? String(value) : String(Number(value.toFixed(2)));
const stabilityEnergyReqPercent = computed(() => });
Math.max(0, Math.min(100, Number(props.energyReqPercent) || 0))
);
const stabilityEnergyReached = computed(
() =>
stabilityEnergyReqPercent.value > 0 &&
stabilityEnergyPercent.value >= stabilityEnergyReqPercent.value
);
const rhythmMarkerPercent = computed(() => { const rhythmMarkerPercent = computed(() => {
if (!validRhythmRoundTime.value) return 0; if (!validRhythmRoundTime.value) return 0;
@@ -239,7 +228,7 @@ const displayName = computed(() => {
}); });
const avatarSrc = computed(() => { const avatarSrc = computed(() => {
return user.value?.avatar || "/static/shooter2.png"; return user.value?.avatar || "https://static.shelingxingqiu.com/shootmini/static/shooter2.png";
}); });
watch( watch(
@@ -568,22 +557,18 @@ onBeforeUnmount(() => {
" "
> >
<template v-if="isStabilityTraining"> <template v-if="isStabilityTraining">
<text class="stability-progress__time">{{ remain }}秒</text> <text class="stability-progress__cost">
<view class="stability-progress__track"> 每秒失去{{ stabilityEnergyCostText }}点能量
</text>
<view v-if="countdownEnabled" class="stability-progress__countdown">
<view <view
class="stability-progress__fill" class="stability-progress__countdown-fill"
:class="{ :style="{
'stability-progress__fill--reached': stabilityEnergyReached, width: `${progressPercent}%`,
transition: transitionStyle,
}" }"
:style="{ width: `${stabilityEnergyPercent}%` }"
/> />
<view <text class="stability-progress__countdown-text">剩余{{ remain }}秒</text>
class="stability-progress__marker"
:style="{ left: `${stabilityEnergyReqPercent}%` }"
/>
<text class="stability-progress__value">
{{ Math.round(stabilityEnergyPercent) }}%
</text>
</view> </view>
</template> </template>
<template v-else-if="isRhythmTraining"> <template v-else-if="isRhythmTraining">
@@ -638,7 +623,7 @@ onBeforeUnmount(() => {
<!-- <button class="progress-card__sound" hover-class="none" @click="updateSound"> <!-- <button class="progress-card__sound" hover-class="none" @click="updateSound">
<image <image
class="progress-card__sound-icon" class="progress-card__sound-icon"
:src="`/static/sound${sound ? '' : '-off'}-yellow.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/sound${sound ? '' : '-off'}-yellow.png`"
mode="aspectFit" mode="aspectFit"
/> />
</button> --> </button> -->
@@ -811,17 +796,17 @@ onBeforeUnmount(() => {
margin: 32rpx 84rpx 0; margin: 32rpx 84rpx 0;
} }
.stability-progress__time { .stability-progress__cost {
display: block; display: block;
margin-bottom: 20rpx; margin-bottom: 20rpx;
color: #ffffff; color: #ffffff;
font-size: 34rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
line-height: 48rpx; line-height: 44rpx;
text-align: center; text-align: center;
} }
.stability-progress__track { .stability-progress__countdown {
position: relative; position: relative;
width: 100%; width: 100%;
height: 24rpx; height: 24rpx;
@@ -830,38 +815,23 @@ onBeforeUnmount(() => {
background: #444444; background: #444444;
} }
.stability-progress__fill { .stability-progress__countdown-fill {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
border-radius: 18rpx; border-radius: 18rpx;
background: linear-gradient(90deg, #87f1df 0%, #5ba8e8 100%); background: linear-gradient(133deg, #ffd19a 0%, #a17636 100%);
transition: width 240ms linear, background 240ms ease;
} }
.stability-progress__fill--reached { .stability-progress__countdown-text {
background: linear-gradient(90deg, #a5df62 0%, #61c787 100%);
}
.stability-progress__marker {
position: absolute;
top: 0;
bottom: 0;
z-index: 2;
width: 4rpx;
transform: translateX(-2rpx);
background: rgba(26, 24, 22, 0.92);
}
.stability-progress__value {
position: absolute; position: absolute;
inset: 0; inset: 0;
z-index: 3; z-index: 2;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #eefaff; color: #fff7de;
font-size: 18rpx; font-size: 18rpx;
line-height: 24rpx; line-height: 24rpx;
text-align: center; text-align: center;
@@ -0,0 +1,730 @@
<script setup>
import {
computed,
getCurrentInstance,
nextTick,
onBeforeUnmount,
onMounted,
ref,
watch,
} from "vue";
const props = defineProps({
percent: {
type: Number,
default: 0,
},
introPending: {
type: Boolean,
default: false,
},
});
const WIDTH = 750;
const HEIGHT = 228;
const MASK_SCALE = 2;
const MASK_WIDTH = WIDTH / MASK_SCALE;
const MASK_HEIGHT = HEIGHT / MASK_SCALE;
const ENTRY_PADDING = 24;
const EXIT_PADDING = 32;
const MAX_FEATHER = 60;
const FULL_TRACK_OFFSET_Y = -3;
const ENTRY_EDGE_BLEND_PERCENT = 5;
const EXIT_EDGE_BLEND_START_PERCENT = 90;
const SWEEP_TRACK_RADIUS = 28;
const SWEEP_TRACK_FEATHER = 8;
const ENTRY_ANIMATION_DURATION = 1000;
const UPDATE_DURATION = 240;
const SWEEP_DELAY = 100;
const SWEEP_DURATION = 1000;
const ASSET_ROOT =
"/pages/training/static/stability-energy";
const getAssetSource = (filename) => `${ASSET_ROOT}/${filename}`;
const instance = getCurrentInstance();
const canvasId = `stability-energy-${Math.random().toString(36).slice(2, 10)}`;
const canvasReady = ref(false);
const fallbackVisible = ref(true);
const normalizedPercent = computed(() =>
Math.max(0, Math.min(100, Number(props.percent) || 0))
);
let engine = null;
let disposed = false;
let animationHandle = null;
let renderedPercent = props.introPending ? 100 : normalizedPercent.value;
let entryAnimationPlaying = false;
let entryAnimationRequested = false;
const showCanvas = () => {
canvasReady.value = true;
};
const requestFrame = (callback) => {
if (typeof requestAnimationFrame === "function") {
return { type: "frame", id: requestAnimationFrame(callback) };
}
return {
type: "timer",
id: setTimeout(() => callback(Date.now()), 16),
};
};
const cancelFrame = () => {
if (!animationHandle) return;
if (
animationHandle.type === "frame" &&
typeof cancelAnimationFrame === "function"
) {
cancelAnimationFrame(animationHandle.id);
} else {
clearTimeout(animationHandle.id);
}
animationHandle = null;
};
const waitForPaint = () =>
new Promise((resolve) => {
const schedule = (callback) => {
if (typeof requestAnimationFrame === "function") {
requestAnimationFrame(callback);
} else {
setTimeout(callback, 16);
}
};
schedule(() => schedule(resolve));
});
const presentCanvas = async () => {
showCanvas();
await nextTick();
await waitForPaint();
if (disposed) return false;
fallbackVisible.value = false;
return true;
};
const smoothStep = (value) => {
const amount = Math.max(0, Math.min(1, value));
return amount * amount * (3 - 2 * amount);
};
const enableImageSmoothing = (context) => {
if ("imageSmoothingEnabled" in context) {
context.imageSmoothingEnabled = true;
}
if ("imageSmoothingQuality" in context) {
context.imageSmoothingQuality = "high";
}
};
// 复用参考 HTML 的贝塞尔路径,保证能量光带沿靶纸下方的弧线推进。
const sampleTrack = () => {
const curves = [
// 新素材移除了左上方延伸段,进度从箭头端点开始进入弯道。
[171, 53, 145, 56, 123, 68, 125, 82],
[125, 82, 128, 128, 272, 163, 412, 163],
[412, 163, 530, 164, 650, 137, 657, 98],
[657, 98, 659, 86, 650, 76, 643, 72],
];
const points = [{ x: 171, y: 53, distance: 0 }];
curves.forEach((curve) => {
for (let step = 1; step <= 32; step += 1) {
const amount = step / 32;
const rest = 1 - amount;
const point = {
x:
rest ** 3 * curve[0] +
3 * rest ** 2 * amount * curve[2] +
3 * rest * amount ** 2 * curve[4] +
amount ** 3 * curve[6],
y:
rest ** 3 * curve[1] +
3 * rest ** 2 * amount * curve[3] +
3 * rest * amount ** 2 * curve[5] +
amount ** 3 * curve[7],
};
const previous = points[points.length - 1];
point.distance =
previous.distance + Math.hypot(point.x - previous.x, point.y - previous.y);
points.push(point);
}
});
return points;
};
const createOffscreenCanvas = (canvas, width = WIDTH, height = HEIGHT) => {
let layerCanvas = null;
if (typeof canvas.createOffscreenCanvas === "function") {
try {
layerCanvas = canvas.createOffscreenCanvas({ type: "2d", width, height });
} catch (error) {
layerCanvas = null;
}
}
if (
!layerCanvas &&
typeof wx !== "undefined" &&
typeof wx.createOffscreenCanvas === "function"
) {
try {
layerCanvas = wx.createOffscreenCanvas({ type: "2d", width, height });
} catch (error) {
layerCanvas = null;
}
}
if (!layerCanvas && typeof document !== "undefined") {
layerCanvas = document.createElement("canvas");
layerCanvas.width = width;
layerCanvas.height = height;
}
if (!layerCanvas) throw new Error("Offscreen canvas unavailable");
layerCanvas.width = width;
layerCanvas.height = height;
const context = layerCanvas.getContext("2d");
if (!context) throw new Error("Offscreen canvas context unavailable");
enableImageSmoothing(context);
return { canvas: layerCanvas, context };
};
const loadCanvasImage = (canvas, source) =>
new Promise((resolve, reject) => {
const image =
typeof canvas.createImage === "function"
? canvas.createImage()
: typeof Image !== "undefined"
? new Image()
: null;
if (!image) {
reject(new Error("Canvas image unavailable"));
return;
}
image.onload = () => resolve(image);
image.onerror = () => reject(new Error(`Image unavailable: ${source}`));
image.src = source;
});
const createEnergyEngine = async (canvas, preloadedFullImage = null) => {
const context = canvas.getContext("2d");
if (!context) throw new Error("Canvas unavailable");
enableImageSmoothing(context);
const maskLayer = createOffscreenCanvas(canvas, MASK_WIDTH, MASK_HEIGHT);
const emptyLayer = createOffscreenCanvas(canvas);
const fullLayer = createOffscreenCanvas(canvas);
const glowLayer = createOffscreenCanvas(canvas);
const sweepLayer = createOffscreenCanvas(canvas);
const track = sampleTrack();
const pathLength = track[track.length - 1].distance;
const revealStarts = new Float32Array(MASK_WIDTH * MASK_HEIGHT);
const revealRates = new Float32Array(MASK_WIDTH * MASK_HEIGHT);
const sweepTrackAlpha = new Float32Array(MASK_WIDTH * MASK_HEIGHT);
const maskPixels = maskLayer.context.createImageData(MASK_WIDTH, MASK_HEIGHT);
maskPixels.data.fill(255);
const images = await Promise.all([
loadCanvasImage(canvas, getAssetSource("progress-empty.png")),
preloadedFullImage ||
loadCanvasImage(canvas, getAssetSource("progress-full.png")),
loadCanvasImage(canvas, getAssetSource("progress-glow.png")),
]);
const segments = track.slice(1).map((end, index) => {
const start = track[index];
const deltaX = end.x - start.x;
const deltaY = end.y - start.y;
return {
start,
deltaX,
deltaY,
length: end.distance - start.distance,
inverseSquaredLength: 1 / (deltaX ** 2 + deltaY ** 2),
};
});
// 初始化每个蒙版像素抵达能量路径的时刻,后续更新只重绘,不重复计算。
for (let pixel = 0; pixel < revealStarts.length; pixel += 1) {
const pixelX = ((pixel % MASK_WIDTH) + 0.5) * MASK_SCALE;
const pixelY = (Math.floor(pixel / MASK_WIDTH) + 0.5) * MASK_SCALE;
let nearestSquaredDistance = Infinity;
let arrivalDistance = 0;
for (let index = 0; index < segments.length; index += 1) {
const segment = segments[index];
const offsetX = pixelX - segment.start.x;
const offsetY = pixelY - segment.start.y;
const projection =
(offsetX * segment.deltaX + offsetY * segment.deltaY) *
segment.inverseSquaredLength;
const amount = Math.max(0, Math.min(1, projection));
const squaredDistance =
(offsetX - segment.deltaX * amount) ** 2 +
(offsetY - segment.deltaY * amount) ** 2;
if (squaredDistance >= nearestSquaredDistance) continue;
nearestSquaredDistance = squaredDistance;
arrivalDistance = segment.start.distance + amount * segment.length;
if (index === 0 && projection < 0) {
arrivalDistance = Math.max(-ENTRY_PADDING, projection * segment.length);
}
if (index === segments.length - 1 && projection > 1) {
arrivalDistance = Math.min(
pathLength + EXIT_PADDING,
segment.start.distance + projection * segment.length
);
}
}
const nearestDistance = Math.sqrt(nearestSquaredDistance);
const feather = Math.min(
MAX_FEATHER,
16 + nearestDistance * 0.9
);
revealStarts[pixel] = arrivalDistance;
revealRates[pixel] = 1 / feather;
sweepTrackAlpha[pixel] =
1 -
smoothStep(
(nearestDistance - SWEEP_TRACK_RADIUS) / SWEEP_TRACK_FEATHER
);
}
const temporary = new Float32Array(revealStarts.length);
const radius = 3;
for (let pass = 0; pass < 3; pass += 1) {
for (let row = 0; row < MASK_HEIGHT; row += 1) {
for (let column = 0; column < MASK_WIDTH; column += 1) {
let sum = 0;
for (let offset = -radius; offset <= radius; offset += 1) {
const neighbor = Math.max(
0,
Math.min(MASK_WIDTH - 1, column + offset)
);
sum += revealStarts[row * MASK_WIDTH + neighbor];
}
temporary[row * MASK_WIDTH + column] = sum / (radius * 2 + 1);
}
}
for (let row = 0; row < MASK_HEIGHT; row += 1) {
for (let column = 0; column < MASK_WIDTH; column += 1) {
let sum = 0;
for (let offset = -radius; offset <= radius; offset += 1) {
const neighbor = Math.max(
0,
Math.min(MASK_HEIGHT - 1, row + offset)
);
sum += temporary[neighbor * MASK_WIDTH + column];
}
revealStarts[row * MASK_WIDTH + column] = sum / (radius * 2 + 1);
}
}
}
const trackPosition = (distance) => {
const boundedDistance = Math.max(0, Math.min(pathLength, distance));
let upper = 1;
while (
upper < track.length - 1 &&
track[upper].distance < boundedDistance
) {
upper += 1;
}
const start = track[upper - 1];
const end = track[upper];
const amount =
(boundedDistance - start.distance) / (end.distance - start.distance);
return {
x: start.x + (end.x - start.x) * amount,
y: start.y + (end.y - start.y) * amount,
};
};
// 满轨素材的视觉中心比空轨低约 3px,所有满轨绘制统一上移补偿。
const drawFullTrack = (targetContext) => {
targetContext.drawImage(
images[1],
0,
FULL_TRACK_OFFSET_Y,
WIDTH,
HEIGHT
);
};
const maskedImage = (layer, image, operation, offsetY = 0) => {
layer.context.globalCompositeOperation = "source-over";
layer.context.clearRect(0, 0, WIDTH, HEIGHT);
layer.context.drawImage(image, 0, offsetY, WIDTH, HEIGHT);
layer.context.globalCompositeOperation = operation;
layer.context.drawImage(maskLayer.canvas, 0, 0, WIDTH, HEIGHT);
layer.context.globalCompositeOperation = "source-over";
};
const draw = (progress) => {
context.globalCompositeOperation = "source-over";
context.clearRect(0, 0, WIDTH, HEIGHT);
if (progress <= 0) {
context.drawImage(images[0], 0, 0, WIDTH, HEIGHT);
return;
}
if (progress >= 100) {
drawFullTrack(context);
return;
}
// 主体百分比仍映射轨道本体,头尾仅补偿端点羽化,避免整图与蒙版切换时跳变。
const distance = (progress / 100) * pathLength;
const entryBlend = smoothStep(progress / ENTRY_EDGE_BLEND_PERCENT);
const exitBlend = smoothStep(
(progress - EXIT_EDGE_BLEND_START_PERCENT) /
(100 - EXIT_EDGE_BLEND_START_PERCENT)
);
for (let pixel = 0; pixel < revealStarts.length; pixel += 1) {
const trackAlpha =
smoothStep(
(distance - revealStarts[pixel]) * revealRates[pixel]
) * entryBlend;
maskPixels.data[pixel * 4 + 3] = Math.round(
255 * (trackAlpha + (1 - trackAlpha) * exitBlend)
);
}
maskLayer.context.putImageData(maskPixels, 0, 0);
maskedImage(emptyLayer, images[0], "destination-out");
maskedImage(
fullLayer,
images[1],
"destination-in",
FULL_TRACK_OFFSET_Y
);
context.drawImage(emptyLayer.canvas, 0, 0);
context.globalCompositeOperation = "lighter";
context.drawImage(fullLayer.canvas, 0, 0);
context.globalCompositeOperation = "source-over";
const headBlend =
smoothStep(progress / 10) * (1 - smoothStep((progress - 85) / 15));
const position = trackPosition(distance - 16);
const headSize = Math.round(72 * (0.55 + 0.45 * headBlend));
const headX = Math.round(position.x - headSize / 2);
const headY = Math.round(position.y - headSize / 2);
glowLayer.context.clearRect(0, 0, WIDTH, HEIGHT);
glowLayer.context.drawImage(
images[2],
headX,
headY,
headSize,
headSize
);
glowLayer.context.globalCompositeOperation = "destination-in";
drawFullTrack(glowLayer.context);
glowLayer.context.globalCompositeOperation = "source-over";
context.globalAlpha = 0.8 * headBlend;
context.drawImage(glowLayer.canvas, 0, 0);
context.globalAlpha = 1;
};
const drawSweep = (amount) => {
context.globalCompositeOperation = "source-over";
context.clearRect(0, 0, WIDTH, HEIGHT);
drawFullTrack(context);
const lead = pathLength * 0.03;
const core = pathLength * 0.08;
const tail = pathLength * 0.18;
const sweepCenter = -tail + amount * (pathLength + lead + tail);
for (let pixel = 0; pixel < revealStarts.length; pixel += 1) {
const offset = sweepCenter - revealStarts[pixel];
let intensity = 0;
if (offset >= -lead && offset < 0) {
intensity = smoothStep(1 + offset / lead);
} else if (offset >= 0 && offset <= core) {
intensity = 1;
} else if (offset > core && offset <= core + tail) {
intensity = 1 - smoothStep((offset - core) / tail);
}
maskPixels.data[pixel * 4 + 3] = Math.round(
255 * intensity * sweepTrackAlpha[pixel]
);
}
maskLayer.context.putImageData(maskPixels, 0, 0);
sweepLayer.context.globalCompositeOperation = "source-over";
sweepLayer.context.clearRect(0, 0, WIDTH, HEIGHT);
drawFullTrack(sweepLayer.context);
sweepLayer.context.globalCompositeOperation = "source-in";
sweepLayer.context.fillStyle = "#fffbd8";
sweepLayer.context.fillRect(0, 0, WIDTH, HEIGHT);
sweepLayer.context.globalCompositeOperation = "destination-in";
sweepLayer.context.drawImage(maskLayer.canvas, 0, 0, WIDTH, HEIGHT);
sweepLayer.context.globalCompositeOperation = "source-over";
// 普通透明叠加只提亮轨道核心,不把满轨素材的外围光晕染白。
context.globalCompositeOperation = "source-over";
context.globalAlpha = 0.9;
context.drawImage(sweepLayer.canvas, 0, 0);
context.globalAlpha = 1;
context.globalCompositeOperation = "source-over";
};
return { draw, drawSweep };
};
const runCompletionSweep = () => {
cancelFrame();
let startedAt = null;
const step = (timestamp) => {
if (!engine || disposed) return;
if (startedAt === null) startedAt = timestamp;
const elapsed = timestamp - startedAt;
if (elapsed < SWEEP_DELAY) {
engine.draw(100);
animationHandle = requestFrame(step);
return;
}
const amount = Math.min(1, (elapsed - SWEEP_DELAY) / SWEEP_DURATION);
engine.drawSweep(amount);
if (amount < 1) {
animationHandle = requestFrame(step);
} else {
animationHandle = null;
engine.draw(100);
}
};
animationHandle = requestFrame(step);
};
// 服务端能量既会因命中增加,也会按秒下降,因此双向过渡都以最新快照为准。
const drawPercent = (targetPercent, animate = true) => {
if (!engine) return;
cancelFrame();
const from = renderedPercent;
const target = Math.max(0, Math.min(100, targetPercent));
const reachesFull = from < 100 && target >= 100;
if (!animate || Math.abs(target - from) < 0.01) {
renderedPercent = target;
engine.draw(target);
if (reachesFull) runCompletionSweep();
return;
}
let startedAt = null;
const step = (timestamp) => {
if (!engine || disposed) return;
if (startedAt === null) startedAt = timestamp;
const amount = Math.min(1, (timestamp - startedAt) / UPDATE_DURATION);
renderedPercent = from + (target - from) * smoothStep(amount);
engine.draw(renderedPercent);
if (amount < 1) {
animationHandle = requestFrame(step);
} else {
animationHandle = null;
renderedPercent = target;
engine.draw(target);
if (reachesFull) runCompletionSweep();
}
};
animationHandle = requestFrame(step);
};
// 首次进入时先展示满能量,再用 1 秒线性动画回落到 0%。
const runEntryAnimation = () => {
if (!engine || disposed) return;
cancelFrame();
entryAnimationRequested = false;
entryAnimationPlaying = true;
renderedPercent = 100;
engine.draw(100);
showCanvas();
let startedAt = null;
const step = (timestamp) => {
if (!engine || disposed) return;
if (startedAt === null) startedAt = timestamp;
const amount = Math.min(
1,
(timestamp - startedAt) / ENTRY_ANIMATION_DURATION
);
renderedPercent = 100 * (1 - amount);
engine.draw(renderedPercent);
if (amount < 1) {
animationHandle = requestFrame(step);
return;
}
animationHandle = null;
entryAnimationPlaying = false;
renderedPercent = 0;
engine.draw(0);
// 动画期间可能收到服务端快照,结束后再追到最新真实能量。
if (normalizedPercent.value > 0) {
drawPercent(normalizedPercent.value);
}
};
animationHandle = requestFrame(step);
};
const initialize = async () => {
await nextTick();
const info = await new Promise((resolve) => {
let query = uni.createSelectorQuery();
if (instance?.proxy && typeof query.in === "function") {
query = query.in(instance.proxy);
}
query
.select(`#${canvasId}`)
.fields({ node: true, size: true })
.exec((result) => resolve(result?.[0] || null));
});
if (disposed) return;
if (!info?.node?.getContext) {
return;
}
try {
const canvas = info.node;
canvas.width = WIDTH;
canvas.height = HEIGHT;
const context = canvas.getContext("2d");
if (!context) throw new Error("Canvas unavailable");
enableImageSmoothing(context);
let preloadedFullImage = null;
if (props.introPending) {
preloadedFullImage = await loadCanvasImage(
canvas,
getAssetSource("progress-full.png")
);
if (disposed) return;
context.clearRect(0, 0, WIDTH, HEIGHT);
context.drawImage(
preloadedFullImage,
0,
FULL_TRACK_OFFSET_Y,
WIDTH,
HEIGHT
);
renderedPercent = 100;
if (!(await presentCanvas())) return;
// 先让满能量首帧完成合成,再开始较重的遮罩和轨道计算。
await new Promise((resolve) => setTimeout(resolve, 0));
if (disposed) return;
}
engine = await createEnergyEngine(canvas, preloadedFullImage);
if (disposed) return;
if (props.introPending || entryAnimationRequested) {
renderedPercent = 100;
engine.draw(100);
showCanvas();
if (!props.introPending && entryAnimationRequested) {
runEntryAnimation();
}
return;
}
renderedPercent = normalizedPercent.value;
engine.draw(renderedPercent);
await presentCanvas();
} catch (error) {
console.log("stability energy canvas unavailable", error);
}
};
watch(normalizedPercent, (value) => {
if (!engine || props.introPending || entryAnimationPlaying) return;
drawPercent(value);
});
watch(
() => props.introPending,
(pending, wasPending) => {
if (pending) {
entryAnimationRequested = false;
if (!engine) return;
cancelFrame();
entryAnimationPlaying = false;
renderedPercent = 100;
engine.draw(100);
showCanvas();
return;
}
if (!wasPending) return;
entryAnimationRequested = true;
if (engine) runEntryAnimation();
}
);
onMounted(initialize);
onBeforeUnmount(() => {
disposed = true;
cancelFrame();
engine = null;
});
</script>
<template>
<view class="stability-energy-track" aria-label="稳定训练能量进度">
<image
v-if="fallbackVisible"
class="stability-energy-track__image"
:src="getAssetSource('progress-full.png')"
mode="scaleToFill"
/>
<canvas
:id="canvasId"
:canvas-id="canvasId"
:class="[
'stability-energy-track__canvas',
canvasReady ? 'stability-energy-track__canvas--ready' : '',
]"
type="2d"
:width="WIDTH"
:height="HEIGHT"
/>
</view>
</template>
<style scoped lang="scss">
.stability-energy-track {
position: relative;
z-index: 4;
width: 100%;
height: 228rpx;
margin: -164rpx 0 -80rpx;
margin-left: -10rpx;
overflow: hidden;
pointer-events: none;
}
.stability-energy-track__image,
.stability-energy-track__canvas {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
}
.stability-energy-track__image {
z-index: 0;
transform: translateY(-3rpx);
}
.stability-energy-track__canvas {
z-index: 1;
opacity: 0;
}
.stability-energy-track__canvas--ready {
opacity: 1;
}
</style>
@@ -162,7 +162,7 @@ onBeforeUnmount(() => {
</view> </view>
</view> </view>
<view v-if="isBattle" class="ready-timer"> <view v-if="isBattle" class="ready-timer">
<image src="../../../static/test-tip.png" mode="widthFix" /> <image src="https://static.shelingxingqiu.com/shootmini/static/test-tip.png" mode="widthFix" />
<view v-if="count >= 0"> <view v-if="count >= 0">
<text>距离正式比赛还有</text> <text>距离正式比赛还有</text>
<text>{{ count }}</text> <text>{{ count }}</text>
@@ -89,7 +89,7 @@ const previewLines = computed(() => {
} }
.difficulty-preview__copy { .difficulty-preview__copy {
width: 80%; width: 84%;
margin: 0 auto; margin: 0 auto;
display: block; display: block;
color: #ffffff; color: #ffffff;
+92 -22
View File
@@ -3,6 +3,7 @@ import { computed, ref, onMounted, onBeforeUnmount } from "vue";
import { onHide, onLoad, onShow, onUnload } from "@dcloudio/uni-app"; import { onHide, onLoad, onShow, onUnload } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue"; import Container from "@/components/Container.vue";
import ShootProgress from "./components/ShootProgress.vue"; import ShootProgress from "./components/ShootProgress.vue";
import StabilityEnergyTrack from "./components/StabilityEnergyTrack.vue";
import BowTarget from "./components/BowTarget.vue"; import BowTarget from "./components/BowTarget.vue";
import ScorePanel2 from "@/components/TrainingScorePanel.vue"; import ScorePanel2 from "@/components/TrainingScorePanel.vue";
import ScoreResult from "./components/ScoreResult.vue"; import ScoreResult from "./components/ScoreResult.vue";
@@ -48,6 +49,7 @@ const { user } = storeToRefs(store);
const sound = ref(true); const sound = ref(true);
const start = ref(false); const start = ref(false);
const practiceStarting = ref(false); const practiceStarting = ref(false);
const stabilityEnergyIntroPending = ref(false);
const pageStages = Object.freeze({ const pageStages = Object.freeze({
DISTANCE: "distance", DISTANCE: "distance",
SHOOTING: "shooting", SHOOTING: "shooting",
@@ -105,14 +107,14 @@ const rhythmTargetArrows = ref(0);
// 服务端状态立即落到 practiceInfo,精准训练的目标区域单独延迟展示。 // 服务端状态立即落到 practiceInfo,精准训练的目标区域单独延迟展示。
const visiblePrecisionTarget = ref({ const visiblePrecisionTarget = ref({
randomBlock: 0, randomBlock: 0,
randomRingArea: 0, randomRingAreas: [],
}); });
const trainingDifficultyStorageKey = "training-selection"; const trainingDifficultyStorageKey = "training-selection";
const useHighlightTest = ref(false); const useHighlightTest = ref(false);
const highlightTestState = ref({ const highlightTestState = ref({
blocks: 8, blocks: 8,
randomBlock: 1, randomBlock: 1,
randomRingArea: 0, randomRingAreas: [],
}); });
const highlightTestTimer = ref(null); const highlightTestTimer = ref(null);
const serverAddr = ref(""); const serverAddr = ref("");
@@ -133,11 +135,14 @@ let shotPresentationGeneration = 0;
let nextDifficultyRequest = null; let nextDifficultyRequest = null;
let nextDifficultyRequestGeneration = 0; let nextDifficultyRequestGeneration = 0;
const audioWaiters = new Set(); const audioWaiters = new Set();
let stabilityEnergyIntroGeneration = 0;
let stabilityEnergyIntroTimer = null;
const shotEffectWaiters = new Map(); const shotEffectWaiters = new Map();
const PRACTICE_SYNC_TIMEOUT_MS = 5000; const PRACTICE_SYNC_TIMEOUT_MS = 5000;
const SHOT_EFFECT_WAIT_TIMEOUT_MS = 1200; const SHOT_EFFECT_WAIT_TIMEOUT_MS = 1200;
const AUDIO_TIMEOUT_BASE = 3500; const AUDIO_TIMEOUT_BASE = 3500;
const AUDIO_TIMEOUT_PER_KEY = 2600; const AUDIO_TIMEOUT_PER_KEY = 2600;
const STABILITY_ENERGY_ENTRY_DELAY_MS = 1000;
const AUDIO_TIMEOUT_MAX = 12000; const AUDIO_TIMEOUT_MAX = 12000;
const RUNTIME_DIAGNOSTIC_INTERVAL_MS = 60000; const RUNTIME_DIAGNOSTIC_INTERVAL_MS = 60000;
let lastRuntimeDiagnosticAt = 0; let lastRuntimeDiagnosticAt = 0;
@@ -195,9 +200,23 @@ const getPositiveInteger = (value) => {
return Number.isInteger(numberValue) && numberValue > 0 ? numberValue : 0; return Number.isInteger(numberValue) && numberValue > 0 ? numberValue : 0;
}; };
const normalizePrecisionRingAreas = (source = {}) => {
const multipleRings = Array.isArray(source.randomRingAreas)
? [...new Set(source.randomRingAreas.map(getPositiveInteger))].filter(
(ring) => ring >= 1 && ring <= 10
)
: [];
if (multipleRings.length > 0) return multipleRings;
const singleRing = getPositiveInteger(source.randomRingArea);
return singleRing >= 1 && singleRing <= 10 ? [singleRing] : [];
};
const getPrecisionTargetSnapshot = (source = {}) => ({ const getPrecisionTargetSnapshot = (source = {}) => ({
randomBlock: getPositiveInteger(source.randomBlock), randomBlock: getPositiveInteger(source.randomBlock),
randomRingArea: getPositiveInteger(source.randomRingArea), // 多环字段优先;后端仅在单环时继续下发旧单值字段。
randomRingAreas: normalizePrecisionRingAreas(source),
}); });
const applyVisiblePrecisionTarget = (source = {}) => { const applyVisiblePrecisionTarget = (source = {}) => {
@@ -345,6 +364,15 @@ const stabilityEnergyPercent = computed(() => {
(stabilityCurrentEnergy.value / stabilityScoreSlot.value) * 100 (stabilityCurrentEnergy.value / stabilityScoreSlot.value) * 100
); );
}); });
const stabilityEnergyCostPerSec = computed(() =>
Math.max(
0,
getPracticeNumber(
practiceInfo.value.energyCostPerSec,
trainingParams.value.energyCostPerSec
)
)
);
const initializeRhythmFirstRoundCountdown = () => { const initializeRhythmFirstRoundCountdown = () => {
rhythmHasActiveServerAnchor.value = false; rhythmHasActiveServerAnchor.value = false;
@@ -384,14 +412,13 @@ const precisionRandomBlock = computed(() => {
return block <= precisionBlocks.value ? block : 0; return block <= precisionBlocks.value ? block : 0;
}); });
const precisionRandomRingArea = computed(() => { const precisionRandomRingAreas = computed(() =>
const ring = getPositiveInteger( normalizePrecisionRingAreas(
useHighlightTest.value useHighlightTest.value
? highlightTestState.value.randomRingArea ? highlightTestState.value
: visiblePrecisionTarget.value.randomRingArea : visiblePrecisionTarget.value
); )
return ring >= 1 && ring <= 10 ? ring : 0; );
});
// 只展示后端进度,不在前端重复判断训练是否完成。 // 只展示后端进度,不在前端重复判断训练是否完成。
const trainingCopy = computed(() => { const trainingCopy = computed(() => {
@@ -555,6 +582,7 @@ const practiceInfoFields = [
"blocks", "blocks",
"randomBlock", "randomBlock",
"randomRingArea", "randomRingArea",
"randomRingAreas",
"roundTime", "roundTime",
"shootTime", "shootTime",
"shootWindowStart", "shootWindowStart",
@@ -746,6 +774,9 @@ const syncPracticeInfo = (message = {}) => {
if (!Object.prototype.hasOwnProperty.call(message, "randomRingArea")) { if (!Object.prototype.hasOwnProperty.call(message, "randomRingArea")) {
nextInfo.randomRingArea = 0; nextInfo.randomRingArea = 0;
} }
if (!Object.prototype.hasOwnProperty.call(message, "randomRingAreas")) {
nextInfo.randomRingAreas = [];
}
} }
if (Object.keys(nextInfo).length === 0) return; if (Object.keys(nextInfo).length === 0) return;
@@ -836,6 +867,12 @@ const playAudioKeysAndWait = (keys) => {
}); });
}; };
const clearStabilityEnergyIntroTimer = () => {
if (!stabilityEnergyIntroTimer) return;
clearTimeout(stabilityEnergyIntroTimer);
stabilityEnergyIntroTimer = null;
};
const shouldWaitForShotEffect = (shot) => { const shouldWaitForShotEffect = (shot) => {
const x = Number(shot?.x); const x = Number(shot?.x);
const y = Number(shot?.y); const y = Number(shot?.y);
@@ -1290,7 +1327,7 @@ const clearHighlightTestTimer = () => {
} }
}; };
// 开发环境测试入口:依次切换 8 个顺时针区域,偶数区域只高亮指定环。 // 开发环境测试入口:依次切换 8 个顺时针区域,偶数区域同时高亮两个环。
const runHighlightTest = () => { const runHighlightTest = () => {
clearHighlightTestTimer(); clearHighlightTestTimer();
useHighlightTest.value = true; useHighlightTest.value = true;
@@ -1302,7 +1339,7 @@ const runHighlightTest = () => {
highlightTestState.value = { highlightTestState.value = {
blocks: 8, blocks: 8,
randomBlock: block, randomBlock: block,
randomRingArea: 0, randomRingAreas: [],
}; };
highlightTestTimer.value = setInterval(() => { highlightTestTimer.value = setInterval(() => {
@@ -1315,7 +1352,10 @@ const runHighlightTest = () => {
highlightTestState.value = { highlightTestState.value = {
blocks: 8, blocks: 8,
randomBlock: block, randomBlock: block,
randomRingArea: block % 2 === 0 ? Math.min(block, 10) : 0, randomRingAreas:
block % 2 === 0
? [Math.min(block, 9), Math.min(block + 1, 10)]
: [],
}; };
}, 1000); }, 1000);
}; };
@@ -1326,7 +1366,7 @@ const resetHighlightTest = () => {
highlightTestState.value = { highlightTestState.value = {
blocks: 8, blocks: 8,
randomBlock: 1, randomBlock: 1,
randomRingArea: 0, randomRingAreas: [],
}; };
scores.value = []; scores.value = [];
}; };
@@ -1375,6 +1415,9 @@ onLoad((options = {}) => {
toRouteNumber(trainingContext.scoreSlot) toRouteNumber(trainingContext.scoreSlot)
), ),
}; };
// 稳定训练在测距阶段预挂载 Canvas,并提前绘制 100% 满能量首帧。
stabilityEnergyIntroPending.value =
trainingParams.value.type === "stability";
practiseId.value = trainingContext.practiceId || ""; practiseId.value = trainingContext.practiceId || "";
serverAddr.value = trainingContext.serverAddr || ""; serverAddr.value = trainingContext.serverAddr || "";
@@ -1420,15 +1463,30 @@ const onReady = async () => {
scores.value = []; scores.value = [];
shotEffectToken.value = 0; shotEffectToken.value = 0;
initializeRhythmFirstRoundCountdown(); initializeRhythmFirstRoundCountdown();
const shouldPlayStabilityEnergyIntro =
trainingType.value === "stability";
clearStabilityEnergyIntroTimer();
const stabilityIntroGeneration = ++stabilityEnergyIntroGeneration;
stabilityEnergyIntroPending.value = shouldPlayStabilityEnergyIntro;
const startAudioKey = getTrainingStartAudioKey(
trainingType.value,
"练习开始"
);
start.value = true; start.value = true;
pageStage.value = pageStages.SHOOTING; pageStage.value = pageStages.SHOOTING;
setPracticeAppHideResumable(true); setPracticeAppHideResumable(true);
// 先由本地锚点保证首轮立即显示,再用最新服务端快照无感校准。 // 先由本地锚点保证首轮立即显示,再用最新服务端快照无感校准。
requestPracticeInfoSync(); requestPracticeInfoSync();
// 开始接口成功即进入正式训练,直接播放对应提示,避免依赖 BattleStart 消息。 // 开始语音只进入原播放队列,不参与能量条的入场计时。
audioManager.play( audioManager.play(startAudioKey);
getTrainingStartAudioKey(trainingType.value, "练习开始") if (shouldPlayStabilityEnergyIntro) {
); stabilityEnergyIntroTimer = setTimeout(() => {
stabilityEnergyIntroTimer = null;
if (stabilityIntroGeneration !== stabilityEnergyIntroGeneration) return;
if (!isShootingStage.value || !isStabilityTraining.value) return;
stabilityEnergyIntroPending.value = false;
}, STABILITY_ENERGY_ENTRY_DELAY_MS);
}
} catch (error) { } catch (error) {
start.value = false; start.value = false;
pageStage.value = pageStages.DISTANCE; pageStage.value = pageStages.DISTANCE;
@@ -1619,6 +1677,9 @@ function onComplete() {
async function onRetry() { async function onRetry() {
pageStage.value = pageStages.LOADING; pageStage.value = pageStages.LOADING;
clearStabilityEnergyIntroTimer();
stabilityEnergyIntroGeneration += 1;
stabilityEnergyIntroPending.value = isStabilityTraining.value;
setPracticeAppHideResumable(false); setPracticeAppHideResumable(false);
clearHighlightTestTimer(); clearHighlightTestTimer();
useHighlightTest.value = false; useHighlightTest.value = false;
@@ -1731,6 +1792,9 @@ onMounted(() => {
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {
clearStabilityEnergyIntroTimer();
stabilityEnergyIntroGeneration += 1;
stabilityEnergyIntroPending.value = false;
setPracticeAppHideResumable(false); setPracticeAppHideResumable(false);
invalidateShotPresentations(); invalidateShotPresentations();
clearPracticeRuntimeContext(); clearPracticeRuntimeContext();
@@ -1790,8 +1854,7 @@ onBeforeUnmount(() => {
:inShootWindow="rhythmInShootWindow" :inShootWindow="rhythmInShootWindow"
:serverTimestamp="rhythmCountdownTimestamp" :serverTimestamp="rhythmCountdownTimestamp"
:hitReq="rhythmHitReq" :hitReq="rhythmHitReq"
:energyPercent="stabilityEnergyPercent" :energyCostPerSec="stabilityEnergyCostPerSec"
:energyReqPercent="stabilityEnergyReqPercent"
:isVip="isVip" :isVip="isVip"
:isSvip="isSvip" :isSvip="isSvip"
:externalShootResultAudio=" :externalShootResultAudio="
@@ -1819,11 +1882,16 @@ onBeforeUnmount(() => {
:showCrosshair="false" :showCrosshair="false"
:sectorCount="precisionBlocks" :sectorCount="precisionBlocks"
:activeSector="precisionRandomBlock" :activeSector="precisionRandomBlock"
:activeRing="precisionRandomRingArea" :activeRings="precisionRandomRingAreas"
:highlightRefreshToken="precisionTargetRefreshToken" :highlightRefreshToken="precisionTargetRefreshToken"
stable-shot-effect stable-shot-effect
@shot-effect-complete="onShotEffectComplete" @shot-effect-complete="onShotEffectComplete"
/> />
<StabilityEnergyTrack
v-if="isStabilityTraining"
:percent="stabilityEnergyPercent"
:introPending="stabilityEnergyIntroPending"
/>
<!-- <view v-if="env !== 'release'" class="highlight-test-actions"> <!-- <view v-if="env !== 'release'" class="highlight-test-actions">
<button <button
class="highlight-test-btn" class="highlight-test-btn"
@@ -1844,7 +1912,7 @@ onBeforeUnmount(() => {
<button class="sound-btn" hover-class="none" @click="updateSound"> <button class="sound-btn" hover-class="none" @click="updateSound">
<image <image
class="sound-icon" class="sound-icon"
:src="`/static/sound${sound ? '' : '-off'}-yellow.png`" :src="`https://static.shelingxingqiu.com/shootmini/static/sound${sound ? '' : '-off'}-yellow.png`"
mode="aspectFit" mode="aspectFit"
/> />
</button> </button>
@@ -2019,6 +2087,8 @@ onBeforeUnmount(() => {
margin: 0; margin: 0;
background: transparent; background: transparent;
border: none; border: none;
position: relative;
z-index: 6;
} }
.sound-btn::after { .sound-btn::after {
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Some files were not shown because too many files have changed in this diff Show More