Fix(AI):[#3647]点击输入框,对话记录同步上移

This commit is contained in:
lifizer
2025-04-22 14:18:05 +08:00
parent 39a54efc27
commit 0d0b816fad
6 changed files with 9 additions and 48 deletions
+5 -10
View File
@@ -3,9 +3,6 @@
:class="{ :class="{
'focus': inputOnFocus 'focus': inputOnFocus
}" }"
:style="{
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
}"
class="fix-page-bottom" class="fix-page-bottom"
> >
<view v-if="inputModel === 'input'" class="bottom-body flex-center-between"> <view v-if="inputModel === 'input'" class="bottom-body flex-center-between">
@@ -29,7 +26,7 @@
<input <input
v-model.trim="prompt" v-model.trim="prompt"
:show-confirm-bar="false" :show-confirm-bar="false"
:adjust-position="false" :adjust-position="true"
:disabled="loading" :disabled="loading"
:maxlength="-1" :maxlength="-1"
class="inp" class="inp"
@@ -148,16 +145,14 @@ export default {
}, },
methods: { methods: {
promptInputFocusHandle() { promptInputFocusHandle() {
this.$emit('focus', 1)
setTimeout(() => { setTimeout(() => {
this.inputOnFocus = true this.inputOnFocus = true
this.$emit('focus', 1) }, 100)
}, 200)
}, },
promptInputBlurHandle() { promptInputBlurHandle() {
setTimeout(() => { this.$emit('focus', 0)
this.inputOnFocus = false this.inputOnFocus = false
this.$emit('focus', 0)
}, 200)
}, },
toggleInputModel() { toggleInputModel() {
if (!this.token) { if (!this.token) {
+1
View File
@@ -95,6 +95,7 @@ export const chatMixins = {
}, },
inputFocusHandle(value) { inputFocusHandle(value) {
this.onFocus = value === 1 this.onFocus = value === 1
this.scrollToBottomHandle()
}, },
historyViewHandle() { historyViewHandle() {
console.log(this.$refs.historyView) console.log(this.$refs.historyView)
-18
View File
@@ -134,9 +134,6 @@
:class="{ :class="{
'focus': onFocus 'focus': onFocus
}" }"
:style="{
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
}"
class="page-to-bottom" class="page-to-bottom"
> >
<image <image
@@ -184,26 +181,11 @@ export default {
} }
}, },
onLoad(options) { onLoad(options) {
if (!options.click) {
uni.switchTab({ url: '/pages/home/index' })
return
}
this.chatNumber = options.chatNumber this.chatNumber = options.chatNumber
this.pageTitle = options.title this.pageTitle = options.title
this.pageTitle = this.pageTitle.length > 8 ? (this.pageTitle.substring(0, 8) + '...') : this.pageTitle this.pageTitle = this.pageTitle.length > 8 ? (this.pageTitle.substring(0, 8) + '...') : this.pageTitle
this.init() this.init()
}, },
onLoad(options) {
if (!options.click) {
uni.switchTab({ url: '/pages/home/index' })
return
}
// 监听键盘高度变化
wx.onKeyboardHeightChange((res) => {
console.log('监听键盘高度变化%s', res.height)
this.keyboardHeight = res.height
})
},
methods: { methods: {
init() { init() {
this.loading = true this.loading = true
+1 -15
View File
@@ -193,9 +193,6 @@
:class="{ :class="{
'focus': onFocus 'focus': onFocus
}" }"
:style="{
'transform': 'translateY(-' + (keyboardHeight + 'px') + ')'
}"
class="page-to-bottom" class="page-to-bottom"
> >
<view <view
@@ -257,21 +254,10 @@ export default {
topicList: [] topicList: []
} }
}, },
onLoad(options) {
if (!options.click) {
uni.switchTab({ url: '/pages/home/index' })
return
}
// 监听键盘高度变化
wx.onKeyboardHeightChange((res) => {
console.log('监听键盘高度变化%s', res.height)
this.keyboardHeight = res.height
})
},
onUnload() { onUnload() {
this.closeWsFn() this.closeWsFn()
if (this.chatNumber) { if (this.chatNumber) {
uni.redirectTo({ uni.navigateTo({
url: '/aiChat/views/index?click=1&back=1' url: '/aiChat/views/index?click=1&back=1'
}) })
} }
+2 -2
View File
@@ -100,7 +100,7 @@ page {
padding: 0 24rpx; padding: 0 24rpx;
transition: all 0.2s; transition: all 0.2s;
&.focus { &.focus {
// transform: translateY(-40rpx); transform: translateY(-40rpx);
} }
.new-chat { .new-chat {
display: flex; display: flex;
@@ -138,7 +138,7 @@ page {
background-color: #fff; background-color: #fff;
transition: all 0.2s; transition: all 0.2s;
&.focus { &.focus {
// transform: translateY(-40rpx); transform: translateY(-40rpx);
} }
.bottom-body { .bottom-body {
position: relative; position: relative;
-3
View File
@@ -453,9 +453,6 @@ export default {
} }
}) })
}, },
onShow() {
wx.offKeyboardHeightChange()
},
onHide() { onHide() {
this.pageToHideHandle() this.pageToHideHandle()
}, },