|
@@ -1,115 +1,31 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <el-row class="movie-list">
|
|
|
|
|
- <el-col :md="24">
|
|
|
|
|
- <el-card :if="!user" :body-style="{ padding: '0px' }" class="card">
|
|
|
|
|
- <div slot="header" class="clearfix">
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <el-avatar>
|
|
|
|
|
- <el-image :src="user.avatarUrl" />
|
|
|
|
|
- </el-avatar>
|
|
|
|
|
- <span>{{ user.screenName }}</span>
|
|
|
|
|
- <span v-html="' '" />
|
|
|
|
|
- <el-button
|
|
|
|
|
- type="danger"
|
|
|
|
|
- size="mini"
|
|
|
|
|
- icon="el-icon-plus"
|
|
|
|
|
- >
|
|
|
|
|
- <span>关注</span>
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button
|
|
|
|
|
- type="danger"
|
|
|
|
|
- size="mini"
|
|
|
|
|
- icon="el-icon-plus"
|
|
|
|
|
- >
|
|
|
|
|
- <span>发消息</span>
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <span v-if="user.intro !== null">{{user.intro}}</span>
|
|
|
|
|
- <span v-if="user.intro === undefined || user.intro === null">此用户没有签名</span>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- <el-row>
|
|
|
|
|
- <router-link target="_blank" :to="`/user/` + user.userId + '/following'">
|
|
|
|
|
- <span class="el-icon-user">关注数: {{ user.followingCount }}</span>
|
|
|
|
|
- </router-link>
|
|
|
|
|
- <span v-html="' '" />
|
|
|
|
|
- <router-link target="_blank" :to="`/user/` + user.userId + '/follower'">
|
|
|
|
|
- <span class="el-icon-user">粉丝数: {{ user.followerCount }}</span>
|
|
|
|
|
- </router-link>
|
|
|
|
|
- </el-row>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-card>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </el-row>
|
|
|
|
|
<el-row>
|
|
<el-row>
|
|
|
- <el-col :md="24" class="movie-list">
|
|
|
|
|
- <el-tabs v-model="activeName" @tab-click='tabClick'>
|
|
|
|
|
- <el-tab-pane label="主页" name="home">
|
|
|
|
|
- <div v-if="activeName === 'home'">
|
|
|
|
|
- <el-col v-for="(video, index) in videoList" :key="index" :md="6" :sm="12" :xs="12">
|
|
|
|
|
- <video-card :video="video" />
|
|
|
|
|
- </el-col>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-tab-pane>
|
|
|
|
|
- <el-tab-pane label="状态" name="status">
|
|
|
|
|
- <div v-if="activeName === 'status'">
|
|
|
|
|
- <status-card />
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-tab-pane>
|
|
|
|
|
- </el-tabs>
|
|
|
|
|
- </el-col>
|
|
|
|
|
- <el-col :span="24" class="pagination">
|
|
|
|
|
- <el-pagination
|
|
|
|
|
- background
|
|
|
|
|
- :small="screenWidth <= 768"
|
|
|
|
|
- hide-on-single-page
|
|
|
|
|
- layout="prev, pager, next"
|
|
|
|
|
- :page-size="pageSize"
|
|
|
|
|
- :current-page="currentPage"
|
|
|
|
|
- :total="totalPages"
|
|
|
|
|
- @current-change="handleCurrentChange"
|
|
|
|
|
- />
|
|
|
|
|
- </el-col>
|
|
|
|
|
|
|
+ <span>账户主页</span>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import StatusCard from '@/components/card/StatusCard'
|
|
|
|
|
-import VideoCard from '@/components/card/VideoCard'
|
|
|
|
|
import { getUserInfo } from "@/api/user";
|
|
import { getUserInfo } from "@/api/user";
|
|
|
-import { userVideoList } from "@/api/video";
|
|
|
|
|
-import { userStatus } from "@/api/status";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'Profile',
|
|
name: 'Profile',
|
|
|
- components: { StatusCard, VideoCard },
|
|
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
|
screenWidth: document.body.clientWidth,
|
|
screenWidth: document.body.clientWidth,
|
|
|
user: null,
|
|
user: null,
|
|
|
userId: null,
|
|
userId: null,
|
|
|
- activeName: 'home',
|
|
|
|
|
- currentPage: 1,
|
|
|
|
|
- pageSize: 12,
|
|
|
|
|
- totalPages: 0,
|
|
|
|
|
- videoList: []
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- const path = this.$route.path
|
|
|
|
|
- this.userId = this.$route.params.id
|
|
|
|
|
- //this.activeName = path.split('/user/' + this.userId + '/')[1]
|
|
|
|
|
- getUserInfo(this.userId).then(res => {
|
|
|
|
|
|
|
+ getUserInfo(10001).then(res => {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
this.user = res.data
|
|
this.user = res.data
|
|
|
- document.title = this.user.screenName + '的个人主页'
|
|
|
|
|
|
|
+ document.title = this.user.screenName + '的帐号主页'
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- this.userVideoListWrapper(1, this.userId)
|
|
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
@@ -121,43 +37,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- handleCurrentChange(pageNumber) {
|
|
|
|
|
- this.currentPage = pageNumber
|
|
|
|
|
- this.$router.push({
|
|
|
|
|
- path: '/user/' + this.userId + '?pageNumber=' + pageNumber + '&lastId=' + this.lastId,
|
|
|
|
|
- query: {
|
|
|
|
|
- pageNumber: this.currentPage,
|
|
|
|
|
- lastId: this.lastId
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // this.videoPageWrapper(this.currentPage, this.lastId)
|
|
|
|
|
- // 回到顶部
|
|
|
|
|
- scrollTo(0, 0)
|
|
|
|
|
- },
|
|
|
|
|
- tabClick(tab) {
|
|
|
|
|
- const tabName = tab.name
|
|
|
|
|
- if (tabName === 'home') {
|
|
|
|
|
- console.log('获取主页')
|
|
|
|
|
- } else if (tabName === 'status') {
|
|
|
|
|
- console.log('获取状态')
|
|
|
|
|
- userStatus(this.userId, 1).then(res => {
|
|
|
|
|
- console.log(res)
|
|
|
|
|
- })
|
|
|
|
|
- } else if (tabName === 'video') {
|
|
|
|
|
- console.log('获取视频')
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- 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
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|