Commit fc8cb7c7 by yanju

话题详情动态获取

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