Commit 89021dc1 by yanju

获取个人中心的我的回答,获取推荐动态,获取话题下的推荐动态,添加备注

parent fc8cb7c7
......@@ -17,6 +17,7 @@ export default {
list:'/api/posts',//动态列表
otherList:'/api/user/',//别人的动态列表 +{userId}/posts
following:'/api/posts/followed',//获取我关注的人的动态
recommends:'/api/post/recommends',//推荐动态
},
PostComment:{
list:'/api/post/',//获取动态评论 +{postId}/comments
......@@ -51,6 +52,8 @@ export default {
hotBloggers:'/api/user/hotBloggers',//热门博主
elites:'/api/user/elites',//社区精英
active:'/api/user/actives',//活跃用户
repliers:'/api/user/hotRepliers',//热门答主
},
Authentication:{
......@@ -76,6 +79,7 @@ export default {
postList:'/api/topic/' ,//获取话题下的所有动态 +{topicName}/posts
hotList:'/api/topic/hots',//获取热门动态
hotSearch:'/api/topic/hotSearch',//获取热搜话题
recommendsPost:'/api/topic/',//获取话题下的推荐动态 +{topicName}/post/recommends
},
Question:{
myParticipated:'/api/my/question/participated' ,//我参与的问答列表
......@@ -233,6 +237,10 @@ export default {
revisePassword:'/api/my/password'//修改密码
},
UserRemark:{
remark:'/api/user/',//用户备注 +{userId}/remarks
},
Question:{
revise:'/api/question/'//修改问题 +{questionId}
},
......
......@@ -228,7 +228,7 @@ hue-6-2: #e6c07b
//定义一些过渡
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
transition: opacity .2s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
......
......@@ -51,10 +51,15 @@ table {
border-spacing: 0
}
body, html {
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",
Roboto,"PingFang SC","Microsoft YaHei","Hiragino Sans GB",
"Helvetica Neue","Helvetica",Arial,"Monaco","Menlo","Consolas",sans-serif;
}
body{
overflow-x:hidden ;
overflow-y: auto;
}
a {
text-decoration: none;
......
......@@ -16,7 +16,7 @@
<span>人气 <span class="label-number">{{statistics.visitedNum}}</span> · 粉丝 <span class="label-number">{{statistics.fansNum}}</span> · 关注 <span class="label-number">{{statistics.followedNum}}</span></span>
</div>
<div class="content-label__right">
<span>项目 <span class="label-number">{{statistics.projectNum}}</span> · 博客 <span>{{statistics.blogNum}}</span> · 回答 <span class="label-number">{{statistics.questionNum}}</span> · 动态 <span class="label-number">{{statistics.postNum}}</span></span>
<span>项目 <span class="label-number">{{statistics.projectNum}}</span> · 博客 <span>{{statistics.blogNum}}</span> · 回答 <span class="label-number">{{statistics.questionReplyNum}}</span> · 动态 <span class="label-number">{{statistics.postNum}}</span></span>
</div>
</div>
<p class="content-main">
......@@ -29,7 +29,7 @@
<transition name="fade">
<div class="fan-card__right-menu" @mouseover="changeStateMenu1" @mouseleave="changeStateMenu2" v-if="showMenu">
<ul >
<li >添加备注</li>
<li @click.stop="dataPostToAddBak">添加备注</li>
<li v-if="cardType==='fans'">移除粉丝</li>
<li v-if="cardType==='fans'" @click.stop="dataPostToFollow">添加关注</li>
<li v-if="cardType==='follow'" @click.stop="dataPostToCancelFollow">取消关注</li>
......@@ -84,7 +84,7 @@ export default {
this.userAvatar = info.userAvatar;
this.userNick = info.userNick;
this.gender = info.gender;
this.statistics = info.statistics;
this.statistics = info.statistics||{};
this.signature = info.signature;
this.id = info.userId
}
......@@ -98,6 +98,32 @@ export default {
}
},
dataPostToAddBak(){
this.$popupbox({
title:'添加备注',
name:'',
onSubmit: (value,close)=>{
this.$axios.$put(config.api.put.UserRemark.remark+this.id+'/remarks',{
remarks:value
}).then((res)=>{
if(res.code===0){
close();
this.$message({
type:'success',
message:'添加用户备注成功!'
})
}else{
this.$message({
type:'warning',
message:res.msg
})
}
})
}
})
},
dataPostToFollow(){
this.$axios.$post(config.api.post.User.follow+this.id+'/follower').then((response)=>{
if(response.code===0){
......
......@@ -236,7 +236,6 @@
this.$axios.$post(config.api.post.Topic.release,{
topicName:this.TopicValue
}).then((res)=>{
console.log(res);
if(res.code===0){
this.releaseWord = this.releaseWord +"#"+this.TopicValue+"#";
this.dataGetTopicList();
......
......@@ -11,12 +11,12 @@
<div class="topic-card-right">
<div class="right-header">
<span class="right-title"># {{cardName}} #</span>
<span class="right-label1" v-if="!followedTopic" @click.stop="dataPostFollowTopic">
<span class="right-label1" v-if="!followedTopic&&!from&&userId!==$store.state.userProfile.userId" @click.stop="dataPostFollowTopic">
<span v-if="!loading">+</span>
<yun-icon v-if="loading" name="loading" size="12"> </yun-icon>
关注
</span>
<span class="right-label2" v-if="followedTopic" @click.stop="dataDeleteFollowTopic" >
<span class="right-label2" v-if="showFollowedTopic" @click.stop="dataDeleteFollowTopic" >
<yun-icon v-if="!loading" name="right" size="12"></yun-icon>
<yun-icon v-if="loading" name="loading" size="12"> </yun-icon>
已关注
......@@ -46,6 +46,18 @@
info:{
type:Object,
default:()=>({})
},
from:{
type:String,
default:''
}
},
computed:{
showFollowedTopic(){
return !!(this.followedTopic || this.from==='notice');
}
},
data(){
......@@ -87,6 +99,7 @@
this.cardName = info.topicName;
this.cardIntro = info.topicDescrption;
this.cardId = info.topicId;
this.userId = info.userId;
this.src = info.cover;
this.topicIcon = info.topicIcon;
this.cardTags = info.tags;
......@@ -141,6 +154,10 @@
type:'success',
message:'取消关注成功'
})
if(this.from==='my'){
this.cardId = ''
}
this.followedTopic = false;
}else{
......
......@@ -30,7 +30,7 @@
<div class="footer-item" @click="changeRoute('answer')">
<p>回答</p>
<h6>{{statistics.questionNum}}</h6>
<h6>{{statistics.questionReplyNum}}</h6>
</div>
<div class="footer-item" >
......
......@@ -25,7 +25,7 @@
<input type="text">
<div @click="search"><yun-icon name="search" size="16px" color="#fff"></yun-icon></div>
</div>
<div class="right__my-answer">
<div class="right__my-answer" v-if="false">
<div class="my-answer__wrap">
<div class="my-answer__l">
<yun-icon name="star" color="#F8A06F" size="20px" style="margin-top: -5px"></yun-icon>
......@@ -50,12 +50,12 @@
</div>
<card-container
title="热门答主"
label="换一换"
more="更多"
width="302px"
height="446px"
style="margin-top: 16px"
></card-container>
>
<user-card style="padding-bottom: 2px;padding-top: 2px" v-for="(val,index) in repliersList" :key="val.userId" :info="val"></user-card>
</card-container>
</div>
</div>
</div>
......@@ -69,8 +69,9 @@ import Pagination from "../../components/pc/pagination";
import AnswerCard from "../../components/pc/answerCard";
import config from "../../action/config";
import EmptyCard from '../../components/pc/emptyCard';
import UserCard from '../../components/pc/userCard2';
export default {
components: {AnswerCard, Pagination, ProjectCard, CardContainer, NavWrap,EmptyCard},
components: {AnswerCard, Pagination, ProjectCard, CardContainer, NavWrap,UserCard,EmptyCard},
data(){
return{
list: [
......@@ -83,6 +84,7 @@ export default {
pages:1,
QuestionList:[],
labelTitle:'',
repliersList:[],
}
},
created() {
......@@ -94,6 +96,7 @@ export default {
});
this.getLabelTitle();
this.dataGetQuestionCategory();
this.dataGetHotRepliersList();
},
watch:{
$route(){
......@@ -123,6 +126,18 @@ export default {
})
},
dataGetHotRepliersList() {
let params={
page: 1,
size: 5
};
this.$axios.$get(config.api.get.User.repliers,{params:params})
.then((response)=>{
this.repliersList = response.data.dataList;
});
},
dataGetQuestionCategory(){
this.$axios.$get(config.api.get.QuestionCategory.list).then((response)=>{
response.data.map((val,index)=>{
......
......@@ -47,9 +47,9 @@
type: 'new'
},
{
label: '热门',
label: '推荐',
address: '/dynamic',
type: 'hot'
type: 'recommends'
},
{
......@@ -135,10 +135,10 @@
})
},
dataGetHotDynamic(currentPage){
dataGetRecommendDynamic(currentPage){
this.paginationState = 'loading';
this.$axios.$get(config.api.get.Post.list,{
this.$axios.$get(config.api.get.Post.recommends,{
params:{
page:currentPage,
size:10
......@@ -284,8 +284,6 @@
})
},
dataGetHotTopic(){
this.$axios.$get(config.api.get.Topic.hotSearch,{
params:{
......@@ -303,8 +301,8 @@
if(type==='new'){
this.dataGetNewDynamic(currentPage);
}
if(type==='hot'){
this.dataGetHotDynamic(currentPage);
if(type==='recommends'){
this.dataGetRecommendDynamic(currentPage);
}
if(type==='following'){
this.dataGetFollowDynamic(currentPage);
......
......@@ -36,7 +36,12 @@
<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/question'}">
<p class="abs"></p>
<p class="word">问题</p>
<p class="line" v-if="selected==='personal-center-home-question'"></p>
</nuxt-link>
<nuxt-link tag="div" class="left__item" :to="{path:'/personal-center/home/answer'}">
<p class="abs"></p>
<p class="word">问答</p>
<p class="line" v-if="selected==='personal-center-home-answer'"></p>
......
<template>
<div>
<card-container key="container3" style="margin-top: 16px" :title="rightConTitle" >
<answer-card v-if="rightList.length>0" :isMy="true" v-for="(val,index) in rightList" :key="val.questionId" :info="val"></answer-card>
<answer-card v-if="rightList.length>0" v-for="(val,index) in rightList" :key="val.questionId" :info="val"></answer-card>
<empty-card v-if="rightList.length===0" height="556px"></empty-card>
</card-container>
......@@ -24,18 +24,12 @@
return{
leftList:[],
rightList:[],
pages:1,
aaa:[]
pages:1
}
},
computed:{
rightConTitle(){
if(this.$route.query.type==="my"){
return '我创建的问题'
}
if(this.$route.query.type==="notice"){
return '我回答的问题'
}
},
},
......@@ -44,18 +38,6 @@
},
methods:{
dataGetMyAnswer(currentPage){
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;
})
},
dataGetNoticeAnswer(currentPage){
this.$axios.$get(config.api.get.Question.myParticipated,{
params:{
......@@ -71,13 +53,8 @@
changePage(currentPage){
//返回页数 请求新的数据
let type = this.$route.query.type
if(type==='my'){
this.dataGetMyAnswer(currentPage);
}
if(type==='notice'){
this.dataGetNoticeAnswer(currentPage);
}
}
......
<template>
<div>
<card-container key="container3" style="margin-top: 16px" :title="rightConTitle" >
<answer-card v-if="rightList.length>0" :isMy="true" v-for="(val,index) in rightList" :key="val.questionId" :info="val"></answer-card>
<empty-card v-if="rightList.length===0" height="556px"></empty-card>
</card-container>
<pagination key="container5" style="margin:20px auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
</div>
</template>
<script>
import ProjectCard from '../../../components/pc/projectCard';
import AnswerCard from '../../../components/pc/answerCard';
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:'answer',
data(){
return{
leftList:[],
rightList:[],
pages:1,
}
},
computed:{
rightConTitle(){
return '我创建的问题'
},
},
components:{
ProjectCard,CardContainer,AnswerCard,Pagination,EmptyCard
},
methods:{
dataGetMyAnswer(currentPage){
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;
})
},
changePage(currentPage){
//返回页数 请求新的数据
this.dataGetMyAnswer(currentPage);
}
},
}
</script>
<style lang="scss">
</style>
......@@ -2,7 +2,7 @@
<div>
<div>
<card-container key="container3" style="margin-top: 16px" :title="rightConTitle">
<topic-card v-if="rightList.length>0" v-for="(val,index) in rightList" :key="val.topicId" :info="val"></topic-card>
<topic-card :from="from" v-if="rightList.length>0" v-for="(val,index) in rightList" :key="val.topicId" :info="val"></topic-card>
<empty-card v-if="rightList.length===0" height="556px"></empty-card>
</card-container>
......@@ -27,6 +27,7 @@
leftList:[],
rightList:[],
pages:1,
from:'my'
}
},
computed:{
......@@ -43,6 +44,7 @@
},
methods:{
dataGetMyTopic(currentPage){
this.from = 'my';
this.$axios.$get(config.api.get.Topic.myList, {
params: {
page: currentPage,
......@@ -55,6 +57,7 @@
},
dataGetNoticeTopic(currentPage){
this.from = 'notice';
this.$axios.$get(config.api.get.Topic.myfollowedList,{
params:{
page:currentPage,
......
......@@ -84,6 +84,11 @@
type: 'new'
},
{
label: '推荐',
address: this.$route.path,
type: 'recommends'
},
{
label: '文字',
address: this.$route.path,
type: 'word'
......@@ -196,6 +201,29 @@
})
},
dataGetRecommendDynamic(currentPage){
this.paginationState = 'loading';
let name = this.$route.params.name;
this.$axios.$get(config.api.get.Topic.recommendsPost+this.topicCardInfo.topicId+'/post/recommends',{
params:{
page:currentPage,
size:10
}
}).then((response)=>{
this.paginationState = 'over';
if(currentPage===1){
this.postList = response.data.dataList;
this.pages = response.data.totalPage;
}else{
let list = response.data.dataList;
for(let i = 0;i<list.length;i++){
this.postList.push(list[i]);
}
this.pages = response.data.totalPage;
}
})
},
dataGetWordDynamic(currentPage){
this.paginationState = 'loading';
let name = this.$route.params.name;
......@@ -281,6 +309,9 @@
if(type==='new'){
this.dataGetNewDynamic(currentPage);
}
if(type==='recommends'){
this.dataGetRecommendDynamic(currentPage);
};
if(type==='word'){
this.dataGetWordDynamic(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