From df4c58d3e40cd43298f9cb2336a176ecfaf9272d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=8E=AB=E5=94=90=E5=B0=BC?= <1431128779@qq.com> Date: Tue, 3 Dec 2024 10:04:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E7=AB=A0=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AF=84=E8=AE=BA=E8=87=AA=E5=8A=A8=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=E8=AF=84=E8=AE=BA=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/comment-list/comment-list.vue | 4 +++ components/comment-modal/comment-modal.vue | 12 ++++---- pagesA/article-detail/article-detail.vue | 33 ++++++++++++++++++---- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/components/comment-list/comment-list.vue b/components/comment-list/comment-list.vue index 33e1537..61f8d19 100644 --- a/components/comment-list/comment-list.vue +++ b/components/comment-list/comment-list.vue @@ -6,6 +6,10 @@ 评论列表 ({{ (result && result.total) || 0 }}条) + + + 刷新 + diff --git a/components/comment-modal/comment-modal.vue b/components/comment-modal/comment-modal.vue index 174218c..40ce546 100644 --- a/components/comment-modal/comment-modal.vue +++ b/components/comment-modal/comment-modal.vue @@ -208,15 +208,17 @@ export default { }, handleOnChange(isOpen) { this.isShow = isOpen; - if (!isOpen) { - this.$emit("on-close", { - refresh: false - }) - } + if(!isOpen){ + this.$emit("on-close", { + isSubmit:false, + refresh: false + }) + } }, handleClose(refresh = false) { this.isShow = false; this.$emit("on-close", { + isSubmit:true, refresh: refresh }) } diff --git a/pagesA/article-detail/article-detail.vue b/pagesA/article-detail/article-detail.vue index 2f248c8..3288de4 100644 --- a/pagesA/article-detail/article-detail.vue +++ b/pagesA/article-detail/article-detail.vue @@ -117,7 +117,7 @@ - + @@ -292,7 +292,9 @@ export default { isComment: false, postName: "", title: "" - } + }, + + commentListScrollTop:0 }; }, computed: { @@ -413,6 +415,7 @@ export default { this.fnSetPageTitle('文章详情'); this.loading = 'success'; this.fnHandleSetFlotButtonItems(this.haloConfigs); + this.handleQueryCommentListScrollTop() }) .catch(err => { console.log("错误", err) @@ -469,6 +472,13 @@ export default { this.commentModal.postName = this.result.metadata.name; this.commentModal.title = "新增评论"; this.commentModal.show = true; + + setTimeout(()=>{ + uni.pageScrollTo({ + scrollTop: this.commentListScrollTop, + duration: 100 + }) + },300) }, fnOnComment(data) { this.commentModal.isComment = data.isComment; @@ -476,8 +486,10 @@ export default { this.commentModal.title = data.title; this.commentModal.show = true; }, - fnOnCommentModalClose(refresh) { - if (refresh && this.$refs.commentListRef) { + fnOnCommentModalClose({refresh,isSubmit}) { + console.log("refresh",refresh) + console.log("isSubmit",isSubmit) + if (refresh && isSubmit && this.$refs.commentListRef) { this.$refs.commentListRef.fnGetData() } this.commentModal.show = false; @@ -957,7 +969,18 @@ export default { } else { return this.haloConfigs?.appConfig?.appInfo?.qrCodeImageUrl; } - } + }, + handleQueryCommentListScrollTop(){ + if(!this.postDetailConfig) return; + if(!this.postDetailConfig.showComment) return; + this.$nextTick(()=>{ + setTimeout(()=>{ + uni.createSelectorQuery().in(this).select('#CommentList').boundingClientRect(res => { + this.commentListScrollTop = res.top - 12; + }).exec(); + }, 2*1000) + }) + } } };