🐞 fix: 五子棋房间表格显示异常
All checks were successful
ci / build (push) Successful in 57s

This commit is contained in:
Litrix 2025-01-14 17:32:01 +08:00
parent 7139800801
commit f3bdeb25bc
2 changed files with 20 additions and 25 deletions

View File

@ -56,11 +56,11 @@ async function submit() {
if (!(await formRef.value!.validate())) return;
submitting.value = true;
const res = await patchRequest(formData, originalFormData.value, {
clubAuthId: () =>
clubAuthId: (clubAuthId) =>
changeUserClubAuth({
userId: user.id,
clubId: club.id,
newAuthId: formData.clubAuthId!,
newAuthId: clubAuthId!,
}),
});
try {

View File

@ -21,34 +21,28 @@
<div class="gobang-list-page-main__no-rooms-title">没有房间</div>
<el-button type="primary" :loading="loading" @click="refresh">刷新</el-button>
</template>
<data-table v-else :rows="rooms"></data-table>
<el-table :data="rooms">
<data-table v-else :rows="rooms" :custom-cols="{ key: 'action', label: '操作' }">
<el-table-column prop="briefId" label="房间ID" />
<el-table-column prop="briefId" :formatter="getPlayerCount" label="房间人数" />
<el-table-column label="操作">
<template #default="{ row }">
<el-button
type="success"
:disabled="
<template #action="{ row }">
<el-button
type="success"
:disabled="
arrayIncludes([RoomState.GAMING, RoomState.FINISHED], (row as RoomRender).state)
"
@click="onJoinButtonClick(row)"
>
<template
v-if="
arrayIncludes([RoomState.GAMING, RoomState.FINISHED], (row as RoomRender).state)
"
@click="onJoinButtonClick(row)"
>
<template
v-if="
arrayIncludes(
[RoomState.GAMING, RoomState.FINISHED],
(row as RoomRender).state,
)
"
>
已满
</template>
<template v-else>加入</template>
</el-button>
</template>
</el-table-column>
</el-table>
已满
</template>
<template v-else>加入</template>
</el-button>
</template>
</data-table>
</template>
</el-main>
</el-container>
@ -166,6 +160,7 @@ const playerCountMap: Record<RoomState, string> = {
<script lang="ts" setup>
import CreateGobangRoomDialog from '@/components/gobang/CreateGobangRoomDialog.vue';
import GobangHeader from '@/components/gobang/GobangHeader.vue';
import DataTable from '@/components/table/DataTable.vue';
import { WEBSOCKET_BASE_URL } from '@/env';
import router from '@/router';
import type { UserInfo } from '@/schemas/response';