Explorar o código

update ShortVideo.vue

reghao hai 9 meses
pai
achega
c8eab7224c
Modificáronse 1 ficheiros con 11 adicións e 50 borrados
  1. 11 50
      src/views/home/ShortVideo.vue

+ 11 - 50
src/views/home/ShortVideo.vue

@@ -20,7 +20,7 @@
             </el-row>
           </div>
           <div class="text item">
-            <video-player :video-prop="video" />
+            <div id="dplayer" ref="dplayer" style="height: 480px;" />
           </div>
         </el-card>
       </el-row>
@@ -183,15 +183,13 @@
 </template>
 
 <script>
-import VideoPlayer from 'components/VideoPlayer'
 import UserAvatarCard from '@/components/card/UserAvatarCard'
-import comment from '@/components/comment'
 
-import { similarVideo, videoErrorReport, downloadVideo, getShortUrl, getShortVideo } from '@/api/video'
-import { collectItem, createAlbum, getUserPlaylist } from '@/api/collect'
+import DPlayer from 'dplayer'
+import { videoUrl } from '@/api/video'
+import { getShortVideo } from '@/api/video'
 import { getUserInfo } from '@/api/user'
-import { publishComment, getComment } from '@/api/comment'
-import { getAuthedUser } from '@/utils/auth'
+import { getAccessToken } from '@/utils/auth'
 
 export default {
   name: 'ShortVideo',
@@ -246,52 +244,15 @@ export default {
       videoId: null,
       video: null,
       user: null,
-      similarVideos: [],
-      isCollected: false,
-      showPlaylistDialog: false,
-      playlist: [],
-      accessCodeForm: {
-        contentId: null,
-        contentType: 1002,
-        accessCode: null
-      },
-      showErrorReportDialog: false,
-      errorReportForm: {
-        videoId: null,
-        errorCode: null
-      },
-      permissionDenied: false,
-      textObject: {
-        content: '视频',
-        route: '/video'
-      },
-      autoPlay: false,
-      showCreateAlbum: false,
-      albumForm: {
-        albumName: null
+      userToken: null,
+      danmaku: {
+        api: process.env.VUE_APP_SERVER_URL + '/api/comment/danmaku/'
       }
     }
   },
-  watch: {
-    // 地址栏 url 发生变化时重新加载本页面
-    $route() {
-      this.$router.go()
-    }
-  },
   created() {
-    const loginUser = getAuthedUser()
-    if (loginUser != null) {
-      this.currentUser = {
-        userId: loginUser.userId,
-        name: loginUser.screenName,
-        avatar: loginUser.avatarUrl,
-        author: true
-      }
-    }
-
-    this.getVideoInfo()
-    // this.getSimilarVideos(this.videoId)
-    // this.getCommentWrapper(this.currentPage)
+    this.userToken = getAccessToken()
+    this.getShortVideoWrapper()
   },
   mounted() {
     const header = this.$refs.header
@@ -336,8 +297,8 @@ export default {
       getShortVideo().then(resp => {
         if (resp.code === 0) {
           this.video = resp.data
-          this.videoId = resp.data.videoId
           document.title = resp.data.title
+          this.getVideoUrl(this.video.videoId)
           this.userId = resp.data.userId
           getUserInfo(this.userId).then(resp => {
             if (resp.code === 0) {