mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-09 02:46:46 +08:00
提交
This commit is contained in:
@@ -22,7 +22,10 @@
|
||||
<view style="display: flex;line-height: 40upx;">
|
||||
<author-info :name="detailData.sysCreateBy" :avatar="detailData.avatar" :sex="detailData.sex" :info="detailData.ucode" :showInfo="true"></author-info>
|
||||
</view>
|
||||
<view class="concern">
|
||||
<view class="concern" v-if="hasFollow" @click="cancelFollow()">
|
||||
已关注
|
||||
</view>
|
||||
<view class="concern" v-else @click="addFollow()">
|
||||
+关注
|
||||
</view>
|
||||
<!-- <view class="concern" style="color: #999;">
|
||||
@@ -190,6 +193,7 @@ import apiQa from '@/api/modules/qa.js';
|
||||
import apiUser from '@/api/system/user.js'
|
||||
import apiPraises from '@/api/modules/praises.js'
|
||||
import apiMessage from '@/api/system/message.js'
|
||||
import apiFollow from "@/api/phase2/userfollow.js"
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
@@ -221,11 +225,13 @@ export default {
|
||||
loading: false,//控制点赞按钮是否可以点击
|
||||
firstIndex:0,
|
||||
type:4,
|
||||
hasFollow:false,
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
this.questionId=option.id
|
||||
this.getData(this.questionId);
|
||||
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo']),
|
||||
@@ -262,6 +268,48 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addFollow(){ //添加关注
|
||||
if(this.detailData.sysCreateAid){
|
||||
if(this.userInfo.aid==this.detailData.sysCreateAid){
|
||||
uni.showToast({icon: 'info',title:"不能对自己操作"})
|
||||
return;
|
||||
}
|
||||
let $this=this;
|
||||
apiFollow.save(this.detailData.sysCreateAid).then(res=>{
|
||||
if(res.status == 200) {
|
||||
$this.hasFollow=true;
|
||||
uni.showToast({icon: 'success',title:"关注成功"})
|
||||
} else {
|
||||
uni.showToast({icon: 'info',title:"关注失败"+res.message})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
cancelFollow(){
|
||||
if(this.detailData.sysCreateAid){
|
||||
if(this.userInfo.aid==this.detailData.sysCreateAid){
|
||||
uni.showToast({icon: 'info',title:"不能对自己操作"})
|
||||
return;
|
||||
}
|
||||
|
||||
let $this=this;
|
||||
apiFollow.remove(this.detailData.sysCreateAid).then(res=>{
|
||||
if(res.status == 200) {
|
||||
$this.hasFollow=false;
|
||||
uni.showToast({icon: 'success',title:"已取消关注"})
|
||||
}else {
|
||||
uni.showToast({icon: 'info',title:"取消关注失败"+res.message})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
autoCheck(id){
|
||||
apiFollow.checkFllow(id).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.hasFollow = res.result ? true : false;
|
||||
}
|
||||
})
|
||||
},
|
||||
closeAnswerEdit(){
|
||||
this.answerEdit.show=false;
|
||||
},
|
||||
@@ -286,6 +334,7 @@ export default {
|
||||
this.answers=res.result.answers;
|
||||
this.answerList=[]
|
||||
this.getAnswerList(id);
|
||||
this.autoCheck(res.result.sysCreateAid);
|
||||
apiUser.getByIds([res.result.sysCreateAid]).then(rs=>{
|
||||
setTimeout(function(){ uni.hideLoading() },100);
|
||||
if(rs.status==200){
|
||||
|
||||
Reference in New Issue
Block a user