Files
huangguo_admin/src/views/novelsManagement/novels/index.vue
T
2026-03-17 22:44:29 +08:00

541 lines
22 KiB
Vue

<template>
<div class="pf-warpper">
<el-row class="table-form">
<!-- 查询条件 -->
<el-form :inline="true" :model="searchData" class="form-inline" label-width="80px" size="mini">
<el-form-item>
<el-input placeholder="请输入小说ID" clearable v-model.number="searchData.id" @clear="onClear('id')" />
</el-form-item>
<el-form-item>
<el-input placeholder="请输入小说标题" clearable v-model.trim="searchData.title" @clear="onClear('title')" />
</el-form-item>
<el-form-item>
<el-input placeholder="请输入小说作者" clearable v-model.trim="searchData.author" @clear="onClear('author')" />
</el-form-item>
<el-form-item>
<el-input placeholder="请输入小说唯一标识" clearable v-model.trim="searchData.jmid" @clear="onClear('jmid')" />
</el-form-item>
<el-form-item>
<el-select placeholder="请选择小说上架状态" clearable v-model.number="searchData.status" @clear="onClear('status')">
<el-option label="待上架" :value="0" />
<el-option label="上架" :value="1" />
<el-option label="下架" :value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="请选择小说更新状态" clearable v-model.number="searchData.updateStatus" @clear="onClear('updateStatus')">
<el-option label="待发布" :value="0" />
<el-option label="连载中" :value="1" />
<el-option label="已完结" :value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="请选择小说主题" clearable v-model.number="searchData.topicId" @clear="onClear('topicId')" filterable>
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in topicIdList" />
</el-select>
</el-form-item>
<el-form-item>
<el-input placeholder="请输入小说标签" clearable v-model.trim="searchData.tagStr" @clear="onClear('tagStr')" />
</el-form-item>
<el-form-item>
<el-select placeholder="请选择小说付费类型" clearable v-model="searchData.novelPayType" @clear="onClear('novelPayType')">
<el-option label="免费" :value="0" />
<el-option label="会员" :value="1" />
<el-option label="金币" :value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="排序方式" clearable v-model.number="searchData.sort" @clear="onClear('sort')">
<el-option label="上架时间" :value="0" />
<el-option label="更新时间" :value="1" />
<el-option label="观看次数排序" :value="2" />
<el-option label="收藏次数排序" :value="3" />
<el-option label="章节数量排序" :value="4" />
<el-option label="图片数量排序" :value="5" />
<el-option label="虚假观看数排序" :value="6" />
<el-option label="周观看次数" :value="7" />
<el-option label="月观看次数" :value="8" />
</el-select>
</el-form-item>
<el-form-item>
<el-select placeholder="请选择小说类型" clearable v-model="searchData.novelType" @clear="onClear('novelType')">
<el-option label="文本" :value="1" />
<el-option label="有声" :value="2" />
<el-option label="asm" :value="3" />
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="onSearch" icon="el-icon-search" plain type="primary">搜索</el-button>
<el-button @click="handleAdd()" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button>
<el-button @click="getData" icon="el-icon-refresh" plain type="info">刷新</el-button>
<el-button @click="setTag" icon="el-icon-edit-outline" plain type="warning">批量设置主题</el-button>
<el-button @click="setTags" icon="el-icon-edit-outline" plain type="warning">批量添加标签</el-button>
<el-button @click="batch" icon="el-icon-edit-outline" plain type="warning">批量设置小说</el-button>
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-col>
<!-- 展示列表 -->
<el-table :data="tableData" border height="750" highlight-current-row style="width: 100%" @selection-change="handleSelectionChange" :row-style="{ height: '70px' }">
<el-table-column type="selection" width="50" fixed="left"> </el-table-column>
<el-table-column align="center" label="ID">
<template slot-scope="scope">{{ scope.row.id }}</template>
</el-table-column>
<!-- <el-table-column align="center" label="唯一标识">-->
<!-- <template slot-scope="scope">{{ scope.row.jmid }}</template>-->
<!-- </el-table-column>-->
<el-table-column align="center" label="排序">
<template slot-scope="scope">{{ scope.row.rank }}</template>
</el-table-column>
<el-table-column align="center" label="小说标题" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.title }}</template>
</el-table-column>
<el-table-column align="center" label="封面">
<template slot-scope="scope">
<ShowImg style="width: 40px; height: 40px; margin: 0 auto; line-height: 40px" :urls="scope.row.coverImg"></ShowImg>
</template>
</el-table-column>
<el-table-column align="center" label="小说作者" width="200">
<template slot-scope="scope">
<el-tag v-for="(item, index) in scope.row.author" :key="index">{{ item }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="章节数量">
<template slot-scope="scope">{{ scope.row.chapterCount }}</template>
</el-table-column>
<el-table-column align="center" label="最新章节">
<template slot-scope="scope">{{ scope.row.newChapter }}</template>
</el-table-column>
<el-table-column align="center" label="最新章节更新时间">
<template slot-scope="scope">{{ scope.row.newTime | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" label="小说总字数">
<template slot-scope="scope">{{ scope.row.wordTotalCount }}</template>
</el-table-column>
<el-table-column align="center" label="页数">
<template slot-scope="scope">{{ scope.row.pageCount }}</template>
</el-table-column>
<el-table-column align="center" label="售价">
<template slot-scope="scope">{{ scope.row.price | changeMoneyYuan }}</template>
</el-table-column>
<el-table-column align="center" label="免费章节">
<template slot-scope="scope">{{ scope.row.noneChapter }}</template>
</el-table-column>
<el-table-column align="center" label="周观看次数">
<template slot-scope="scope">{{ scope.row.weekWatchTimes }}</template>
</el-table-column>
<el-table-column align="center" label="月观看次数">
<template slot-scope="scope">{{ scope.row.monthWatchTimes }}</template>
</el-table-column>
<el-table-column align="center" label="最后观看时间">
<template slot-scope="scope">{{ scope.row.lastWatchTime | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" label="小说发布者ID">
<template slot-scope="scope">{{ scope.row.publishId }}</template>
</el-table-column>
<!-- <el-table-column align="center" label="圈子">
<template slot-scope="scope">{{ scope.row.circleId | changeName(circleList, 'id', 'name') }}</template>
</el-table-column> -->
<el-table-column align="center" label="描述信息" width="300" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.desc }}</template>
</el-table-column>
<el-table-column align="center" label="是否VIP" width="100">
<template slot-scope="scope">
<el-button :type="scope.row.isVip ? 'success' : 'danger'" plain size="mini">{{ scope.row.isVip ? 'VIP' : '非VIP' }}</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="上架状态">
<template slot-scope="scope">{{ scope.row.status | changeStatus }}</template>
</el-table-column>
<el-table-column align="center" label="上架时间" width="150">
<template slot-scope="scope">{{ scope.row.addedTime | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" label="更新状态">
<template slot-scope="scope">{{ scope.row.updateStatus | changeUpdateStatus }}</template>
</el-table-column>
<el-table-column align="center" label="小说主题" width="300">
<template slot-scope="scope">
<el-tag :key="index" v-for="(item, index) in scope.row.topics" type="success">{{ item | changeName(topicIdList, 'id', 'name') }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="小说标签" width="300">
<template slot-scope="scope">
<el-tag :key="index" v-for="(item, index) in scope.row.tagName" type="success">{{ item.name }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="是否音频小说" width="80">
<template slot-scope="scope">{{ scope.row.isAudio ? '是' : '否' }} </template>
</el-table-column>
<!-- <el-table-column align="center" label="配音角色" width="300">-->
<!-- <template slot-scope="scope">-->
<!-- <template>-->
<!-- <el-table :data="scope.row.roleList" max-height="200" border style="width: 100%">-->
<!-- <el-table-column align="center" prop="comicsCvId" label="CV-id" width="135">-->
<!-- <template slot-scope="scopes">{{-->
<!-- scopes.row.comicsCvId-->
<!-- }}</template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="roleName" label="配音角色" width="135">-->
<!-- <template slot-scope="scopes">{{-->
<!-- scopes.row.roleName-->
<!-- }}</template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- </template>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" label="评分">
<template slot-scope="scope">{{ scope.row.novelNumber }}</template>
</el-table-column>
<el-table-column align="center" label="真实信息">
<el-table-column align="center" label="评论数">
<template slot-scope="scope">{{ scope.row.real.comments }}</template>
</el-table-column>
<el-table-column align="center" label="点赞数">
<template slot-scope="scope">{{ scope.row.real.likes }}</template>
</el-table-column>
<el-table-column align="center" label="售卖数">
<template slot-scope="scope">{{ scope.row.real.sells }}</template>
</el-table-column>
<el-table-column align="center" label="分享数">
<template slot-scope="scope">{{ scope.row.real.shares }}</template>
</el-table-column>
<el-table-column align="center" label="观看数">
<template slot-scope="scope">{{ scope.row.real.watchTimes }}</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="虚拟信息">
<el-table-column align="center" label="评论数">
<template slot-scope="scope">{{ scope.row.fake.comments }}</template>
</el-table-column>
<el-table-column align="center" label="点赞数">
<template slot-scope="scope">{{ scope.row.fake.likes }}</template>
</el-table-column>
<el-table-column align="center" label="售卖数">
<template slot-scope="scope">{{ scope.row.fake.sells }}</template>
</el-table-column>
<el-table-column align="center" label="分享数">
<template slot-scope="scope">{{ scope.row.fake.shares }}</template>
</el-table-column>
<el-table-column align="center" label="观看数">
<template slot-scope="scope">{{ scope.row.fake.watchTimes }}</template>
</el-table-column>
</el-table-column>
<el-table-column align="center" label="创建时间" width="150">
<template slot-scope="scope">{{ scope.row.createdAt | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" label="更新时间" width="150">
<template slot-scope="scope">{{ scope.row.updatedAt | BeiJingTime }}</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="550">
<template slot-scope="scope">
<el-button @click="onAddComment(scope.row)" size="mini" type="success">添加评论</el-button>
<el-button @click="addTotal(scope.$index, scope.row)" size="mini" type="primary">整本添加</el-button>
<el-button @click="showChapterList(scope.$index, scope.row)" size="mini" type="primary">查看章节列表</el-button>
<el-button @click="topNovels(scope.$index, scope.row)" size="mini" type="success">最新置顶</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.pageNum"
:page-size="searchData.pageSize"
: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="dialogFormVisible" @close="closeEdit" :circleList="circleList"></Edit>
<ChapterList :data="editData" v-if="chapterListVisible" @close="closeEdit" />
<SetTag :data="selectBatch" v-if="setTagVisible" @close="closeEdit"></SetTag>
<EditCom :data="editData" v-if="editComVisible" :objectype="6" @close="closeEdit" />
<!-- <AddTags :data="selectBatch" v-if="tagsVisible" @close="closeEdit" /> -->
<AddTotal :data="editData" v-if="addTotalVisible" @close="closeEdit" />
<Batch :data="selectBatch" v-if="batchVisible" @close="closeEdit"></Batch>
</div>
</template>
<script>
import { novelsList, novelsDel, novelsNewOne } from '@/api/novelsManagement/novels'
import { novelsTopicList } from '@/api/novelsManagement/novelsTopic'
import { novelsTagList } from '@/api/novelsManagement/novelsTag'
import { circleListSearch } from '@/api/user/circleList'
import ChapterList from './components/chapterList'
import ShowImg from '@/components/ShowImg/index.vue'
import Edit from './components/AddOrEdit'
import SetTag from './components/setTag'
// import EditCom from '@/views/videoManagement/videoList/components/videoComment.vue'
import AddTags from './components/addTags'
import Batch from './components/batch'
import AddTotal from './components/addTotal'
export default {
name: 'Novels',
components: {
Edit,
ShowImg,
ChapterList,
SetTag,
// EditCom,
AddTags,
AddTotal,
Batch
},
data() {
return {
// 请求列表筛选参数
searchData: {
id: undefined,
status: undefined, // 激活状态
pageNum: 1,
pageSize: 10,
novelPayType: undefined, // true 是否VIp
sort: undefined, // integer 排序,0创建时间,1rank排序,2观看数量排序,3收藏数量排序
tagId: undefined, // integer 标签
title: undefined, // "string",标题
topicId: undefined, // integer 主题
author: undefined, // 小说作者
tagStr: undefined,
novelType: undefined
},
tableData: [],
total: 0,
dialogFormVisible: false,
chapterListVisible: false,
editComVisible: false, // 评论弹出框
setTagVisible: false,
tagsVisible: false, // 批量添加标签
addTotalVisible: false, // 整本添加
batchVisible: false, // 批量设置小说
editData: {},
topicIdList: [],
tagIdList: [],
selectBatch: [],
circleList: []
}
},
filters: {
changeStatus(val) {
switch (val) {
case 0:
return '待上架'
case 1:
return '上架'
case 2:
return '取消上架'
case 3:
return '待审核'
case 4:
return '拒绝'
}
},
changeUpdateStatus(val) {
switch (val) {
case 0:
return '待发布'
case 1:
return '连载中'
case 2:
return '已完结'
}
}
},
async mounted() {
// this.getNovelsTagList()
this.getNovelsTopicList()
await this.getData()
// this.getCircleListSearch();
},
methods: {
// TODO:请求小说主题列表数据
getNovelsTopicList() {
const param = {
pageNum: 1,
pageSize: 500,
status: true
}
novelsTopicList(param).then(res => {
if (res.code === 200) {
this.topicIdList = res.data.list
this.$store.dispatch('novels/setNovelsTopicList', res.data.list)
} else {
this.topicIdList = []
this.$store.dispatch('novels/setNovelsTopicList', [])
this.$message.error('请求小说主题列表失败')
}
})
},
// 批量设置
batch() {
this.batchVisible = true
},
// TODO:请求小说标签列表数据
getNovelsTagList() {
const param = {
pageNum: 1,
pageSize: 10000
}
novelsTagList(param).then(res => {
if (res.code === 200) {
this.tagIdList = res.data.list
this.$store.dispatch('novels/setNovelsTagList', res.data.list)
} else {
this.tagIdList = []
this.$store.dispatch('novels/setNovelsTagList', [])
this.$message.error('请求小说标签列表失败!')
}
})
},
// TODO:请求小说列表数据
getData() {
novelsList(this.searchData).then(res => {
if (res.code === 200) {
this.tableData = res.data.list
this.total = res.data.count
} else {
this.tableData = []
this.total = 0
this.$message.error('请求小说列表数据失败')
}
})
},
// TODO:小说置顶
topNovels(index, row) {
novelsNewOne({ id: row.id }).then(res => {
if (res.code === 200) {
this.$message.success('置顶成功')
} else {
this.$message.error('置顶失败')
}
})
},
// TODO:删除小说列表数据
handleDelete(index, row) {
this.$confirm('确定删除?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
novelsDel({ novelId: row.id }).then(res => {
if (res.code === 200) {
this.getData({ pageNum: 1 }) // 刷新商品列表
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
})
},
// TODO:请求圈子列表数据
getCircleListSearch() {
circleListSearch({ pageNum: 1, pageSize: 5000 }).then(res => {
if (res.code === 200) {
this.circleList = res.data.list
} else {
this.$message.error('请求圈子列表失败!')
this.circleList = []
}
})
},
onSearch() {
this.searchData.pageNum = 1
this.getData()
},
handleSelectionChange(val) {
this.selectBatch = val
},
setTag() {
this.setTagVisible = true
},
setTags() {
this.tagsVisible = true
},
showChapterList(index, row) {
this.editData = {
title: '视频列表',
type: 3,
data: row
}
this.chapterListVisible = true
},
addTotal(index, row) {
this.editData = {
title: '整本添加',
data: row
}
this.addTotalVisible = true
},
// 列表编辑按钮点击事件
handleAdd() {
this.editData = {
title: '新增',
data: {}
}
this.dialogFormVisible = true
},
// 列表编辑按钮点击事件
handleEdit(index, row) {
this.editData = {
title: '编辑',
data: row
}
this.dialogFormVisible = true
},
closeEdit() {
this.editData = {
title: '新增',
data: {}
}
this.editComVisible = false
this.setTagVisible = false
this.dialogFormVisible = false
this.chapterListVisible = false
this.tagsVisible = false
this.addTotalVisible = false
this.batchVisible = false
this.getData()
},
onClear(key) {
this.searchData[key] = undefined
this.getData()
},
// 切换每页显示的条数触发
handleSizeChange(val) {
this.searchData.pageSize = val
this.getData()
},
// 切换页码时触发
handleCurrentChange(val) {
this.searchData.pageNum = val
this.getData()
},
onAddComment(row) {
this.editData = {
title: '添加评论',
data: row
}
this.editComVisible = true
}
}
}
</script>