This commit is contained in:
zhaofang
2022-11-11 15:01:38 +08:00
parent be72392b7d
commit fd782ef6f0
2 changed files with 65 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
<template>
<view class="my-medal">
<view class="medal-img">
<u-avatar v-if="userInfo.avatar && userInfo.avatar!=''" shape="circle" :size="76" :src="fileBaseUrl + userInfo.avatar" ></u-avatar>
<u-avatar style="margin: 0 auto;" v-if="userInfo.avatar && userInfo.avatar!=''" shape="circle" :size="76" :src="fileBaseUrl + userInfo.avatar" ></u-avatar>
<view v-else>
<view v-if="userInfo.sex == null" class="peo"></view>
<view v-else>
@@ -221,9 +221,9 @@
background-position: 14upx 26upx;
border-radius: 20upx 20upx 0px 0px;
backdrop-filter: blur(32px);
margin: 32upx;
margin-top: 70upx;
margin: 70upx 32upx 0 32upx;
height: 47vh;
max-height: 47vh;
padding: 60upx 24upx;
padding-bottom: 140upx;
.medal-title{
@@ -254,23 +254,27 @@
font-size: 20upx;
color: #fff;
bottom: 20upx;
left:36upx;
// left:36upx;
left:0;
right:0;
transform: scale(.7);
}
.img-level{
position: absolute;
font-size: 12upx;
color: #fff;
left:60upx;
// left:60upx;
top: 24upx;
left:0;
right:0;
transform: scale(.7);
}
}
.medal-list-index:last-child{
.medal-img-index .img-level{
left:50upx;
}
}
// .medal-list-index:last-child{
// .medal-img-index .img-level{
// left:50upx;
// }
// }
}

View File

@@ -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){