Explorar o código

更新 admin 相关页面和接口

reghao %!s(int64=2) %!d(string=hai) anos
pai
achega
0c7d7df392

+ 1 - 1
src/api/admin.js

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

+ 2 - 2
src/components/card/SideVideoCard.vue

@@ -21,13 +21,13 @@
         </el-col>
         <el-col :md="16">
           <div style="padding: 14px">
-            <router-link :to="`/video/${video.videoId}`">
+            <router-link style="text-decoration-line: none" :to="`/video/${video.videoId}`">
               <span style="left: 0;margin-bottom: 0px;color: black;">{{ video.title | ellipsis }}</span>
             </router-link>
           </div>
           <div style="padding: 14px">
             <span style="left: 0;margin-bottom: 0px;color: black;">
-              <router-link target="_blank" :to="`/user/${video.user.userId}`">
+              <router-link style="text-decoration-line: none" target="_blank" :to="`/user/${video.user.userId}`">
                 <i class="el-icon-user"> {{ video.user.screenName | ellipsisUsername }} </i></router-link>
             </span>
           </div>

+ 15 - 17
src/components/card/SiteNotice.vue

@@ -1,34 +1,35 @@
 <template>
-  <el-card class="box-card" :body-style="{ paddingTop: '0px' }">
+  <el-card class="box-card">
     <div slot="header" class="clearfix">
       <img src="@/assets/img/icon/speaker.png" alt="" class="recommand-icon">
       <span>站点公告</span>
     </div>
-    <div class="item">
-      <span style="left: 0;margin-bottom: 0px;color: darkslateblue;"> 哈哈哈哈 </span>
+    <div class="text item" style="height: 20vh;">
+      <el-scrollbar style="width: 100%; height: 100%;">
+        <el-row>
+          <span v-html="content" />
+        </el-row>
+      </el-scrollbar>
     </div>
   </el-card>
 </template>
 
 <script>
+import { getSiteNotice } from '@/api/admin'
+
 export default {
   name: 'SiteNotice',
-  filters: {
-    ellipsis(value) {
-      if (!value) return ''
-      const max = 15
-      if (value.length > max) {
-        return value.slice(0, max) + '...'
-      }
-      return value
-    }
-  },
   data() {
     return {
-      dataList: []
+      content: ''
     }
   },
   created() {
+    getSiteNotice().then(resp => {
+      if (resp.code === 0) {
+        this.content = resp.data
+      }
+    })
   },
   methods: {}
 }
@@ -42,9 +43,6 @@ export default {
     bottom: 8px;
     left: 35px;
   }
