Fix(AI):[#3606]苹果手机键盘底部及开启新对话按钮没有留空隙
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
:class="{
|
||||
'focus': inputOnFocus
|
||||
}"
|
||||
:style="{
|
||||
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
|
||||
}"
|
||||
class="fix-page-bottom"
|
||||
>
|
||||
<view v-if="inputModel === 'input'" class="bottom-body flex-center-between">
|
||||
@@ -26,6 +29,7 @@
|
||||
<input
|
||||
v-model.trim="prompt"
|
||||
:show-confirm-bar="false"
|
||||
:adjust-position="false"
|
||||
:disabled="loading"
|
||||
:maxlength="-1"
|
||||
class="inp"
|
||||
@@ -99,7 +103,6 @@ import {
|
||||
getFileTransResult
|
||||
} from '@/api/voiceToText/index'
|
||||
import { VUE_APP_API_URL } from '@/config'
|
||||
import settings from '@/config/baseSetting.js'
|
||||
import cookie from '@/utils/store/cookie'
|
||||
export default {
|
||||
name: 'BottomSend',
|
||||
@@ -107,6 +110,10 @@ export default {
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
keyboardHeight: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -20,6 +20,7 @@ export const chatMixins = {
|
||||
// 状态栏高度
|
||||
statusBarHeight: 20,
|
||||
fileHttpStr: Object.freeze(VUE_APP_API_URL + settings.sysPrefix),
|
||||
keyboardHeight: 0,
|
||||
optionsFrom: '',
|
||||
onFocus: false,
|
||||
loading: false,
|
||||
@@ -67,8 +68,17 @@ export const chatMixins = {
|
||||
}
|
||||
}.bind(this)).exec()
|
||||
},
|
||||
onLoad() {
|
||||
// 监听键盘高度变化
|
||||
wx.onKeyboardHeightChange((res) => {
|
||||
console.log('监听键盘高度变化%s', res.height)
|
||||
this.keyboardHeight = res.height
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
this.closeWsFn()
|
||||
// console.log('在页面卸载时取消监听')
|
||||
// wx.offKeyboardHeightChange()
|
||||
},
|
||||
created() {
|
||||
const _this = this
|
||||
@@ -215,7 +225,9 @@ export const chatMixins = {
|
||||
},
|
||||
closeWsFn() {
|
||||
this.loading = false
|
||||
this.chatMessageList[this.chatMessageListLength - 1].showCursor = false
|
||||
if (this.chatMessageListLength) {
|
||||
this.chatMessageList[this.chatMessageListLength - 1].showCursor = false
|
||||
}
|
||||
uni.closeSocket({
|
||||
success: () => {
|
||||
console.log('-----关闭连接')
|
||||
|
||||
@@ -134,6 +134,9 @@
|
||||
:class="{
|
||||
'focus': onFocus
|
||||
}"
|
||||
:style="{
|
||||
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
|
||||
}"
|
||||
class="page-to-bottom"
|
||||
>
|
||||
<image
|
||||
@@ -147,6 +150,7 @@
|
||||
<bottom-send
|
||||
ref="bottomSend"
|
||||
:loading="loading"
|
||||
:keyboard-height="keyboardHeight"
|
||||
@send="streamReq"
|
||||
@history="historyViewHandle"
|
||||
@focus="inputFocusHandle"
|
||||
|
||||
@@ -187,6 +187,9 @@
|
||||
:class="{
|
||||
'focus': onFocus
|
||||
}"
|
||||
:style="{
|
||||
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
|
||||
}"
|
||||
class="page-to-bottom"
|
||||
>
|
||||
<view
|
||||
@@ -212,6 +215,7 @@
|
||||
<bottom-send
|
||||
ref="bottomSend"
|
||||
:loading="loading"
|
||||
:keyboard-height="keyboardHeight"
|
||||
@send="streamReq"
|
||||
@add="createNewHandle"
|
||||
@history="historyViewHandle"
|
||||
|
||||
@@ -99,7 +99,7 @@ page {
|
||||
padding: 0 24rpx;
|
||||
transition: all 0.2s;
|
||||
&.focus {
|
||||
transform: translateY(-40rpx);
|
||||
// transform: translateY(-40rpx);
|
||||
}
|
||||
.new-chat {
|
||||
display: flex;
|
||||
@@ -136,7 +136,7 @@ page {
|
||||
padding: 24rpx 24rpx 48rpx 24rpx;
|
||||
transition: all 0.2s;
|
||||
&.focus {
|
||||
transform: translateY(-40rpx);
|
||||
// transform: translateY(-40rpx);
|
||||
}
|
||||
.bottom-body {
|
||||
position: relative;
|
||||
|
||||
@@ -453,6 +453,9 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
wx.offKeyboardHeightChange()
|
||||
},
|
||||
onHide() {
|
||||
this.pageToHideHandle()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user