From 42794ac8486759c805e5d465ba4588cc31cdcb83 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期一, 12 八月 2024 13:17:31 +0800
Subject: [PATCH] 键盘弹起问题

---
 miniprogram/pages/question/question.ts |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/miniprogram/pages/question/question.ts b/miniprogram/pages/question/question.ts
index 3de8e64..0ce82c3 100644
--- a/miniprogram/pages/question/question.ts
+++ b/miniprogram/pages/question/question.ts
@@ -7,10 +7,6 @@
   roleImageMap
 } from "@/model/chat/types";
 import {
-  CHAT_GROUP_DATA,
-  TEST_DATA
-} from "./testData";
-import {
   TAB_BAR_HEIGHT
 } from "@/custom-tab-bar/constants";
 import {
@@ -134,6 +130,7 @@
     section_a_id: '',
     sample_id: '',
     userName:getStorage('username'),
+    keyboardHeight:0,
 
   },
   onClickClear(){
@@ -141,6 +138,18 @@
     
     this.setData({
       sendText:''
+    })
+  },
+  inputFocus(e){
+    if(e.detail.height>0){
+      this.setData({
+        keyboardHeight:e.detail.height-55
+      })
+    }
+  },
+  changeInputBlur(e){
+    this.setData({
+      keyboardHeight:0
     })
   },
   async getSampleList() {
@@ -501,6 +510,14 @@
     if (!isPassed) return;
     this.getHistoryGroupData();
     this.getSampleList();
+    wx.onKeyboardHeightChange((res)=>{
+      console.log('馃殌 ~ res',res);
+    })
+  },
+  onShow(){
+    this.setData({
+      userName:getStorage('username')
+    })
   },
 
   async onRouteDone() {
@@ -530,6 +547,7 @@
     app.globalData.sectionAId = '';
     app.globalData.sectionB = null;
   }
+  
 
   // pageLifetimes: {
   //   show() {

--
Gitblit v1.9.3