-  .text {
-    font-size: 14px;
-  }
 }
 
 .item {

+ 1 - 1
src/components/card/VideoCard.vue

@@ -27,7 +27,7 @@
           </div>
         </router-link>
         <div style="padding: 14px">
-          <router-link target="_blank" :to="`/video/${video.videoId}`">
+          <router-link style="text-decoration-line: none" target="_blank" :to="`/video/${video.videoId}`">
             <span style="left: 0;margin-bottom: 0px;color: black;">{{ video.title | ellipsis }}</span>
           </router-link>
         </div>

+ 14 - 2
src/views/admin/DataSource.vue

@@ -9,10 +9,22 @@
         <el-table-column
           prop="title"
           label="Name"
+          width="400px"
         >
           <template slot-scope="scope">
-            <a :href="scope.row.pageUrl" target="_blank">
-              <span>{{ scope.row.title }}</span>
+            <a :href="scope.row.pageUrl" style="text-decoration-line: none" target="_blank">
+              <el-tooltip
+                :content="scope.row.title"
+                raw-content
+                placement="top-start"
+              >
+                <span v-if="scope.row.title.length <= 60">
+                  {{ scope.row.title }}
+                </span>
+                <span v-else>
+                  {{ scope.row.title.substr(0, 55) + "..." }}
+                </span>
+              </el-tooltip>
             </a>
           </template>
         </el-table-column>

+ 56 - 16
src/views/admin/PostList.vue

@@ -26,34 +26,55 @@
           </template>
         </el-table-column>
         <el-table-column
-          prop="videoId"
-          label="视频 ID"
-          width="120"
+          prop="title"
+          label="标题"
+          width="150"
         >
           <template slot-scope="scope">
-            <router-link target="_blank" :to="`/video/${scope.row.videoId}`">
-              <span>{{ scope.row.videoId }}</span>
-            </router-link>
+            <el-tooltip
+              :content="scope.row.title"
+              raw-content
+              placement="top-start"
+            >
+              <router-link style="text-decoration-line: none" target="_blank" :to="`/video/${scope.row.videoId}`">
+                <span v-if="scope.row.title.length <= 15">
+                  {{ scope.row.title }}
+                </span>
+                <span v-else>
+                  {{ scope.row.title.substr(0, 15) + "..." }}
+                </span>
+              </router-link>
+            </el-tooltip>
           </template>
         </el-table-column>
-        <el-table-column
-          prop="title"
-          label="标题"
-          width="150"
-        />
         <el-table-column
           prop="description"
           label="描述"
+          width="150"
         >
           <template slot-scope="scope">
-            <span v-if="scope.row.description === null">-</span>
-            <span v-else>{{ scope.row.description }}</span>
+            <el-tooltip
+              v-if="scope.row.description"
+              :content="scope.row.description"
+              raw-content
+              placement="top-start"
+            >
+              <span v-if="scope.row.description && scope.row.description.length <= 15">
+                {{ scope.row.description }}
+              </span>
+              <span v-if="scope.row.description && scope.row.description.length > 15">
+                {{ scope.row.description.substr(0, 15) + "..." }}
+              </span>
+            </el-tooltip>
+            <span v-else>-</span>
           </template>
         </el-table-column>
         <el-table-column
           prop="duration"
           label="时长"
-        />
+        >
+<!--          <span>59:59:59</span>-->
+        </el-table-column>
         <el-table-column
           prop="direction"
           label="方向"
@@ -120,9 +141,13 @@
         <el-table-column
           fixed="right"
           label="操作"
-          width="280"
+          width="320"
         >
           <template slot-scope="scope">
+            <el-button
+              size="mini"
+              @click="handleCache(scope.$index, scope.row)"
+            >缓存</el-button>
             <el-button
               size="mini"
               @click="handlePreview(scope.$index, scope.row)"
@@ -251,7 +276,8 @@ import {
   deleteVideoPost,
   getVideoResource,
   convertVideo,
-  updateVideoStatus
+  updateVideoStatus,
+  cacheBiliVideo
 } from '@/api/video'
 import { getPostList } from '@/api/admin'
 
@@ -342,6 +368,20 @@ export default {
         }
       })
     },
