perf: 兼容iPad键盘

This commit is contained in:
kuaifan 2023-04-26 20:58:56 +08:00
parent 9771e1e741
commit 7aa44b8623
4 changed files with 31 additions and 3 deletions

View File

@ -297,6 +297,13 @@ export default {
this.$store.dispatch("getBasicData", 600) this.$store.dispatch("getBasicData", 600)
} }
} }
//
window.__onKeyboardStatus = (data) => {
const message = $A.jsonParse(decodeURIComponent(data));
this.$store.state.keyboardType = message.keyboardType;
this.$store.state.keyboardHeight = message.keyboardHeight;
this.$store.state.safeAreaBottom = message.safeAreaBottom;
}
// //
window.__onNotificationPermissionStatus = (ret) => { window.__onNotificationPermissionStatus = (ret) => {
this.$store.state.appNotificationPermission = $A.runNum(ret) == 1; this.$store.state.appNotificationPermission = $A.runNum(ret) == 1;

View File

@ -179,7 +179,7 @@
</VirtualList> </VirtualList>
<!--底部输入--> <!--底部输入-->
<div ref="footer" class="dialog-footer" :class="footerClass" @click="onActive"> <div ref="footer" class="dialog-footer" :class="footerClass" :style="footerStyle" @click="onActive">
<div class="dialog-newmsg" @click="onToBottom">{{$L(`${msgNew}条新消息`)}}</div> <div class="dialog-newmsg" @click="onToBottom">{{$L(`${msgNew}条新消息`)}}</div>
<div class="dialog-goto" @click="onToBottom"><i class="taskfont">&#xe72b;</i></div> <div class="dialog-goto" @click="onToBottom"><i class="taskfont">&#xe72b;</i></div>
<DialogUpload <DialogUpload
@ -661,7 +661,11 @@ export default {
'dialogIns', 'dialogIns',
'cacheUserBasic', 'cacheUserBasic',
'fileLinks', 'fileLinks',
'cacheEmojis' 'cacheEmojis',
'keyboardType',
'keyboardHeight',
'safeAreaBottom'
]), ]),
...mapGetters(['isLoad']), ...mapGetters(['isLoad']),
@ -828,6 +832,18 @@ export default {
return null return null
}, },
footerStyle() {
const {keyboardType, keyboardHeight, safeAreaBottom, windowScrollY} = this
const style = {};
if (windowScrollY === 0
&& keyboardType === "show"
&& keyboardHeight > 0
&& keyboardHeight < 120) {
style.paddingBottom = (keyboardHeight + safeAreaBottom) + 'px';
}
return style;
},
msgUnreadOnly() { msgUnreadOnly() {
let num = 0; let num = 0;
this.cacheDialogs.some(dialog => { this.cacheDialogs.some(dialog => {

View File

@ -28,6 +28,11 @@ export default {
formLabelPosition: windowWidth > 576 ? 'right' : 'top', formLabelPosition: windowWidth > 576 ? 'right' : 'top',
formLabelWidth: windowWidth > 576 ? 'auto' : '', formLabelWidth: windowWidth > 576 ? 'auto' : '',
// 键盘状态仅iOS
keyboardType: null, // show|hide
keyboardHeight: 0, // 键盘高度
safeAreaBottom: 0, // 安全区域底部高度
// App通知权限 // App通知权限
appNotificationPermission: true, appNotificationPermission: true,

@ -1 +1 @@
Subproject commit d7ded42bf291f9ada70850f68ea16a7f7c7bcb0d Subproject commit 057b1c4d1a02d72a403f31c4bbf2c97ba7084c3d