Commit fc8cb7c7 by yanju

话题详情动态获取

parent 58c5970b
...@@ -97,9 +97,7 @@ ...@@ -97,9 +97,7 @@
setCurrentPage(n){ setCurrentPage(n){
this.currentPage = 1; this.currentPage = 1;
this.paginationState='loading'
this.$emit(config.event.listenPageChange,1) this.$emit(config.event.listenPageChange,1)
}, },
getElementToPageTop(el) { getElementToPageTop(el) {
...@@ -122,7 +120,6 @@ ...@@ -122,7 +120,6 @@
} }
} }
else{ else{
// this.paginationState = 'complete';
} }
} }
......
...@@ -71,10 +71,10 @@ ...@@ -71,10 +71,10 @@
</div> </div>
<div class="bottom__r"> <div class="bottom__r">
<div class="select-box"> <!-- <div class="select-box">-->
<p>公开</p> <!-- <p>公开</p>-->
<yun-icon name="down_arrow" size="6px" color="#999" pb="1px"></yun-icon> <!-- <yun-icon name="down_arrow" size="6px" color="#999" pb="1px"></yun-icon>-->
</div> <!-- </div>-->
<p class="send-box" @click="dataPostContent"> <p class="send-box" @click="dataPostContent">
发布 发布
......
...@@ -83,7 +83,6 @@ ...@@ -83,7 +83,6 @@
this.followLoading=true; this.followLoading=true;
this.$axios.$get(config.api.get.User.otherInfo+this.id+'/baseinfo').then((response) => { this.$axios.$get(config.api.get.User.otherInfo+this.id+'/baseinfo').then((response) => {
if(response.code===0){ if(response.code===0){
console.log(this.followLoading);
let data = response.data; let data = response.data;
this.userId = response.userId; this.userId = response.userId;
this.nickName=data.nickName; this.nickName=data.nickName;
......
...@@ -73,7 +73,11 @@ ...@@ -73,7 +73,11 @@
</div> </div>
<div class="detail-container__right"> <div class="detail-container__right">
<user-card :isFollow="articleDetail.followedAuthor" :userId="articleDetail.userId"></user-card> <user-card :isFollow="articleDetail.followedAuthor" :userId="articleDetail.userId"></user-card>
<card-container style="margin-top:16px" title="相关推荐" label="换一换" more="更多"> <card-container style="margin-top:16px" title="相关推荐" label="换一换" more="更多" v-if="answerList.length>0">
<nuxt-link tag="div" :to="'/answer/detail/'+val.questionId" class="topic-content__c" v-for="(val,index) in answerList" :key="val.questionId" >
<p>{{val.questionTitle}}</p>
<h6>{{val.replyNumber}}</h6>
</nuxt-link>
</card-container> </card-container>
</div> </div>
<div class="article-option"> <div class="article-option">
...@@ -133,11 +137,12 @@ ...@@ -133,11 +137,12 @@
return{ return{
commentContent:'', commentContent:'',
commentList:[], commentList:[],
answerList:[],
} }
}, },
created(){ created(){
this.dataGetReAnswerList();
globalBus.$emit(config.event.listenDetailInfo,this.articleDetail.questionTitle,'answer') globalBus.$emit(config.event.listenDetailInfo,this.articleDetail.questionTitle,'answer')
}, },
...@@ -157,7 +162,17 @@ ...@@ -157,7 +162,17 @@
}) })
} }
} },
dataGetReAnswerList() {
let params={
page: 1,
size: 5
};
this.$axios.$get(config.api.get.Question.recommendsList+this.articleDetail.questionId+'/recommends',{params:params})
.then((response)=>{
this.answerList = response.data.dataList;
});
},
}, },
components:{ components:{
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
</card-container> </card-container>
<card-container style="margin-top: 16px" title="社区精英" label="换一换" > <card-container style="margin-top: 16px;padding-bottom:15px" title="社区精英" label="换一换" >
<user-card style="padding-bottom: 2px;padding-top: 2px" v-for="(val,index) in elitesList" :key="val.userId" :info="val"></user-card> <user-card style="padding-bottom: 2px;padding-top: 2px" v-for="(val,index) in elitesList" :key="val.userId" :info="val"></user-card>
</card-container> </card-container>
<card-container style="margin-top: 16px" title="热门问答" label="换一换" more="更多" @listenCardConMore="changeRoute('/answer')"> <card-container style="margin-top: 16px" title="热门问答" label="换一换" more="更多" @listenCardConMore="changeRoute('/answer')">
<nuxt-link tag="div" :to="'/topic/detail/'+val.questionId" class="topic-content__c" v-for="(val,index) in answerList" :key="val.questionId" > <nuxt-link tag="div" :to="'/answer/detail/'+val.questionId" class="topic-content__c" v-for="(val,index) in answerList" :key="val.questionId" >
<p>{{val.questionTitle}}</p> <p>{{val.questionTitle}}</p>
<h6>{{val.replyNumber}}</h6> <h6>{{val.replyNumber}}</h6>
</nuxt-link> </nuxt-link>
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
.information-content { .information-content {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
margin-top: 3*$length; margin-top: 5*$length;
@extend %nowrap; @extend %nowrap;
@extend %cursorPointer; @extend %cursorPointer;
@extend %animate-transition; @extend %animate-transition;
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
></nav-wrap> ></nav-wrap>
</div> </div>
<div class="__right"> <div class="__right">
<release-card :initWord="$route.params.name" @listenReleaseState="dataGetDynamic(1)"></release-card> <release-card :initWord="$route.params.name" @listenReleaseState="restartPagination()"></release-card>
<social-card @listenSocialCardState="dataGetDynamic(1)" v-for="(val,index) in postList" :key="val.postId" :info="val"></social-card> <social-card @listenSocialCardState="restartPagination()" v-for="(val,index) in postList" :key="val.postId" :info="val"></social-card>
<pagination :paginationReset="paginationReset" :paginationState="paginationState" :type="2" key="container5" style="margin:20px auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination> <pagination ref="pagination" :paginationState="paginationState" :type="2" key="container5" style="margin:20px auto;" :pages="pages" v-on:listenPageChange="changePage"></pagination>
</div> </div>
</div> </div>
...@@ -48,10 +48,8 @@ ...@@ -48,10 +48,8 @@
<card-container <card-container
title="活跃用户" title="活跃用户"
label="换一换"
more="更多"
width="302px" width="302px"
style="margin-top: 16px" style="margin-top: 16px;padding-bottom: 15px"
v-if="userList.length>0" v-if="userList.length>0"
> >
<user-card style="padding-bottom: 2px;padding-top: 2px" v-for="(val,index) in userList" :key="val.userId" :info="val"></user-card> <user-card style="padding-bottom: 2px;padding-top: 2px" v-for="(val,index) in userList" :key="val.userId" :info="val"></user-card>
...@@ -81,44 +79,26 @@ ...@@ -81,44 +79,26 @@
return{ return{
list: [ list: [
{ {
label: '推荐', label: '最新',
address: this.$route.path, address: this.$route.path,
type: '推荐' type: 'new'
}, },
{ {
label: '热门',
address: this.$route.path,
type: '热门'
},
{
label: '关注',
address: this.$route.path,
type: '关注'
},
{
label: '我的',
address: this.$route.path,
type: '我的'
},
{
label: '文字', label: '文字',
address: this.$route.path, address: this.$route.path,
type: '文字' type: 'word'
}, },
{ {
label: '视频', label: '视频',
address: this.$route.path, address: this.$route.path,
type: '视频' type: 'video'
}, },
{ {
label: '图片', label: '图片',
address: this.$route.path, address: this.$route.path,
type: '图片' type: 'picture'
} }
], ],
topicCardInfo:{}, topicCardInfo:{},
...@@ -136,10 +116,12 @@ ...@@ -136,10 +116,12 @@
created() { created() {
let name = this.$route.params.name; let name = this.$route.params.name;
this.dataGetTopicInfo(name); this.dataGetTopicInfo(name);
this.dataGetUsers();
this.$router.replace({ this.$router.replace({
path: this.$route.path, path: this.$route.path,
query: { query: {
type: '推荐' type: 'new'
} }
}); });
...@@ -164,7 +146,9 @@ ...@@ -164,7 +146,9 @@
this.dataGetSearchTopic(val) this.dataGetSearchTopic(val)
this.showHideCard = true; this.showHideCard = true;
}, },
$route(){
this.restartPagination();
}
}, },
methods:{ methods:{
...@@ -175,46 +159,148 @@ ...@@ -175,46 +159,148 @@
} }
}).then((response)=>{ }).then((response)=>{
this.topicCardInfo = response.data; this.topicCardInfo = response.data;
this.dataGetUsers(response.data.topicId);
}) })
}, },
dataGetDynamic(currentPage){
restartPagination(){
this.postList = [];
this.pages = 1;
if(process.browser){
this.$refs.pagination.setCurrentPage(1)
}
},
dataGetNewDynamic(currentPage){
this.paginationState = 'loading';
let name = this.$route.params.name; let name = this.$route.params.name;
this.$axios.$get(config.api.get.Topic.detail+name+'/posts',{ this.$axios.$get(config.api.get.Topic.postList+name+'/posts',{
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;
this.$axios.$get(config.api.get.Topic.postList+name+'/posts',{
params:{ params:{
page:currentPage, page:currentPage,
size:10, size:10,
type:0
} }
}).then((response)=>{ }).then((response)=>{
this.paginationState = 'over'; this.paginationState = 'over';
if(currentPage===1){ if(currentPage===1){
this.postList = response.data.dataList; this.postList = response.data.dataList;
this.pages = response.data.totalPage; this.pages = response.data.totalPage;
this.paginationReset = true;
}else{ }else{
let list = response.data.dataList; let list = response.data.dataList;
for(let i = 0;i<list.length;i++){ for(let i = 0;i<list.length;i++){
this.postList.push(list[i]); this.postList.push(list[i]);
} }
this.paginationReset = false;
this.pages = response.data.totalPage; this.pages = response.data.totalPage;
} }
}) })
}, },
dataGetVideoDynamic(currentPage){
this.paginationState = 'loading';
let name = this.$route.params.name;
this.$axios.$get(config.api.get.Topic.postList+name+'/posts',{
params:{
page:currentPage,
size:10,
type:1
}
}).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;
}
})
},
dataGetPictureDynamic(currentPage){
this.paginationState = 'loading';
let name = this.$route.params.name;
this.$axios.$get(config.api.get.Topic.postList+name+'/posts',{
params:{
page:currentPage,
size:10,
type:2
}
}).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;
}
})
},
changePage(currentPage){ changePage(currentPage){
//返回页数 请求新的数据 //返回页数 请求新的数据
this.dataGetDynamic(currentPage); let type = this.$route.query.type;
}, if(type==='new'){
this.dataGetNewDynamic(currentPage);
}
if(type==='word'){
this.dataGetWordDynamic(currentPage);
}
if(type==='video'){
this.dataGetPictureDynamic(currentPage);
}
if(type==='picture'){
this.dataGetVideoDynamic(currentPage);
}
dataGetUsers(id){ },
this.$axios.$get(config.api.get.Topic.topicFollowerList+id+'/follower',{
dataGetUsers(){
this.$axios.$get(config.api.get.User.active,{
params:{ params:{
page:1, page:1,
size:10 size:5
} }
}).then((response)=>{ }).then((response)=>{
this.userList = response.data.dataList; this.userList = response.data.dataList;
......
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