Commit 5e3e6e86 by yanju

话题的关注

parent bc7d62dc
......@@ -195,6 +195,10 @@ export default {
delete:'/api/question/'//删除问题 +{questionId}
},
Topic:{
cancelFollow:'/api/topic/',//取消关注 +{topicId}/follower
},
QuestionReply:{
delete:'/api/question/reply/',//删除问题回复 +{replyId}
},
......
......@@ -17,7 +17,7 @@
></alerts-content>
</div>
<div class="alerts-card__footer">
<p>查看全部 ( {{ unread }}</p>
<nuxt-link to="/personal-center/message">查看全部 ( {{ unread }}</nuxt-link>
</div>
</div>
</div>
......
......@@ -11,10 +11,19 @@
<div class="topic-card-right">
<div class="right-header">
<span class="right-title"># {{cardName}} #</span>
<span class="right-label" @click="handleFocus" :style="{color: fontColor}">{{focus}}</span>
<span class="right-label1" v-if="!followedTopic" @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" >
<yun-icon v-if="!loading" name="right" size="12"></yun-icon>
<yun-icon v-if="loading" name="loading" size="12"> </yun-icon>
已关注
</span>
</div>
<p class="right-content">{{cardIntro}}</p>
<p class="right-footer">{{cardNum1}}使用 · 1.45亿阅读</p>
<p class="right-footer">{{cardNum1}}讨论</p>
</div>
</div>
</div>
......@@ -22,6 +31,8 @@
<script>
import {dateConvert} from "../../action/utils/dataConvert";
import {globalBus} from "../common/globalBus";
import config from "../../action/config";
export default {
......@@ -49,7 +60,9 @@
cardTags:[],
cardTime:'',
cardNum1:'',
topicIcon:''
topicIcon:'',
loading : false,
followedTopic:false
}
},
......@@ -79,10 +92,57 @@
this.cardTags = info.tags;
this.cardTime = dateConvert(info.createTime);
this.cardNum1 = info.referenceCount;
this.followedTopic = info.followedTopic;
}
},
changeRoute(r){
this.$router.push(r);
},
dataPostFollowTopic(){
this.loading = true;
this.$axios.$post(config.api.post.Topic.follow+this.cardId+'/follower').then((response)=>{
if(response.code===0){
this.$message({
type:'success',
message:'关注成功'
})
this.followedTopic = true;
}else{
this.$message({
type:'warning',
message:response.msg
})
}
this.loading = false;
})
},
dataDeleteFollowTopic(){
this.loading = true;
this.$axios.$delete(config.api.post.Topic.follow+this.cardId+'/follower').then((response)=>{
this.loading = false;
if(response.code===0){
this.$message({
type:'success',
message:'取消关注成功'
})
this.followedTopic = false;
}else{
this.$message({
type:'warning',
message:response.msg
})
}
})
}
},
watch:{
......@@ -144,13 +204,16 @@
margin-right: 23*$length;
@include fontStyle(14,14,500,#333,left);
}
.right-label{
.right-label1{
@include fontStyle(14,20,500,#55B946,left);
}
.right-label2{
@include fontStyle(14,20,500,#666,left);
}
}
.right-content{
margin-top: 8*$length;
@include fontStyle(12,17,500,#666,left);
@include fontStyle(12,17,500,#999,left);
height: auto;
}
.right-footer{
......
......@@ -68,11 +68,6 @@
label: '我的消息',
address: '/personal-center/message',
id: '我的消息'
},
{
label: '私信',
address: '/personal-center/message#',
id: '私信'
}
],
selected:'全部'
......
......@@ -170,7 +170,6 @@
methods:{
dataGetTopicInfo(name){
this.$axios.$get(config.api.get.Topic.detail+name,{
params:{
by:'name'
......
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