标记已读
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
/* 显示操作弹窗 */
|
/* 显示操作弹窗 */
|
||||||
showPop: false,
|
showPop: false,
|
||||||
/* 弹窗按钮列表 */
|
/* 弹窗按钮列表 */
|
||||||
popButton: ['置顶聊天', '删除该聊天'],
|
popButton: ['置顶聊天', '标记已读', '删除该聊天'],
|
||||||
/* 弹窗定位样式 */
|
/* 弹窗定位样式 */
|
||||||
popStyle: "",
|
popStyle: "",
|
||||||
pickedItem: {},
|
pickedItem: {},
|
||||||
@@ -72,6 +72,9 @@
|
|||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
RongIMLib.setConversationToTop(this.pickedItem.conversationType, this.pickedItem.targetId, !this
|
RongIMLib.setConversationToTop(this.pickedItem.conversationType, this.pickedItem.targetId, !this
|
||||||
.pickedItem.isTop)
|
.pickedItem.isTop)
|
||||||
|
} else if (index == 1) {
|
||||||
|
RongIMLib.clearMessagesUnreadStatus(this.pickedItem.conversationType, this.pickedItem.targetId, this
|
||||||
|
.pickedItem.sentTime)
|
||||||
} else {
|
} else {
|
||||||
RongIMLib.removeConversation(this.pickedItem.conversationType, this.pickedItem.targetId)
|
RongIMLib.removeConversation(this.pickedItem.conversationType, this.pickedItem.targetId)
|
||||||
RongIMLib.deleteMessages(this.pickedItem.conversationType, this.pickedItem.targetId)
|
RongIMLib.deleteMessages(this.pickedItem.conversationType, this.pickedItem.targetId)
|
||||||
@@ -96,8 +99,6 @@
|
|||||||
style += `left:${touches.clientX}px`
|
style += `left:${touches.clientX}px`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.popButton[0] = item.isTop ? '取消置顶' : '置顶聊天'
|
this.popButton[0] = item.isTop ? '取消置顶' : '置顶聊天'
|
||||||
this.popStyle = style
|
this.popStyle = style
|
||||||
this.pickedItem = item
|
this.pickedItem = item
|
||||||
|
|||||||
@@ -1,87 +1,33 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.chat {
|
|
||||||
height: 100vh;
|
|
||||||
overflow: scroll;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
.chat-scroll{
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
flex-direction: column-reverse;
|
|
||||||
justify-content: flex-end;
|
|
||||||
.cell{
|
|
||||||
padding: $padding/2 $padding;
|
|
||||||
.time{
|
|
||||||
text-align: center;
|
|
||||||
text{
|
|
||||||
color: $text-gray;
|
|
||||||
font-size: $title-size-sm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.cell-item{
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-start;
|
|
||||||
&.left{
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
.avatar{
|
|
||||||
margin-right: 20rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&.right{
|
|
||||||
flex-direction: row-reverse;
|
|
||||||
.avatar{
|
|
||||||
margin-left: 20rpx;
|
|
||||||
}
|
|
||||||
.state{
|
|
||||||
text-align: right;
|
|
||||||
font-size: 24rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.message-bar{
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="chat">
|
<view class="chat">
|
||||||
|
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
||||||
<!-- chat -->
|
<!-- chat -->
|
||||||
<view class="chat-scroll">
|
<view class="body">
|
||||||
<view class="cell" v-for="(item, index) in messages" :key="index">
|
<view class="scroll">
|
||||||
<view class="time">
|
<view class="cell" v-for="(item, index) in messages" :key="index">
|
||||||
<text>{{ item.sentTime|timeCustomCN }}</text>
|
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||||
</view>
|
<view :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
|
||||||
<view :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
|
<u-avatar class="avatar" size="40" shape="square"
|
||||||
<u-avatar class="avatar" size="40" shape="square"
|
@click="showUser(item.senderUserId, item.messageDirection)"
|
||||||
@click="showUser(item.senderUserId, item.messageDirection)"
|
:src="contact(item.senderUserId).portraitUrl" />
|
||||||
:src="contact(item.senderUserId).portraitUrl" />
|
<view class="msg">
|
||||||
<view class="msg">
|
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
|
||||||
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
|
:msg="item.content" />
|
||||||
:msg="item.content" />
|
<show-image v-if="item.objectName === 'RC:ImgMsg'" :guest="item.messageDirection == 1"
|
||||||
<show-image v-if="item.objectName === 'RC:ImgMsg'" :guest="item.messageDirection == 1"
|
:msg="item.content" />
|
||||||
:msg="item.content" />
|
<show-text v-if="item.objectName === 'RC:TxtMsg'" :guest="item.messageDirection == 1"
|
||||||
<show-text v-if="item.objectName === 'RC:TxtMsg'" :guest="item.messageDirection == 1"
|
:msg="item.content" />
|
||||||
:msg="item.content" />
|
<view class="state" v-if="item.messageDirection == 1">
|
||||||
<view class="state" v-if="item.messageDirection == 1">
|
<text
|
||||||
<text :class="item.sentStatus === 50?'state-text':'state-text-active'">{{ item.sentStatus == 50 ? '已读': '未读'}}</text>
|
:class="item.sentStatus === 50?'state-text':'state-text-active'">{{ item.sentStatus == 50 ? '已读': '未读'}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view id="chatBottom"></view>
|
|
||||||
</view>
|
</view>
|
||||||
<!-- footer -->
|
|
||||||
<sent-message-bar class="message-bar" :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import im from '@/utils/im/index.js'
|
import im from '@/utils/im/index.js'
|
||||||
@@ -89,7 +35,6 @@
|
|||||||
import showImage from '../components/showImage'
|
import showImage from '../components/showImage'
|
||||||
import showText from '../components/showText'
|
import showText from '../components/showText'
|
||||||
import sentMessageBar from '../components/sentMessageBar'
|
import sentMessageBar from '../components/sentMessageBar'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
sentMessageBar,
|
sentMessageBar,
|
||||||
@@ -199,15 +144,81 @@
|
|||||||
// 更新badge提醒数量
|
// 更新badge提醒数量
|
||||||
im.setNotifyBadge()
|
im.setNotifyBadge()
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
let el = this.$refs.chatBottom
|
|
||||||
ChatList.scrollToElement(el, {
|
|
||||||
offset: 0,
|
|
||||||
animated: false
|
|
||||||
})
|
|
||||||
}, 50)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
/* 窗口 */
|
||||||
|
.chat {
|
||||||
|
background: $window-color;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
|
||||||
|
.body {
|
||||||
|
overflow: scroll;
|
||||||
|
flex: 1;
|
||||||
|
height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
|
||||||
|
.scroll {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
|
.cell {
|
||||||
|
padding: 10rpx 30rpx;
|
||||||
|
|
||||||
|
.time {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-item {
|
||||||
|
display: flex;
|
||||||
|
width: 690rpx;
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
|
&.left {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.right {
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
|
||||||
|
.state {
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.msg {
|
||||||
|
margin: 0 20rpx;
|
||||||
|
|
||||||
|
.state {
|
||||||
|
padding-top: 10rpx;
|
||||||
|
|
||||||
|
.state-text {
|
||||||
|
font-size: $title-size-m - 2;
|
||||||
|
color: rgba($color: $main-color, $alpha: 0.3)
|
||||||
|
}
|
||||||
|
|
||||||
|
.state-text-active {
|
||||||
|
font-size: $title-size-m - 2;
|
||||||
|
color: #cecece;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cell-footer {
|
||||||
|
height: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user