切换 顶部高度

cyl/master-0822
zsk 3 months ago
parent ffd1a287fc
commit a97b82d717

@ -64,7 +64,7 @@
</div> </div>
<!-- {{ssff}}键盘高度{{keyHeight}} 输入框距离底部距离{{writeStyle}}屏幕高度{{screenHeight}}顶部聊天区域高度{{msgKeyHeight}} --> <!-- {{ssff}}键盘高度{{keyHeight}} 输入框距离底部距离{{writeStyle}}屏幕高度{{screenHeight}}顶部聊天区域高度{{msgKeyHeight}} -->
<input v-show="!showEmojiInput" :focus="isFocus" class="msg-input-input g_flex_1" :maxlength="-1" :placeholder="isTeamMute ? t('teamMutePlaceholder') : t('chatInputPlaceHolder')" v-model="inputText" type="text" :disabled="isTeamMute" :confirm-hold="true" cursor-spacing="20" :adjust-position="pushUp" confirm-type="send" @keyboardheightchange="keyboardheightchange" @confirm="handleSendTextMsg" @blur="handleInputBlur" @input="handleInput" id="msg-input" /> <input v-show="!showEmojiInput" :focus="isFocus" class="msg-input-input g_flex_1" :maxlength="-1" :placeholder="isTeamMute ? t('teamMutePlaceholder') : t('chatInputPlaceHolder')" v-model="inputText" type="text" :disabled="isTeamMute" :confirm-hold="true" cursor-spacing="20" :adjust-position="pushUp" confirm-type="send" @keyboardheightchange="keyboardheightchange" @focus="handleInputFocus" @confirm="handleSendTextMsg" @blur="handleInputBlur" @input="handleInput" id="msg-input" />
</div> </div>
<div class="msg-input-button" @tap="(event) => handleSendJob()"> <div class="msg-input-button" @tap="(event) => handleSendJob()">
<div class="iconfont icon-5gongdanguanli g_c_6 g_fs_24"></div> <div class="iconfont icon-5gongdanguanli g_c_6 g_fs_24"></div>
@ -370,7 +370,39 @@ const keyHeight = ref(350);
const msgKeyHeight = ref("100%"); const msgKeyHeight = ref("100%");
const ssff = ref(uni.getWindowInfo().safeArea.top); const ssff = ref(uni.getWindowInfo().safeArea.top);
console.log("安全域高度安全域高度安全域高度安全域高度安全域高度安全域高度", ssff);
const handleInputFocus = (e) => {
emojiVisible.value = false;
extVisible.value = false;
audioPanelVisible.value = false;
sendMoreVisible.value = false;
const systemInfo = uni.getSystemInfoSync();
const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
setTimeout(()=>{
console.log("获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点获取焦点");
uni.$emit("msgKeyHeight", availableHeight); //
writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`;
uni.$emit(events.ON_SCROLL_BOTTOM);
},80)
// if (e.detail.height === 0) {
// writeStyle.value = "bottom: 0";
// uni.$emit("msgKeyHeight", "100%"); //
// } else {
// //
// emojiVisible.value = false;
// extVisible.value = false;
// audioPanelVisible.value = false;
// sendMoreVisible.value = false;
// const systemInfo = uni.getSystemInfoSync();
// const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
// uni.$emit("msgKeyHeight", availableHeight); //
// writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`;
// // let safeBottom = 0;
// }
}
// message-input.vuekeyboardheightchange // message-input.vuekeyboardheightchange
// message-input.vuekeyboardheightchange // message-input.vuekeyboardheightchange
@ -384,70 +416,32 @@ const keyboardheightchange = (e) => {
uni.$emit("msgKeyHeight", "100%"); // uni.$emit("msgKeyHeight", "100%"); //
} else { } else {
// //
console.log("触发输入框触发输入框触发输入框触发输入框触发输入框触发输入框触发输入框触发输入框");
emojiVisible.value = false; emojiVisible.value = false;
extVisible.value = false; extVisible.value = false;
audioPanelVisible.value = false; audioPanelVisible.value = false;
sendMoreVisible.value = false; sendMoreVisible.value = false;
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
// let safeBottom = 0;
// // #ifdef MP-WEIXIN
// if (systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.bottom) {
// safeBottom = systemInfo.safeAreaInsets.bottom;
// }
// // #endif
// // #ifdef APP-PLUS
// if (systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.bottom) {
// safeBottom = systemInfo.safeAreaInsets.bottom;
// }
// // #endif
// //
// // #ifdef MP-WEIXIN
// if (systemInfo.platform === 'ios') {
// const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
// uni.$emit('msgKeyHeight', availableHeight); //
// }else{
// const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
// uni.$emit('msgKeyHeight', availableHeight); //
// }
const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value; const availableHeight = systemInfo.windowHeight - e.detail.height - ssff.value;
uni.$emit("msgKeyHeight", availableHeight); // uni.$emit("msgKeyHeight", availableHeight); //
writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`; writeStyle.value = `bottom: calc(${e.detail.height}px - env(safe-area-inset-bottom))`;
// #endif
// #ifdef APP-PLUS
//
let availableHeight, bottomValue;
if (systemInfo.platform === "ios") {
//
availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom;
bottomValue = e.detail.height - safeBottom - 34;
} else {
//
availableHeight = systemInfo.windowHeight - e.detail.height - safeBottom - 34;
bottomValue = e.detail.height - safeBottom;
}
uni.$emit("msgKeyHeight", availableHeight); //
writeStyle.value = `bottom: ${bottomValue}px`;
// #endif
} }
setTimeout(()=>{
uni.$emit(events.ON_SCROLL_BOTTOM);
},80)
}; };
const handleInputBlur = () => { // const handleInputBlur = () => {
isFocus.value = false; // isFocus.value = false;
uni.$emit("msgKeyHeight", "100%"); // uni.$emit("msgKeyHeight", "100%");
}; // };
// //
const scrollBottom = () => { const scrollBottom = () => {
if (isAndroidApp || isWxApp || isIosApp) { if (isAndroidApp || isWxApp || isIosApp) {
setTimeout(() => { setTimeout(() => {
uni.$emit(events.ON_SCROLL_BOTTOM); uni.$emit(events.ON_SCROLL_BOTTOM);
}, 300); }, 80);
} else { } else {
uni.$emit(events.ON_SCROLL_BOTTOM); uni.$emit(events.ON_SCROLL_BOTTOM);
} }
@ -574,15 +568,15 @@ const handleEmojiVisible = () => {
uni.$emit(events.KeyboardEvent, 0); uni.$emit(events.KeyboardEvent, 0);
} }
uni.$emit(events.ON_SCROLL_BOTTOM); uni.$emit(events.ON_SCROLL_BOTTOM);
}, 100); }, 80);
}; };
watch(sendMoreVisible, (val) => { // watch(sendMoreVisible, (val) => {
if (val) { // if (val) {
uni.$emit("msgKeyHeight", uni.getSystemInfoSync().windowHeight - 320); // // uni.$emit("msgKeyHeight", uni.getSystemInfoSync().windowHeight - 270); //
} else { // } else {
uni.$emit("msgKeyHeight", "100%"); // // uni.$emit("msgKeyHeight", "100%"); //
} // }
}); // });
// "+" // "+"
const handleSendMoreVisible = () => { const handleSendMoreVisible = () => {
if (isTeamMute.value) return; if (isTeamMute.value) return;
@ -590,12 +584,17 @@ const handleSendMoreVisible = () => {
emojiVisible.value = false; emojiVisible.value = false;
sendMoreVisible.value = !sendMoreVisible.value; sendMoreVisible.value = !sendMoreVisible.value;
setTimeout(()=>{
if (sendMoreVisible.value) { if (sendMoreVisible.value) {
uni.$emit(events.KeyboardEvent, 230); uni.$emit(events.KeyboardEvent, 230);
uni.$emit("msgKeyHeight", uni.getSystemInfoSync().windowHeight - 260); //
} else { } else {
uni.$emit(events.KeyboardEvent, 0); uni.$emit(events.KeyboardEvent, 0);
uni.$emit("msgKeyHeight", '100%'); //
} }
uni.$emit(events.ON_SCROLL_BOTTOM); uni.$emit(events.ON_SCROLL_BOTTOM);
},80)
// }, 300) // }, 300)
}; };

@ -15,6 +15,7 @@
<view class="msg-tip" v-show="noMore"></view> <view class="msg-tip" v-show="noMore"></view>
<div v-for="(item, index) in finalMsgs" :key="item.renderKey"> <div v-for="(item, index) in finalMsgs" :key="item.renderKey">
聊天区域高度{{msgKeyHeight}}
<MessageItem :msg="item" :index="index" :key="item.renderKey" :reply-msgs-map="replyMsgsMap" <MessageItem :msg="item" :index="index" :key="item.renderKey" :reply-msgs-map="replyMsgsMap"
:broadcastNewAudioSrc="broadcastNewAudioSrc"> </MessageItem> :broadcastNewAudioSrc="broadcastNewAudioSrc"> </MessageItem>
<!-- {{screenHeight1}} <!-- {{screenHeight1}}

Loading…
Cancel
Save