Commit 7283bd72 by yanju

获取别人的主页

parent dca63694
<template>
<div class="user-avatar" :style="{backgroundColor:randomColor,width:size,height:size,borderRadius:borderR}">
<nuxt-link tag="div" class="user-avatar" :to="userId?'/personal-center/home/project?user='+userId:''" :style="{backgroundColor:randomColor,width:size,height:size,borderRadius:borderR}">
<img :src="src" v-if="src"/>
<p v-if="!src">{{firstWord}}</p>
</div>
</nuxt-link>
</template>
......@@ -16,6 +16,7 @@
type: String,
default: ''
},
userId:String,
size:String,
borderR:String,
},
......
......@@ -89,7 +89,7 @@
</ul>
<ul class="abs-box abs-box2" v-if="showHideBox2" @mouseover="changeStateShowBox(2)" @mouseleave="changeStateHideBox(2)">
<li>
<nuxt-link tag="span" to="/personal-center/home/project">我的主页</nuxt-link>
<nuxt-link tag="span" :to="'/personal-center/home/project?user='+$store.state.userProfile.userId">我的主页</nuxt-link>
</li>
<li>
<nuxt-link tag="span" to="/personal-center/like/support">我的喜欢</nuxt-link>
......
......@@ -5,7 +5,7 @@
<div class="social-card">
<div class="card_header">
<div class="header-l">
<yun-avatar :src="userAvatar" :name="userNick"></yun-avatar>
<yun-avatar :userId="userId" :src="userAvatar" :name="userNick"></yun-avatar>
<div class="header-l__info">
<div class="header-l__info-top">
<p class="name">{{userNick}}</p>
......
<template>
<div class="user-card__wrap">
<div class="user-card1">
<yun-avatar style="margin:40px auto 0;" :src="userAvatar" size="84px"></yun-avatar>
<yun-avatar :userId="userId" style="margin:40px auto 0;" :src="userAvatar" size="84px"></yun-avatar>
<div class="info1">
<p class="name">{{nickName}}</p>
<yun-icon name="sex_man" size="12px" color="#00AAE6" v-if="gender===1"></yun-icon>
......
......@@ -8,37 +8,37 @@
<div class="bottom-container__bg"></div>
<div class="bottom-container">
<div class="bottom-left">
<user-card from="my" :userId="this.$store.state.userProfile.userId"></user-card>
<user-card :from="$store.state.userProfile.userId===userId?'my':''" :userId="userId"></user-card>
</div>
<div class="bottom-right">
<div class="bottom-right__tab">
<div class="tab__left">
<nuxt-link tag="div" class="left__item" to="/personal-center/home/project">
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/project',query:{user:$route.query.user}}">
<p class="abs"></p>
<p class="word">项目</p>
<p class="line" v-if="selected==='personal-center-home-project'"></p>
</nuxt-link>
<nuxt-link tag="div" class="left__item" to="/personal-center/home/blog">
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/blog',query:{user:$route.query.user}}">
<p class="abs"></p>
<p class="word">博客</p>
<p class="line" v-if="selected==='personal-center-home-blog'"></p>
</nuxt-link>
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/answer',query:{type:'my'}}">
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/answer',query:{type:'my',user:$route.query.user}}">
<p class="abs"></p>
<p class="word">问答</p>
<p class="line" v-if="selected==='personal-center-home-answer'"></p>
</nuxt-link>
<nuxt-link tag="div" class="left__item" to="/personal-center/home/dynamic">
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/dynamic',query:{user:$route.query.user}}">
<p class="abs"></p>
<p class="word">动态</p>
<p class="line" v-if="selected==='personal-center-home-dynamic'"></p>
</nuxt-link>
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/topic',query:{type:'my'}}">
<nuxt-link tag="div" v-if="$store.state.userProfile.userId===userId" class="left__item" :to="{path:'/personal-center/home/topic',query:{type:'my',user:$route.query.user}}">
<p class="abs"></p>
<p class="word">话题</p>
<p class="line" v-if="selected==='personal-center-home-topic'"></p>
</nuxt-link>
<nuxt-link tag="div" class="left__item" to="/personal-center/home/info">
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/info',query:{user:$route.query.user}}">
<p class="abs"></p>
<p class="word">资料</p>
<p class="line" v-if="selected==='personal-center-home-info'"></p>
......@@ -65,19 +65,16 @@
</template>
<script>
import UserCard from '../../components/pc/userCard';
import ProjectCard from '../../components/pc/projectCard';
import CardContainer from '../../components/pc/cardContainer';
import PageFooter from '../../components/pc/pageFooter';
export default {
layout: 'only-header',
data(){
return{
labelList: ['我的消息','私信'],
userId:'',
// selected: this.$route.name
}
},
......@@ -95,6 +92,13 @@
created(){
this.selected = this.$route.name;
let userId = this.$route.query.user;
if(userId){
this.userId = userId;
}else{
this.router.replace('/')
}
},
......
......@@ -29,7 +29,22 @@
}
},
computed:{
rightConTitle(){ return this.$route.query.type==="my"?'我创建的问题':'我参与的问题'},
rightConTitle(){
if(this.$route.query.type==="my"&&this.$store.state.userProfile.userId===this.$route.query.user){
return '我创建的问题'
}
if(this.$route.query.type==="notice"&&this.$store.state.userProfile.userId===this.$route.query.user){
return '我回答的问题'
}
if(this.$route.query.type==="my"&&this.$store.state.userProfile.userId!==this.$route.query.user){
return 'Ta创建的问题'
}
if(this.$route.query.type==="notice"&&this.$store.state.userProfile.userId!==this.$route.query.user){
return 'Ta回答的问题'
}
},
},
components:{
ProjectCard,CardContainer,AnswerCard,Pagination,EmptyCard
......@@ -37,19 +52,34 @@
methods:{
dataGetMyAnswer(currentPage){
this.$axios.$get(config.api.get.Question.myCreated,{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
if(this.$store.state.userProfile.userId===this.$route.query.user){
this.$axios.$get(config.api.get.Question.myCreated,{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
})
}else{
this.$axios.$get(config.api.get.Question.otherCreated+this.$route.query.user+'/questions',{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
}
},
dataGetNoticeAnswer(currentPage){
this.$axios.$get(config.api.get.Question.myParticipated,{
if(this.$store.state.userProfile.userId===this.$route.query.user){
this.$axios.$get(config.api.get.Question.myParticipated,{
params:{
page:currentPage,
size:10
......@@ -57,7 +87,17 @@
}).then((response)=>{
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
})}else{
this.$axios.$get(config.api.get.Question.otherParticipated+this.$route.query.user+'/question/participated',{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
}
},
changePage(currentPage){
......
......@@ -28,7 +28,18 @@
}
},
computed:{
rightConTitle(){ return this.rightConType===1?'我的博客':'我关注的话题'},
rightConTitle(){
if(this.$store.state.userProfile.userId===this.$route.query.user){
return '我的博客'
}
if(this.$store.state.userProfile.userId!==this.$route.query.user){
return 'Ta的博客'
}
},
},
components:{
BlogCard,CardContainer,Pagination,EmptyCard
......@@ -36,15 +47,28 @@
methods:{
dataGetBlog(currentPage){
this.$axios.$get(config.api.get.Blog.myList,{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
if(this.$store.state.userProfile.userId===this.$route.query.user) {
this.$axios.$get(config.api.get.Blog.myList, {
params: {
page: currentPage,
size: 10
}
}).then((response) => {
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
}else{
this.$axios.$get(config.api.get.Blog.otherList+this.$route.query.user+'/blogs', {
params: {
page: currentPage,
size: 10
}
}).then((response) => {
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
}
},
changePage(currentPage){
......
<template>
<div >
<release-card style="margin-top: 16px" @listenReleaseState="dataGetDynamic(1)"></release-card>
<release-card v-if="$store.state.userProfile.userId===$route.query.user" style="margin-top: 16px" @listenReleaseState="dataGetDynamic(1)"></release-card>
<social-card pageType="my" @listenSocialCardState="dataGetDynamic(1)" v-for="(val,index) in rightList" :key="val.postId" :info="val"></social-card>
<empty-card v-if="rightList.length===0&&$store.state.userProfile.userId!==$route.query.user" height="556px"></empty-card>
<pagination key="container5" style="margin:20px auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
</div>
</template>
......@@ -11,6 +13,7 @@
import CardContainer from '../../../components/pc/cardContainer';
import config from '../../../action/config';
import Pagination from "../../../components/pc/pagination";
import EmptyCard from "../../../components/pc/emptyCard";
export default {
name:'dynamic',
......@@ -23,23 +26,44 @@
}
},
computed:{
rightConTitle(){ return this.rightConType===1?'我的动态':'我关注的话题'},
rightConTitle(){
if(this.$store.state.userProfile.userId===this.$route.query.user){
return '我的动态'
}
if(this.$store.state.userProfile.userId!==this.$route.query.user){
return 'Ta的动态'
}
},
},
components:{
SocialCard,CardContainer,Pagination,ReleaseCard
SocialCard,CardContainer,Pagination,ReleaseCard,EmptyCard
},
methods:{
dataGetDynamic(currentPage){
this.$axios.$get(config.api.get.Post.myList,{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
if(this.$store.state.userProfile.userId===this.$route.query.user) {
this.$axios.$get(config.api.get.Post.myList, {
params: {
page: currentPage,
size: 10
}
}).then((response) => {
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
}else{
this.$axios.$get(config.api.get.Post.otherList+this.$route.query.user+'/posts', {
params: {
page: currentPage,
size: 10
}
}).then((response) => {
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
}
},
changePage(currentPage){
......
......@@ -29,7 +29,15 @@
},
computed:{
rightConTitle(){ return this.rightConType===1?'我的项目':'我关注的话题'},
rightConTitle(){
if(this.$store.state.userProfile.userId===this.$route.query.user){
return '我的项目'
}
if(this.$store.state.userProfile.userId!==this.$route.query.user){
return 'Ta的项目'
}
},
},
components:{
ProjectCard,CardContainer,Pagination,EmptyCard
......@@ -38,15 +46,28 @@
methods:{
dataGetProject(currentPage){
this.$axios.$get(config.api.get.Project.myList,{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
if(this.$store.state.userProfile.userId===this.$route.query.user) {
this.$axios.$get(config.api.get.Project.myList, {
params: {
page: currentPage,
size: 10
}
}).then((response) => {
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
}else{
this.$axios.$get(config.api.get.Project.otherList+this.$route.query.user+'/projects', {
params: {
page: currentPage,
size: 10
}
}).then((response) => {
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
this.pages = response.data.totalPage;
})
}
},
changePage(currentPage){
//返回页数 请求新的数据
......
......@@ -30,22 +30,37 @@
}
},
computed:{
rightConTitle(){ return this.$route.query.type==="1"?'我创建的话题':'我关注的话题'},
},
rightConTitle(){
if(this.$route.query.type==="my"&&this.$store.state.userProfile.userId===this.$route.query.user){
return '我创建的话题'
}
if(this.$route.query.type==="notice"&&this.$store.state.userProfile.userId===this.$route.query.user){
return '我参与的话题'
}
if(this.$route.query.type==="my"&&this.$store.state.userProfile.userId!==this.$route.query.user){
return 'Ta创建的话题'
}
if(this.$route.query.type==="notice"&&this.$store.state.userProfile.userId!==this.$route.query.user){
return 'Ta创建的话题'
}
}, },
components:{
ProjectCard,CardContainer,TopicCard,Pagination,EmptyCard
},
methods:{
dataGetMyTopic(currentPage){
this.$axios.$get(config.api.get.Topic.myList,{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
if(this.$store.state.userProfile.userId===this.$route.query.user) {
this.$axios.$get(config.api.get.Topic.myList, {
params: {
page: currentPage,
size: 10
}
}).then((response) => {
this.rightList = response.data.dataList;
this.pages = response.data.totalPage;
})
})
}
},
dataGetNoticeTopic(currentPage){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment