Files
ZhHealth/pages/im/private/setting.vue
2022-01-19 16:49:29 +08:00

70 lines
2.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>