退出房间规则修改

This commit is contained in:
kron
2025-06-28 12:46:41 +08:00
parent c7546f6b71
commit af9ef91dc3

View File

@@ -284,7 +284,7 @@ onMounted(() => {
onUnmounted(() => {
uni.$off("socket-inbox", onReceiveMessage);
if (owner.value.id !== user.value.id) {
if (owner.value.id !== user.value.id && !battleId.value) {
exitRoomAPI(roomNumber.value);
}
});
@@ -433,13 +433,22 @@ onUnmounted(() => {
</ScreenHint>
<SModal :show="showModal" :onClose="() => (showModal = false)">
<view class="btns">
<SButton :onClick="exitRoom" width="200px" :rounded="20">
暂时离开
</SButton>
<view :style="{ height: '20px' }"></view>
<SButton :onClick="destroyRoom" width="200px" :rounded="20">
解散房间
</SButton>
<block v-if="!battleId">
<SButton :onClick="exitRoom" width="200px" :rounded="20">
暂时离开
</SButton>
<block v-if="owner.id === user.id">
<view :style="{ height: '20px' }"></view>
<SButton :onClick="destroyRoom" width="200px" :rounded="20">
解散房间
</SButton>
</block>
</block>
<block v-else>
<SButton :onClick="exitRoom" width="200px" :rounded="20">
退出比赛
</SButton>
</block>
</view>
</SModal>
</Container>
@@ -537,13 +546,4 @@ onUnmounted(() => {
align-items: center;
justify-content: center;
}
/* .btns > button {
color: #000;
background-color: #fed847;
padding: 10px;
width: 200px;
border-radius: 20px;
font-size: 14px;
margin: 10px;
} */
</style>