This commit is contained in:
cansnow
2025-12-08 18:10:51 +08:00
parent 22ee59cd3d
commit b2e1b8930e
19 changed files with 218 additions and 300 deletions
@@ -58,24 +58,24 @@ export default {
<style lang="scss" scoped>
.media_message_container {
position: relative;
border-radius: 16rpx;
overflow: hidden;
position: relative;
border-radius: 16rpx;
overflow: hidden;
.play_icon {
width: 48px;
height: 48px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.play_icon {
width: 48px;
height: 48px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.video_duration {
position: absolute;
bottom: 12rpx;
right: 24rpx;
color: #fff;
}
.video_duration {
position: absolute;
bottom: 12rpx;
right: 24rpx;
color: #fff;
}
}
</style>
@@ -12,7 +12,7 @@
<view style="height: 100%;display: flex;justify-items: center;align-items: center;">
<view class="message_send_state">
<u-loading-icon v-if="showSending && !isPreview" />
<image v-if="isFailedMessage && !isPreview" src="@/static/images/chating_message_failed.png" />
<image v-if="isFailedMessage && !isPreview" class="state_img" src="@/static/images/chating_message_failed.png" />
</view>
</view>
<view class="message_content_wrap message_content_wrap_shadow" :id="`message_content_wrap_${source.clientMsgID}`" @longtap.stop.prevent="longtapEvent($event)">
@@ -23,12 +23,6 @@
</view>
</view>
<!-- 长按菜单 -->
<chunLei-popups v-model="toolTipFlag" :popData="toolTipData" @tapPopup="tapPopup"
:x="toolTipX" :y="toolTipY" :placement="popPostion"
:triangle="false"
direction="row" theme="dark" :dynamic="true">
</chunLei-popups>
</view>
<view v-else class="notice_message_container" style="margin: 0 auto;" :id="`auchor${source.clientMsgID}`">
@@ -39,11 +33,10 @@
<script>
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 TextMessageRender from "./TextMessageRender";
import MediaMessageRender from "./MediaMessageRender";
import ErrorMessageRender from "./ErrorMessageRender";
import {noticeMessageTypes} from "@/constant";
import {tipMessaggeFormat,formatMessageTime} from "@/util/imCommon";
@@ -56,8 +49,7 @@
MyAvatar,
TextMessageRender,
MediaMessageRender,
ErrorMessageRender,
chunLeiPopups
ErrorMessageRender
},
props: {
source: Object,
@@ -139,123 +131,9 @@
},
longtapEvent(e){
console.log('longtapEvent');
// console.log("#"+e.currentTarget.id,e);
// let view = uni.createSelectorQuery().in(this).select("#"+e.currentTarget.id.replace('message_content_wrap_','auchor'));
// console.log(e.touches[0].clientX,e.touches[0].clientY);
// view.boundingClientRect((data) => {
// console.log(data.left,data.top);
// //console.log("得到布局位置信息" + JSON.stringify(data));
// }).exec();
this.$emit('userEvent',{type:"longtapMsgContent"},this.source);
//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: 6,
icon: '/static/images/chat/longTipIcon/select.png',
title: '多选',
disabled: false
},
{
id: 7,
icon: '/static/images/chat/longTipIcon/delete.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;
console.log(currentHandleMsg);
if (e.title == "撤回") {
that.toolTipFlag = false;
that.$emit('userEvent',{type:'revokeMessage'},that.source);
}
if (e.title == "复制") {
let content = currentHandleMsg.textElem?.content;
if (content) {
let copyContent =content.text;
let formatStr = copyContent;
//let formatStr = this.replaceReseverEmoji(copyContent);
uni.setClipboardData({
data: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.$emit('userEvent',{type:'forward'},that.source);
that.toolTipFlag = false;
return
}
if(e.title=="调换"){
that.toolTipFlag = false;
return;
}
if (e.title == "多选") {
that.$emit('userEvent',{type:'select'},that.source);
that.toolTipFlag = false;
return
}
if (e.title == "删除") {
that.toolTipFlag = false;
that.$emit('userEvent',{type:'deleteMsg'},that.source);
return
}
},
},
};
</script>
@@ -346,7 +224,7 @@
color: #999;
}
image {
.state_img {
width: 16px;
height: 16px;
}
@@ -376,7 +254,7 @@
}
.message_content_wrap {
flex-direction: row-reverse;
.bg_container {
border-radius: 12rpx 0 12rpx 12rpx;
background-color: #94ec68 !important;
@@ -398,7 +276,7 @@
background-color: #fdf5e9;
}
}
.notice_message_container {
@include ellipsisWithLine(2);
text-align: center;