diff --git a/src/components/GuideTwo.vue b/src/components/GuideTwo.vue index abe4c51..214f7dc 100644 --- a/src/components/GuideTwo.vue +++ b/src/components/GuideTwo.vue @@ -26,20 +26,21 @@ defineProps({ .container { display: flex; align-items: center; - padding: 0 15px; + padding: 0 26rpx 0 28rpx; margin-bottom: 14rpx; - width: clac(100% - 30px); + width: clac(100% - 54rpx); } .container .shooter2 { - width: 150rpx; - height: 162rpx; + display: block; + width: 133rpx; + height: 144rpx; } .container .bg-box { color: #fff; font-size: 28rpx; position: relative; flex: 1; - min-height: 55px; + height: 128rpx; display: flex; align-items: center; justify-content: center; diff --git a/src/pages/battle-room.vue b/src/pages/battle-room.vue index e488ce5..652c1c5 100644 --- a/src/pages/battle-room.vue +++ b/src/pages/battle-room.vue @@ -42,6 +42,17 @@ const battleTitle = computed(() => { return `${half}v${half}对抗赛`; }); +/** 靶纸尺寸(cm),由 URL 参数或 API 返回的 targetType 字段填充 */ +const targetSize = ref(0); + +/** + * 根据 targetSize 动态生成靶纸尺寸文本,如"40cm" + * 数据未就绪时显示 "--";数据来源:创建者取 URL 参数 target,加入者取 API 返回的 targetType + */ +const targetSizeLabel = computed(() => + targetSize.value ? `${targetSize.value}cm` : '--' +); + const ready = ref(false); const allReady = ref(false); const timer = ref(null); @@ -56,6 +67,15 @@ async function refreshRoomData() { const result = await getRoomAPI(roomNumber.value); if (result.started) return; room.value = result; + // 加入者通过 API 返回的 targetType 字段同步靶纸尺寸,并持久化到本地缓存 + if (result.targetType) { + targetSize.value = result.targetType; + uni.setStorageSync(`targetSize_${roomNumber.value}`, result.targetType); + } else if (targetSize.value === 0) { + // API 无该字段时,从本地缓存兜底(如"返回房间"场景) + const stored = uni.getStorageSync(`targetSize_${roomNumber.value}`); + if (stored) targetSize.value = stored; + } owner.value = {}; opponent.value = {}; const members = result.members || []; @@ -269,6 +289,15 @@ onLoad(async (options) => { roomNumber.value = options.roomNumber; store.updateRoomNumber(options.roomNumber); } + // 创建者通过 URL 参数 target(1→20cm,2→40cm)初始化靶纸尺寸,并持久化到本地缓存 + if (options.target) { + targetSize.value = parseInt(options.target) * 20; + uni.setStorageSync(`targetSize_${roomNumber.value}`, targetSize.value); + } else if (roomNumber.value) { + // "返回房间"等无 target 参数的场景:从本地缓存恢复(待 refreshRoomData 进一步覆盖) + const stored = uni.getStorageSync(`targetSize_${roomNumber.value}`); + if (stored) targetSize.value = stored; + } }); /** @@ -299,11 +328,8 @@ onBeforeUnmount(() => { - 弓箭手们,人都到齐了吗? - {{ - `${room.count / 2}v${room.count / 2}比赛即将开始!` - }} - 大乱斗即将开始! + 请使用{{ targetSizeLabel }}全环靶 + 如果实际靶纸与选择靶纸不同,将导致射箭无效 @@ -818,4 +844,23 @@ onBeforeUnmount(() => { border: 1rpx solid #a3793f66; color: #fed847; } + +.guide-tips__target { + font-weight: 400; + font-size: 26rpx; + color: rgba(255, 217, 71, 0.8); +} + +.guide-tips__warn { + font-weight: 400; + font-size: 22rpx; + color: rgba(255, 255, 255, 0.8); + margin-top: 6rpx; +} + +.guide-tips { + display: flex; + flex-direction: column; + padding-left: 20rpx; +} diff --git a/src/static/shooter2.png b/src/static/shooter2.png index 1fb3622..29c8f9d 100644 Binary files a/src/static/shooter2.png and b/src/static/shooter2.png differ