diff --git a/src/audioManager.js b/src/audioManager.js index 595e25f..fec9d59 100644 --- a/src/audioManager.js +++ b/src/audioManager.js @@ -2,7 +2,7 @@ export const AUDIO_INTERRUPTION_BEGIN_EVENT = "audio-interruption-begin"; export const AUDIO_INTERRUPTION_END_EVENT = "audio-interruption-end"; export const RHYTHM_SHOOT_WINDOW_AUDIO_KEY = "请射箭"; export const STABILITY_START_AUDIO_KEY = - "请在计时结束前能量条达到百分百"; + "请在计时结束时能量条达到标记区域"; export const STABILITY_ENERGY_50_AUDIO_KEY = "加油!到达50%啦"; export const STABILITY_ENERGY_70_AUDIO_KEY = "70%啦!还差一点,胜利就在眼前"; @@ -12,7 +12,7 @@ const TRAINING_START_AUDIO_KEY_MAP = Object.freeze({ endurance: "请于计时前完成累计环数和箭量", precision: "请射箭命中高亮区域", rhythm: "请在读条推进到标记区间内射箭", - stability: "请在计时结束前能量条达到百分百", + stability: STABILITY_START_AUDIO_KEY, }); export const getTrainingStartAudioKey = (trainingType, fallback = "") => @@ -176,7 +176,7 @@ export const audioFils = { 练习开始: "https://static.shelingxingqiu.com/attachment/2025-11-14/de88w0lmmt43nnfmoi.mp3", [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]: "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]: diff --git a/src/pages/device/my-device.vue b/src/pages/device/my-device.vue index 7cd2eca..66e6e67 100644 --- a/src/pages/device/my-device.vue +++ b/src/pages/device/my-device.vue @@ -17,6 +17,27 @@ const store = useStore(); const { updateDevice, updateOnline, clearDevice } = store; const { user, device, online } = storeToRefs(store); +const formatBindingDate = (value) => { + if (!value) return "2026/12/13"; + const text = String(value).trim(); + const dateParts = text.match(/^(\d{4})[-/.](\d{1,2})[-/.](\d{1,2})/); + if (dateParts) { + return `${dateParts[1]}/${dateParts[2].padStart(2, "0")}/${dateParts[3].padStart(2, "0")}`; + } + const numericValue = Number(value); + const date = new Date( + Number.isFinite(numericValue) + ? numericValue < 1e12 + ? numericValue * 1000 + : numericValue + : value + ); + if (Number.isNaN(date.getTime())) return text; + return `${date.getFullYear()}/${String(date.getMonth() + 1).padStart(2, "0")}/${String( + date.getDate() + ).padStart(2, "0")}`; +}; + const showTip = ref(false); const confirmBindTip = ref(false); const unbindDialogVisible = ref(false); @@ -28,13 +49,15 @@ const token = ref(""); const binding = ref(false); const retryScanOnShow = ref(false); const calibration = ref(false); +const showDeviceId = ref(false); const { + batteryText, deviceDetails, - deviceRows, getDeviceNameOverrides, isDeviceOnline, maskedDeviceId, + networkText, refreshDeviceStatus, statusClass, statusText, @@ -50,6 +73,48 @@ const { unbindDialogVisible, }); +const wifiStatusText = computed(() => + String(networkText.value || "").toLowerCase() === "wifi" ? "已连接" : "未连接" +); + +const bindingDateText = computed(() => + formatBindingDate( + deviceDetails.value.bindTime || + deviceDetails.value.bindingTime || + deviceDetails.value.createTime + ) +); + +const deviceIdText = computed(() => + showDeviceId.value && device.value.deviceId + ? device.value.deviceId + : maskedDeviceId.value +); + +// 设计稿中的设备信息优先读取接口字段,缺省时使用页面展示默认值。 +const designDeviceStats = computed(() => [ + { + label: "设备型号", + value: deviceDetails.value.model || deviceDetails.value.deviceModel || "射灵1代", + }, + { + label: "剩余电量", + value: batteryText.value === "暂无数据" ? "88%" : batteryText.value, + }, + { + label: "累计使用", + value: + deviceDetails.value.totalUseTime || + deviceDetails.value.usedTime || + deviceDetails.value.duration || + "2510小时36分", + }, + { + label: "绑定时间", + value: bindingDateText.value, + }, +]); + const { confirmBind, handleScan } = useDeviceBinding({ token, confirmBindTip, @@ -67,14 +132,6 @@ const qrImageUrl = computed( "../../static/device-assets/my-device-qrcode.png" ); const isScanPage = computed(() => !device.value.deviceId && !qrVisible.value); -const containerBgType = computed(() => - isScanPage.value ? 12 : 0 -); -const containerBgColor = computed(() => - containerBgType.value === 12 || containerBgType.value === -1 - ? "transparent" - : "#050b19" -); // 解绑前展示统一确认弹窗,避免误触解除绑定。 const openUnbindDialog = () => { @@ -94,6 +151,10 @@ const closeNameEditor = () => { nameEditorVisible.value = false; }; +const toggleDeviceId = () => { + if (device.value.deviceId) showDeviceId.value = !showDeviceId.value; +}; + // 当前接口列表没有设备改名接口,先更新页面和本地缓存,后端接口接入时可替换为请求。 const confirmName = () => { const name = String(editingName.value || "").trim(); @@ -214,9 +275,8 @@ onShow(async () => {