This commit is contained in:
唐明明
2022-01-27 17:58:49 +08:00

View File

@@ -124,99 +124,124 @@
if (code == 0) { if (code == 0) {
this.isTop = conversation.isTop this.isTop = conversation.isTop
} }
}) });
}, },
methods: { toPrivate() {
copyAddress() { uni.redirectTo({
uni.setClipboardData({ url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
data: this.userInfo.address, });
success: () => { },
uni.showToast({ setRemark() {
icon: 'none', uni.showToast({
title: '复制区块链成功' title: '开发中',
icon: 'none'
});
},
deleteFriend() {
uni.showModal({
title: '删除确认',
content: '确认删除后不可恢复',
success: e => {
if (e.confirm) {
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'
});
}
});
});
}
}) })
} },
}) toPrivate() {
}, uni.redirectTo({
toPrivate() { url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId
uni.redirectTo({ })
url: '/pages/im/private/index?conversationType=1&targetId=' + this.targetId },
}) setRemark() {
}, uni.showToast({
setRemark() { title: '开发中',
uni.showToast({ icon: 'none'
title: '开发中', })
icon: 'none' },
}) deleteFriend() {
}, uni.showModal({
deleteFriend() { title: '删除确认',
uni.showModal({ content: '确认删除后不可恢复',
title: '删除确认', success: (e) => {
content: '确认删除后不可恢复', if (e.confirm) {
success: (e) => { deleteFriend(this.targetId).then(res => {
if (e.confirm) { // 删除聊天记录
deleteFriend(this.targetId).then(res => { RongIMLib.deleteMessages(1, this.targetId)
// 删除聊天记录 RongIMLib.removeConversation(1, this.targetId)
RongIMLib.deleteMessages(1, this.targetId) uni.showToast({
RongIMLib.removeConversation(1, this.targetId) icon: 'none',
uni.showToast({ title: '好友删除成功',
icon: 'none', success() {
title: '好友删除成功', uni.switchTab({
success() { url: '/pages/im/index'
uni.switchTab({ })
url: '/pages/im/index' }
}) })
}
}) })
}) }
} }
} })
}) },
}, setStatus() {
setStatus() { RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({
RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({ status
status
}) => {
this.status = !Boolean(status)
})
},
setTop() {
RongIMLib.setConversationToTop(this.conversationType, this.targetId, this.isTop, (res) => {
RongIMLib.getConversation(this.conversationType, this.targetId, ({
conversation
}) => { }) => {
this.isTop = conversation.isTop this.status = !Boolean(status)
}) })
}) },
}, setTop() {
// 申请好友 RongIMLib.setConversationToTop(this.conversationType, this.targetId, this.isTop, (res) => {
toBeFriend() { RongIMLib.getConversation(this.conversationType, this.targetId, ({
pedingFriend(this.targetId).then(res => { conversation
uni.showToast({ }) => {
title: '申请成功', this.isTop = conversation.isTop
icon: "none" })
}) })
}).catch(err => { },
uni.showToast({ // 申请好友
icon: 'error', toBeFriend() {
title: err.message, pedingFriend(this.targetId).then(res => {
duration: 2000 uni.showToast({
title: '申请成功',
icon: 'none'
});
})
.catch(err => {
uni.showToast({
icon: 'error',
title: err.message,
duration: 2000
})
})
},
singleCall(e) {
CallLib.startSingleCall(this.targetId, e.type, '');
uni.redirectTo({
url: '/pages/im/private/call',
success: (err) => {
console.log('跳转视频通话成功');
},
fail: (err) => {
console.log('跳转视频页失败', err);
}
}) })
}) },
},
singleCall(e) {
CallLib.startSingleCall(this.targetId, e.type, '');
uni.redirectTo({
url: '/pages/im/private/call',
success: (err) => {
console.log('跳转视频通话成功');
},
fail: (err) => {
console.log('跳转视频页失败', err);
}
})
},
} }
}
}; };
</script> </script>