好友删除,扫码加好友
This commit is contained in:
@@ -58,7 +58,8 @@
|
||||
<script>
|
||||
import {
|
||||
getFriendInfo,
|
||||
pedingFriend
|
||||
pedingFriend,
|
||||
deleteFriend
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import * as RongIMLib from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
||||
|
||||
@@ -71,11 +72,10 @@
|
||||
isTop: false,
|
||||
block: false,
|
||||
conversationType: 1
|
||||
};
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
console.log(this.targetId);
|
||||
getFriendInfo(e.targetId).then(res => {
|
||||
this.userInfo = res
|
||||
uni.setNavigationBarTitle({
|
||||
@@ -125,9 +125,19 @@
|
||||
content: '确认删除后不可恢复',
|
||||
success: (e) => {
|
||||
if (e.confirm) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '开发中'
|
||||
deleteFriend(this.targetId).then(res => {
|
||||
// 删除聊天记录
|
||||
RongIMLib.deleteMessages(1, this.targetId)
|
||||
RongIMLib.removeConversation(1, this.targetId)
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '好友删除成功',
|
||||
success() {
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -154,20 +164,18 @@
|
||||
},
|
||||
// 申请好友
|
||||
toBeFriend() {
|
||||
pedingFriend(this.targetId)
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
title: '申请成功',
|
||||
icon: "none"
|
||||
})
|
||||
pedingFriend(this.targetId).then(res => {
|
||||
uni.showToast({
|
||||
title: '申请成功',
|
||||
icon: "none"
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
title: err.message,
|
||||
duration: 2000
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
title: err.message,
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user