fix: comment
Some checks failed
continuous-integration/drone/tag Build encountered an error

This commit is contained in:
zzc
2026-06-25 00:16:49 +08:00
parent a263e8a7e0
commit a34ed84a29
4 changed files with 45 additions and 10 deletions

View File

@@ -33,7 +33,7 @@
<el-table-column align="center" label="状态切换" width="80">
<template #default="{ row }">
<el-switch v-model="row.enable" :active-value="true" :inactive-value="false" @change="handleToggleStatus(row)" />
<el-switch v-model="row.status" :active-value="2" :inactive-value="4" @change="handleToggleStatus(row)" />
</template>
</el-table-column>
@@ -57,7 +57,7 @@
</template>
<script>
import { getCommentList, toggleEnable } from '@/api/rating/pk'
import { getCommentList, commentStatus } from '@/api/rating/pk'
import { formatTime } from '@/utils'
import { getThumbUrl } from '@/utils/blessing'
import UserInfo from '@/components/UserInfo'
@@ -126,11 +126,12 @@
},
async handleToggleStatus(row) {
try {
const { msg } = await toggleEnable({ id: row.id, enable: row.enable })
const enable = row.status === 2
const { msg } = await commentStatus({ id: row.id, enable })
this.$baseMessage(msg || '状态切换成功', 'success')
} catch (error) {
console.error(error)
row.enable = !row.enable
row.status = row.status === 2 ? 4 : 2
}
},
},

View File

@@ -85,7 +85,7 @@
<el-table-column align="center" label="状态切换" width="100">
<template #default="{ row }">
<el-switch v-model="row.enable" :active-value="true" :inactive-value="false" @change="handleToggleStatus(row)" />
<el-switch v-model="row.status" :active-value="2" :inactive-value="4" @change="handleToggleStatus(row)" />
</template>
</el-table-column>
@@ -113,7 +113,7 @@
</template>
<script>
import { getCommentList, toggleEnable, getList as getPkList } from '@/api/rating/pk'
import { getCommentList, commentStatus, getList as getPkList } from '@/api/rating/pk'
import { formatTime } from '@/utils'
import { getThumbUrl } from '@/utils/blessing'
import UserInfo from '@/components/UserInfo'
@@ -242,11 +242,13 @@
},
async handleToggleStatus(row) {
try {
const { msg } = await toggleEnable({ id: row.id, enable: row.enable })
// status: 2为启用4为禁用
const enable = row.status === 2
const { msg } = await commentStatus({ id: row.id, enable })
this.$baseMessage(msg || '状态切换成功', 'success')
} catch (error) {
console.error(error)
row.enable = !row.enable
row.status = row.status === 2 ? 4 : 2
}
},