This commit is contained in:
liuyuan
2025-09-04 13:55:23 +08:00
parent 9126f47346
commit 0d0bf4bb3a
27 changed files with 9302 additions and 5262 deletions

View File

@@ -3,6 +3,7 @@
class="hb-comment"
:style="isDisable || isShowList || isPopup ? 'height:auto' : 'height: 70vh'"
id="commentData"
>
<!-- 阅读数-start -->
@@ -73,7 +74,7 @@
<view
class="comment-main-content"
style="color: #232325; line-height: 38rpx"
@click="reply(item.user.nickname, item.user.nickname, item.id)"
@click.stop="reply(item.user.nickname, item.user.nickname, item.id)"
>
{{ item.content }}
<!-- {{
@@ -90,9 +91,7 @@
</view>
<view class="comment-main-foot">
<view
@click="
reply(item.user.nickname, item.user.nickname, item.id)
"
@click.stop="reply(item.user.nickname, item.user.nickname, item.id)"
class="foot-time"
style="color: #b7b8ba; letter-spacing: 1rpx; font-size: 24rpx"
>{{ item.createTime }}</view
@@ -101,7 +100,7 @@
class="foot-btn"
style="color: #777775"
v-if="!isDisable"
@click="
@click.stop="
reply(item.user.nickname, item.user.nickname, item.id)
"
>回复</view
@@ -145,7 +144,7 @@
<view
class="comment-main-content"
style="color: #232325 !important; line-height: 38rpx"
@click="
@click.stop="
reply(each.user.nickname, each.user.nickname, item.id)
"
>
@@ -153,9 +152,9 @@
</view>
<view class="comment-main-foot">
<view
@click="
reply(each.user.nickname, each.user.nickname, item.id)
"
@click.stop="
reply(each.user.nickname, each.user.nickname, item.id)
"
class="foot-time"
style="
color: #b7b8ba;
@@ -168,7 +167,7 @@
class="foot-btn"
style="color: #777775"
v-if="each.user && !isDisable"
@click="
@click.stop="
reply(each.user.nickname, each.user.nickname, item.id)
"
>
@@ -249,7 +248,7 @@
</view>
<view
class="input-container"
:style="{ bottom: (show?205:0) + 'px' }"
:style="{ bottom: (show?200:0) + 'px' }"
v-if="showInput"
>
<view style="overflow: hidden; margin-bottom: 4rpx; font-size: 32rpx"
@@ -262,7 +261,7 @@
>取消</text
>
<text @click.stop="sendComment" style="float: right; color: #1985fd;margin-right:20rpx;margin-top:4rpx;"
<text @click.stop="sendComment" style="float: right; color: #1985fd;margin-right:20rpx;margin-top:4rpx;z-index: 99999;"
>发送</text
>
<image
@@ -284,7 +283,7 @@
</view>
<view>
<view :style="!show?'padding-bottom: 20rpx':'padding-bottom: 10rpx'">
<textarea
auto-height
@@ -294,8 +293,8 @@
maxlength="-1"
:placeholder="placeholder ? placeholder : '发表评论...'"
@focus.stop="onInputFocus"
:auto-focus="showInput"
@blur.stop="onInputBlur"
:auto-focus="focus"
/>
</view>
@@ -542,8 +541,12 @@ export default {
emojichet() {
// this.reply("", "", 0);
this.show = true; // 打开 emoji 列表
setTimeout(()=>{
this.focus=false
this.showInput=true
this.show = true;
},50)
// 打开 emoji 列表
// if(this.show){
// this.focus = false;
// }else{
@@ -568,20 +571,28 @@ export default {
},
// 输入框失去焦点
onInputBlur() {
onInputBlur(event) {
console.log(11111111111);
if (!this.commentContent.trim()) {
this.showInput = false;
}
// 阻止焦点事件冒泡,防止冲突
event.stopPropagation();
console.log('失去焦点');
// if (!this.commentContent.trim()) {
setTimeout(()=>{
this.showInput = false;
},50)
// }
// 如果输入框为空,点击空白处关闭输入框
},
// 发送评论
sendComment() {
if (this.commentContent.trim()) {
sendComment(event) {
setTimeout(()=>{
event.stopPropagation();
console.log('按钮点击');
if (this.commentContent.trim()) {
// 这里添加发送评论的逻辑
console.log("发送评论:", this.commentContent);
this.$emit("add", this.commentContent, this.pId);
@@ -592,6 +603,8 @@ export default {
} else {
this.$commonJS.showToast("请输入评论");
}
},0)
},
// 初始化评论
init(cmData) {
@@ -607,7 +620,9 @@ export default {
stopPrevent() {},
// 回复评论
reply(pUser, reUser, pId) {
this.showInput = false;
this.show=false
this.focus=false
if (this.isDisable) {
return false;
}
@@ -632,7 +647,12 @@ export default {
// } else {
// this.commentReq.content = "";
// }
this.showInput = true;
setTimeout(()=>{
this.focus=true
this.showInput = true;
},20)
// this.showTag = true;
// this.commentInput();
},
@@ -937,6 +957,7 @@ export default {
// text-align: center;
color: #999999;
position: fixed;
padding-bottom: 20rpx;
bottom: 0;
left: 0;
display: flex;

View File

@@ -4,7 +4,7 @@
<view class="page-body" style="height: 100%;">
<view class='wrapper' style="height: 100%;">
<PickerColor ref="colorPicker" :color="{r: 255,g: 0,b: 0,a: 0.6}" @confirm="confirm"></PickerColor>
<view class='toolbar' @tap="format">
<view class='toolbar' @tap="format" :style="`top:${toolbarTop?toolbarTop:0} ;`">
<!-- <view class="iconfont icon-undo" @tap="undo"></view>
<view class="iconfont icon-redo" @tap="redo"></view> -->
<!-- <view class="iconfont icon-charutupian" @tap="insertImage"></view> -->
@@ -75,6 +75,10 @@
type: String,
default: ''
},
toolbarTop: {
type: String,
default: ''
},
placeholder: {
type: String,
default: ''
@@ -399,8 +403,8 @@
position: sticky;
top: -1px; /* 距离顶部的距离 */
z-index: 10; /* 确保在其他内容之上 */
background-color: #d8e6ff;
border-bottom: 1rpx solid #5188e5;
background-color: #fff;
border-bottom: 1rpx solid #f7f7f7;
/* position: fixed;
bottom: 10upx;
left: 0;
@@ -419,6 +423,9 @@
line-height: 1;
padding-bottom: 60upx;
}
/deep/ .ql-container .ql-editor{
overflow: visible !important;
}
/deep/ .ql-editor.ql-blank:before {
font-size: 28upx;