Files
91fans_admin/src/views/lsjMediaLibrary/videoList/index.vue
T
rootandClaude Opus 5 e282bd23e8 Switch to dart-sass and make deploy script fail-safe
node-sass 4.x cannot build on arm64/Node 16. Use sass with ::v-deep
instead of /deep/, and only replace the server dist after the upload
is unpacked and verified.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 19:18:37 +08:00

396 lines
13 KiB
Vue

<template>
<div class="pf-warpper avlist">
<el-row class="table-form">
<el-form :inline="true" :model="searchData" class="form-inline" size="mini">
<el-form-item>
<el-input placeholder="请输入关键字" clearable v-model="searchData.keywords" @clear="onClear('keywords')" />
</el-form-item>
<el-form-item>
<el-input placeholder="请输入ID" clearable v-model="searchData.ids" @clear="onClear('ids')" />
</el-form-item>
<el-form-item>
<el-input placeholder="请输入up主id" clearable v-model="searchData.home_id" @clear="onClear('home_id')" />
</el-form-item>
<el-form-item>
<el-select placeholder="请选择更新状态" clearable v-model="searchData.update_status"
@clear="onClear('update_status')">
<el-option label="已完结" value="1" />
<el-option label="未完结" value="0" />
</el-select>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入mi,多个用,分开" clearable v-model="searchData.mid" @clear="onClear('mid')" />
</el-form-item>
<el-form-item>
<el-select placeholder="请选择视频分类类型" clearable v-model="searchData.cat_id" @clear="onClear('cat_id')">
<el-option v-for="item in videoTypeList" :key="item.value" :label="item.value" :value="item.label" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="请选择内容类型" clearable v-model="searchData.position" @clear="onClear('position')">
<el-option v-for="item in positionList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-date-picker v-model="time" type="daterange" range-separator="至" value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button @click="onSeach" icon="el-icon-search" plain type="primary">搜索</el-button>
<!-- <el-button @click="add" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button> -->
<!-- <el-button @click="addAudioArray" icon="el-icon-circle-plus-outline" plain type="warning">批量加入音频视频库</el-button> -->
<el-button @click="addVideoArray" icon="el-icon-circle-plus-outline" plain
type="warning">批量加入后台视频库</el-button>
<!-- <el-button @click="addOutside" icon="el-icon-circle-plus-outline" plain type="warning">批量加入外用列表</el-button> -->
</el-form-item>
</el-form>
</el-row>
<el-table :data="resData" element-loading-text="拼命加载中" border height="735" highlight-current-row v-loading="loading"
:cell-style="{ padding: '5px' }" @selection-change="handleSelectionChange">
<el-table-column fixed type="selection" width="50"> </el-table-column>
<el-table-column align="center" label="视频ID" width="190px">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<el-table-column align="center" label="视频标题" width="190px" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column>
<el-table-column align="center" label="视频描述" width="190px" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column align="center" label="视频定位">
<template slot-scope="scope">{{
scope.row.position | changePosition
}}</template>
</el-table-column>
<el-table-column align="center" label="up主名称">
<template slot-scope="scope">{{
scope.row.up_user
}}</template>
</el-table-column>
<el-table-column align="center" label="视频分类ID">
<template slot-scope="scope">{{
scope.row.cat_id
}}</template>
</el-table-column>
<el-table-column align="center" label="视频分类名称">
<template slot-scope="scope">{{
scope.row.cat_name
}}</template>
</el-table-column>
<el-table-column align="center" label="视频封面类型">
<template slot-scope="scope">{{ scope.row.img_type === 'long' ? '横图' : '竖图' }}</template>
</el-table-column>
<el-table-column align="center" label="视频横版封面" width="120">
<template slot-scope="scope">
<decrypt-img style="height: 60px; margin: 0 auto" :noNeedDoamin="true" :src="scope.row.img_x"></decrypt-img>
</template>
</el-table-column>
<el-table-column align="center" label="视频竖版封面" width="120">
<template slot-scope="scope">
<decrypt-img style="height: 60px;" :noNeedDoamin="true" :src="scope.row.img_y"></decrypt-img>
</template>
</el-table-column>
<el-table-column align="center" label="标签" width="300px">
<template slot-scope="scope">
<el-tag :key="index + 'tagData'" style="margin: 2px" v-for="(item, index) in scope.row.tags" size="mini">
{{ item.name }}
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="视频导演">
<template slot-scope="scope">{{ scope.row.director }}</template>
</el-table-column>
<el-table-column align="center" label="上架状态" width="110px">
<template slot-scope="scope">
<el-button plain size="mini">{{
scope.row.status_text }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" width="120px" label="上架时间">
<template slot-scope="scope">{{ scope.row.issue_date | changeDate }}</template>
</el-table-column>
<el-table-column align="center" width="120px" label="更新状态">
<template slot-scope="scope">{{ scope.row.update_status === '0' ? '更新中' : '已完结' }}</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="300">
<template slot-scope="scope">
<el-button v-if="scope.row.type == 'MP3'" @click="audioListFn(scope.$index, scope.row)" type="success"
size="mini">加入后台MP3库</el-button>
<el-button v-else @click="addVideo(scope.row.id)" size="mini"
:type="scope.row.isAdd ? 'info' : 'primary'" :disabled="scope.row.isAdd ? true : false">{{
`${scope.row.isAdd ? '已加入后台视频库' : '加入后台视频库'}` }}</el-button>
<el-button @click="handleEdit(scope.$index, scope.row)" size="mini" type="success">查看详情</el-button>
<!-- <el-button @click="handleDelete(scope.$index, scope.row)" size="mini" type="danger">删除</el-button> -->
</template>
</el-table-column>
</el-table>
<div class="table-pagination">
<el-pagination :current-page="page" :page-size="page_size" :page-sizes="[10, 20, 30, 50, 100]" :total="total"
@current-change="handleCurrentChange" @size-change="handleSizeChange"
layout="total, sizes, prev, pager, next, jumper" />
</div>
<!-- 查看详情 -->
<Edit :data="editData" v-if="editVisible" @close="closeEdit(false)" />
<ShowVideo ref="showvideo"></ShowVideo>
</div>
</template>
<script>
// 引入模块
import Edit from './components/AddOrEdit'
// import EditShowLocation from './components/editShowLocation'
import API from '@/api'
import ShowVideo from '@/components/ShowVideo/index.vue'
import {
positionList, videoTypeList, statusList
} from '../config'
import { isNumber } from 'lodash'
// import { audioAdd } from '@/api/novelsManagement/audio.js'
export default {
name: 'MediaCat',
components: {
ShowVideo,
Edit
},
data() {
return {
videoTypeList: videoTypeList(),
positionList: positionList(),
statusList: statusList(),
page: 1,
page_size: 20,
// 请求列表参数
searchData: {
position: 'guochan', // 番号
id: undefined,
name: undefined, // 外用状态
status: undefined, // "string",当前状态
cat_id: undefined, // 视频归类
keywords: undefined, //关键字搜索
},
time: undefined,
resData: [], // el-table表格数据
total: 0, // 数据总条数
selectArray: undefined,
editShowLocationVisible: undefined,
loading: true, // 列表加载状态
// 编辑数据
editVisible: false, // 新增或编辑弹出框
editData: {
title: '查看详情',
data: {}
}
}
},
filters: {
changeFormat(val) {
switch (val) {
case 1:
return '长视频'
case 2:
return '短视频'
case 3:
return '预览'
}
},
changeContentType(val) {
switch (val) {
case 1:
return 'AV(日本)'
case 2:
return '短视频(国产)'
case 3:
return '动漫'
}
}
},
mounted() {
this.getMediaSearch()
},
methods: {
addOutside() {
this.editShowLocationVisible = true
this.editData = {
title: '',
data: this.selectArray
}
},
// TODO:加入后台视频库
addVideo(ids) {
const loadingIns = this.$loading({ text: '正在同步,请耐心等待...' })
API.lsjVideoAdd({ position: this.searchData.position, ids: Array.isArray(ids) ? ids : [ids] }).then((res) => {
loadingIns.close()
if (res.code === 200) {
this.$message.success('加入成功!')
this.getMediaSearch()
} else {
this.$message.error('加入失败!')
}
}).catch(err => {
loadingIns.close()
this.$message.error('加入失败!' + err)
})
},
// 加入后台音频库
addAudioArray() {
Object.keys(this.selectArray).forEach((key) => {
if (!this.selectArray[key].isAdd) {
this.audioListFn(key, this.selectArray[key])
}
})
},
// TODO:加入音频视频库
audioListFn() {
// audioAdd({ id: row.id }).then((res) => {
// if (res.code === 200) {
// this.$message.success('加入成功!')
// this.getMediaSearch()
// } else {
// this.$message.error('加入失败!')
// }
// })
},
// TODO:请求影片列表数据
getMediaSearch() {
this.loading = true
if (isNumber(this.page) || isNumber(this.page_size)) {
this.searchData.page = this.page + ''
this.searchData.page_size = this.page_size + ''
}
if (this.time) {
this.searchData.start_time = this.time[0]
this.searchData.end_time = this.time[1]
} else {
this.searchData.start_time = undefined
this.searchData.end_time = undefined
}
API.lsjVideoList(this.searchData).then((res) => {
if (res.code === 200) {
this.resData = res.data.data
this.total = res.data.total ? parseInt(res.data.total) : 300000
} else {
this.$message.error('请求列表失败!')
this.resData = []
this.total = 0
}
this.loading = false
}).catch(() => {
this.loading = false
})
},
// TODO:删除影片列表数据
handleDelete(index, row) {
this.$confirm('确定删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
API.lsjVideoDel({ id: row.id }).then((res) => {
if (res.code === 200) {
this.getMediaSearch()
this.$message.success('成功删除!')
} else {
this.$message.error(res.tip)
}
})
})
},
addVideoArray() {
if (!this.selectArray || !this.selectArray.length) {
this.$message.error('请先选择需要操作的数据')
return
}
this.addVideo(this.selectArray.map(v => v.id))
},
onSeach() {
this.page = 1
this.page_size = 20
this.getMediaSearch()
},
// 切换每页数据量
handleSizeChange(val) {
this.page_size = val
this.getMediaSearch()
},
// 切换页数
handleCurrentChange(val) {
this.page = val
this.getMediaSearch()
},
handleSelectionChange(val) {
this.selectArray = val
},
// 新增按钮
add() {
this.editVisible = true // 新增或编辑弹出框
this.editData = {
title: '新增',
data: {}
}
},
// 编辑按钮
handleEdit(index, row) {
this.editVisible = true // 新增或编辑弹出框
this.editData = {
title: '查看详情',
data: row
}
},
// 关闭编辑弹窗
closeEdit(refresh) {
this.editVisible = false
this.editShowLocationVisible = false
refresh && this.getMediaSearch()
},
// 清空某一项筛选列表
onClear(key) {
this.searchData[key] = undefined
this.getMediaSearch()
}
}
}
</script>
<style lang="scss" scoped>
.avlist {
display: flex;
flex-direction: column;
height: 100%;
::v-deep {
.el-form-item--mini.el-form-item {
margin-bottom: 12px;
}
.el-table {
font-size: 12px;
.cell {
padding: 0;
}
}
}
.el-pagination {
margin: 15px 0;
}
}
</style>