This commit is contained in:
cansnow
2025-12-02 03:05:52 +08:00
parent b4c9ae1b67
commit 29be534f22
24 changed files with 1118 additions and 372 deletions
@@ -4,6 +4,7 @@
:previewImg="false"
:showImgMenu="false"
:lazyLoad="false"
selectable
:content="getContent"
/>
</view>
@@ -15,13 +15,19 @@
<image v-if="isFailedMessage && !isPreview" src="@/static/images/chating_message_failed.png" />
</view>
</view>
<view class="message_content_wrap message_content_wrap_shadow">
<view class="message_content_wrap message_content_wrap_shadow" @longtap="longtap($event)">
<text-message-render v-if="showTextRender" :message="source" />
<media-message-render v-else-if="showMediaRender" :message="source" />
<error-message-render v-else />
</view>
</view>
</view>
<!-- 长按菜单 -->
<chunLei-popups v-model="toolTipFlag" :popData="toolTipData" @tapPopup="tapPopup"
:x="toolTipX" :y="toolTipY" :placement="popPostion"
direction="row" theme="dark" :dynamic="true">
</chunLei-popups>
</view>
<view v-else class="notice_message_container" :id="`auchor${source.clientMsgID}`">
@@ -30,25 +36,15 @@
</template>
<script>
import {
mapGetters
} from "vuex";
import {
MessageStatus,
MessageType,
SessionType,
} from "openim-uniapp-polyfill";
import {mapGetters} from "vuex";
import {MessageStatus,MessageType,SessionType,} from "openim-uniapp-polyfill";
import chunLeiPopups from "@/components/chunLei-popups.vue";
import MyAvatar from "@/components/MyAvatar/index.vue";
import TextMessageRender from "./TextMessageRender.vue";
import MediaMessageRender from "./MediaMessageRender.vue";
import ErrorMessageRender from "./ErrorMessageRender.vue";
import {
noticeMessageTypes
} from "@/constant";
import {
tipMessaggeFormat,
formatMessageTime
} from "@/util/imCommon";
import {noticeMessageTypes} from "@/constant";
import {tipMessaggeFormat,formatMessageTime} from "@/util/imCommon";
const textRenderTypes = [MessageType.TextMessage];
@@ -60,6 +56,7 @@
TextMessageRender,
MediaMessageRender,
ErrorMessageRender,
chunLeiPopups
},
props: {
source: Object,
@@ -71,7 +68,14 @@
isActive: Boolean,
},
data() {
return {};
return {
toolTipX: 0,
toolTipY: 0,
toolTipFlag: false,
popPostion:"default",
toolTipData: [],
};
},
computed: {
...mapGetters([
@@ -133,6 +137,119 @@
}, 2000);
}
},
longtap(e){
console.log(e.target,e.currentTarget);
this.showToolTip(e);
},
//操作项
showToolTip: function(e) {
let that = this;
that.toolTipData=[
{
id: 1,
icon: '/static/images/chat/longTipIcon/copy.png',
title: '复制',
disabled: false
},
{
id: 4,
icon: '/static/images/chat/longTipIcon/zhuanfa.png',
title: '转发',
disabled: false
},
{
id: 5,
icon: '/static/images/chat/longTipIcon/tag.png',
title: '编辑',
disabled: false
}
];
that.toolTipX =e.touches[0].clientX;
that.toolTipY = e.touches[0].clientY-20;
that.toolTipFlag = !that.toolTipFlag;
if(that.toolTipFlag==true){
let nowTime=new Date().getTime();
let msgTime=that.source.createTime;
let diff= nowTime-msgTime;
if(this.isSender&&diff<120000){
that.toolTipData.push({
id: 3,
icon: '/static/images/chat/longTipIcon/revert.png',
title: '撤回',
disabled: false
})
}
}
},
tapPopup(e) {
let that = this;
let currentHandleMsg=that.source;
if (e.title == "撤回") {
let editMessage=JSON.parse(JSON.stringify(currentHandleMsg));
that.$emit("revertMsg",editMessage)
that.toolTipFlag = false;
}
if (e.title == "复制") {
let content = currentHandleMsg.content;
if (content) {
let copyContent =content.text;
let formatStr = this.replaceReseverEmoji(copyContent);
that.globalUtil.uniCopy({
content: formatStr,
success: (res) => {
uni.showToast({
title: res,
icon: 'none'
})
},
error: (e) => {
uni.showToast({
title: e,
icon: 'none',
duration: 3000,
})
}
})
}
that.toolTipFlag = false;
return;
}
if (e.title == "转发") {
that.toolTipFlag = false;
/* that.$u.route({
url: '/pages/chat/chatGroup/msgForward',
params: {
msgList:encodeURIComponent(JSON.stringify([currentHandleMsg])),
sendType: 1, //1 单条转发 2多条转发
fromChatGroupId: currentHandleMsg.groupId
}
}) */
return
}
if(e.title=="调换"){
that.toolTipFlag = false;
return;
}
if (e.title == "多选") {
that.toolTipFlag = false;
/* that.$u.route({
url: '/pages/chat/chatting/chatting-checkbox',
params: {
groupId:currentHandleMsg.groupId,
pageNum:1,
selectMsgId: currentHandleMsg.id,
}
}) */
return
}
if(e.title=="编辑"){
let editMessage=JSON.parse(JSON.stringify(currentHandleMsg));
editMessage.formatTimeStr=currentHandleMsg.createTime;
that.$emit("showUpdateMsg",editMessage)
that.toolTipFlag = false;
return;
}
},
},
};
</script>
@@ -185,19 +302,22 @@
color: #666;
margin-bottom: 6rpx;
}
.message_content_wrap_shadow {
box-shadow: 0px 0px 2px rgba(0,0,0,0.1);
}
.message_content_wrap {
@include vCenterBox();
text-align: start;
// font-size: 14px;
color: $uni-text-color;
width: fit-content;
max-width: 100%;
word-wrap: break-word;
word-break: break-word;
.bg_container {
padding: 16rpx 24rpx;
border-radius: 0rpx 12rpx 12rpx 12rpx;
background-color: #f0f0f0;
background-color: #fff;
}
}
}
@@ -245,13 +365,15 @@
margin-right: 20rpx;
// text-align: end;
align-items: flex-end;
.message_content_wrap_shadow {
box-shadow: 0px 0px 2px #95e261;
}
.message_content_wrap {
flex-direction: row-reverse;
.bg_container {
border-radius: 12rpx 0 12rpx 12rpx;
background-color: #dcebfe !important;
background-color: #94ec68 !important;
}
}
}