up
This commit is contained in:
@@ -25,3 +25,8 @@ export function offlineVideo(videoId, data) {
|
||||
export function updateVideo(videoId, data) {
|
||||
return request.put(`/admin/videos/${videoId}`, data)
|
||||
}
|
||||
|
||||
/** 删除视频(级联删除所有关联数据:标签/点赞/收藏/评论/观看记录/收益/举报) */
|
||||
export function deleteVideo(videoId) {
|
||||
return request.delete(`/admin/videos/${videoId}`)
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<el-button v-if="row.status === 2" link type="danger" :icon="Delete" @click="offline(row)">
|
||||
下架
|
||||
</el-button>
|
||||
<el-button link type="danger" :icon="Delete" @click="deleteVideoRow(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty><el-empty description="暂无视频" /></template>
|
||||
@@ -108,11 +109,11 @@
|
||||
|
||||
<script setup>
|
||||
import { Delete, Edit, Refresh, Search, View } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
|
||||
import request from '@/api/request'
|
||||
import { listVideos, offlineVideo, updateVideo } from '@/api/videos'
|
||||
import { listVideos, offlineVideo, updateVideo, deleteVideo } from '@/api/videos'
|
||||
import VideoPreview from '@/components/VideoPreview.vue'
|
||||
import { askReason } from '@/utils/reason'
|
||||
|
||||
@@ -199,6 +200,19 @@ async function offline(row) {
|
||||
load()
|
||||
}
|
||||
|
||||
async function deleteVideoRow(row) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定删除《${row.title}》?\n\n将级联删除:标签、点赞、收藏、评论、观看记录、收益、举报等所有关联数据。此操作不可恢复!`,
|
||||
'删除视频',
|
||||
{ confirmButtonText: '确定删除', cancelButtonText: '取消', type: 'error' }
|
||||
)
|
||||
} catch { return }
|
||||
await deleteVideo(row.video_id)
|
||||
ElMessage.success('已删除')
|
||||
load()
|
||||
}
|
||||
|
||||
// ---------- 编辑弹窗 ----------
|
||||
function openEdit(row) {
|
||||
editingVideoId.value = row.video_id
|
||||
|
||||
Reference in New Issue
Block a user