feat: configure hot leagues in match center

This commit is contained in:
hajimi
2026-08-02 02:50:40 +08:00
parent 3e95fad23f
commit 163df0cf85
11 changed files with 109 additions and 67 deletions
+31 -3
View File
@@ -40,6 +40,14 @@
:inactive-value="0" @change="handleToggleShow(row)" />
</template>
</el-table-column>
<el-table-column label="热门联赛" min-width="100">
<template #default="{ row }">
<el-switch v-if="row.type === 'league' && !row.is_group"
v-perms="['match.league/edit']" v-model="row.is_hot" :active-value="1"
:inactive-value="0" @change="handleToggleHot(row)" />
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150" fixed="right">
<template #default="{ row }">
<el-button v-perms="['match.league/edit']" type="primary" link @click="handleEdit(row)">
@@ -68,6 +76,9 @@
<el-form-item label="显示">
<el-switch v-model="editData.is_show" :active-value="1" :inactive-value="0" />
</el-form-item>
<el-form-item v-if="editData.type === 'league'" label="热门联赛">
<el-switch v-model="editData.is_hot" :active-value="1" :inactive-value="0" />
</el-form-item>
</el-form>
<template #footer>
<el-button @click="showEdit = false">取消</el-button>
@@ -120,17 +131,34 @@ const editData = reactive({
type: '',
icon: '',
sort: 0,
is_show: 1
is_show: 1,
is_hot: 0
})
const handleEdit = (row: any) => {
Object.assign(editData, { id: row.id, label: row.label, type: row.type, icon: row.icon || '', sort: row.sort, is_show: row.is_show })
Object.assign(editData, {
id: row.id,
label: row.label,
type: row.type,
icon: row.icon || '',
sort: row.sort,
is_show: row.is_show,
is_hot: row.is_hot || 0
})
showEdit.value = true
}
const handleToggleShow = async (row: any) => {
try {
await leagueEdit({ id: row.id, label: row.label, sort: row.sort, is_show: row.is_show })
await leagueEdit({ id: row.id, is_show: row.is_show })
} catch (error) {
getLists()
}
}
const handleToggleHot = async (row: any) => {
try {
await leagueEdit({ id: row.id, is_hot: row.is_hot })
} catch (error) {
getLists()
}