Commit 38d0db46 authored by 罗林杰's avatar 罗林杰

修改关注

parent 919c50e2
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
</view> </view>
<view class="bottom-address">{{item.city}}</view> <view class="bottom-address">{{item.city}}</view>
</view> </view>
<image v-if="type == '1' || type == '3'" class="cnacleLike" :src="baseUrl+'/user/cancelLike.png'" @click="gotoDetail(item.userId)"/>
</view> </view>
</view> </view>
</view> </view>
...@@ -33,7 +34,7 @@ ...@@ -33,7 +34,7 @@
</template> </template>
<script> <script>
import {userList} from "../../api/user"; import {deleteFollow, userList} from "../../api/user";
import {getOssUrl} from "../../api/article"; import {getOssUrl} from "../../api/article";
import {getCity, getValue} from "../../common/options"; import {getCity, getValue} from "../../common/options";
import {calculateAge, parseDate} from "../../common"; import {calculateAge, parseDate} from "../../common";
...@@ -68,16 +69,6 @@ export default { ...@@ -68,16 +69,6 @@ export default {
//设置页头 //设置页头
this.type = options.type; this.type = options.type;
this.num = options.num; this.num = options.num;
if (this.type == '1'){
//我喜欢的
this.title = '我喜欢的' + '('+ this.num +')';
} else if (this.type == '2'){
//喜欢我的
this.title = '喜欢我的' + '('+ this.num +')';
} else if (this.type == '3'){
//互相喜欢
this.title = '互相喜欢' + '('+ this.num +')';
}
//获取当前页面的页头高度 //获取当前页面的页头高度
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
...@@ -103,6 +94,8 @@ export default { ...@@ -103,6 +94,8 @@ export default {
//我喜欢的 //我喜欢的
userList(params).then(res =>{ userList(params).then(res =>{
this.userList = res.data.data this.userList = res.data.data
this.num = this.userList.length
this.getTitle()
//遍历this.userList //遍历this.userList
this.userList.forEach(item => { this.userList.forEach(item => {
//处理头像 //处理头像
...@@ -129,6 +122,19 @@ export default { ...@@ -129,6 +122,19 @@ export default {
console.log(e) console.log(e)
}) })
}, },
//获取表头
getTitle(){
if (this.type == '1'){
//我喜欢的
this.title = '我喜欢的' + '('+ this.num +')';
} else if (this.type == '2'){
//喜欢我的
this.title = '喜欢我的' + '('+ this.num +')';
} else if (this.type == '3'){
//互相喜欢
this.title = '互相喜欢' + '('+ this.num +')';
}
},
//获取用户列表数据 //获取用户列表数据
getUserList(){ getUserList(){
if (this.type == '1'){ if (this.type == '1'){
...@@ -157,6 +163,34 @@ export default { ...@@ -157,6 +163,34 @@ export default {
this.getList(params) this.getList(params)
} }
}, },
deleteLike(id){
//是否确认
uni.showModal({
title: '提示',
content: '是否取消关注',
success: (res) => {
if (res.confirm) {
const form = {
userId: uni.getStorageSync('userInfo').businessId,
targetId: id,
}
deleteFollow(form).then(res => {
if (res.data.code == 200){
this.$u.toast('取消关注成功')
this.getUserList()
}
})
} else if (res.cancel) {
}
}
});
},
//跳转用户详情
gotoDetail(item){
uni.navigateTo({
url: '/pagesUser/userInfo?id='+item.userId
})
},
backbar() { backbar() {
uni.navigateBack({ uni.navigateBack({
delta: 1, //返回层数,2则上上页 delta: 1, //返回层数,2则上上页
...@@ -284,4 +318,12 @@ export default { ...@@ -284,4 +318,12 @@ export default {
} }
} }
.cnacleLike{
height: 40rpx;
width: 60rpx;
margin-top: 100rpx;
margin-right: 10rpx;
justify-content: flex-end;
display: flex
}
</style> </style>
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