优化
This commit is contained in:
@@ -40,6 +40,10 @@ Component({
|
||||
has_emoji:{
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
baseInfo: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -317,10 +321,12 @@ Component({
|
||||
cloudCustomDataJson = JSON.parse(cloudCustomData);
|
||||
}
|
||||
let message_rounds = 0;
|
||||
let patient_family_data = "";
|
||||
let patient_family_data = {};
|
||||
patient_family_data.patient_name = this.data.baseInfo.patient_family_name;
|
||||
patient_family_data.patient_sex = this.data.baseInfo.patient_family_sex;
|
||||
patient_family_data.patient_age = this.data.baseInfo.patient_family_age;
|
||||
if(cloudCustomDataJson){
|
||||
message_rounds = cloudCustomDataJson.message_rounds;
|
||||
patient_family_data = cloudCustomDataJson.patient_family_data
|
||||
}
|
||||
|
||||
const mycloudCustomData = JSON.stringify({
|
||||
@@ -577,10 +583,12 @@ Component({
|
||||
cloudCustomDataJson = JSON.parse(cloudCustomData);
|
||||
}
|
||||
let message_rounds = 0;
|
||||
let patient_family_data = "";
|
||||
let patient_family_data = {};
|
||||
patient_family_data.patient_name = this.data.baseInfo.patient_family_name;
|
||||
patient_family_data.patient_sex = this.data.baseInfo.patient_family_sex;
|
||||
patient_family_data.patient_age = this.data.baseInfo.patient_family_age;
|
||||
if(cloudCustomDataJson){
|
||||
message_rounds = cloudCustomDataJson.message_rounds;
|
||||
patient_family_data = cloudCustomDataJson.patient_family_data
|
||||
}
|
||||
|
||||
const to = this.getToAccount();
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100vw;
|
||||
/* height: 450rpx; */
|
||||
height: 100px;
|
||||
margin-left: 14rpx;
|
||||
margin-right: 14rpx;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,6 @@ Component({
|
||||
},
|
||||
// 获取消息列表
|
||||
getMessageList(conversation) {
|
||||
|
||||
console.log("getMessageListgetMessageListgetMessageList")
|
||||
if (!this.data.isCompleted) {
|
||||
wx.$TUIKit.getMessageList({
|
||||
@@ -166,8 +165,9 @@ Component({
|
||||
// console.log(item)
|
||||
//去除自定义消息
|
||||
// if(HMM_type == "TIMCustomElem") return;
|
||||
let show_avatar = this.checkShowAvatar(item);
|
||||
item.show_avatar = show_avatar;
|
||||
if(!this.checkShowAvatar(item)){
|
||||
item.no_avatar = true;
|
||||
}
|
||||
|
||||
HMM_messageList_del.push(item);
|
||||
})
|
||||
@@ -182,6 +182,7 @@ Component({
|
||||
this.getMessageList(conversation);
|
||||
}
|
||||
this.$handleMessageRender(this.data.messageList, messageList);
|
||||
}).then(res => {
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -247,7 +248,9 @@ Component({
|
||||
// 收到的消息
|
||||
$onMessageReceived(value) {
|
||||
const message = value.data[0];
|
||||
message.show_avatar = this.checkShowAvatar(message);
|
||||
if(!this.checkShowAvatar(message)){
|
||||
message.no_avatar = true;
|
||||
}
|
||||
wx.$TUIKit.setMessageRead({ conversationID: this.data.conversation.conversationID }).then(() => {
|
||||
logger.log('| MessageList | setMessageRead | ok');
|
||||
});
|
||||
@@ -271,7 +274,7 @@ Component({
|
||||
});
|
||||
} catch (error) {
|
||||
}
|
||||
if ((item.type === MESSAGE_TYPE_TEXT.TIM_CUSTOM_ELEM && this.data.typingMessage.businessID !== BUSINESS_ID_TEXT.USER_TYPING)) {
|
||||
if ((item.type === MESSAGE_TYPE_TEXT.TIM_CUSTOM_ELEM && this.data.typingMessage.businessID !== BUSINESS_ID_TEXT.USER_TYPING) || item.type !== MESSAGE_TYPE_TEXT.TIM_CUSTOM_ELEM) {
|
||||
this.data.showNewMessageCount.push(message);
|
||||
this.setData({
|
||||
showNewMessageCount: this.data.showNewMessageCount,
|
||||
@@ -325,9 +328,9 @@ Component({
|
||||
console.log("自己的消息上屏 updateMessageList: ", message);
|
||||
console.log(message);
|
||||
//自己的消息有头像
|
||||
message.show_avatar = this.checkShowAvatar(message);
|
||||
console.log(message.show_avatar)
|
||||
console.log(message.flow)
|
||||
if(!this.checkShowAvatar(message)){
|
||||
message.no_avatar = true;
|
||||
}
|
||||
if (message.conversationID !== this.data.conversation.conversationID) return;
|
||||
wx.$TUIKit.setMessageRead({ conversationID: this.data.conversation.conversationID }).then(() => {
|
||||
logger.log('| MessageList | setMessageRead | ok');
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</view>
|
||||
<TipMessage wx:if="{{item.type === 'TIMGroupTipElem'}}" message="{{item}}"/>
|
||||
<view wx:if="{{item.type !== 'TIMGroupTipElem'}}" class="{{item.flow === 'out' ? 't-self-message':'t-recieve-message'}}" >
|
||||
<image class="t-message-avatar" wx:if="{{item.flow === 'in' && 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" />
|
||||
<image class="t-message-avatar" wx:if="{{item.flow === 'in' && !item.no_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 class="read-receipts" wx:if="{{conversation.type === 'C2C' && item.flow==='out' }}">
|
||||
<!-- <view wx:if="{{item.isPeerRead}}" >已读</view>
|
||||
<view wx:else>未读</view> -->
|
||||
@@ -53,7 +53,7 @@
|
||||
<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"/>
|
||||
<image class="t-message-avatar" wx:if="{{item.flow === 'out' && !item.no_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>
|
||||
</view>
|
||||
|
||||
@@ -78,28 +78,9 @@ Component({
|
||||
showTips: true,
|
||||
});
|
||||
}
|
||||
|
||||
let rect = null;
|
||||
if (wx.getMenuButtonBoundingClientRect) {
|
||||
rect = wx.getMenuButtonBoundingClientRect();
|
||||
}
|
||||
console.log("rect: ", rect)
|
||||
wx.getSystemInfo({
|
||||
success: (res) => {
|
||||
const { statusBarHeight } = wx.getSystemInfoSync();
|
||||
console.log("statusBarHeight: ", statusBarHeight);
|
||||
console.log("${rect.height}px: ", `${rect.height}`);
|
||||
let height = Number.parseInt(statusBarHeight) + Number.parseInt(`${rect.height}`) + 50;
|
||||
this.setData({
|
||||
navbar_height: height
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('navbar 获取系统信息失败', err);
|
||||
},
|
||||
});
|
||||
|
||||
this.getNavbarHeight()
|
||||
},
|
||||
|
||||
ready() {
|
||||
//修改为组件传值
|
||||
// this.getInquiryMessageBasic()
|
||||
@@ -157,6 +138,30 @@ Component({
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
getNavbarHeight(addHeight){
|
||||
let rect = null;
|
||||
if (wx.getMenuButtonBoundingClientRect) {
|
||||
rect = wx.getMenuButtonBoundingClientRect();
|
||||
}
|
||||
console.log("rect: ", rect)
|
||||
wx.getSystemInfo({
|
||||
success: (res) => {
|
||||
const { statusBarHeight } = wx.getSystemInfoSync();
|
||||
console.log("statusBarHeight: ", statusBarHeight);
|
||||
console.log("${rect.height}px: ", `${rect.height}`);
|
||||
let height = Number.parseInt(statusBarHeight) + Number.parseInt(`${rect.height}`) + 50;
|
||||
if(addHeight){
|
||||
height = height + addHeight
|
||||
}
|
||||
this.setData({
|
||||
navbar_height: height
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('navbar 获取系统信息失败', err);
|
||||
},
|
||||
});
|
||||
},
|
||||
//结束问诊
|
||||
putDoctorInquiryFinish() {
|
||||
this.setData({
|
||||
@@ -230,6 +235,7 @@ Component({
|
||||
sendMessage(event) {
|
||||
// 将自己发送的消息写进消息列表里面
|
||||
this.selectComponent('#MessageList').updateMessageList(event.detail.message);
|
||||
this.getNavbarHeight();
|
||||
},
|
||||
showMessageErrorImage(event) {
|
||||
this.selectComponent('#MessageList').sendMessageError(event);
|
||||
@@ -273,10 +279,13 @@ Component({
|
||||
this.setData({
|
||||
input_area_style: "position: absolute; bottom: 30px;"
|
||||
})
|
||||
this.getNavbarHeight(100);
|
||||
this.selectComponent('#MessageList').handleJumpNewMessage();
|
||||
}else{
|
||||
this.setData({
|
||||
input_area_style: ""
|
||||
input_area_style: "",
|
||||
})
|
||||
this.getNavbarHeight();
|
||||
}
|
||||
},
|
||||
// 监听键盘,获取焦点时将输入框推到键盘上方
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</view>
|
||||
<view class="input-area" style="{{input_area_style}}" wx:if="{{baseInfo.inquiry_status == 4}}">
|
||||
<view class="message-input" style="{{viewData.style}}" wx:if="{{showChat}}">
|
||||
<MessageInput bind:myhandleExtensions="myhandleExtensions" id="MessageInput" inquiry_type="{{inquiry_type}}" order_inquiry_id="{{order_inquiry_id}}" conversation="{{conversation}}" hasCallKit="{{hasCallKit}}" bind:sendMessage="sendMessage" bind:downKeysBoards="downKeysBoards" bind:pullKeysBoards="pullKeysBoards" bind:showMessageErrorImage="showMessageErrorImage"
|
||||
<MessageInput bind:myhandleExtensions="myhandleExtensions" id="MessageInput" inquiry_type="{{inquiry_type}}" baseInfo="{{baseInfo}}" order_inquiry_id="{{order_inquiry_id}}" conversation="{{conversation}}" hasCallKit="{{hasCallKit}}" bind:sendMessage="sendMessage" bind:downKeysBoards="downKeysBoards" bind:pullKeysBoards="pullKeysBoards" bind:showMessageErrorImage="showMessageErrorImage"
|
||||
bind:handleCall="handleCall" ></MessageInput>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user