退出房间规则修改

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