This commit is contained in:
2022-01-28 09:51:22 +08:00
parent 27c3f583f1
commit 572066de9a
2 changed files with 118 additions and 122 deletions

View File

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

View File

@@ -8,7 +8,7 @@ import {
const initIm = (KEY) => { const initIm = (KEY) => {
RongIMLib.init(KEY) RongIMLib.init(KEY)
CallLib.init() CallLib.init({})
addListeners() addListeners()
} }