This commit is contained in:
cansnow
2025-12-05 16:10:52 +08:00
parent 29be534f22
commit 69a61178e1
64 changed files with 2575 additions and 1141 deletions
@@ -3,10 +3,8 @@
<view>
<view class="chat_footer">
<!-- 语音信息 -->
<image v-if="1==2" v-show="!isAudio" @click.prevent="isAudio=!isAudio"
src="@/static/images/chating_footer_audio.png" alt="" srcset="" />
<image v-if="1==2" v-show="isAudio" @click.prevent="isAudio=!isAudio"
src="@/static/images/chating_footer_audio_recording.png" alt="" srcset="" />
<image v-if="1==2" v-show="!isAudio" @click.prevent="isAudio=!isAudio" src="@/static/images/chating_footer_audio.png" alt="" srcset="" />
<image v-if="1==2" v-show="isAudio" @click.prevent="isAudio=!isAudio" src="@/static/images/chating_footer_audio_recording.png" alt="" srcset="" />
<view class="input_content">
<!-- #ifdef APP-PLUS -->
<view v-if="isAudio" class="voice_title" @touchstart.stop.prevent="startVoice"
@@ -20,14 +18,12 @@
</view>
<view class="footer_action_area" v-show="!isAudio">
<image class="emoji_action" @click.prevent="updateActionBar(true)"
src="@/static/images/chating_footer_emoji.png" alt="" srcset="" />
<image v-show="!hasContent" @click.prevent="updateActionBar"
src="@/static/images/chating_footer_add.png" alt="" srcset="" />
<image class="emoji_action" @click.prevent="updateActionBar(true)" src="@/static/images/chating_footer_emoji.png" alt="" srcset="" />
<image v-show="!hasContent" @click.prevent="updateActionBar(false)" src="@/static/images/chating_footer_add.png" alt="" srcset="" />
<button class="send_btn" type="primary" v-show="hasContent" @touchend.prevent="sendTextMessage">发送</button>
</view>
</view>
<chating-action-bar :isEmoji="isEmoji" @sendMessage="sendMessage" @prepareMediaMessage="prepareMediaMessage"
<chating-action-bar :isEmoji="isEmoji" @sendMessage="sendMessage($event,storeCurrentConversation.userID,storeCurrentConversation.groupID)" @prepareMediaMessage="prepareMediaMessage"
v-show="actionBarVisible" />
<u-action-sheet :safeAreaInsetBottom="true" round="12" :actions="actionSheetMenu" @select="selectClick"
:closeOnClickOverlay="true" :closeOnClickAction="true" :show="showActionSheet"
@@ -142,17 +138,17 @@
async sendTextMessage() {
if (!this.hasContent) return;
const message = await this.createTextMessage();
this.sendMessage(message);
this.sendMessage(message,this.storeCurrentConversation.userID,this.storeCurrentConversation.groupID);
},
sendMessage(message) {
sendMessage(message,user_id,group_id) {
this.pushNewMessage(message);
if (needClearTypes.includes(message.contentType)) {
this.customEditorCtx.clear();
}
this.$emit("scrollToBottom");
IMSDK.asyncApi(IMMethods.SendMessage, IMSDK.uuid(), {
recvID: this.storeCurrentConversation.userID,
groupID: this.storeCurrentConversation.groupID,
recvID: user_id,
groupID: group_id,
message,
offlinePushInfo,
})
@@ -289,7 +285,7 @@
IMSDK.uuid(),
getPurePath(path)
);
this.sendMessage(message);
this.sendMessage(message,this.storeCurrentConversation.userID,this.storeCurrentConversation.groupID);
});
},
selectClick({idx}) {
@@ -5,13 +5,18 @@
upper-threshold="250" @scrolltoupper="scrolltoupper">
<view id="scroll_wrap">
<u-loadmore nomoreText="" :status="loadMoreStatus" />
<view v-for="item in storeHistoryMessageList" :key="item.clientMsgID">
<view class="msg_item" v-for="item in storeHistoryMessageList" :key="item.clientMsgID" @click="onUserMessageEvent({type:'selected'},item)">
<template v-if="selectFlag">
<uni-icons class="selectedIcon" size="30" color="#07c160" type="checkbox-filled" v-if="selectClientMsgIDItems.indexOf(item.clientMsgID)>-1"></uni-icons>
<uni-icons class="selectedIcon" size="30" color="#ccc" type="circle" v-else></uni-icons>
</template>
<message-item-render
@messageItemRender="messageItemRender"
@longpress="onLongPressMessageItem(item)"
@userEvent="onUserMessageEvent"
:source="item"
:isSender="item.sendID === storeCurrentUserID"
/>
<!-- :isActive="selectClientMsgIDItems.indexOf(item.clientMsgID)>-1" -->
</view>
<view style="visibility: hidden; height: 12px" id="auchormessage_bottom_item"></view>
</view>
@@ -19,10 +24,7 @@
</template>
<script>
import {
mapGetters,
mapActions
} from "vuex";
import {mapGetters,mapActions} from "vuex";
import MessageItemRender from "./MessageItem/index.vue";
export default {
@@ -30,7 +32,18 @@
components: {
MessageItemRender,
},
props: {},
props: {
selectFlag:{
type:Boolean,
default:false
},
selectItems:{
type:Array,
default(){
return [];
}
}
},
data() {
return {
scrollIntoView: "",
@@ -45,7 +58,7 @@
withAnimation: false,
messageLoadState: {
loading: false,
},
}
};
},
computed: {
@@ -62,6 +75,13 @@
}
return this.messageLoadState.loading ? "loading" : "loadmore";
},
selectClientMsgIDItems(){
let arr = [];
this.selectItems.forEach((v,k)=>{
arr.push(v.clientMsgID);
});
return arr;
}
},
mounted() {
this.loadMessageList();
@@ -90,10 +110,7 @@
viewType: 0,
};
try {
const {
emptyFlag
} =
await this.getHistoryMesageList(options);
const {emptyFlag} =await this.getHistoryMesageList(options);
if (emptyFlag) {
this.$emit("initSuccess");
}
@@ -112,10 +129,7 @@
this.$emit("click", e);
},
onScroll(event) {
const {
scrollHeight,
scrollTop
} = event.target;
const {scrollHeight,scrollTop} = event.target;
this.old.scrollTop = scrollTop
this.needScoll =
scrollHeight - scrollTop < uni.getWindowInfo().windowHeight * 1.2;
@@ -162,9 +176,7 @@
});
},
checkInitHeight() {
this.getEl("#scroll_view").then(({
height
}) => {
this.getEl("#scroll_view").then(({height}) => {
this.bgHeight = `${height}px`;
});
},
@@ -179,9 +191,10 @@
.exec();
});
},
onLongPressMessageItem(msg){
}
onUserMessageEvent(e,data){
this.$emit('userEvent',e,data)
},
empty(){}
},
};
</script>
@@ -255,4 +268,16 @@
.fade-enter {
opacity: 0;
}
.msg_item{
display: flex;
flex-direction: row;
align-items: flex-start;
width: 100%;
.message_item{
flex:1;
}
.selectedIcon{
margin-top: 20rpx;
}
}
</style>
@@ -15,7 +15,7 @@
<image v-if="isFailedMessage && !isPreview" src="@/static/images/chating_message_failed.png" />
</view>
</view>
<view class="message_content_wrap message_content_wrap_shadow" @longtap="longtap($event)">
<view class="message_content_wrap message_content_wrap_shadow" :id="`message_content_wrap_${source.clientMsgID}`" @longtap.stop.prevent="longtapEvent($event)">
<text-message-render v-if="showTextRender" :message="source" />
<media-message-render v-else-if="showMediaRender" :message="source" />
<error-message-render v-else />
@@ -26,11 +26,12 @@
<!-- 长按菜单 -->
<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" :id="`auchor${source.clientMsgID}`">
<view v-else class="notice_message_container" style="margin: 0 auto;" :id="`auchor${source.clientMsgID}`">
<text>{{ getNoticeContent }}</text>
</view>
</template>
@@ -74,7 +75,6 @@
toolTipFlag: false,
popPostion:"default",
toolTipData: [],
};
},
computed: {
@@ -137,9 +137,17 @@
}, 2000);
}
},
longtap(e){
console.log(e.target,e.currentTarget);
this.showToolTip(e);
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) {
@@ -158,11 +166,23 @@
disabled: false
},
{
id: 5,
icon: '/static/images/chat/longTipIcon/tag.png',
title: '编辑',
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;
@@ -184,18 +204,19 @@
tapPopup(e) {
let that = this;
let currentHandleMsg=that.source;
console.log(currentHandleMsg);
if (e.title == "撤回") {
let editMessage=JSON.parse(JSON.stringify(currentHandleMsg));
that.$emit("revertMsg",editMessage)
that.toolTipFlag = false;
that.$emit('userEvent',{type:'revokeMessage'},that.source);
}
if (e.title == "复制") {
let content = currentHandleMsg.content;
let content = currentHandleMsg.textElem?.content;
if (content) {
let copyContent =content.text;
let formatStr = this.replaceReseverEmoji(copyContent);
that.globalUtil.uniCopy({
content: formatStr,
let formatStr = copyContent;
//let formatStr = this.replaceReseverEmoji(copyContent);
uni.setClipboardData({
data:formatStr,
success: (res) => {
uni.showToast({
title: res,
@@ -215,15 +236,8 @@
return;
}
if (e.title == "转发") {
that.$emit('userEvent',{type:'forward'},that.source);
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=="调换"){
@@ -231,24 +245,16 @@
return;
}
if (e.title == "多选") {
that.$emit('userEvent',{type:'select'},that.source);
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)
if (e.title == "删除") {
that.toolTipFlag = false;
return;
that.$emit('userEvent',{type:'deleteMsg'},that.source);
return
}
},
},
};
@@ -289,7 +295,7 @@
flex-direction: column;
align-items: flex-start;
margin-left: 20rpx;
// text-align: start;
// text-align: flex-start;
max-width: 80%;
position: relative;
@@ -307,7 +313,7 @@
}
.message_content_wrap {
@include vCenterBox();
text-align: start;
text-align: flex-start;
// font-size: 14px;
color: $uni-text-color;
width: fit-content;
@@ -316,7 +322,7 @@
.bg_container {
padding: 16rpx 24rpx;
border-radius: 0rpx 12rpx 12rpx 12rpx;
border-radius: 12rpx;
background-color: #fff;
}
}
@@ -0,0 +1,39 @@
<template>
<view class="chat_footer">
<uni-icons type="redo" size="30" color="#000" @click.prevent="forwardMsg"></uni-icons>
<uni-icons type="trash" size="30" color="#000" @click.prevent="deleteMsg"></uni-icons>
</view>
</template>
<script>
export default {
data() {
return {
};
},
methods: {
forwardMsg() {
this.$emit('userEvent',{type:'forward'});
},
deleteMsg(e) {
this.$emit('userEvent',{type:'deleteMsg'});
},
},
};
</script>
<style lang="scss" scoped>
.chat_footer {
display: flex;
align-items: center;
justify-content: space-evenly;
background: #f6f6f6;
// height: 50px;
max-height: 120px;
padding: 24rpx 20rpx;
image {
width: 26px;
height: 26px;
}
}
</style>
@@ -0,0 +1,64 @@
<template>
<u-navbar placeholder class="chating_header" bgColor="transparent">
<view @click="leftClick" class="u-nav-slot" slot="left">
取消
</view>
<view class="u-nav-slot" slot="center">
<view class="chating_info">
<view class="conversation_info">
<view class="title">已选择{{ count }}条消息</view>
</view>
</view>
</view>
</view>
<view class="u-nav-slot" slot="right">
</view>
</u-navbar>
</template>
<script>
export default {
name: "SelectHeader",
props: {
count:{
type:Number,
default(){
return 0;
}
}
},
computed: {
},
methods: {
leftClick(e) {
this.$emit("leftClick", e);
},
},
};
</script>
<style lang="scss" scoped>
.chating_header {
border: 2rpx solid #e1e1e1;
.u-nav-slot {
padding: 24rpx;
}
.chating_info {
@include vCenterBox();
flex-direction: column;
.conversation_info {
flex-direction: row;
justify-content: center;
@include vCenterBox();
.title {
@include nomalEllipsis();
max-width: 280rpx;
font-size: 30rpx;
font-weight: 500;
}
}
}
}
</style>