| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543 |
- <template>
- <el-row>
- <el-col :md="2">
- <el-menu
- :default-active="this.$route.path"
- router
- class="el-menu-vertical-demo"
- >
- <el-menu-item v-for="(item,i) in navList" :key="i" :index="item.path">
- <i :class="item.icon" />
- <span slot="title">{{ item.name }}</span>
- </el-menu-item>
- </el-menu>
- </el-col>
- <el-col :md="22">
- <el-tabs v-model="activeName" @tab-click='tabClick'>
- <el-tab-pane label="视频" name="video">
- <el-row :md="6" :sm="12" :xs="12">
- <el-table
- :data="dataList"
- style="width: 100%"
- >
- <el-table-column
- type="index">
- </el-table-column>
- <el-table-column
- prop="pubDate"
- label="发布时间">
- </el-table-column>
- <el-table-column
- prop="coverUrl"
- label="封面"
- width="80">
- <template slot-scope="scope">
- <el-image :src="scope.row.coverUrl" min-width="40" height="30" />
- </template>
- </el-table-column>
- <el-table-column
- prop="videoId"
- label="视频 ID">
- <template slot-scope="scope">
- <router-link target="_blank" :to="`/video/${scope.row.videoId}`">
- <span>{{scope.row.videoId}}</span>
- </router-link>
- </template>
- </el-table-column>
- <el-table-column
- prop="title"
- label="标题">
- </el-table-column>
- <el-table-column
- prop="description"
- label="描述">
- </el-table-column>
- <el-table-column
- prop="scope"
- label="可见范围">
- <template slot-scope="scope">
- <el-tooltip class="item" effect="dark" content="点击修改视频可见范围" placement="top-end">
- <el-button
- v-if="scope.row.scope === 1"
- size="mini"
- @click="handleScope(scope.$index, scope.row)">所有人可见</el-button>
- <el-button
- v-else-if="scope.row.scope === 2"
- size="mini"
- type="success"
- @click="handleScope(scope.$index, scope.row)">VIP 可见</el-button>
- <el-button
- v-else-if="scope.row.scope === 3"
- size="mini"
- type="warning"
- @click="handleScope(scope.$index, scope.row)">验证码可见</el-button>
- <el-button
- v-else
- size="mini"
- type="danger"
- @click="handleScope(scope.$index, scope.row)">本人可见</el-button>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column
- prop="scope"
- label="审核状态">
- <template slot-scope="scope">
- <el-tag v-if="scope.row.status === 1" :type="'warning'" disable-transitions>
- 审核中
- </el-tag>
- <el-tag v-else-if="scope.row.status === 2" :type="'success'" disable-transitions>
- 审核通过
- </el-tag>
- <el-tag v-else :type="'danger'" disable-transitions>
- 审核未通过
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="210">
- <template slot-scope="scope">
- <el-button
- size="mini"
- @click="handlePreview(scope.$index, scope.row)">预览</el-button>
- <el-button
- size="mini"
- @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
- <el-button
- size="mini"
- type="danger"
- @click="handleDelete(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="相册" name="image">
- <el-row :md="6" :sm="12" :xs="12">
- <el-table
- :data="dataList"
- style="width: 100%"
- >
- <el-table-column
- type="index">
- </el-table-column>
- <el-table-column
- prop="coverUrl"
- label="相册封面"
- width="150">
- <template slot-scope="scope">
- <el-image :src="scope.row.coverUrl" min-width="40" height="30" />
- </template>
- </el-table-column>
- <el-table-column
- prop="pubDate"
- label="发布时间">
- </el-table-column>
- <el-table-column
- prop="albumName"
- label="相册名字"
- width="180">
- </el-table-column>
- <el-table-column
- prop="total"
- label="图片数量">
- </el-table-column>
- <el-table-column
- prop="scope"
- label="可见范围">
- <template slot-scope="scope">
- <el-tag v-if="scope.row.viewCount === 1" disable-transitions>
- 全部可见
- </el-tag>
- <el-tag v-else-if="scope.row.viewCount === 2" :type="'success'" disable-transitions>
- VIP 可见
- </el-tag>
- <el-tag v-else-if="scope.row.viewCount === 3" :type="'warning'" disable-transitions>
- 验证码可见
- </el-tag>
- <el-tag v-else :type="'danger'" disable-transitions>
- 本人可见
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <el-button
- size="mini"
- @click="handleEditImage(scope.$index, scope.row)">编辑</el-button>
- <el-button
- size="mini"
- type="danger"
- @click="handleDeleteImage(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="音频" name="audio">
- <el-row :md="6" :sm="12" :xs="12">
- <el-table
- :data="dataList"
- style="width: 100%"
- >
- <el-table-column
- type="index">
- </el-table-column>
- <el-table-column
- prop="coverUrl"
- label="音频封面"
- width="150">
- <template slot-scope="scope">
- <el-image :src="scope.row.coverUrl" min-width="40" height="30" />
- </template>
- </el-table-column>
- <el-table-column
- prop="pubDate"
- label="发布时间">
- </el-table-column>
- <el-table-column
- prop="title"
- label="音频名字">
- </el-table-column>
- <!-- <el-table-column
- prop="description"
- label="音频简介">
- </el-table-column>-->
- <el-table-column
- prop="scope"
- label="可见范围">
- <template slot-scope="scope">
- <el-tag v-if="scope.row.viewCount === 1" disable-transitions>
- 全部可见
- </el-tag>
- <el-tag v-else-if="scope.row.viewCount === 2" :type="'success'" disable-transitions>
- VIP 可见
- </el-tag>
- <el-tag v-else-if="scope.row.viewCount === 3" :type="'warning'" disable-transitions>
- 验证码可见
- </el-tag>
- <el-tag v-else :type="'danger'" disable-transitions>
- 本人可见
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <el-button
- size="mini"
- @click="handleEditAudio(scope.$index, scope.row)">编辑</el-button>
- <el-button
- size="mini"
- type="danger"
- @click="handleDeleteAudio(scope.$index, scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- </el-tab-pane>
- <el-tab-pane label="文章" name="article">
- <span>
- <h4>文章稿件</h4>
- </span>
- </el-tab-pane>
- </el-tabs>
- </el-col>
- <!-- 修改视频可见范围对话框 -->
- <el-dialog
- append-to-body
- :visible.sync="showEditScopeDialog"
- width="30%"
- center
- >
- <el-card class="box-card">
- <div slot="header" class="clearfix">
- <span>修改视频可见范围</span>
- <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateVideoScope">更新</el-button>
- </div>
- <div class="text item">
- <el-form ref="form" :model="form" label-width="80px">
- <el-form-item label="可见范围">
- <el-select v-model="form.scope" placeholder="选择可见范围">
- <el-option label="所有人可见" value="1" />
- <el-option label="验证码可见" value="2" />
- <el-option label="VIP 可见" value="3" />
- <el-option label="仅自己可见" value="4" />
- </el-select>
- </el-form-item>
- </el-form>
- </div>
- </el-card>
- </el-dialog>
- <!-- 视频预览对话框 -->
- <el-dialog
- title="预览视频"
- append-to-body
- :visible.sync="showPreviewDialog"
- :before-close="handleDialogClose"
- width="70%"
- center
- >
- <template>
- <video-preview-player :video-prop.sync="this.videoProp"/>
- </template>
- </el-dialog>
- </el-row>
- </template>
- <script>
- import VideoPreviewPlayer from 'components/VideoPreviewPlayer'
- import {userVideoPost, updateVideoScope, videoInfo, deleteVideo} from "@/api/video";
- import {getUserAlbums} from "@/api/image";
- import { getUserAudio } from "@/api/audio";
- export default {
- name: 'PostList',
- components: { VideoPreviewPlayer },
- data() {
- return {
- navList: [
- { path: '/post/publish', name: '发布', icon: 'el-icon-upload' },
- { path: '/post/list', name: '稿件', icon: 'el-icon-files' },
- { path: '/post/analysis', name: '数据', icon: 'el-icon-data-analysis' }
- ],
- activeName: 'video',
- userId: 10001,
- dataList: [],
- showPreviewDialog: false,
- videoProp: null,
- showEditScopeDialog: false,
- form: {
- videoId: null,
- scope: null
- }
- }
- },
- created() {
- document.title = "稿件列表"
- const path = this.$route.path
- if (path.endsWith("video")) {
- this.activeName = 'video'
- document.title = '视频稿件'
- } else if (path.endsWith("image")) {
- this.activeName = 'image'
- document.title = '图片稿件'
- } else if (path.endsWith("audio")) {
- this.activeName = 'audio'
- document.title = '音频稿件'
- } else if (path.endsWith("article")) {
- this.activeName = 'article'
- document.title = '文章稿件'
- }
- this.getData()
- },
- watch: {
- $route(){
- this.$router.go()
- }
- },
- methods: {
- handleScope(index, row) {
- this.form.videoId = row.videoId
- this.form.scope = row.scope
- this.showEditScopeDialog = true
- },
- handleDialogClose(done) {
- this.showPreviewDialog = false
- this.videoProp = {
- videoId: null,
- play: false
- }
- done()
- },
- handlePreview(index, row) {
- videoInfo(row.videoId).then(res => {
- if (res.code === 0) {
- this.showPreviewDialog = true
- this.videoProp = {
- videoId: res.data.videoId,
- play: true
- }
- }
- })
- console.log('预览 ' + row.videoId);
- },
- handleEdit(index, row) {
- console.log(row.videoId);
- const path = '/post/edit/video/' + row.videoId
- this.$router.push(path)
- },
- handleDelete(index, row) {
- deleteVideo(row.videoId).then(res => {
- if (res.code === 0) {
- this.$notify({
- title: '提示',
- message: '视频稿件已删除',
- type: 'warning',
- duration: 3000
- })
- this.$router.go(0)
- }
- })
- },
- handleEditImage(index, row) {
- console.log(row.videoId);
- const path = '/post/edit/album/' + row.albumId
- this.$router.push(path)
- },
- handleDeleteImage(index, row) {
- console.log(row.videoId);
- },
- handleEditAudio(index, row) {
- console.log(row.videoId);
- const path = '/post/edit/audio/' + row.audioId
- this.$router.push(path)
- },
- handleDeleteAudio(index, row) {
- console.log(row.videoId);
- },
- tabClick(tab) {
- this.activeName = tab.name
- this.goToTab(this.activeName)
- },
- goToTab(activeName) {
- const path = '/post/' + activeName
- if (this.$route.path === path) {
- this.$router.go(0)
- return
- }
- this.$router.push(path)
- },
- getData() {
- this.dataList = []
- if (this.activeName === 'video') {
- userVideoPost(1, this.userId, 1).then(res => {
- if (res.code === 0) {
- const resData = res.data.list
- if (resData.length !== 0) {
- this.showEmpty = false
- for (const item of resData) {
- this.dataList.push(item)
- }
- } else {
- this.showEmpty = true
- }
- } else {
- this.$notify({
- title: '提示',
- message: res.msg,
- type: 'warning',
- duration: 3000
- })
- }
- }).catch(error => {
- this.$notify({
- title: '提示',
- message: error.message,
- type: 'error',
- duration: 3000
- })
- })
- } else if (this.activeName === 'image') {
- getUserAlbums(this.userId).then(res => {
- if (res.code === 0) {
- const resData = res.data
- if (resData.length !== 0) {
- this.showEmpty = false
- for (const item of resData) {
- this.dataList.push(item)
- }
- } else {
- this.showEmpty = true
- }
- }
- })
- } else if (this.activeName === 'audio') {
- this.currentPage = 1
- this.lastId = 0
- getUserAudio(this.userId).then(res => {
- if (res.code === 0) {
- const resData = res.data.list
- if (resData.length !== 0) {
- this.showEmpty = false
- for (const item of resData) {
- this.dataList.push(item)
- }
- } else {
- this.showEmpty = true
- }
- }
- })
- } else if (this.activeName === 'article') {
- this.currentPage = 1
- this.lastId = 0
- }
- },
- onUpdateVideoScope() {
- this.showEditScopeDialog = false
- updateVideoScope(this.form).then(res => {
- if (res.code === 0) {
- this.$notify({
- title: '提示',
- message: '视频可见范围已更新',
- type: 'warning',
- duration: 3000
- })
- }
- }).catch(error => {
- this.$notify({
- title: '提示',
- message: error.message,
- type: 'warning',
- duration: 3000
- })
- })
- }
- }
- }
- </script>
- <style>
- .uploader-example {
- width: 500px;
- padding: 15px;
- margin: 40px auto 0;
- font-size: 12px;
- box-shadow: 0 0 10px rgba(0, 0, 0, .4);
- }
- .uploader-example .uploader-btn {
- margin-right: 4px;
- }
- .uploader-example .uploader-list {
- max-height: 440px;
- overflow: auto;
- overflow-x: hidden;
- overflow-y: auto;
- }
- .avatar-uploader .el-upload {
- border: 1px dashed #d9d9d9;
- border-radius: 6px;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- }
- .avatar-uploader .el-upload:hover {
- border-color: #409EFF;
- }
- .avatar-uploader-icon {
- font-size: 28px;
- color: #8c939d;
- width: 320px;
- height: 240px;
- line-height: 178px;
- text-align: center;
- }
- .avatar {
- width: 320px;
- height: 240px;
- display: block;
- }
- </style>
|