This commit is contained in:
haomingming
2023-04-04 09:04:29 +08:00
parent df9a526b7b
commit a1d691367e
32 changed files with 228 additions and 87 deletions
@@ -120,7 +120,7 @@ Component({
}];
return renderDom;
}
// 1:消息内页横条
// 1:消息内页横条(医生->患者)
if (customMessage.message_type === GDXZ_CUSTOM_MSEEAGE.TRABECULA) {
const renderDom = [{
type: 'trabecula',
@@ -129,6 +129,15 @@ Component({
}];
return renderDom;
}
//8:消息内页横条(患者->医生)
if (customMessage.message_type === GDXZ_CUSTOM_MSEEAGE.TRABECULA_PATIENT) {
const renderDom = [{
type: 'trabecula_patient',
title: customMessage.title,
desc: customMessage.desc,
}];
return renderDom;
}
// 2:订单结束评价弹出
if (customMessage.message_type === GDXZ_CUSTOM_MSEEAGE.ORDER_EVALUATION) {
let data = customMessage.data;
@@ -37,14 +37,18 @@
<view wx:if="{{renderDom[0].type ==='c2cCalling' || renderDom[0].type ==='groupCalling'}}" class="custom-message {{isMine?'my-custom':''}}" >
<view class="custom-content-text">{{renderDom[0].text}}</view>
</view>
<view wx:if="{{renderDom[0].type ==='notSupport'}}" class="message-body-span text-message" >
<!-- <view wx:if="{{renderDom[0].type ==='notSupport'}}" class="message-body-span text-message" >
<view class="message-body-span-text">{{renderDom[0].text}}</view>
</view>
</view> -->
<!-- 自定义横条样式 -->
<view wx:if="{{renderDom[0].type==='trabecula'}}" class="gdxz_custom_trabecula_message">
<view class="gdxz_custom_message_title">{{renderDom[0].title}}</view>
<view class="gdxz_custom_message_desc">{{renderDom[0].desc}}</view>
</view>
<!-- <view wx:if="{{renderDom[0].type==='trabecula_patient'}}" class="gdxz_custom_trabecula_message">
<view class="gdxz_custom_message_title">{{renderDom[0].title}}</view>
<view class="gdxz_custom_message_desc">{{renderDom[0].desc}}</view>
</view> -->
<!-- 自定义评价样式 -->
<view wx:if="{{renderDom[0].type==='order_evaluation'}}" class="gdxz_custom_order_evaluation_message" bindtap="showPop">
<view class="evaluation_title">请您对本次问诊服务进行评价</view>
@@ -121,7 +121,7 @@ line-height: 42rpx;
margin-bottom: 12rpx;
}
/* 自定义评价样式 */
/* 自定义样式 */
/* 横条样式 */
.gdxz_custom_trabecula_message{
display: flex;
@@ -9,6 +9,8 @@ Component({
type: Object,
value: {},
observer(newVal) {
console.log("observerobserverobserverobserver")
// console.log(newVal)
this.setData({
renderDom: parseText(newVal),
});
@@ -150,7 +150,7 @@ Component({
// 获取消息列表
getMessageList(conversation) {
console.log("getMessageListgetMessageListgetMessageList")
if (!this.data.isCompleted) {
wx.$TUIKit.getMessageList({
conversationID: conversation.conversationID,
@@ -186,9 +186,9 @@ Component({
}
},
checkShowAvatar(message){
// console.log("checkShowAvatar ");
console.log("checkShowAvatar ");
let type = message.type;
// console.log("message type: ", type);
console.log("message type: ", type);
let show_avatar = true;
if(type === "TIMCustomElem"){
const customMessage = JSON.parse(message.payload.data);
@@ -200,6 +200,7 @@ Component({
},
// 历史消息渲染
$handleMessageRender(messageList, currentMessageList) {
console.log("handleMessageRenderhandleMessageRenderhandleMessageRender");
this.showHistoryMessageTime(currentMessageList);
if (messageList.length > 0) {
if (this.data.conversation.type === '@TIM#SYSTEM') {
@@ -216,6 +217,7 @@ Component({
},
// 系统消息去重
filterRepateSystemMessage(messageList) {
console.log("filterRepateSystemMessage")
const noRepateMessage = [];
for (let index = 0; index < messageList.length; index++) {
if (!noRepateMessage.some(item => item && item.ID === messageList[index].ID)) {
@@ -231,15 +233,16 @@ Component({
this.updateReadByPeer(event);
},
// 更新已读更新
updateReadByPeer(event) {
event.data.forEach((item) => {
const index = this.data.messageList.findIndex(element => element.ID === item.ID);
this.data.messageList[index] = item;
this.setData({
messageList: this.data.messageList,
});
});
},
// updateReadByPeer(event) {
// console.log("updateReadByPeerupdateReadByPeer")
// event.data.forEach((item) => {
// const index = this.data.messageList.findIndex(element => element.ID === item.ID);
// this.data.messageList[index] = item;
// this.setData({
// messageList: this.data.messageList,
// });
// });
// },
// 收到的消息
$onMessageReceived(value) {
@@ -320,8 +323,11 @@ Component({
// 自己的消息上屏
updateMessageList(message) {
console.log("自己的消息上屏 updateMessageList: ", message);
console.log(message);
//自己的消息有头像
message.show_avatar = this.checkShowAvatar(message);
console.log(message.show_avatar)
console.log(message.flow)
if (message.conversationID !== this.data.conversation.conversationID) return;
wx.$TUIKit.setMessageRead({ conversationID: this.data.conversation.conversationID }).then(() => {
logger.log('| MessageList | setMessageRead | ok');
@@ -332,20 +338,26 @@ Component({
if (message.type === MESSAGE_TYPE_TEXT.TIM_CUSTOM_ELEM) {
const typingMessage = JSON.parse(message.payload.data);
if (typingMessage.businessID === BUSINESS_ID_TEXT.USER_TYPING) {
console.log(1111111)
this.setData({
messageList: this.data.messageList,
});
} else {
console.log(44444)
this.data.messageList.push(message);
}
} else {
console.log(55555)
console.log(message)
this.data.messageList.push(message);
}
console.log(222222)
this.setData({
lastMessageSequence: this.data.messageList.slice(-1)[0].sequence,
messageList: this.data.messageList,
jumpAim: `ID-${this.filterSystemMessageID(this.data.messageList[this.data.messageList.length - 1].ID)}`,
}, () => {
console.log(333333)
this.setData({
messageList: this.data.messageList,
});
@@ -378,6 +390,7 @@ Component({
},
// 更新 messagelist
updateMessageByID(deleteMessageID) {
console.log("updateMessageByIDupdateMessageByIDupdateMessageByID")
const { messageList } = this.data;
const deleteMessageArr = messageList.filter(item => item.ID === deleteMessageID);
this.setData({
@@ -52,6 +52,7 @@
<FileMessage wx:if="{{item.type === 'TIMFileElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
<MergerMessage wx:if="{{item.type === 'TIMRelayElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
</view>
<image class="t-message-avatar" wx:if="{{item.flow === 'out' && item.show_avatar }}" src="{{item.avatar || 'https://gdxz-hospital.oss-cn-chengdu.aliyuncs.com/applet/doctor/static/images/default_photo.png'}}" data-value="{{item}}" bindtap="getMemberProfile"/>
</view>
</view>