|
@@ -0,0 +1,215 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <v-card>
|
|
|
|
|
+ <!--<v-container fill-height fluid style="padding: 0px;">
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col style="padding: 0px;">
|
|
|
|
|
+ <v-img :src="userInfo.backgroundUrl" :aspect-ratio="5.98" />
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ </v-container>-->
|
|
|
|
|
+ <v-container fill-height>
|
|
|
|
|
+ <v-row align="center">
|
|
|
|
|
+ <v-col
|
|
|
|
|
+ cols="12"
|
|
|
|
|
+ md="8"
|
|
|
|
|
+ >
|
|
|
|
|
+ <v-avatar size="80" style="float: left;">
|
|
|
|
|
+ <v-img :src="userInfo.avatarUrl" />
|
|
|
|
|
+ </v-avatar>
|
|
|
|
|
+ <h2 style="margin-top: 20px;margin-left: 100px;">
|
|
|
|
|
+ <!--{{ userInfo.username }}-->
|
|
|
|
|
+ {{ userInfo.screenName }}
|
|
|
|
|
+ <!--<v-chip color="yellow" @click="goToVip()">
|
|
|
|
|
+ <v-chip v-if="Power.checkPower(userInfo) === 'vip'" color="yellow" @click="goTOVIP()">
|
|
|
|
|
+ 小会员
|
|
|
|
|
+ </v-chip>-->
|
|
|
|
|
+ </h2>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ <v-col
|
|
|
|
|
+ v-if="userInfo && userInfo.userId !== loginUserId"
|
|
|
|
|
+ cols="6"
|
|
|
|
|
+ md="4"
|
|
|
|
|
+ class="hidden-sm-and-down ml-0 pl-4"
|
|
|
|
|
+ >
|
|
|
|
|
+ <!--<v-btn color="primary" @click="goToSetting">自定义频道</v-btn> <v-btn color="primary" @click="goToStudio">创作中心</v-btn>-->
|
|
|
|
|
+ <v-btn color="primary" @click="followUser">关注TA</v-btn>
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col>
|
|
|
|
|
+ {{ userInfo.intro }}
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row>
|
|
|
|
|
+ <v-col
|
|
|
|
|
+ v-if="userInfo || userInfo.userId !== userId"
|
|
|
|
|
+ cols="6"
|
|
|
|
|
+ md="4"
|
|
|
|
|
+ >
|
|
|
|
|
+ 关注数: {{ userInfo.followingCount }}
|
|
|
|
|
+ 粉丝数: {{ userInfo.followerCount }}
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-tabs>
|
|
|
|
|
+ <v-tab @click="selectTab(1)">主页</v-tab>
|
|
|
|
|
+ <v-tab @click="selectTab(2)">状态</v-tab>
|
|
|
|
|
+ <v-tab @click="selectTab(3)">投稿</v-tab>
|
|
|
|
|
+ </v-tabs>
|
|
|
|
|
+ </v-container>
|
|
|
|
|
+ </v-card>
|
|
|
|
|
+ <v-divider />
|
|
|
|
|
+ <v-divider />
|
|
|
|
|
+ <v-divider />
|
|
|
|
|
+ <v-divider />
|
|
|
|
|
+ <v-divider />
|
|
|
|
|
+ <v-divider />
|
|
|
|
|
+ <v-card>
|
|
|
|
|
+ <v-container fill-height>
|
|
|
|
|
+ <div id="top" />
|
|
|
|
|
+ <v-row v-if="cardType === 'video'">
|
|
|
|
|
+ <v-col
|
|
|
|
|
+ v-for="item in cardList"
|
|
|
|
|
+ :key="item.videoId"
|
|
|
|
|
+ >
|
|
|
|
|
+ <video-card :video="item" />
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row v-if="cardType === 'status'">
|
|
|
|
|
+ <v-col
|
|
|
|
|
+ v-for="item in cardList"
|
|
|
|
|
+ :key="item.statusId"
|
|
|
|
|
+ >
|
|
|
|
|
+ <status-card :item="item" />
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ <v-row v-if="cardType === 'answer'">
|
|
|
|
|
+ <v-col
|
|
|
|
|
+ v-for="item in cardList"
|
|
|
|
|
+ :key="item.audioId"
|
|
|
|
|
+ >
|
|
|
|
|
+ <audio-card :item="item" />
|
|
|
|
|
+ </v-col>
|
|
|
|
|
+ </v-row>
|
|
|
|
|
+ </v-container>
|
|
|
|
|
+ <v-divider />
|
|
|
|
|
+ </v-card>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import { userVideoList } from '@/api/media/video'
|
|
|
|
|
+import { getUserInfo } from '@/api/user/user'
|
|
|
|
|
+import Power from '@/utils/check-power.vue'
|
|
|
|
|
+import TimeUtil from '@/utils/time-util.vue'
|
|
|
|
|
+
|
|
|
|
|
+import StatusCard from '@/components/card/status-card'
|
|
|
|
|
+import VideoCard from '@/components/card/video-card.vue'
|
|
|
|
|
+import AudioCard from '@/components/card/audio-card.vue'
|
|
|
|
|
+
|
|
|
|
|
+export default {
|
|
|
|
|
+ name: 'UserHome',
|
|
|
|
|
+ components: {
|
|
|
|
|
+ StatusCard,
|
|
|
|
|
+ VideoCard,
|
|
|
|
|
+ AudioCard
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ TimeUtil,
|
|
|
|
|
+ Power,
|
|
|
|
|
+ loginUserId: 0,
|
|
|
|
|
+ userId: 0,
|
|
|
|
|
+ userInfo: {},
|
|
|
|
|
+ cardType: null,
|
|
|
|
|
+ cardList: [],
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ type: 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ created() {
|
|
|
|
|
+ const userIdStr = this.$route.params.userId
|
|
|
|
|
+ if (userIdStr === undefined) {
|
|
|
|
|
+ // 从"个人中心"加载
|
|
|
|
|
+ this.loginUserId = this.$store.state.user.userInfo.userId
|
|
|
|
|
+ this.userId = this.$store.state.user.userInfo.userId
|
|
|
|
|
+ this.userInfo = this.$store.state.user.userInfo
|
|
|
|
|
+ document.title = '我的主页'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.userId = parseInt(userIdStr)
|
|
|
|
|
+ this.getUserInfo1(this.userId)
|
|
|
|
|
+ }
|
|
|
|
|
+ this.getVideoList(this.page)
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ selectTab(type) {
|
|
|
|
|
+ if (type === this.type) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.type = type
|
|
|
|
|
+ if (type === 1) {
|
|
|
|
|
+ this.$router.push('/u/' + this.userId + '/post')
|
|
|
|
|
+ /* this.initPagerParam()
|
|
|
|
|
+ this.getVideoList(1)
|
|
|
|
|
+ this.$vuetify.goTo(type)*/
|
|
|
|
|
+ } else if (type === 2) {
|
|
|
|
|
+ this.$router.push('/u/' + this.userId + '/status')
|
|
|
|
|
+ /* this.initPagerParam()
|
|
|
|
|
+ this.getStatusList(1)
|
|
|
|
|
+ this.$vuetify.goTo(type)*/
|
|
|
|
|
+ } else if (type === 3) {
|
|
|
|
|
+ this.$router.push('/u/' + this.userId + '/post')
|
|
|
|
|
+ /* this.initPagerParam()
|
|
|
|
|
+ this.getAnswerList(1)
|
|
|
|
|
+ this.$vuetify.goTo(type)*/
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ getUserInfo1(userId) {
|
|
|
|
|
+ getUserInfo(userId).then(res => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ this.userInfo = res.data
|
|
|
|
|
+ document.title = this.userInfo.screenName + ' 的主页'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ alert(res.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ console.error(error.message)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ getVideoList(page) {
|
|
|
|
|
+ userVideoList(page, this.userId).then(res => {
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ this.cardType = 'video'
|
|
|
|
|
+ this.$vuetify.goTo(0)
|
|
|
|
|
+
|
|
|
|
|
+ const pageList = res.data
|
|
|
|
|
+ this.cardList.splice(0, this.cardList.length)
|
|
|
|
|
+ for (const item of pageList.list) {
|
|
|
|
|
+ this.cardList.push(item)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ alert(res.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ console.error(error.message)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ goToVip() {
|
|
|
|
|
+ this.$router.push('/vip')
|
|
|
|
|
+ },
|
|
|
|
|
+ goToStudio() {
|
|
|
|
|
+ this.$router.push('/studio')
|
|
|
|
|
+ },
|
|
|
|
|
+ goToSetting() {
|
|
|
|
|
+ this.$router.push('/user/account')
|
|
|
|
|
+ },
|
|
|
|
|
+ followUser() {
|
|
|
|
|
+ console.log('关注用户')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style>
|
|
|
|
|
+</style>
|