fix:新增分享房间图片&2v2+3v3+大乱斗只有管理员房间才展示踢人按钮
This commit is contained in:
@@ -65,6 +65,7 @@ const goBattle = ref(false);
|
||||
async function refreshRoomData() {
|
||||
if (!roomNumber.value) return;
|
||||
const result = await getRoomAPI(roomNumber.value);
|
||||
console.log(result);
|
||||
if (result.started) return;
|
||||
room.value = result;
|
||||
// 加入者通过 API 返回的 targetType 字段同步靶纸尺寸,并持久化到本地缓存
|
||||
@@ -276,11 +277,27 @@ const shareTitle = computed(() => {
|
||||
return '星球论箭,来一决高下敢否?';
|
||||
});
|
||||
|
||||
/**
|
||||
* 根据对战类型动态返回分享封面图路径
|
||||
* battleType === 2(多人乱斗)→ melee_share.jpg
|
||||
* 其余(好友约战 / 组队对战)→ contest_share.jpg
|
||||
*
|
||||
* 网络图片:
|
||||
* https://static.shelingxingqiu.com/shootmini/static/share/melee_share.jpg
|
||||
* https://static.shelingxingqiu.com/shootmini/static/share/contest_share.jpg
|
||||
*/
|
||||
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';
|
||||
});
|
||||
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: shareTitle.value,
|
||||
path: "/pages/friend-battle?roomID=" + roomNumber.value,
|
||||
imageUrl: "",
|
||||
imageUrl: shareImage.value,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -385,7 +402,8 @@ onBeforeUnmount(() => {
|
||||
<view v-for="(item, index) in players" :key="index">
|
||||
<Avatar v-if="item.id" :src="item.avatar" :size="36" />
|
||||
<text v-if="owner.id === item.id">管理员</text>
|
||||
<button v-if="owner.id !== item.id && item.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' }">
|
||||
<image src="../static/close-white.png" mode="widthFix" />
|
||||
</button>
|
||||
@@ -425,8 +443,9 @@ onBeforeUnmount(() => {
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- isOwner:当前用户是房主时才展示踢人按钮 -->
|
||||
<PlayerSeats v-if="room.battleType === 2" :total="room.count || 10" :players="players"
|
||||
:removePlayer="removePlayer" />
|
||||
:removePlayer="removePlayer" :isOwner="owner.id === user.id" />
|
||||
<view>
|
||||
<SButton :disabled="!canClick" :onClick="getReady">
|
||||
{{
|
||||
|
||||
Reference in New Issue
Block a user