From 0ef3eb9bf77dc17fa65529ec76b2dabdfa1f02fd Mon Sep 17 00:00:00 2001
From: Yer11214 <17633066053@163.com>
Date: Tue, 17 Dec 2024 09:46:02 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9im=20bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/mine/im/index.vue | 150 ++++++++++++++++++++++++----------------
1 file changed, 92 insertions(+), 58 deletions(-)
diff --git a/pages/mine/im/index.vue b/pages/mine/im/index.vue
index ae0814d..62b6393 100644
--- a/pages/mine/im/index.vue
+++ b/pages/mine/im/index.vue
@@ -158,36 +158,36 @@
-
-
-
+
-
+
-
+
+
+
+ 用一句简短的话描述您的问题
+
+
+
+
+
+
+
+
- 发送
+ 发送
+
+
@@ -233,26 +233,7 @@ export default {
if (this.resolve.goodsid) {
this.commodityDetails()
}
- // 如果需要缓存消息缓存msgList即可
- // 监听键盘拉起
- // 因为无法控制键盘拉起的速度,所以这里尽量以慢速处理
- uni.onKeyboardHeightChange(res => {
- const query = uni.createSelectorQuery()
- query.select('#msgList').boundingClientRect(data => {
- // 若消息体没有超过2倍的键盘则向下移动差值,防止遮住消息体
- var up = res.height * 2 - data.height - l * 110
- if (up > 0) {
- // 动态改变空盒子高度
- this.messageBoxMove(up, 300)
- // 记录改变的值,若不收回键盘且发送了消息用来防止消息过多被遮盖
- mgUpHeight = up
- }
- // 收回
- if (res.height == 0) {
- this.messageBoxMove(0, 0)
- }
- }).exec();
- })
+
var query = uni.getSystemInfoSync()
l = query.screenWidth / 750
@@ -270,8 +251,12 @@ export default {
}
// this.ws.connect();
- this.sokcet();
+ this.socket();
},
+
+
+
+
// 页面隐藏
onHide () {
uni.closeSocket();
@@ -321,30 +306,65 @@ export default {
goodListData: {},
count: 0, //判断socket断开连接请求次数
inputHeight:0,
+ isShow:false,
+
+
}
},
- // watch: {
- // 'ws.callBackMapping': {
- // handler: function (val) {
- // val = JSON.parse(val)
- // if (val.messageResultType == 'MESSAGE') {
- // this.msgList.push(val.result)
- // }
- // this.newMessageNum++;
- // //接收到消息后发送已读
- // let msg = val
- // msg.operation_type = 'READ'
- // this.ws.send(JSON.stringify(msg))
- // }
- // }
- // },
+ onPageScroll (e) {
+
+ // #ifdef APP-PLUS
+ uni.hideKeyboard()
+ this.isShow = false
+ // #endif
+ },
methods: {
+ navigateToBottom(){
+ // #ifdef H5
+ this.isShow = true
+ this.$refs.inputRef.focus()
+ // #endif
+
+ // #ifdef APP-PLUS
+ this.$nextTick(() => {
+ uni.pageScrollTo({
+ scrollTop: 5000000,
+ duration: 50,
+ success: () => {
+ setTimeout(() => {
+ this.isShow = true
+ }, 200);
+ ;
+ },
+ fail: () => { },
+ complete: () => {}
+ });
+ });
+ // #endif
+
+ },
+
eventHandle(){
+
this.inputHeight = 0
+ this.isShow = false
},
inputBindFocus(e){
if (e.detail.height) {
- this.inputHeight = e.detail.height //这个高度就是软键盘的高度
+
+
+ // #ifdef APP-PLUS
+ // 判断是否是ios
+ if (uni.getSystemInfoSync().platform == 'ios') {
+ this.inputHeight = e.detail.height - 40 //这个高度就是软键盘的高度
+ }else{
+ this.inputHeight = e.detail.height
+ }
+ // #endif
+
+ // #ifndef APP-PLUS
+ this.inputHeight = e.detail.height //这个高度就是软键盘的高度
+ // #endif
}
},
sendMessage () {
@@ -404,7 +424,7 @@ export default {
});
})
},
- sokcet () {
+ socket () {
var _this = this;
uni.closeSocket();
this.socketOpen = false;
@@ -455,7 +475,7 @@ export default {
// 监听是否断线,断线进行重新连接
uni.onSocketClose((res) => {
if (res.code != null && res.code != 1000) {
- this.sokcet()
+ this.socket()
}
})
},
@@ -825,6 +845,7 @@ export default {
margin-left: 10rpx;
}
.dh-input {
+ line-height: 65rpx;
width: 500rpx;
height: 65rpx;
border-radius: 30rpx;
@@ -871,6 +892,19 @@ uni-page-head {
right: 0;
z-index: 9999;
}
+.bottom-dh{
+ position: fixed; // input 所在盒子设置绝对定位
+ flex-shrink: 0;
+ width: 100%;
+ left: 0;
+ bottom: 0; // 默认 0
+ z-index: 199;
+ padding-bottom: env(safe-area-inset-bottom);
+ background: #FFFFFF;
+ box-sizing: border-box;
+
+}
+