IM测试,下一步页面调整

This commit is contained in:
2022-01-18 16:31:01 +08:00
parent e85b9c2c0d
commit 070c6c729e
10 changed files with 326 additions and 30 deletions

View File

@@ -0,0 +1,68 @@
<template>
<div>
会话设置 {{ targetId}}
<div @click="setStatus">免打扰开关 {{status}}</div>
<div @click="setTop">置顶会话 {{isTop}}</div>
<u-button @click="toIndex">会首页</u-button>
</div>
</template>
<script>
import * as RongIMLib from '@rongcloud/imlib-uni'
export default {
data() {
return {
targetId: '',
conversationType: 1,
isTop: false,
status: 0 // 0 是免打扰1是正常通知
}
},
onLoad(e) {
this.targetId = e.targetId
this.conversationType = e.conversationType
RongIMLib.getConversation(this.conversationType, this.targetId, ({
conversation
}) => {
this.isTop = conversation.isTop
})
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({
status
}) => {
this.status = status
})
},
methods: {
toIndex() {
uni.switchTab({
url: '/pages/im/index'
})
},
setStatus() {
RongIMLib.setConversationNotificationStatus(this.conversationType, this.targetId, this.status, ({
status
}) => {
this.status = status
})
},
setTop() {
RongIMLib.setConversationToTop(this.conversationType, this.targetId, !this.isTop, (res) => {
console.log(res);
RongIMLib.getConversation(this.conversationType, this.targetId, ({
conversation
}) => {
console.log(conversation.isTop);
this.isTop = conversation.isTop
})
})
}
}
}
</script>
<style>
</style>