reghao 2 лет назад
Родитель
Сommit
39d2fd13c4
1 измененных файлов с 29 добавлено и 12 удалено
  1. 29 12
      src/views/user/Profile.vue

+ 29 - 12
src/views/user/Profile.vue

@@ -4,8 +4,22 @@
       <el-col :md="24">
         <el-card :if="!user" :body-style="{ padding: '0px' }" class="card">
           <div slot="header" class="clearfix">
-            <span>{{ user.screenName }}</span>
-            <el-button style="float: right; padding: 3px 0" type="text">关注</el-button>
+            <el-row>
+              <el-avatar>
+                <el-image :src="user.avatarUrl" />
+              </el-avatar>
+              <span>{{ user.screenName }}</span>
+              <span v-html="'&nbsp;'" />
+              <router-link target="_blank" :to="`/message/` + user.userId"><span class="el-icon-message">关注</span></router-link>
+              <router-link target="_blank" :to="`/message/` + user.userId"><span class="el-icon-message">发消息</span></router-link>
+            </el-row>
+            <el-row>
+              <span>玩偶姐姐</span>
+            </el-row>
+            <el-row>
+              关注数: {{ user.followingCount }}
+              粉丝数: {{ user.followerCount }}
+            </el-row>
           </div>
         </el-card>
       </el-col>
@@ -72,17 +86,11 @@ export default {
     getUserInfo(this.userId).then(res => {
       if (res.code === 0) {
         this.user = res.data
+        document.title = this.user.screenName + '的个人主页'
       }
     })
 
-    userVideoList(1, this.userId).then(res => {
-      if (res.code === 0) {
-        const resData = res.data
-        this.videoList = resData.list
-        this.totalPages = resData.totalPages
-        this.lastId = resData.lastId
-      }
-    })
+    this.userVideoListWrapper(1, this.userId)
   },
   mounted() {
     // 当窗口宽度改变时获取屏幕宽度
@@ -97,7 +105,7 @@ export default {
     handleCurrentChange(pageNumber) {
       this.currentPage = pageNumber
       this.$router.push({
-        path: '/video',
+        path: '/user/' + this.userId + '?pageNumber=' + pageNumber + '&lastId=' + this.lastId,
         query: {
           pageNumber: this.currentPage,
           lastId: this.lastId
@@ -115,7 +123,6 @@ export default {
         this.$router.push({path: path});
       } else if (index === 1) {
         const path = '/user/' + this.userId + '/video'
-        console.log(path)
         this.$router.push({path: path});
       } else if (index === 2) {
         this.$router.push({path: '/user/' + this.userId + '/audio'});
@@ -124,6 +131,16 @@ export default {
       } else if (index === 4) {
         this.$router.push({path: '/user/' + this.userId + '/article'});
       }
+    },
+    userVideoListWrapper(pageNumber, userId) {
+      userVideoList(pageNumber, userId).then(res => {
+        if (res.code === 0) {
+          const resData = res.data
+          this.videoList = resData.list
+          this.totalPages = resData.totalPages
+          this.lastId = resData.lastId
+        }
+      })
     }
   }
 }