From d9c3e57f0e4dceec56d1974b58294bb76a5270fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com>
Date: Fri, 13 Feb 2026 11:04:49 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BD=93=E5=89=8D=E5=A4=84?=
=?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/plugins/video/components/search.vue | 2 +-
pages/plugins/video/detail/detail.vue | 79 +++++++++++++++++++----
2 files changed, 67 insertions(+), 14 deletions(-)
diff --git a/pages/plugins/video/components/search.vue b/pages/plugins/video/components/search.vue
index 3b509afd..00451143 100644
--- a/pages/plugins/video/components/search.vue
+++ b/pages/plugins/video/components/search.vue
@@ -4,7 +4,7 @@
-
+
搜索
diff --git a/pages/plugins/video/detail/detail.vue b/pages/plugins/video/detail/detail.vue
index 621824df..773555e6 100644
--- a/pages/plugins/video/detail/detail.vue
+++ b/pages/plugins/video/detail/detail.vue
@@ -140,7 +140,7 @@
@@ -284,6 +289,10 @@
current_sub_index: 0, // 默认选中第一个具体类型
report_comment_id: '', // 举报的评论id
comment_scroll_top: 0,
+ comment_value: '',
+ is_add_comment: false,
+ // 监听键盘高度变化事件
+ listener_height: 0,
};
},
computed: {
@@ -317,6 +326,15 @@
onShow() {
this.init();
},
+ mounted() {
+ // 添加全局点击事件监听
+ document.addEventListener('click', this.handle_global_click);
+
+ // 添加触摸事件监听(移动端兼容)
+ document.addEventListener('touchstart', this.handle_global_click);
+ // 创建监听事件
+ this.bind_keyboard_listener();
+ },
beforeDestroy() {
// 清理定时器
if (this.video_switch_debounce_timer) {
@@ -335,6 +353,10 @@
document.removeEventListener('keydown', this.handle_keydown);
}
// #endif
+ this.unbind_keyboard_listener();
+ // 移除全局事件监听器
+ document.removeEventListener('click', this.handle_global_click);
+ document.removeEventListener('touchstart', this.handle_global_click);
},
methods: {
isEmpty,
@@ -1521,18 +1543,36 @@
}
});
},
- mounted() {
- // 添加全局点击事件监听
- document.addEventListener('click', this.handle_global_click);
-
- // 添加触摸事件监听(移动端兼容)
- document.addEventListener('touchstart', this.handle_global_click);
+ add_comment() {
+ //#ifndef H5
+ this.is_add_comment = true;
+ //#endif
+ },
+ /**
+ * 键盘高度变化监听处理
+ * @param {Object} res - 键盘高度变化事件对象
+ */
+ listener(res) {
+ console.log(res);
+ // 减1是为了兼容,避免跟键盘之间会不连贯
+ if (res.height > 0) {
+ this.listener_height = res.height - 1;
+ } else {
+ this.listener_height = 0;
+ }
+ },
+ /**
+ * 绑定键盘高度变化监听事件
+ */
+ bind_keyboard_listener() {
+ uni.onKeyboardHeightChange(this.listener);
+ },
+ /**
+ * 解绑键盘高度变化监听事件
+ */
+ unbind_keyboard_listener() {
+ uni.offKeyboardHeightChange(this.listener);
},
- beforeDestroy() {
- // 移除全局事件监听器
- document.removeEventListener('click', this.handle_global_click);
- document.removeEventListener('touchstart', this.handle_global_click);
- }
}
};
@@ -1893,4 +1933,17 @@
border-color: transparent;
}
}
+ .keyboard-input {
+ position: fixed;
+ left: 0;
+ z-index: 99;
+ background: #fff;
+ padding: 20rpx 16rpx;
+ box-sizing: border-box;
+ }
+ .keyboard-input-border {
+ padding: 16rpx 22rpx;
+ border: 2rpx solid #ddd;
+ border-radius: 50rpx;
+ }