This commit is contained in:
cansnow
2026-01-15 22:50:35 +08:00
parent dd16348558
commit db99bebcb4
26 changed files with 433 additions and 284 deletions
@@ -16,6 +16,7 @@
</view>
<view class="lastest_msg_wrap">
<text class="lastest_msg_content">{{ latestMessage }}</text>
<uni-icons v-if="source.recvMsgOpt===2" custom-prefix="imfont" type="im-bell-off" size="16" color="#ddd"></uni-icons>
</view>
</view>
</view>
@@ -47,6 +48,7 @@
parsedMessage = JSON.parse(this.source.latestMsg);
} catch (e) {}
if (!parsedMessage) return "";
//console.log(parsedMessage);
return getConversationContent(parsedMessage);
},
latestMessageTime() {
@@ -64,7 +66,7 @@
},
methods: {
clickConversationItem() {
console.log(this.source);
//console.log(this.source);
prepareConversationState(this.source);
},
longtapConversationItem() {
@@ -148,6 +150,7 @@
.lastest_msg_wrap {
display: flex;
align-items: center;
font-size: 24rpx;
margin: 10rpx 0;
color: #666;
+29 -18
View File
@@ -2,13 +2,15 @@
<view class="conversation_container">
<chat-header ref="chatHeaderRef" />
<uni-swipe-action ref="swipe_action">
<template v-for="item in storeConversationList" >
<uni-swipe-action-item
v-if="item.sendID !='system1'"
:right-options="swipe_actions"
@click="actionClick($event,item)"
v-for="item in storeConversationList"
:key="item.conversationID" >
<conversation-item @longtapEvent="showExtendMenu(item)" :source="item"/>
</uni-swipe-action-item>
</template>
</uni-swipe-action>
<view class="loading_wrap" v-if="storeProgress > 0 && storeProgress < 100">
<u-loading-icon :vertical="true" :text="storeProgress + '%'"></u-loading-icon>
@@ -59,7 +61,12 @@
};
},
computed: {
...mapGetters(["storeConversationList", "storeIsSyncing", "storeProgress",'storeCurrentUserID']),
...mapGetters([
"storeConversationList",
"storeIsSyncing",
"storeProgress",
'storeCurrentUserID'
]),
},
onReady() {
// #ifdef APP
@@ -87,33 +94,33 @@
},
showExtendMenu(item){
const _this = this;
const menu = [item.recvMsgOpt===0 ? '关闭免打扰':'免打扰',item.isPrivateChat? '关闭阅后即焚':'开启阅后即焚','隐藏',item.isPinned ? '取消置顶':'置顶','删除'];
const menu = [item.recvMsgOpt===0 ? '免打扰':'关闭免打扰',item.isPrivateChat? '关闭阅后即焚':'开启阅后即焚','隐藏',item.isPinned ? '取消置顶':'置顶','删除'];
uni.showActionSheet({
itemList:menu,
success(e) {
switch(menu[e.tapIndex]){
case '免打扰':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
recvMsgOpt: 2
})
break;
case '关闭免打扰':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
recvMsgOpt: 0
})
break;
case '开启阅后即焚':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
isPrivateChat: true,
burnDuration:60
})
break;
case '关闭阅后即焚':
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
_this.setConversation({
conversationID: item.conversationID,
isPrivateChat: false
})
break;
@@ -121,10 +128,16 @@
IMSDK.asyncApi('hideConversation', IMSDK.uuid(), item.conversationID)
break;
case '置顶':
_this.setPinConversation(item.conversationID,true);
_this.setConversation({
conversationID: item.conversationID,
isPinned: true
});
break;
case '取消置顶':
_this.setPinConversation(item.conversationID,false);
_this.setConversation({
conversationID: item.conversationID,
isPinned: false
})
break;
case '删除':
_this.deleteConversation(item.conversationID);
@@ -155,11 +168,9 @@
})
},
setPinConversation(conversationId,status){
IMSDK.asyncApi('setConversation', IMSDK.uuid(), {
conversationID: conversationId,
isPinned: status
})
async setConversation(data){
await IMSDK.asyncApi('setConversation', IMSDK.uuid(), data);
},
onRefresh() {