BUG修复
This commit is contained in:
@@ -70,6 +70,13 @@ function request(method, url, data = {}) {
|
||||
resolve({});
|
||||
return;
|
||||
}
|
||||
if (message === "ROOM_EMPTY") {
|
||||
uni.showToast({
|
||||
title: "房间已过期",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: "none",
|
||||
|
||||
@@ -42,31 +42,23 @@ async function refreshRoomData() {
|
||||
id: m.userInfo.id,
|
||||
name: m.userInfo.name,
|
||||
avatar: m.userInfo.avatar,
|
||||
rankLvl: m.userInfo.rankLvl,
|
||||
};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (result.battleType === 1 && result.count === 1) {
|
||||
if (user.value.id !== owner.value.id) {
|
||||
opponent.value = {
|
||||
id: user.value.id,
|
||||
name: user.value.nickName,
|
||||
avatar: user.value.avatar,
|
||||
};
|
||||
} else if (result.members.length > 1) {
|
||||
result.members.some((m) => {
|
||||
if (m.userInfo.id !== owner.value.id) {
|
||||
opponent.value = {
|
||||
id: m.userInfo.id,
|
||||
name: m.userInfo.name,
|
||||
avatar: m.userInfo.avatar,
|
||||
};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
if (result.battleType === 1 && result.count === 2) {
|
||||
result.members.forEach((m) => {
|
||||
if (m.userInfo.id !== owner.value.id) {
|
||||
opponent.value = {
|
||||
id: m.userInfo.id,
|
||||
name: m.userInfo.name,
|
||||
avatar: m.userInfo.avatar,
|
||||
rankLvl: m.userInfo.rankLvl,
|
||||
};
|
||||
}
|
||||
});
|
||||
} else if (result.battleType === 2) {
|
||||
players.value = [];
|
||||
const ownerIndex = result.members.findIndex(
|
||||
@@ -117,12 +109,14 @@ async function onReceiveMessage(messages = []) {
|
||||
id: msg.userId,
|
||||
name: msg.name,
|
||||
avatar: msg.avatar,
|
||||
rankLvl: msg.rankLvl,
|
||||
};
|
||||
} else {
|
||||
opponent.value = {
|
||||
id: msg.userId,
|
||||
name: msg.name,
|
||||
avatar: msg.avatar,
|
||||
rankLvl: msg.rankLvl,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -132,12 +126,14 @@ async function onReceiveMessage(messages = []) {
|
||||
id: msg.userId,
|
||||
name: msg.name,
|
||||
avatar: msg.avatar,
|
||||
rankLvl: msg.rankLvl,
|
||||
};
|
||||
} else {
|
||||
players.value.push({
|
||||
id: msg.userId,
|
||||
name: msg.name,
|
||||
avatar: msg.avatar,
|
||||
rankLvl: msg.rankLvl,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -285,26 +281,38 @@ onHide(() => {});
|
||||
mode="widthFix"
|
||||
/>
|
||||
<view>
|
||||
<view class="player" :style="{ transform: 'translateY(-60px)' }">
|
||||
<Avatar :rankLvl="user.rankLvl" :src="user.avatar" :size="60" />
|
||||
<view
|
||||
v-if="owner.id"
|
||||
class="player"
|
||||
:style="{ transform: 'translateY(-60px)' }"
|
||||
>
|
||||
<Avatar :rankLvl="owner.rankLvl" :src="owner.avatar" :size="60" />
|
||||
<text>{{ owner.name }}</text>
|
||||
<text>创建者</text>
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="no-player"
|
||||
:style="{ transform: 'translateY(-60px)' }"
|
||||
>
|
||||
<image src="../static/question-mark.png" mode="widthFix" />
|
||||
</view>
|
||||
<image src="../static/versus.png" mode="widthFix" />
|
||||
<block v-if="opponent.id">
|
||||
<view class="player" :style="{ transform: 'translateY(60px)' }">
|
||||
<image
|
||||
:src="opponent.avatar || '../static/user-icon.png'"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<text v-if="opponent.name">{{ opponent.name }}</text>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="no-player">
|
||||
<image src="../static/question-mark.png" mode="widthFix" />
|
||||
</view>
|
||||
</block>
|
||||
<view
|
||||
v-if="opponent.id"
|
||||
class="player"
|
||||
:style="{ transform: 'translateY(60px)' }"
|
||||
>
|
||||
<Avatar
|
||||
:rankLvl="opponent.rankLvl"
|
||||
:src="opponent.avatar"
|
||||
:size="60"
|
||||
/>
|
||||
<text v-if="opponent.name">{{ opponent.name }}</text>
|
||||
</view>
|
||||
<view class="no-player" v-else>
|
||||
<image src="../static/question-mark.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<PlayerSeats
|
||||
@@ -478,7 +486,7 @@ onHide(() => {});
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
}
|
||||
.player > text:last-child {
|
||||
.player > text:nth-child(3) {
|
||||
color: #000;
|
||||
background-color: #fed847;
|
||||
font-size: 8px;
|
||||
|
||||
Reference in New Issue
Block a user