fix:更新约战头部tip模块样式
This commit is contained in:
@@ -26,20 +26,21 @@ defineProps({
|
|||||||
.container {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 15px;
|
padding: 0 26rpx 0 28rpx;
|
||||||
margin-bottom: 14rpx;
|
margin-bottom: 14rpx;
|
||||||
width: clac(100% - 30px);
|
width: clac(100% - 54rpx);
|
||||||
}
|
}
|
||||||
.container .shooter2 {
|
.container .shooter2 {
|
||||||
width: 150rpx;
|
display: block;
|
||||||
height: 162rpx;
|
width: 133rpx;
|
||||||
|
height: 144rpx;
|
||||||
}
|
}
|
||||||
.container .bg-box {
|
.container .bg-box {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-height: 55px;
|
height: 128rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@@ -42,6 +42,17 @@ const battleTitle = computed(() => {
|
|||||||
return `${half}v${half}对抗赛`;
|
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 ready = ref(false);
|
||||||
const allReady = ref(false);
|
const allReady = ref(false);
|
||||||
const timer = ref(null);
|
const timer = ref(null);
|
||||||
@@ -56,6 +67,15 @@ async function refreshRoomData() {
|
|||||||
const result = await getRoomAPI(roomNumber.value);
|
const result = await getRoomAPI(roomNumber.value);
|
||||||
if (result.started) return;
|
if (result.started) return;
|
||||||
room.value = result;
|
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 = {};
|
owner.value = {};
|
||||||
opponent.value = {};
|
opponent.value = {};
|
||||||
const members = result.members || [];
|
const members = result.members || [];
|
||||||
@@ -269,6 +289,15 @@ onLoad(async (options) => {
|
|||||||
roomNumber.value = options.roomNumber;
|
roomNumber.value = options.roomNumber;
|
||||||
store.updateRoomNumber(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(() => {
|
|||||||
<GuideTwo>
|
<GuideTwo>
|
||||||
<view class="battle-guide">
|
<view class="battle-guide">
|
||||||
<view class="guide-tips">
|
<view class="guide-tips">
|
||||||
<text>弓箭手们,人都到齐了吗?</text>
|
<text class="guide-tips__target">请使用{{ targetSizeLabel }}全环靶</text>
|
||||||
<text v-if="room.battleType === 1">{{
|
<text class="guide-tips__warn">如果实际靶纸与选择靶纸不同,将导致射箭无效</text>
|
||||||
`${room.count / 2}v${room.count / 2}比赛即将开始!`
|
|
||||||
}}</text>
|
|
||||||
<text v-if="room.battleType === 2">大乱斗即将开始! </text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</GuideTwo>
|
</GuideTwo>
|
||||||
@@ -818,4 +844,23 @@ onBeforeUnmount(() => {
|
|||||||
border: 1rpx solid #a3793f66;
|
border: 1rpx solid #a3793f66;
|
||||||
color: #fed847;
|
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;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 25 KiB |
Reference in New Issue
Block a user