This commit is contained in:
haomingming
2023-05-05 11:44:37 +08:00
parent e7be139b04
commit 97a504c6d2
55 changed files with 1961 additions and 249 deletions
@@ -154,6 +154,7 @@ Component({
const renderDom = [{
type: 'prescribe',
product_name: data.product_name,
title: customMessage.title,
order_inquiry_id: data.order_inquiry_id,
order_prescription_id: data.order_prescription_id,
pharmacist_verify_time: data.pharmacist_verify_time.substring(0,10),
@@ -166,6 +167,7 @@ Component({
const renderDom = [{
type: 'prescribe_verify',
product_name: data.product_name,
title: customMessage.title,
order_inquiry_id: data.order_inquiry_id,
order_prescription_id: data.order_prescription_id,
pharmacist_verify_time: data.pharmacist_verify_time.substring(0,10),
@@ -49,21 +49,32 @@
<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' && false}}" class="gdxz_custom_order_evaluation_message" bindtap="showPop">
<view class="evaluation_title">请您对本次问诊服务进行评价</view>
<view class="evaluation_ratebox">
<van-rate disabled value="{{0}}" size="40rpx" gutter="46rpx" color="#ffd21e" void-icon="star" void-color="#e7e7e7" readonlygutter="20"/>
</view>
<view class="evaluation_button">点击评价</view>
</view>
<!-- 自定义开处方样式 -->
<view wx:if="{{renderDom[0].type==='prescribe'}}"
class="gdxz_custom_order_prescribe_message"
data-url="/Pages/yishi/onlinechufang/index?order_inquiry_id={{renderDom[0].order_inquiry_id}}&order_prescription_id={{renderDom[0].order_prescription_id}}&from=chat"
bindtap="go">
<view class="prescribe_title">
处方已开具
{{renderDom[0].title}}
</view>
<view class="prescribe_box">
<view class="prescribe_box_top">
<view class="prescribe_box_top_product_name"><text style="color: #999;"> RP</text>{{renderDom[0].product_name}}</view>
<view class="prescribe_box_top_pharmacist_verify_time"><text style="color: #999;">开方日期:</text> {{renderDom[0].pharmacist_verify_time}}</view>
</view>
<view class="prescribe_box_bottom" data-order_prescription_id="{{renderDom[0].order_prescription_id}}">
<view class="prescribe_box_buy">去查看</view>
</view>
</view>
</view>
<view wx:if="{{renderDom[0].type==='prescribe_verify'}}"
class="gdxz_custom_order_prescribe_message"
data-url="/Pages/yishi/onlinechufang/index?order_inquiry_id={{renderDom[0].order_inquiry_id}}&order_prescription_id={{renderDom[0].order_prescription_id}}&from=chat"
bindtap="go">
<view class="prescribe_title">
{{renderDom[0].title}}
</view>
<view class="prescribe_box">
<view class="prescribe_box_top">
@@ -133,7 +133,7 @@ line-height: 42rpx;
.gdxz_custom_message_title{
flex: 1;
display: flex;
max-width: 92vw;
max-width: 95vw;
justify-content: center;
background-color: #E1E1E1;
padding: 5rpx 40rpx;
@@ -143,7 +143,7 @@ line-height: 42rpx;
.gdxz_custom_message_desc{
margin-top: 30rpx;
display: flex;
max-width: 92vw;
max-width: 95vw;
letter-spacing: 2rpx;
justify-content: center;
color: #666666;
@@ -1,5 +1,8 @@
import logger from '../../../../utils/logger';
import constant from '../../../../utils/constant';
import { API } from '../../../../../utils/network/api';
const api = new API()
let app = getApp()
// eslint-disable-next-line no-undef
Component({
@@ -44,6 +47,15 @@ Component({
baseInfo: {
type: Object,
value: {}
},
message_rounds:{
type: Number,
value: 0,
observer(newVal) {
this.setData({
message_rounds: newVal,
});
},
}
},
@@ -76,11 +88,15 @@ Component({
isFirstSendTyping: true,
time: 0,
focus: false,
my_focus: false,
isEmoji: false,
fileList: [],
hasCallKit: false,
showChangYongYu: false,
ChangYongYu: []
ChangYongYu: [],
dialog_visible: false,
dialog_message: "在线开处方需先进行多点执业认证",
message_rounds: 0
},
lifetimes: {
@@ -240,6 +256,7 @@ Component({
// 选自定义消息
handleExtensions() {
console.warn("wx.aegis: ", wx.aegis);
wx.aegis.reportEvent({
name: 'chooseExtensions',
@@ -346,7 +363,7 @@ Component({
inquiry_type: this.data.inquiry_type,
message_type: 0,
is_system: 0,
message_rounds: message_rounds,
message_rounds: this.data.message_rounds,
patient_family_data: patient_family_data
});
@@ -395,7 +412,8 @@ Component({
},
handleCommonFunctions(e) {
switch (e.target.dataset.function.key) {
console.log("handleCommonFunctions: ", e)
switch (e.target.dataset.key) {
case '0':
this.setData({
displayCommonWords: true,
@@ -418,19 +436,24 @@ Component({
let _this = this;
console.log("开始订阅消息");
wx.requestSubscribeMessage({
tmplIds: ['5Tl-xmaWXrKP5BB8E6b3oTdPHbHa7WYWbmvZiuz4TLs'],
tmplIds: ['kUy70xHlr7ADo4aIHiictM4Te7MSec3E5kHsYvFQu40'],
success (res) {
console.log(res);
let usertype = wx.getStorageSync('usertype');
let userID = wx.getStorageSync('user_id_'+usertype);
let multi_point_status = wx.getStorageSync(userID+'_multi_point_status');
if(multi_point_status == 1){
app.go("/Pages/yishi/onlinechufang/index?order_inquiry_id="+_this.data.order_inquiry_id)
}else{
_this.setData({
dialog_visible: true
})
}
let order_inquiry_id = _this.data.order_inquiry_id
api.getDoctorPrescriptionCheck({order_inquiry_id: order_inquiry_id}).then(response => {
let status = response.data.status
if(status == 1){
app.go("/Pages/yishi/onlinechufang/index?order_inquiry_id="+order_inquiry_id)
}else{
_this.setData({
dialog_visible: true,
dialog_message: response.data.message
})
}
}).catch(errors => {
console.error(errors);
})
}
})
break;
@@ -444,7 +467,7 @@ Component({
})
},
confirmDialog(){
app.go("/Pages/yishi/zhiye_identity/index")
// app.go("/Pages/yishi/zhiye_identity/index")
this.setData({
dialog_visible: false
})
@@ -632,7 +655,7 @@ Component({
inquiry_type: this.data.inquiry_type,
message_type: 0,
is_system: 0,
message_rounds: message_rounds,
message_rounds: this.data.message_rounds,
patient_family_data: patient_family_data
});
@@ -666,7 +689,7 @@ Component({
sendMessageBtn: false,
});
}
event.detail.value && this.sendTypingStatusMessage();
// event.detail.value && this.sendTypingStatusMessage();
},
// 发送正在输入状态消息
@@ -730,7 +753,7 @@ Component({
this.setData({
focus: true,
});
this.getMessageList(this.data.conversation);
// this.getMessageList(this.data.conversation);
this.triggerEvent('pullKeysBoards', {
event,
});
@@ -844,8 +867,7 @@ Component({
ext3: wx.$chat_SDKAppID,
});
}
})
.catch((error) => {
}).catch((error) => {
logger.log(`| TUI-chat | message-input | sendMessageError: ${error.code} `);
wx.aegis.reportEvent({
name: 'sendMessage',
@@ -866,6 +888,7 @@ Component({
handleClose() {
this.setData({
displayFlag: '',
my_focus: false
});
},
@@ -1,14 +1,15 @@
<view class="TUI-message-input-container">
<view class="TUI-commom-function">
<view class="TUI-commom-function-item" wx:for="{{commonFunction}}" wx:key="index" data-function="{{item}}" bindtap="handleCommonFunctions">{{item.name}}</view>
<view class="TUI-commom-function-item" data-key="10" bindtap="handleCommonFunctions">查看完整病例</view>
<view class="TUI-commom-function-item" data-key="11" bindtap="handleCommonFunctions" wx:if="{{baseInfo.multi_point_status == 1}}">在线开处方</view>
</view>
<view class="TUI-message-input">
<image class="TUI-icon" bindtap="switchAudio" wx:if="{{has_audio}}"
src="{{isAudio ? '../../../../static/assets/keyboard.svg' : '../../../../static/assets/audio.svg'}}" />
<view wx:if="{{!isAudio || isEmoji}}" class="TUI-message-input-main {{ focus && 'TUI-message-input-main-focus'}}" >
<textarea id="mytextarea" class="TUI-message-input-area" adjust-position="{{false}}" cursor-spacing="20"
<textarea hold-keyboard id="mytextarea" class="TUI-message-input-area" adjust-position="{{false}}" cursor-spacing="0"
value="{{message}}" bindinput="onInputValueChange" maxlength="-1" type="text" auto-height="{{true}}"
placeholder="请输入文字" placeholder-class="input-placeholder" confirm-type="send" show-confirm-bar="{{false}}"
placeholder="请输入文字" placeholder-class="input-placeholder" confirm-type="return" show-confirm-bar="{{false}}"
bindfocus="inputBindFocus"
bindblur="inputBindBlur"
bindconfirm="sendTextMessage"/>
@@ -26,7 +27,7 @@
<image class="TUI-icon" bindtap="handleEmoji" src="../../../../static/assets/face-emoji.svg" />
</view>
<view wx:if="{{!sendMessageBtn}}" bindtap="handleExtensions" class="TUI-sendMessage-btn">
<image class="TUI-icon" src="https://gdxz-hospital.oss-cn-chengdu.aliyuncs.com/applet/doctor/static/images/chat/tianjia.png" />
<image class="TUI-icon" src="https://gdxz-hospital.oss-cn-chengdu.aliyuncs.com/applet/doctor/static/images/chat/tianjia.png" />
</view>
<view wx:else class="TUI-sendMessage-btn TUI-sendMessage-btn-input" bindtap="sendTextMessage">
发送
@@ -104,7 +105,7 @@
<t-dialog
visible="{{ dialog_visible }}"
title="温馨提示"
content="在线开处方需先进行多点执业认证"
content="{{dialog_message}}"
>
<view slot="cancel-btn" class="dialog dialog_cancel_btn" bindtap="cancelDialog">
取消
@@ -74,8 +74,8 @@
padding: 20rpx 20rpx;
}
.TUI-icon {
width: 56rpx;
height: 56rpx;
width: 50rpx;
height: 50rpx;
margin: 0 16rpx;
}
.TUI-Extensions {
@@ -111,6 +111,7 @@
color: #fff;
max-height: 200rpx;
padding: 20rpx 0;
height: 50rpx;
}
.TUI-sendMessage-btn-input{
background-color: #3CC7C0;
@@ -2,6 +2,8 @@ import dayjs from '../../../../utils/dayjs';
import logger from '../../../../utils/logger';
import constant from '../../../../utils/constant';
import { getTimeAgoChat } from './../../../../../utils/util'
import { wechatTimeFormat } from './../../../../../utils/wechatTime'
const { GDXZ_CUSTOM_MSEEAGE } = constant;
// eslint-disable-next-line no-undef
const app = getApp();
@@ -87,7 +89,10 @@ Component({
errorMessage: {},
errorMessageID: '',
typingMessage: {},
autoToButtom: true
autoToButtom: true,
cachTime: "",
list_first_loading: false,
message_rounds: 0
},
lifetimes: {
@@ -132,9 +137,15 @@ Component({
},
pageLifetimes: {
show(){
this.setData({
list_first_loading: true
})
console.log("showshowshowshowshowshowshow")
},
hide(){
this.setData({
list_first_loading: false
})
console.log("hidehidehidehidehidehidehidehidehidehidehide")
}
},
@@ -178,15 +189,24 @@ Component({
// console.log(item)
//去除自定义消息
// if(HMM_type == "TIMCustomElem") return;
if(!this.checkShowAvatar(item)){
this.refreshMessageRounds(item)
let checkShowAvatar = this.checkShowAvatar(item, false)
if(!checkShowAvatar){
item.no_avatar = true;
}else{
item.no_avatar = false;
}
let cath_time = this.cachMessageTime(item.time * 1000);
item.messageTime = cath_time[0]
item.isShowTime = cath_time[1]
item.showMessageTime = cath_time[1]
HMM_messageList_del.push(item);
})
HMM_data.messageList = HMM_messageList_del;
this.showMoreHistoryMessageTime(HMM_messageList_del);
// this.showMoreHistoryMessageTime(HMM_messageList_del);
// this.showHistoryMessageTime(HMM_messageList_del);
const { messageList } = HMM_data; // 消息列表。
this.data.nextReqMessageID = res.data.nextReqMessageID; // 用于续拉,分页续拉时需传入该字段。
this.data.isCompleted = res.data.isCompleted; // 表示是否已经拉完所有消息。
@@ -196,32 +216,86 @@ Component({
}
this.$handleMessageRender(this.data.messageList, messageList);
}).then(res => {
this.setData({
list_first_loading: false
})
}).catch(error => {
this.setData({
list_first_loading: false
})
});
}
},
checkShowAvatar(message){
console.log("checkShowAvatar ");
refreshMessageRounds(message){
console.log("messageList refreshMessageRounds message: ", message);
let cloudCustomData = "";
let cloudCustomDataJson = "";
if(message.cloudCustomData){
cloudCustomData = message.cloudCustomData;
}
if(cloudCustomData){
cloudCustomDataJson = JSON.parse(cloudCustomData);
}
let payload = message.payload.data;
if(payload){
const payloadData = JSON.parse(message.payload.data);
if(payloadData){
let title = payloadData.title
//问诊已开始,重置message_rounds = 0
if(title.indexOf("问诊已开始") > -1){
this.setData({
message_rounds: 0
})
var myEventOption = {}
myEventOption.message_rounds = 0
this.triggerEvent('refreshMessageRounds', myEventOption)
return
}
}
}
let now_message_rounds = this.data.message_rounds
console.log("now_message_rounds: ", now_message_rounds)
if(cloudCustomDataJson){
let message_rounds = cloudCustomDataJson.message_rounds;
console.log("message_rounds: ", message_rounds)
if(message_rounds > now_message_rounds){
this.setData({
message_rounds: message_rounds
})
var myEventOption = {}
myEventOption.message_rounds = message_rounds
this.triggerEvent('refreshMessageRounds', myEventOption)
}
}
},
checkShowAvatar(message, refreshBaseInfo){
// 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);
if(customMessage.message_type != GDXZ_CUSTOM_MSEEAGE.PRESCRIBE){
if(Number(customMessage.message_type) != GDXZ_CUSTOM_MSEEAGE.PRESCRIBE && Number(customMessage.message_type) != GDXZ_CUSTOM_MSEEAGE.PRESCRIBE_VERIFY){
show_avatar = false;
}
if(customMessage.message_type != GDXZ_CUSTOM_MSEEAGE.TRABECULA){
//收到横条消息去触发父组件getbase方法
this.triggerEvent('getInquiryMessageBasic');
if(Number(customMessage.message_type) == GDXZ_CUSTOM_MSEEAGE.TRABECULA && refreshBaseInfo){
const title = customMessage.title
if(title.indexOf("问诊已结束") > -1){
//收到横条消息去触发父组件getbase方法
this.triggerEvent('getInquiryMessageBasic');
}
}
}
return show_avatar;
},
// 历史消息渲染
$handleMessageRender(messageList, currentMessageList) {
console.log("handleMessageRenderhandleMessageRenderhandleMessageRender");
this.showHistoryMessageTime(currentMessageList);
// this.showHistoryMessageTime(currentMessageList);
if (messageList.length > 0) {
if (this.data.conversation.type === '@TIM#SYSTEM') {
this.filterRepateSystemMessage(messageList);
@@ -270,11 +344,12 @@ Component({
let autoToButtom = this.data.autoToButtom;
console.log("autoToButtom:", autoToButtom)
const message = value.data[0];
//更新会话数
this.refreshMessageRounds(message)
if(message.flow == 'out'){
message.isRead = false;
}
if(!this.checkShowAvatar(message)){
if(!this.checkShowAvatar(message, true)){
message.no_avatar = true;
}
wx.$TUIKit.setMessageRead({ conversationID: this.data.conversation.conversationID }).then(() => {
@@ -283,7 +358,13 @@ Component({
console.log('| MessageList | setMessageRead | ok');
console.log('message cloudCustomData', message.cloudCustomData);
const { BUSINESS_ID_TEXT, MESSAGE_TYPE_TEXT } = constant;
this.messageTimeForShow(message);
// this.messageTimeForShow(message);
let cath_time = this.cachMessageTime(message.time * 1000);
message.messageTime = cath_time[0]
message.isShowTime = cath_time[1]
message.showMessageTime = cath_time[1]
this.setData({
UseData: value,
});
@@ -367,7 +448,7 @@ Component({
console.log("自己的消息上屏 updateMessageList: ", message);
console.log(message);
//自己的消息有头像
if(!this.checkShowAvatar(message)){
if(!this.checkShowAvatar(message, false)){
message.no_avatar = true;
}
if (message.conversationID !== this.data.conversation.conversationID) return;
@@ -376,30 +457,31 @@ Component({
});
const { BUSINESS_ID_TEXT, MESSAGE_TYPE_TEXT } = constant;
// this.$onMessageReadByPeer();
this.messageTimeForShow(message);
// this.messageTimeForShow(message);
let cath_time = this.cachMessageTime(message.time * 1000);
message.messageTime = cath_time[0]
message.isShowTime = cath_time[1]
message.showMessageTime = cath_time[1]
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,
});
@@ -584,20 +666,26 @@ Component({
this.updateMessageByID(event.detail.message.ID);
},
// 展示消息时间
messageTimeForShow(messageTime) {
messageTimeForShow(message) {
console.log("messageTimeForShow")
const interval = 5 * 60 * 1000;
const nowTime = Math.floor(messageTime.time / 10) * 10 * 1000;
// const interval = 5 * 60 * 1000;
const interval = 5 * 60;
const nowTime = Math.floor(message.time / 10) * 10 * 1000;
console.log("nowTime: ", nowTime)
if (this.data.messageList.length > 0) {
const lastTime = this.data.messageList.slice(-1)[0].time * 1000;
console.log("nowTime - lastTime=", (nowTime - lastTime))
if (nowTime - lastTime > interval) {
Object.assign(messageTime, {
Object.assign(message, {
isShowTime: true,
}),
this.data.messageTime = dayjs(nowTime);
this.data.messageTime = this.cachMessageTime(nowTime)[0];
let messageTime = this.cachMessageTime(nowTime);
message.messageTime = messageTime[0];
message.showMessageTime = messageTime[1];
console.log("dayjs(nowTime): ", dayjs(nowTime))
this.setData({
messageTime: getTimeAgoChat(nowTime/1000),
messageTime: this.cachMessageTime(nowTime)[0],
showMessageTime: true,
});
}
@@ -605,26 +693,17 @@ Component({
},
// 渲染历史消息时间
showHistoryMessageTime(messageList) {
const cut = 5 * 60 * 1000;
const cut = 5 * 60;
for (let index = 0; index < messageList.length; index++) {
const nowadayTime = Math.floor(messageList[index].time / 10) * 10 * 1000;
const firstTime = messageList[0].time * 1000;
console.log("nowadayTime - firstTime=",(nowadayTime - firstTime))
console.log("cut",cut)
if (nowadayTime - firstTime > cut) {
const indexbutton = messageList.map(item => item).indexOf(messageList[index]); // 获取第一个时间大于30分钟的消息所在位置的下标
const firstTime = nowadayTime; // 找到第一个数组时间戳大于30分钟的将其值设为初始值
const showHistoryTime = Math.floor(messageList[indexbutton].time / 10) * 10 * 1000;
Object.assign(messageList[indexbutton], {
isShowHistoryTime: true,
}),
this.setData({
firstTime: nowadayTime,
messageHistoryTime: getTimeAgoChat(showHistoryTime/1000),
showMessageHistoryTime: true,
});
return firstTime;
}
const thismessagetime = Math.floor(messageList[index].time / 10) * 10 * 1000;
let messageTime = this.cachMessageTime(thismessagetime);
messageList[index].messageTime = messageTime[0]
messageList[index].showMessageHistoryTime = messageTime[1]
this.setData({
messageHistoryTime: messageTime[0],
showMessageHistoryTime: messageTime[1]
});
}
},
// 拉取更多历史消息渲染时间
@@ -633,13 +712,34 @@ Component({
const showHistoryTime = messageList[0].time * 1000;
Object.assign(messageList[0], {
isShowMoreHistoryTime: true,
});
this.data.newArr[messageList[0].ID] = getTimeAgoChat(showHistoryTime/1000);
}),
this.data.newArr[messageList[0].ID] = this.cachMessageTime(showHistoryTime)[0];
this.setData({
newArr: this.data.newArr,
});
}
},
cachMessageTime(messageTime){
// console.log("cachMessageTime messageTime 参数:", messageTime)
let time = wechatTimeFormat(messageTime)
// console.log("cachMessageTime: ", time)
if(time){
// let nowCachTime = time.split(":")[0] //小时级别
let nowCachTime = time
let cachTime = this.data.cachTime
// console.log("nowCachTime: ", nowCachTime)
// console.log("cachTime: ", cachTime)
if(nowCachTime == cachTime){
return [time, false]
}else{
this.setData({
cachTime: nowCachTime
})
return [time, true]
}
}
return [time, false]
},
// 消息发送失败
sendMessageError(event) {
this.setData({
@@ -12,6 +12,7 @@
"FaceMessage": "../MessageElements/FaceMessage/index",
"FileMessage": "../MessageElements/FileMessage/index",
"MergerMessage": "../MessageElements/MergerMessage/index",
"RevokeMessage": "../MessageElements/RevokeMessage/index"
"RevokeMessage": "../MessageElements/RevokeMessage/index",
"van-loading": "@vant/weapp/loading/index"
}
}
@@ -1,16 +1,19 @@
<view class="container">
<scroll-view class="message-list-container" scroll-y="true" scroll-into-view="{{jumpAim}}" refresher-enabled="{{true}}" bindrefresherrefresh="refresh" refresher-triggered="{{triggered}}" lower-threshold="200" bindscrolltolower="scrollHandler">
<scroll-view class="message-list-container" scroll-y="true" scroll-into-view="{{jumpAim}}" refresher-enabled="{{true}}" bindrefresherrefresh="refresh" refresher-triggered="{{triggered}}" lower-threshold="200" bindscrolltolower="scrollHandler" bindscrolltoupper="refresh" upper-threshold="100">
<view class="no-message" wx:if="{{isCompleted}}">没有更多啦</view>
<view class="t-message" wx:if="{{conversation.type !== '@TIM#SYSTEM'}}" wx:for="{{messageList}}" wx:key="index" data-index ='{{index}}' >
<view class="time-pop-mask" data-value="{{item.time}}" wx:if="{{showMessageTime}}">
<view style="width: 100%;text-align: center;position: absolute;top: 50%;">
<van-loading size="24px" wx:if="{{list_first_loading}}">加载中...</van-loading>
</view>
<view class="t-message" wx:if="{{conversation.type !== '@TIM#SYSTEM'}}" wx:for="{{messageList}}" wx:key="index" data-index ='{{index}}'>
<view class="time-pop-mask" data-value="{{item.time}}" wx:if="{{item.showMessageTime}}">
<view class="showmessagetime 1" wx:if="{{item.isShowTime}}">
<text class="time" wx:if="{{!item.isDeleted && !item.isRevoked}}">{{messageTime}} </text>
<text class="time" wx:if="{{!item.isDeleted && !item.isRevoked}}">{{item.messageTime}} </text>
</view>
</view>
<view class="time-pop-mask" data-value="{{item.time}}" wx:if="{{showMessageHistoryTime}}">
<view class="time-pop-mask" data-value="{{item.time}}" wx:if="{{item.showMessageHistoryTime}}">
<view class="showmessagetime 2" wx:if="{{item.isShowHistoryTime && !item.isShowTime && !item.isShowMoreHistoryTime}}">
<text class="time" wx:if="{{!item.isDeleted && !item.isRevoked}}">{{messageHistoryTime}} </text>
<text class="time" wx:if="{{!item.isDeleted && !item.isRevoked}}">{{item.messageTime}} </text>
</view>
</view>
<view class="time-pop-mask" wx:if="{{item.isShowMoreHistoryTime}}">
@@ -28,7 +28,7 @@
.t-message-avatar {
margin-left: 20rpx;
margin-right: 12rpx;
border-radius: 10rpx;
border-radius: 50%;
width: 80rpx;
height: 80rpx;
}
+36 -5
View File
@@ -76,9 +76,17 @@ Component({
if (app?.globalData?.reportType === constant.OPERATING_ENVIRONMENT) {
this.setData({
showTips: true,
message_rounds: 0
});
}
this.getNavbarHeight()
wx.onKeyboardHeightChange(res => {
console.log("键盘高度:", res.height)
this.setData({
keysboards_height: res.height
})
this.getNavbarHeight();
})
},
ready() {
@@ -131,13 +139,23 @@ Component({
},
navbar_height: 0,
dialog_visible: false,
KeysBoardsStatus: "down"
KeysBoardsStatus: "down",
message_rounds: 0,
keysboards_height: 0
},
/**
* 组件的方法列表
*/
methods: {
refreshMessageRounds(e){
console.log("TUIchat refreshMessageRounds", e)
let message_rounds = e.detail.message_rounds
console.log("TUIchat refreshMessageRounds message_rounds", message_rounds)
this.setData({
message_rounds: message_rounds
})
},
getNavbarHeight(addHeight){
let rect = null;
if (wx.getMenuButtonBoundingClientRect) {
@@ -153,6 +171,11 @@ Component({
if(addHeight){
height = height + addHeight
}
let keysboards_height = this.data.keysboards_height
console.log("getNavbarHeight 键盘高度:", keysboards_height)
if(keysboards_height){
height = height + keysboards_height
}
this.setData({
navbar_height: height
})
@@ -241,7 +264,12 @@ Component({
this.selectComponent('#MessageList').sendMessageError(event);
},
triggerClose() {
this.selectComponent('#MessageInput').handleClose();
console.log("message-list triggerClose")
if(this.data.baseInfo.inquiry_status == 4){
this.selectComponent('#MessageInput').handleClose();
}
wx.hideKeyboard()
this.getNavbarHeight()
},
handleCall(event) {
if (event.detail.conversationType === wx.$TUIKitTIM.TYPES.CONV_GROUP) {
@@ -274,6 +302,7 @@ Component({
},
myhandleExtensions(e){
console.log("myhandleExtensionsmyhandleExtensions: ", e);
wx.hideKeyboard()
let displayFlag = e.detail.displayFlag;
setTimeout(() => {
if(displayFlag){
@@ -288,25 +317,27 @@ Component({
})
this.getNavbarHeight();
}
}, 10);
}, 100);
},
// 监听键盘,获取焦点时将输入框推到键盘上方
pullKeysBoards(event) {
console.log("pullKeysBoardspullKeysBoards")
setNewInputStyle(event.detail.event.detail.height);
this.getNavbarHeight();
this.setData({
'viewData.style': newInputStyle,
input_area_style: "position: absolute; bottom: 45rpx;",
input_area_style: "position: absolute; bottom: 52rpx;",
KeysBoardsStatus: "pull"
});
this.selectComponent('#MessageList').handleJumpNewMessage();
},
// 监听键盘,失去焦点时收起键盘
downKeysBoards(event) {
console.log("downKeysBoardsdownKeysBoards")
console.log(event)
let value = event.detail.event.detail.value;
this.getNavbarHeight();
if(value){
this.setData({
'viewData.style': inputStyle,
+10 -7
View File
@@ -16,27 +16,30 @@
<image class="tui-navigatorbar-back" bindtap="goBack" src="../../static/assets/ic_back_black.svg" />
<view class="conversation-title">{{conversationName}}</view>
</view> -->
<view class="list-box {{ showTips && 'list-box-notips'}} || {{ showGroupTips && 'list-box-group'}} || {{ showAll && 'list-box-group-notips'}}" style="height: calc(100vh - 197rpx - 100rpx - {{navbar_height}}px);"><!-- 100vh -input-area高度 - info高度 -navbar高度 -->
<view class="list-box {{ showTips && 'list-box-notips'}} || {{ showGroupTips && 'list-box-group'}} || {{ showAll && 'list-box-group-notips'}}" style="height: calc(100vh {{baseInfo.inquiry_status==4?'- 197rpx':'+ 20px'}} - 100rpx - {{navbar_height}}px);"><!-- 100vh -input-area高度 - info高度 -navbar高度 -->
<!-- <view wx:if="{{showTips}}" class="safetytips-box"> -->
<!-- <view class="safetytips">
<text>【安全提示】本 APP 仅用于体验腾讯云即时通信 IM 产品功能,不可用于业务洽谈与拓展。请勿轻信汇款、中奖等涉及钱款等信息,勿轻易拨打陌生电话,谨防上当受骗。</text>
<span class="report" bindtap="handleReport">点此投诉</span>
</view> -->
<!-- </view> -->
<!-- <scroll-view class="message-list" bindtap="triggerClose"> -->
<MessageList bind:getInquiryMessageBasic="getInquiryMessageBasic" id="MessageList" conversation="{{conversation}}" unreadCount="{{unreadCount}}" bind:changeMemberCount="changeMemberCount" bind:resendMessage="resendMessage" bind:typing="typing" order_inquiry_id="{{order_inquiry_id}}"></MessageList>
<!-- </scroll-view> -->
<scroll-view class="message-list" bindtap="triggerClose">
<MessageList
bind:getInquiryMessageBasic="getInquiryMessageBasic"
bind:refreshMessageRounds="refreshMessageRounds"
id="MessageList" conversation="{{conversation}}" unreadCount="{{unreadCount}}" bind:changeMemberCount="changeMemberCount" bind:resendMessage="resendMessage" bind:typing="typing" order_inquiry_id="{{order_inquiry_id}}"></MessageList>
</scroll-view>
</view>
<view class="group-profile">
<TUIGroup id="TUIGroup" wx:if="{{isShow}}" conversation="{{conversation}}" bind:groupCall="groupCall" bind:showConversationList="showConversationList"></TUIGroup>
</view>
<view class="input-area" style="{{input_area_style}}">
<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}}" 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>
bind:handleCall="handleCall" message_rounds="{{message_rounds}}"></MessageInput>
</view>
</view>
<view style="height: 40px;position: fixed;bottom: 0;width: 100%;background-color: #fff;z-index: 1;">
<view style="height: 40px;position: fixed;bottom: 0;width: 100%;background-color: #fff;z-index: 1;" wx:if="{{baseInfo.inquiry_status==4}}">
</view>
</view>