no message

This commit is contained in:
wangdongbo 2026-02-11 14:38:28 +08:00
parent 2def830fc3
commit 781c8803a8
3 changed files with 33 additions and 7 deletions

View File

@ -6,17 +6,23 @@ $text-color-sub: #999;
$primary-color: #0877F1; $primary-color: #0877F1;
.chat-page { .chat-page {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh;
background-color: #f5f5f5; background-color: #f5f5f5;
overflow: hidden; overflow: hidden;
} }
/* 患者信息栏样式 */ /* 患者信息栏样式 */
.patient-info-bar { .patient-info-bar {
position: sticky; position: fixed;
top: 0; top: 0;
left: 0;
right: 0;
background: #fff; background: #fff;
border-bottom: 1rpx solid #f0f0f0; border-bottom: 1rpx solid #f0f0f0;
padding: 20rpx 32rpx; padding: 20rpx 32rpx;
@ -110,11 +116,14 @@ $primary-color: #0877F1;
} }
.chat-content { .chat-content {
flex: 1; position: fixed;
top: 100rpx; /* 患者信息栏高度,根据实际调整 */
left: 0;
right: 0;
bottom: 120rpx; /* 输入框高度,根据实际调整 */
box-sizing: border-box; box-sizing: border-box;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
min-height: 0;
} }
.chat-content-compressed { .chat-content-compressed {
@ -379,12 +388,16 @@ $primary-color: #0877F1;
} }
.input-section { .input-section {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #fff; background: #fff;
border-top: 1rpx solid #e0e0e0; border-top: 1rpx solid #e0e0e0;
position: relative;
z-index: 200; z-index: 200;
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
flex-shrink: 0; flex-shrink: 0;
transform: translateZ(0); /* 开启硬件加速,提升性能 */
} }
.input-toolbar { .input-toolbar {

View File

@ -8,7 +8,7 @@
<view class="input-area"> <view class="input-area">
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..." <textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput" @confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput"
:auto-height="true" :show-confirm-bar="false" :adjust-position="true" :cursor-spacing="40" /> :auto-height="true" :show-confirm-bar="false" :adjust-position="false" :cursor-spacing="40" />
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord" <input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
@touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord" :placeholder="isRecording ? '松开发送' : '按住说话'" disabled> @touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord" :placeholder="isRecording ? '松开发送' : '按住说话'" disabled>
</input> </input>

View File

@ -1,5 +1,6 @@
<template> <template>
<view class="chat-page"> <page-meta :page-style="'overflow:' + (keyboardHeight > 0 ? 'hidden' : 'visible')"></page-meta>
<view class="chat-page" :style="{ paddingBottom: keyboardHeight + 'px' }">
<!-- 患者信息栏 --> <!-- 患者信息栏 -->
<view class="patient-info-bar" v-if="patientInfo.name"> <view class="patient-info-bar" v-if="patientInfo.name">
<view class="patient-info-content"> <view class="patient-info-content">
@ -213,6 +214,9 @@ const chatInfo = ref({
avatar: "/static/home/avatar.svg", avatar: "/static/home/avatar.svg",
}); });
//
const keyboardHeight = ref(0);
// //
const isEvaluationPopupOpen = ref(false); const isEvaluationPopupOpen = ref(false);
@ -443,6 +447,12 @@ onLoad((options) => {
chatInfo.value.userID = options.userID; chatInfo.value.userID = options.userID;
} }
//
uni.onKeyboardHeightChange((res) => {
console.log("键盘高度变化:", res.height);
keyboardHeight.value = res.height;
});
checkLoginAndInitTIM(); checkLoginAndInitTIM();
updateNavigationTitle(); updateNavigationTitle();
}); });
@ -998,6 +1008,9 @@ const handleApplyConsult = async () => {
onUnmounted(() => { onUnmounted(() => {
clearMessageCache(); clearMessageCache();
//
uni.offKeyboardHeightChange();
timChatManager.setCallback("onSDKReady", null); timChatManager.setCallback("onSDKReady", null);
timChatManager.setCallback("onSDKNotReady", null); timChatManager.setCallback("onSDKNotReady", null);
timChatManager.setCallback("onMessageReceived", null); timChatManager.setCallback("onMessageReceived", null);