+    handleCache(index, row) {
+      const bvId = row.videoId
+      cacheBiliVideo(bvId).then(resp => {
+        if (resp.code === 0) {
+          const resData = resp.data
+          this.$notify({
+            title: '提示',
+            message: resData.msg,
+            type: 'warning',
+            duration: 3000
+          })
+        }
+      })
+    },
     handlePreview(index, row) {
       videoInfo(row.videoId).then(res => {
         if (res.code === 0) {

+ 20 - 5
src/views/admin/SiteConfig.vue

@@ -7,7 +7,7 @@
             <span>当前公告</span>
           </div>
           <div class="text item">
-            <span v-html="loginUser.signature" />
+            <span v-html="notice" />
           </div>
         </el-card>
       </el-row>
@@ -20,9 +20,9 @@
             <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdate">更新</el-button>
           </div>
           <div class="text item">
-            <el-form ref="form" :model="loginUser">
+            <el-form ref="form" :model="formData">
               <el-form-item>
-                <el-input v-model="loginUser.signature" type="textarea" autosize style="padding-right: 1px" />
+                <el-input v-model="formData.content" type="textarea" :rows="5" style="padding-right: 1px" />
               </el-form-item>
             </el-form>
           </div>
@@ -34,23 +34,38 @@
 
 <script>
 import { getAuthedUser } from '@/utils/auth'
+import { getSiteNotice, updateSiteNotice } from '@/api/admin'
 
 export default {
   name: 'SiteConfig',
   data() {
     return {
-      loginUser: null
+      loginUser: null,
+      notice: '',
+      formData: {
+        content: null
+      }
     }
   },
   created() {
     document.title = '站点配置'
     this.loginUser = getAuthedUser()
+    getSiteNotice().then(resp => {
+      if (resp.code === 0) {
+        this.notice = resp.data
+      }
+    })
   },
   mounted() {
   },
   methods: {
     onUpdate() {
-      console.log(this.loginUser.signature)
+      updateSiteNotice(this.formData).then(resp => {
+        if (resp.code === 0) {
+          this.notice = this.formData.content
+          this.formData.content = null
+        }
+      })
     }
   }
 }

+ 15 - 5
src/views/admin/UserList.vue

@@ -23,10 +23,9 @@
         <el-table-column
           prop="screenName"
           label="用户名"
-          width="120"
         >
           <template slot-scope="scope">
-            <router-link target="_blank" :to="`/user/${scope.row.userId}`">
+            <router-link style="text-decoration-line: none" target="_blank" :to="`/user/${scope.row.userId}`">
               <span>{{ scope.row.screenName }}</span>
             </router-link>
           </template>
@@ -34,7 +33,6 @@
         <el-table-column
           prop="gender"
           label="性别"
-          width="150"
         >
           <template slot-scope="scope">
             <span v-if="scope.row.gender === 0">女</span>
@@ -47,8 +45,20 @@
           label="签名"
         >
           <template slot-scope="scope">
-            <span v-if="scope.row.signature === null">-</span>
-            <span v-else>{{ scope.row.signature }}</span>
+            <el-tooltip
+              v-if="scope.row.signature"
+              :content="scope.row.signature"
+              raw-content
+              placement="top-start"
+            >
+              <span v-if="scope.row.signature.length <= 15">
+                {{ scope.row.signature }}
+              </span>
+              <span v-else>
+                {{ scope.row.signature.substr(0, 15) + "..." }}
+              </span>
+            </el-tooltip>
+            <span v-else>-</span>
           </template>
         </el-table-column>
         <el-table-column

+ 1 - 1
src/views/home/Index.vue

@@ -3,7 +3,7 @@
     <el-row class="movie-list">
       <el-col :md="12">
         <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-          <site-notice style="height: 270px;" />
+          <site-notice />
         </el-row>
         <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
           <el-carousel :interval="3000" height="300px">

+ 1 - 23
src/views/home/VideoPage.vue

@@ -60,15 +60,6 @@
                 >
                   <span>下载</span>
                 </el-button>
-                <el-button
-                  v-if="video.cache != null"
-                  type="danger"
-                  size="mini"
-                  icon="el-icon-download"
-                  @click="cacheBiliVideo(video.videoId)"
-                >
-                  <span>{{ video.cache.msg }}</span>
-                </el-button>
                 <el-button
                   type="danger"
                   size="mini"
@@ -216,7 +207,7 @@ import SideVideoCard from 'components/card/SideVideoCard'
 import UserAvatarCard from '@/components/card/UserAvatarCard'
 import comment from '@/components/comment'
 
-import { similarVideo, videoInfo, videoErrorReport, downloadVideo, cacheBiliVideo, getShortUrl } from '@/api/video'
+import { similarVideo, videoInfo, videoErrorReport, downloadVideo, getShortUrl } from '@/api/video'
 import { collectItem } from '@/api/collect'
 import { getUserInfo } from '@/api/user'
 import { submitAccessCode } from '@/api/content'
@@ -498,19 +489,6 @@ export default {
         })
       })
     },
-    cacheBiliVideo(bvId) {
-      cacheBiliVideo(bvId).then(resp => {
-        if (resp.code === 0) {
-          const resData = resp.data
-          this.$notify({
-            title: '提示',
-            message: resData.msg,
-            type: 'warning',
-            duration: 3000
-          })
-        }
-      })
-    },
     submitAccessCodeWrapper() {
       submitAccessCode(this.accessCodeForm).then(resp => {
         if (resp.code === 0) {

+ 33 - 4
src/views/post/VideoPost.vue

@@ -39,15 +39,44 @@
         <el-table-column
           prop="title"
           label="标题"
-          width="150"
-        />
+          :show-overflow-tooltip="true"
+        >
+          <template slot-scope="scope">
+            <el-tooltip
+              v-if="scope.row.title"
+              :content="scope.row.title"
+              raw-content
+              placement="top-start"
+            >
+              <span v-if="scope.row.title.length <= 15">
+                {{ scope.row.title }}
+              </span>
+              <span v-else>
+                {{ scope.row.title.substr(0, 15) + "..." }}
+              </span>
+            </el-tooltip>
+          </template>
+        </el-table-column>
         <el-table-column
           prop="description"
           label="描述"
+          :show-overflow-tooltip="true"
         >
           <template slot-scope="scope">
-            <span v-if="scope.row.description !== null">-</span>
-            <span v-else>{{ scope.row.description }}</span>
+            <el-tooltip
+              v-if="scope.row.description"
+              :content="scope.row.description"
+              raw-content
+              placement="top-start"
+            >
+              <span v-if="scope.row.description && scope.row.description.length <= 15">
+                {{ scope.row.description }}
+              </span>
+              <span v-if="scope.row.description && scope.row.description.length > 15">
+                {{ scope.row.description.substr(0, 15) + "..." }}
+              </span>
+            </el-tooltip>
+            <span v-else-if="scope.row.description === null">-</span>
           </template>
         </el-table-column>
         <el-table-column