|
@@ -5,27 +5,31 @@
|
|
|
<el-card :if="!user" :body-style="{ padding: '0px' }" class="card">
|
|
<el-card :if="!user" :body-style="{ padding: '0px' }" class="card">
|
|
|
<div slot="header" class="clearfix">
|
|
<div slot="header" class="clearfix">
|
|
|
<el-row>
|
|
<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="followButton.icon"
|
|
|
|
|
- @click="followUser(user.userId)"
|
|
|
|
|
- >
|
|
|
|
|
- <span>{{followButton.text}}</span>
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button
|
|
|
|
|
- type="danger"
|
|
|
|
|
- size="mini"
|
|
|
|
|
- icon="el-icon-message"
|
|
|
|
|
- @click="sendMessage(user.userId)"
|
|
|
|
|
- >
|
|
|
|
|
- <span>发消息</span>
|
|
|
|
|
- </el-button>
|
|
|
|
|
|
|
+ <el-col :md="1">
|
|
|
|
|
+ <el-avatar>
|
|
|
|
|
+ <el-image :src="user.avatarUrl" />
|
|
|
|
|
+ </el-avatar>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :md="23">
|
|
|
|
|
+ <span>{{ user.screenName }}</span>
|
|
|
|
|
+ <span v-html="' '" />
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ :icon="followButton.icon"
|
|
|
|
|
+ @click="followUser(user.userId)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span>{{followButton.text}}</span>
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ icon="el-icon-message"
|
|
|
|
|
+ @click="sendMessage(user.userId)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span>发消息</span>
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<span v-if="user.intro !== null">{{user.intro}}</span>
|
|
<span v-if="user.intro !== null">{{user.intro}}</span>
|
|
@@ -89,7 +93,7 @@
|
|
|
<script>
|
|
<script>
|
|
|
import StatusCard from '@/components/card/StatusCard'
|
|
import StatusCard from '@/components/card/StatusCard'
|
|
|
import VideoCard from '@/components/card/VideoCard'
|
|
import VideoCard from '@/components/card/VideoCard'
|
|
|
-import { getUserInfo } from "@/api/user";
|
|
|
|
|
|
|
+import { getUserInfo, checkRelation, followUser, unfollowUser } from "@/api/user";
|
|
|
import { userVideoList } from "@/api/video";
|
|
import { userVideoList } from "@/api/video";
|
|
|
import { userStatus } from "@/api/status";
|
|
import { userStatus } from "@/api/status";
|
|
|
|
|
|
|
@@ -103,8 +107,8 @@ export default {
|
|
|
user: null,
|
|
user: null,
|
|
|
userId: null,
|
|
userId: null,
|
|
|
followButton: {
|
|
followButton: {
|
|
|
- icon: 'el-icon-check',
|
|
|
|
|
- text: '已关注'
|
|
|
|
|
|
|
+ icon: 'el-icon-plus',
|
|
|
|
|
+ text: '关注'
|
|
|
},
|
|
},
|
|
|
activeName: 'video',
|
|
activeName: 'video',
|
|
|
currentPage: 1,
|
|
currentPage: 1,
|
|
@@ -116,9 +120,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- const path = this.$route.path
|
|
|
|
|
this.userId = this.$route.params.id
|
|
this.userId = this.$route.params.id
|
|
|
- //this.activeName = path.split('/user/' + this.userId + '/')[1]
|
|
|
|
|
getUserInfo(this.userId).then(res => {
|
|
getUserInfo(this.userId).then(res => {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
this.user = res.data
|
|
this.user = res.data
|
|
@@ -126,6 +128,16 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ checkRelation(this.userId).then(res => {
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ if (res.data) {
|
|
|
|
|
+ this.followButton.text = '已关注'
|
|
|
|
|
+ this.followButton.icon = 'el-icon-check'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
this.userVideoListWrapper(1, this.userId)
|
|
this.userVideoListWrapper(1, this.userId)
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -172,13 +184,19 @@ export default {
|
|
|
},
|
|
},
|
|
|
followUser(userId) {
|
|
followUser(userId) {
|
|
|
if (this.followButton.text === '关注') {
|
|
if (this.followButton.text === '关注') {
|
|
|
- console.log('关注用户')
|
|
|
|
|
- this.followButton.text = '已关注'
|
|
|
|
|
- this.followButton.icon = 'el-icon-check'
|
|
|
|
|
|
|
+ followUser(userId).then(res => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ this.followButton.text = '已关注'
|
|
|
|
|
+ this.followButton.icon = 'el-icon-check'
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
- console.log('取消关注用户')
|
|
|
|
|
- this.followButton.text = '关注'
|
|
|
|
|
- this.followButton.icon = 'el-icon-plus'
|
|
|
|
|
|
|
+ unfollowUser(userId).then(res => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ this.followButton.text = '关注'
|
|
|
|
|
+ this.followButton.icon = 'el-icon-plus'
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
sendMessage(userId) {
|
|
sendMessage(userId) {
|
|
@@ -192,7 +210,7 @@ export default {
|
|
|
this.totalPages = resData.totalPages
|
|
this.totalPages = resData.totalPages
|
|
|
this.lastId = resData.lastId
|
|
this.lastId = resData.lastId
|
|
|
|
|
|
|
|
- if (this.videoList .length !== 0) {
|
|
|
|
|
|
|
+ if (this.videoList.length !== 0) {
|
|
|
this.showEmpty = false
|
|
this.showEmpty = false
|
|
|
} else {
|
|
} else {
|
|
|
this.showEmpty = true
|
|
this.showEmpty = true
|