fix:项目初始化
This commit is contained in:
@@ -0,0 +1,305 @@
|
||||
|
||||
<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="请输入合集ID" clearable v-model.number="searchData.id" @clear="onClear('id')" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input placeholder="请输入合集名称" clearable v-model="searchData.name" @clear="onClear('name')" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input placeholder="请输入用户ID" clearable v-model.number="searchData.userId" @clear="onClear('userId')" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select placeholder="请选择内容类型" clearable v-model="searchData.objectType" @clear="onClear('objectType')">
|
||||
<el-option v-for="item in contentTypeList" :key="item.label+item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select placeholder="是否启用" clearable v-model="searchData.status" @clear="onClear('status')">
|
||||
<el-option label="启用" :value="true" />
|
||||
<el-option label="未启用" :value="false" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input placeholder="请输入圈子ID" clearable v-model.number="searchData.circleId" @clear="onClear('circleId')" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select placeholder="请选择视频所属位置" clearable v-model="searchData.location" @clear="onClear('location')">
|
||||
<el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in locationList" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="onSearch" 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-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-table :data="resData" element-loading-text="拼命加载中" border height="750" highlight-current-row style="width: 100%" v-loading="loading" :row-style="{ height: '70px' }">
|
||||
|
||||
<el-table-column align="center" label="合集ID">
|
||||
<template slot-scope="scope">{{ scope.row.id }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="用户ID">
|
||||
<template slot-scope="scope">{{ scope.row.userId }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="圈子">
|
||||
<template slot-scope="scope">{{ scope.row.circleId }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="合集名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="合集所属位置">
|
||||
<template slot-scope="scope">{{ scope.row.location | changeLocation}}</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.avatar"></ShowImg>
|
||||
</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.background"></ShowImg>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="视频类型">
|
||||
<template slot-scope="scope">{{ scope.row.contentType | changeContentType }}</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.count }}</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="售卖次数">
|
||||
<template slot-scope="scope">{{ scope.row.sells }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="观看次数">
|
||||
<template slot-scope="scope">{{ scope.row.watches }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="点赞次数">
|
||||
<template slot-scope="scope">{{ scope.row.likes }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否启用" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button :type="scope.row.status ? 'success' : 'danger'" plain size="mini">{{ scope.row.status ? "已启用" : "未启用" }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="详细描述" width="350">
|
||||
<template slot-scope="scope">{{ scope.row.desc }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建时间" width="180">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.createdAt | BeiJingTime
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="更新时间" width="180">
|
||||
<template slot-scope="scope">{{
|
||||
scope.row.updatedAt | BeiJingTime
|
||||
}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="showMediaList(scope.$index, scope.row)" size="mini" type="primary">查看视频列表</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 :mediacollectcategoryListData="mediacollectcategoryListData" :circleList="circleList" :data="editData" v-if="editVisible" @close="closeEdit" />
|
||||
<MediaList :data="editData" v-if="mediaListVisible" @close="closeEdit" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// 引入模块
|
||||
import Edit from './components/AddOrEdit'
|
||||
import MediaList from './components/mediaList'
|
||||
import {
|
||||
mediacollDel,
|
||||
mediacollList,
|
||||
} from '@/api/videoManagement/collectionList'
|
||||
import ShowImg from '@/components/ShowImg/index.vue'
|
||||
import { contentTypeList,locationList } from '@/filters/mediaLibrary/videoList'
|
||||
import { circleListSearch } from '@/api/user/circleList'
|
||||
import {
|
||||
mediacollectcategoryList
|
||||
|
||||
} from '@/api/videoManagement/videoCollectCategory'
|
||||
export default {
|
||||
name: 'CollectionList',
|
||||
components: {
|
||||
Edit,
|
||||
ShowImg,
|
||||
MediaList,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
contentTypeList: contentTypeList(),
|
||||
locationList:locationList(),
|
||||
mediacollectcategoryListData:[],
|
||||
circleList:[],
|
||||
// 请求列表参数
|
||||
searchData: {
|
||||
circleId: undefined,
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
objectType: undefined,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: undefined,
|
||||
userId: undefined,
|
||||
},
|
||||
resData: [], // el-table表格数据
|
||||
editVisible: false, // 新增或编辑弹出框
|
||||
mediaListVisible: false,
|
||||
total: 0, // 数据总条数
|
||||
loading: true, // 列表加载状态
|
||||
// 编辑数据
|
||||
editData: {
|
||||
title: '新增',
|
||||
data: {},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
// this.getMediacollectcategoryList()
|
||||
this.getCircleListSearch()
|
||||
this.onSearch()
|
||||
},
|
||||
methods: {
|
||||
// TODO:请求视频合集分类列表数据
|
||||
// getMediacollectcategoryList() {
|
||||
// mediacollectcategoryList({
|
||||
// pageSize:500,
|
||||
// pageNum:1
|
||||
// }).then((res) => {
|
||||
// if (res.code === 200) {
|
||||
// this.mediacollectcategoryListData = res.data.list
|
||||
// } else {
|
||||
// this.$message.error('请求列表失败!')
|
||||
// this.mediacollectcategoryListData = []
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// TODO:请求圈子列表数据
|
||||
getCircleListSearch() {
|
||||
circleListSearch({ pageNum: 1, pageSize: 5000 }).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.circleList = res.data.list
|
||||
} else {
|
||||
this.$message.error('请求圈子列表失败!')
|
||||
this.circleList = []
|
||||
}
|
||||
})
|
||||
},
|
||||
// TODO:请求合集列表数据
|
||||
getMediacollList() {
|
||||
this.loading = true
|
||||
mediacollList(this.searchData).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.resData = res.data.list
|
||||
this.total = 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(() => {
|
||||
mediacollDel({ id: row.id }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.getMediacollList()
|
||||
this.$message.success('成功删除')
|
||||
} else {
|
||||
this.$message.error(res.tip)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
onSearch() {
|
||||
this.searchData.pageNum = 1
|
||||
this.searchData.pageSize = 10
|
||||
this.getMediacollList()
|
||||
},
|
||||
|
||||
// 切换每页数据量
|
||||
handleSizeChange(val) {
|
||||
this.searchData.pageSize = val
|
||||
this.getMediacollList()
|
||||
},
|
||||
// 切换页数
|
||||
handleCurrentChange(val) {
|
||||
this.searchData.pageNum = val
|
||||
this.getMediacollList()
|
||||
},
|
||||
|
||||
// 新增按钮
|
||||
add() {
|
||||
this.editVisible = true
|
||||
this.editData = {
|
||||
title: '新增',
|
||||
data: {},
|
||||
}
|
||||
},
|
||||
// 编辑按钮
|
||||
handleEdit(index, row) {
|
||||
this.editVisible = true
|
||||
this.editData = {
|
||||
title: '编辑',
|
||||
data: row,
|
||||
}
|
||||
},
|
||||
|
||||
// 查看视频列表
|
||||
showMediaList(index, row) {
|
||||
this.mediaListVisible = true
|
||||
this.editData = {
|
||||
title: '视频列表',
|
||||
type: 2,
|
||||
data: row,
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭编辑弹窗
|
||||
closeEdit() {
|
||||
this.editData = {
|
||||
title: '新增',
|
||||
data: {},
|
||||
}
|
||||
this.editVisible = false
|
||||
this.mediaListVisible = false
|
||||
this.getMediacollList()
|
||||
},
|
||||
// 清空某一项筛选列表
|
||||
onClear(key) {
|
||||
this.searchData[key] = undefined
|
||||
this.getMediacollList()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user