Sfoglia il codice sorgente

更新 admin 相关页面和接口

reghao 2 anni fa
parent
commit
07a7c14753

+ 2 - 2
src/api/admin.js

@@ -2,8 +2,8 @@ import { get, post } from '@/utils/request'
 
 const adminApi = {
   siteNoticeApi: '/api/user/account/check/username',
-  userListApi: '/api/user/account/check/username',
-  postListApi: '/api/user/account/select/username',
+  userListApi: '/api/user/list',
+  postListApi: '/api/content/post',
   dataSourceApi: '/api/spider/data/source'
 }
 

+ 6 - 0
src/api/video.js

@@ -3,6 +3,7 @@ import { get, post, delete0 } from '@/utils/request'
 const videoApi = {
   videoPostApi: '/api/content/post/video',
   updateVideoScopeApi: '/api/content/post/video/update/scope',
+  updateVideoStatusApi: '/api/content/post/video/update/status',
   updateVideoInfoApi: '/api/content/post/video/update/info',
   updateVideoCoverApi: '/api/content/post/video/update/cover',
   updateVideoFileApi: '/api/content/post/video/update/file',
@@ -40,6 +41,11 @@ export function updateVideoScope(data) {
   return post(videoApi.updateVideoScopeApi, data)
 }
 
+// 更新视频状态
+export function updateVideoStatus(data) {
+  return post(videoApi.updateVideoStatusApi, data)
+}
+
 // 更新视频信息
 export function updateVideoInfo(data) {
   return post(videoApi.updateVideoInfoApi, data)

+ 36 - 59
src/views/admin/PostList.vue

@@ -46,7 +46,7 @@
           label="描述"
         >
           <template slot-scope="scope">
-            <span v-if="scope.row.description !== null">-</span>
+            <span v-if="scope.row.description === null">-</span>
             <span v-else>{{ scope.row.description }}</span>
           </template>
         </el-table-column>
@@ -64,31 +64,18 @@
           width="120"
         >
           <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)"
-              >所有人可见</el-button>
-              <el-button
-                v-else-if="scope.row.scope === 3"
-                size="mini"
-                type="warning"
-                @click="handleScope(scope.$index, scope.row)"
-              >VIP 可见</el-button>
-              <el-button
-                v-else
-                size="mini"
-                type="danger"
-                @click="handleScope(scope.$index, scope.row)"
-              >验证码可见</el-button>
-            </el-tooltip>
+            <el-tag v-if="scope.row.scope === 1" :type="'warning'" disable-transitions>
+              本人可见
+            </el-tag>
+            <el-tag v-else-if="scope.row.scope === 2" :type="'success'" disable-transitions>
+              所有人可见
+            </el-tag>
+            <el-tag v-else-if="scope.row.scope === 3" :type="'danger'" disable-transitions>
+              VIP 可见
+            </el-tag>
+            <el-tag v-else :type="'danger'" disable-transitions>
+              验证码可见
+            </el-tag>
           </template>
         </el-table-column>
         <el-table-column
@@ -130,16 +117,6 @@
           prop="duration"
           label="发布用户"
         />
-        <el-table-column
-          label="视频资源"
-        >
-          <template slot-scope="scope">
-            <el-button
-              size="mini"
-              @click="handleVideoResource(scope.$index, scope.row)"
-            >查看</el-button>
-          </template>
-        </el-table-column>
         <el-table-column
           fixed="right"
           label="操作"
@@ -153,12 +130,11 @@
             <el-button
               size="mini"
               @click="handleEdit(scope.$index, scope.row)"
-            >编辑</el-button>
+            >审核</el-button>
             <el-button
               size="mini"
-              type="danger"
-              @click="handleDelete(scope.$index, scope.row)"
-            >删除</el-button>
+              @click="handleVideoResource(scope.$index, scope.row)"
+            >资源</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -216,7 +192,7 @@
           </el-table-column>
         </el-table>
       </el-dialog>
-      <!-- 修改视频可见范围对话框 -->
+      <!-- 稿件审核对话框 -->
       <el-dialog
         append-to-body
         :visible.sync="showEditScopeDialog"
@@ -225,11 +201,11 @@
       >
         <el-card class="box-card">
           <div slot="header" class="clearfix">
-            <span>修改视频可见范围</span>
-            <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateScope">更新</el-button>
+            <span>稿件审核</span>
+            <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateStatus">更新</el-button>
           </div>
           <div class="text item">
-            <el-select v-model="form.scope" placeholder="选择可见范围">
+            <el-select v-model="form.scope" placeholder="选择审核结果">
               <el-option label="本人可见" value="1" />
               <el-option label="所有人可见" value="2" />
               <el-option label="VIP 可见" value="3" />
@@ -248,7 +224,7 @@
         center
       >
         <template>
-          <video-preview-player :video-prop.sync="this.videoProp" />
+          <video-preview-player :video-prop.sync="videoProp" />
         </template>
       </el-dialog>
     </el-row>
@@ -270,7 +246,14 @@
 
 <script>
 import VideoPreviewPlayer from 'components/VideoPreviewPlayer'
-import { updateVideoScope, videoInfo, deleteVideoPost, getVideoResource, convertVideo, getVideoPosts } from '@/api/video'
+import {
+  videoInfo,
+  deleteVideoPost,
+  getVideoResource,
+  convertVideo,
+  updateVideoStatus
+} from '@/api/video'
+import { getPostList } from '@/api/admin'
 
 export default {
   name: 'PostList',
@@ -280,7 +263,7 @@ export default {
       // 屏幕宽度, 为了控制分页条的大小
       screenWidth: document.body.clientWidth,
       currentPage: 1,
-      pageSize: 12,
+      pageSize: 20,
       totalSize: 0,
       dataList: [],
       // **********************************************************************
@@ -290,7 +273,7 @@ export default {
       showPreviewDialog: false,
       form: {
         videoId: null,
-        scope: 1
+        scope: '1'
       },
       videoResources: []
     }
@@ -308,7 +291,7 @@ export default {
     },
     getData() {
       this.dataList = []
-      getVideoPosts(this.currentPage).then(resp => {
+      getPostList(this.currentPage).then(resp => {
         if (resp.code === 0) {
           this.dataList = resp.data.list
           this.totalSize = resp.data.totalSize
@@ -339,11 +322,6 @@ export default {
         }
       })
     },
-    handleScope(index, row) {
-      this.form.videoId = row.videoId
-      this.form.scope = '' + row.scope
-      this.showEditScopeDialog = true
-    },
     handleDialogClose(done) {
       this.showPreviewDialog = false
       this.videoProp = {
@@ -376,8 +354,7 @@ export default {
       })
     },
     handleEdit(index, row) {
-      const path = '/my/post/edit/video/' + row.videoId
-      this.$router.push(path)
+      this.showEditScopeDialog = true
     },
     handleDelete(index, row) {
       this.$confirm('确定要删除 ' + row.title + '?', '提示', {
@@ -403,13 +380,13 @@ export default {
         })
       })
     },
-    onUpdateScope() {
+    onUpdateStatus() {
       this.showEditScopeDialog = false
-      updateVideoScope(this.form).then(res => {
+      updateVideoStatus(this.form).then(res => {
         if (res.code === 0) {
           this.$notify({
             title: '提示',
-            message: '视频可见范围已更新',
+            message: '稿件状态已更新',
             type: 'warning',
             duration: 3000
           })

+ 1 - 1
src/views/admin/SiteConfig.vue

@@ -7,7 +7,7 @@
             <span>当前公告</span>
           </div>
           <div class="text item">
-            <span v-html="loginUser.signature"></span>
+            <span v-html="loginUser.signature" />
           </div>
         </el-card>
       </el-row>

+ 38 - 86
src/views/admin/UserList.vue

@@ -12,49 +12,55 @@
           type="index"
         />
         <el-table-column
-          prop="coverUrl"
+          prop="avatarUrl"
           label="头像"
           width="90"
         >
           <template slot-scope="scope">
-            <el-image :src="scope.row.coverUrl" min-width="30" height="20" />
+            <el-image :src="scope.row.avatarUrl" min-width="30" height="20" />
           </template>
         </el-table-column>
         <el-table-column
-          prop="videoId"
-          label="用户 ID"
+          prop="screenName"
+          label="用户"
           width="120"
         >
           <template slot-scope="scope">
-            <router-link target="_blank" :to="`/video/${scope.row.videoId}`">
-              <span>{{ scope.row.videoId }}</span>
+            <router-link target="_blank" :to="`/user/${scope.row.userId}`">
+              <span>{{ scope.row.screenName }}</span>
             </router-link>
           </template>
         </el-table-column>
         <el-table-column
-          prop="title"
+          prop="gender"
           label="性别"
           width="150"
-        />
+        >
+          <template slot-scope="scope">
+            <span v-if="scope.row.gender === 0">女</span>
+            <span v-else-if="scope.row.gender === 1">男</span>
+            <span v-else>未知</span>
+          </template>
+        </el-table-column>
         <el-table-column
-          prop="description"
+          prop="signature"
           label="签名"
         >
           <template slot-scope="scope">
-            <span v-if="scope.row.description !== null">-</span>
-            <span v-else>{{ scope.row.description }}</span>
+            <span v-if="scope.row.signature === null">-</span>
+            <span v-else>{{ scope.row.signature }}</span>
           </template>
         </el-table-column>
         <el-table-column
-          prop="duration"
+          prop="following"
           label="关注数"
         />
         <el-table-column
-          prop="direction"
+          prop="follower"
           label="粉丝数"
         />
         <el-table-column
-          prop="scope"
+          prop="userId"
           label="帐号状态"
           width="120"
         >
@@ -76,22 +82,16 @@
         <el-table-column
           fixed="right"
           label="操作"
-          width="280"
         >
           <template slot-scope="scope">
             <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-dialog
         append-to-body
         :visible.sync="showEditScopeDialog"
@@ -100,15 +100,14 @@
       >
         <el-card class="box-card">
           <div slot="header" class="clearfix">
-            <span>修改视频可见范围</span>
-            <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateScope">更新</el-button>
+            <span>修改帐号状态</span>
+            <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateStatus">更新</el-button>
           </div>
           <div class="text item">
-            <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 v-model="form.scope" placeholder="设置帐号状态">
+              <el-option label="正常" value="1" />
+              <el-option label="禁言" value="2" />
+              <el-option label="封禁" value="3" />
             </el-select>
           </div>
         </el-card>
@@ -131,7 +130,7 @@
 </template>
 
 <script>
-import { updateVideoScope, videoInfo, deleteVideoPost, getVideoResource, convertVideo, getVideoPosts } from '@/api/video'
+import { getUserList } from '@/api/admin'
 
 export default {
   name: 'UserList',
@@ -140,23 +139,21 @@ export default {
       // 屏幕宽度, 为了控制分页条的大小
       screenWidth: document.body.clientWidth,
       currentPage: 1,
-      pageSize: 12,
+      pageSize: 20,
       totalSize: 0,
       dataList: [],
       // **********************************************************************
-      videoProp: null,
-      showVideoResourceDialog: false,
       showEditScopeDialog: false,
-      showPreviewDialog: false,
       form: {
         videoId: null,
-        scope: 1
+        scope: '1'
       },
       videoResources: []
     }
   },
   created() {
     document.title = '用户列表'
+    this.getData()
   },
   methods: {
     handleCurrentChange(pageNumber) {
@@ -167,7 +164,7 @@ export default {
     },
     getData() {
       this.dataList = []
-      getVideoPosts(this.currentPage).then(resp => {
+      getUserList(this.currentPage).then(resp => {
         if (resp.code === 0) {
           this.dataList = resp.data.list
           this.totalSize = resp.data.totalSize
@@ -193,60 +190,15 @@ export default {
       this.form.scope = '' + row.scope
       this.showEditScopeDialog = true
     },
-    handleDialogClose(done) {
-      this.showPreviewDialog = false
-      this.videoProp = {
-        videoId: null,
-        play: false
-      }
-      done()
-    },
     handleEdit(index, row) {
-      const path = '/my/post/edit/video/' + row.videoId
-      this.$router.push(path)
-    },
-    handleDelete(index, row) {
-      this.$confirm('确定要删除 ' + row.title + '?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        deleteVideoPost(row.videoId).then(res => {
-          if (res.code === 0) {
-            this.$notify({
-              title: '提示',
-              message: '稿件已删除',
-              type: 'warning',
-              duration: 3000
-            })
-            this.$router.go(0)
-          }
-        })
-      }).catch(() => {
-        this.$message({
-          type: 'info',
-          message: '已取消'
-        })
-      })
+      this.showEditScopeDialog = true
     },
-    onUpdateScope() {
+    onUpdateStatus() {
       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
-        })
+      this.$notify({
+        message: '接口未实现',
+        type: 'warning',
+        duration: 3000
       })
     }
   }

+ 1 - 1
src/views/post/VideoPost.vue

@@ -168,7 +168,7 @@
         center
       >
         <template>
-          <video-preview-player :video-prop.sync="this.videoProp" />
+          <video-preview-player :video-prop.sync="videoProp" />
         </template>
       </el-dialog>
     </el-row>