diff --git a/src/audioManager.js b/src/audioManager.js index 1e7239e..0d5fc18 100644 --- a/src/audioManager.js +++ b/src/audioManager.js @@ -1,4 +1,6 @@ export const audioFils = { + "20CM全环靶": "https://static.shelingxingqiu.com/shootmini/static/audio/20CM%E5%85%A8%E7%8E%AF%E9%9D%B6-%E6%97%A0%E6%95%88.mp3", + "40CM全环靶": "https://static.shelingxingqiu.com/shootmini/static/audio/40CM%E5%85%A8%E7%8E%AF%E9%9D%B6-%E6%97%A0%E6%95%88.mp3", // 激光已校准: // "https://static.shelingxingqiu.com/attachment/2025-10-29/ddupaur1vdkyhzaqdc.mp3", 胜利: "https://static.shelingxingqiu.com/attachment/2025-09-17/dcuo9yjp0kt5msvmvd.mp3", @@ -36,7 +38,7 @@ export const audioFils = { 请开始射击: "https://static.shelingxingqiu.com/attachment/2025-09-17/dcutzdrl5u0iromqhf.mp3", 射击无效: - "https://static.shelingxingqiu.com/attachment/2025-09-17/dcutya55ufiiw8oo55.mp3", + "https://static.shelingxingqiu.com/shootmini/static/audio/%E5%B0%84%E7%AE%AD%E6%97%A0%E6%95%88%E6%A3%80%E6%9F%A5%E8%B7%9D%E7%A6%BB%E5%92%8C%E9%9D%B6%E7%BA%B8.mp3", 未上靶: "https://static.shelingxingqiu.com/attachment/2025-11-12/de6n45o3tsm1v4unam.mp3", "1环": diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue index 03de5dd..37f0433 100644 --- a/src/pages/battle-room.vue +++ b/src/pages/battle-room.vue @@ -17,6 +17,7 @@ import { import { MESSAGETYPES, MESSAGETYPESV2 } from "@/constants"; import useStore from "@/store"; import { storeToRefs } from "pinia"; +import audioManager from "@/audioManager"; const store = useStore(); const { user } = storeToRefs(store); @@ -55,6 +56,8 @@ const ready = ref(false); const allReady = ref(false); const timer = ref(null); const goBattle = ref(false); +/** 从结算页返回时为 true,跳过进场靶纸语音 */ +const skipTargetAudio = ref(false); /** * 从服务端刷新当前房间数据,更新成员列表、准备状态等信息 @@ -263,19 +266,18 @@ const shareTitle = computed(() => { }); /** - * 根据对战类型动态返回分享封面图路径 - * battleType === 2(多人乱斗)→ melee_share.jpg - * 其余(好友约战 / 组队对战)→ contest_share.jpg + * 根据对战类型和靶纸尺寸动态返回分享封面图路径,共 4 张图: + * contest_share_20.jpg — 约战/对抗赛 + 20cm 靶 + * contest_share_40.jpg — 约战/对抗赛 + 40cm 靶 + * melee_share_20.jpg — 多人乱斗 + 20cm 靶 + * melee_share_40.jpg — 多人乱斗 + 40cm 靶 * - * 网络图片: - * https://static.shelingxingqiu.com/shootmini/static/share/melee_share.jpg - * https://static.shelingxingqiu.com/shootmini/static/share/contest_share.jpg + * 当 targetSize 未知时默认取 20cm 图。 */ const shareImage = computed(() => { - if (room.value.battleType === 2) { - return 'https://static.shelingxingqiu.com/shootmini/static/share/melee_share.jpg'; - } - return 'https://static.shelingxingqiu.com/shootmini/static/share/contest_share.jpg'; + const type = room.value.battleType === 2 ? 'melee' : 'contest'; + const size = targetSize.value === 40 ? '40' : '20'; + return `https://static.shelingxingqiu.com/shootmini/static/share/${type}_share_${size}.jpg`; }); onShareAppMessage(() => { @@ -302,6 +304,8 @@ onShow(() => { * - 同步到 Pinia Store(供 Header 组件展示房号胶囊) */ onLoad(async (options) => { + // 从结算页跳回时携带 fromResult=1,标记跳过进场语音 + if (options.fromResult) skipTargetAudio.value = true; if (options.roomNumber) { roomNumber.value = options.roomNumber; store.updateRoomNumber(options.roomNumber); @@ -326,6 +330,13 @@ onMounted(() => { keepScreenOn: true, }); uni.$on("socket-inbox", onReceiveMessage); + // 页面加载完成 1 秒后根据靶纸尺寸播报对应语音;从结算页返回时跳过 + setTimeout(() => { + if (!skipTargetAudio.value) { + const key = targetSize.value === 40 ? '40CM全环靶' : '20CM全环靶'; + audioManager.play(key); + } + }, 1000); }); onBeforeUnmount(() => { diff --git a/src/pages/friend-battle-result.vue b/src/pages/friend-battle-result.vue index 63bcd88..7b8e426 100644 --- a/src/pages/friend-battle-result.vue +++ b/src/pages/friend-battle-result.vue @@ -275,7 +275,7 @@ async function exit() { return; } uni.redirectTo({ - url: `/pages/battle-room?roomNumber=${data.value.roomId}`, + url: `/pages/battle-room?roomNumber=${data.value.roomId}&fromResult=1`, }); } else { uni.redirectTo({ diff --git a/src/pages/user.vue b/src/pages/user.vue index 306c904..e2f2fcd 100644 --- a/src/pages/user.vue +++ b/src/pages/user.vue @@ -145,7 +145,7 @@ const buildVersion = typeof __BUILD_TIME__ !== 'undefined' ? __BUILD_TIME__ : '' v-if="showLogout" /> {{ buildVersion }}