老司机媒资库
This commit is contained in:
@@ -0,0 +1,354 @@
|
||||
<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.id" @clear="onClear('id')" />
|
||||
</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.pay_type" @clear="onClear('pay_type')">
|
||||
<el-option label="金币" value="1" />
|
||||
<el-option label="会员" value="2" />
|
||||
<el-option label="免费" value="0" />
|
||||
</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="addPostArray" 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-row>
|
||||
<el-col>
|
||||
<el-table :data="resData" element-loading-text="拼命加载中" border height="735" highlight-current-row
|
||||
style="width: 100%; font-size: 10px" v-loading="loading" :row-style="{ height: '30px' }"
|
||||
:cell-style="{ padding: '5px' }" @selection-change="handleSelectionChange">
|
||||
<el-table-column 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.title }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="帖子内容" width="390px" show-overflow-tooltip>
|
||||
<template slot-scope="scope">{{ scope.row.content }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="帖子内容预览" width="130px">
|
||||
<template slot-scope="scope">
|
||||
<el-button slot="reference" size="small" @click="showDetailFn(scope.row.files)">节点内容预览</el-button>
|
||||
</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="发布者ID">
|
||||
<template slot-scope="scope" v-if="scope.row.up_user">{{
|
||||
scope.row.up_user.id
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="发布者昵称">
|
||||
<template slot-scope="scope" v-if="scope.row.up_user">{{
|
||||
scope.row.up_user.nickname
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="帖子封面" width="80px">
|
||||
<template slot-scope="scope">
|
||||
<ShowImg style="width: 30px; height: 30px; margin: 0 auto" :noNeedDoamin="true" :urls="scope.row.img">
|
||||
</ShowImg>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="帖子封面数量">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.img_count
|
||||
}}</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.categories"
|
||||
size="mini">
|
||||
{{ item.name }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="价格">
|
||||
<template slot-scope="scope">{{ scope.row.money }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="付费类型" width="110px">
|
||||
<template slot-scope="scope">
|
||||
<el-button plain size="mini">{{
|
||||
scope.row.pay_type === 1 ? '金币' : scope.row.pay_type === 2 ? '会员' :'免费' }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" width="120px" label="更新时间">
|
||||
<template slot-scope="scope">{{ scope.row.time | BeiJingTime }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" fixed="right" label="操作" width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="addPost(scope.$index, scope.row)" 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="primary">查看详情</el-button>
|
||||
<!-- <el-button @click="handleDelete(scope.$index, scope.row)" size="mini" type="danger">删除</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="table-pagination">
|
||||
<el-pagination :current-page="searchData.page" :page-size="searchData.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" />
|
||||
<PostDetailView v-if="showDetail" :itemData="postDetailData" @close="closeEdit"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// 引入模块
|
||||
import ShowImg from '@/components/ShowImg/index.vue'
|
||||
import Edit from './components/AddOrEdit'
|
||||
import { lsjPostList, lsjPostDel, lsjPostAdd } from '@/api/lsjMediaLibrary/postList.js'
|
||||
import {
|
||||
positionList, statusList
|
||||
} from '@/filters/lsjMediaLibrary/videoList.js'
|
||||
import { audioAdd } from '@/api/novelsManagement/audio.js'
|
||||
import PostDetailView from '@/components/PostDetailView/index.vue'
|
||||
import { isNumber } from 'mathjs/lib/entry/typeChecks'
|
||||
|
||||
export default {
|
||||
name: 'MediaCat',
|
||||
components: {
|
||||
ShowImg,
|
||||
Edit,
|
||||
PostDetailView
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
positionList: positionList(),
|
||||
statusList: statusList(),
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
// 请求列表参数
|
||||
searchData: {
|
||||
position: 'guochan', // 番号
|
||||
id: undefined,
|
||||
name: undefined, // 外用状态
|
||||
status: undefined, // "string",当前状态
|
||||
cat_id: undefined // 视频归类
|
||||
},
|
||||
time: undefined,
|
||||
resData: [], // el-table表格数据
|
||||
total: 0, // 数据总条数
|
||||
selectArray: undefined,
|
||||
editShowLocationVisible: undefined,
|
||||
showDetail: false,
|
||||
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: {
|
||||
showDetailFn(row) {
|
||||
this.postDetailData = row
|
||||
this.showDetail = true
|
||||
},
|
||||
addOutside() {
|
||||
this.editShowLocationVisible = true
|
||||
this.editData = {
|
||||
title: '',
|
||||
data: this.selectArray
|
||||
}
|
||||
},
|
||||
// TODO:加入后台视频库
|
||||
addPost(index, row) {
|
||||
lsjPostAdd({ id: row.id }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success('加入成功!')
|
||||
this.getMediaSearch()
|
||||
} else {
|
||||
this.$message.error('加入失败!')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 加入后台音频库
|
||||
addAudioArray() {
|
||||
Object.keys(this.selectArray).forEach((key) => {
|
||||
if (!this.selectArray[key].isAdd) {
|
||||
this.audioListFn(key, this.selectArray[key])
|
||||
}
|
||||
})
|
||||
},
|
||||
// TODO:加入音频视频库
|
||||
audioListFn(index, row) {
|
||||
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
|
||||
}
|
||||
lsjPostList(this.searchData).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.resData = res.data.data
|
||||
this.total = Number(res.data.total)
|
||||
} else {
|
||||
this.$message.error('请求列表失败!')
|
||||
this.resData = []
|
||||
this.total = 0
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
// TODO:删除影片列表数据
|
||||
handleDelete(index, row) {
|
||||
this.$confirm('确定删除?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
lsjPostDel({ id: row.id }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.getMediaSearch()
|
||||
this.$message.success('成功删除!')
|
||||
} else {
|
||||
this.$message.error(res.tip)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
addPostArray() {
|
||||
Object.keys(this.selectArray).forEach((key) => {
|
||||
if (!this.selectArray[key].isAdd) {
|
||||
this.addPost(key, this.selectArray[key])
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onSeach() {
|
||||
this.searchData.page = 1
|
||||
this.searchData.page_size = 20
|
||||
this.getMediaSearch()
|
||||
},
|
||||
// 切换每页数据量
|
||||
handleSizeChange(val) {
|
||||
this.searchData.page_size = val
|
||||
this.getMediaSearch()
|
||||
},
|
||||
// 切换页数
|
||||
handleCurrentChange(val) {
|
||||
this.searchData.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() {
|
||||
this.editVisible = false
|
||||
this.editShowLocationVisible = false
|
||||
this.showDetail = false
|
||||
this.getMediaSearch()
|
||||
},
|
||||
// 清空某一项筛选列表
|
||||
onClear(key) {
|
||||
this.searchData[key] = undefined
|
||||
this.getMediaSearch()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user