From 125e22c42f85f17655be60af360250cbc3a92a18 Mon Sep 17 00:00:00 2001 From: yanwenlong Date: Thu, 28 Sep 2023 00:29:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E8=AF=84=E5=A4=9A=E5=B1=82=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=92=8C=E8=A1=A8=E6=83=85=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/comments/commentsDetail.vue | 108 +++++++++++++++++++++++------- 1 file changed, 84 insertions(+), 24 deletions(-) diff --git a/pages/comments/commentsDetail.vue b/pages/comments/commentsDetail.vue index 05545e1..923a19b 100644 --- a/pages/comments/commentsDetail.vue +++ b/pages/comments/commentsDetail.vue @@ -70,8 +70,8 @@ --> - - user + + {{item.user.name}} @@ -80,16 +80,34 @@ --> - - {{formatTimeDifferenceFromT(item.createTime)}} - - - - {{item.contlike}} - - {{item.commentNum}} - + + {{formatTimeDifferenceFromT(item.createTime)}} + + + + {{item.contlike}} + + {{item.commentsNum}} + + + + + + {{item1.user.name + " 回复 " + item1.puser.name}}: + + + + {{formatTimeDifferenceFromT(item1.createTime)}} + + + + {{item1.contlike}} + + + + + @@ -102,10 +120,11 @@ 努力加载中 - + + - 添加评论 + {{Pform.name?("回复:"+Pform.name):"添加评论"}} @@ -162,7 +181,7 @@ commentInfo:{}, pPage:1, pTotal:0, // 评论的总条数 - pinglunId:null, + // pinglunId:null, plList:[], // 书评的评论list } }, @@ -235,7 +254,7 @@ console.log(res,'书评评论') // this.plList = this.plList.concat(res.page.list) let plList1 = res.page.records - this.pTotal = res.page.size + this.pTotal = res.page.pages this.status = 3 // 评论格式化 var newarr = [] @@ -243,6 +262,12 @@ var pjstr = '' pjstr = this.getHtmlComment(item1.content) item1.phtml = pjstr + if(item1.comments && item1.comments.length>0){ + item1.comments.forEach((item2)=>{ + var pjstr1 = '' + item2.content = this.getHtmlComment(item2.content) + }) + } // console.log(pjstr) newarr.push(item1) @@ -441,8 +466,16 @@ }, // 显示评论框 pinglun(val){ - console.log(val) - this.pinglunId = val || null + console.log('pinglun-val', val) + if(val && val.user && val.user.name){ + this.Pform.name = val.user.name || '' + this.Pform.pid = val.id + this.Pform.puserId = val.user.id || '' + } else { + // this.pinglunId = val || null + this.Pform.pid = '' + this.Pform.puserId = '' + } this.pingjiaShow = true }, // 提交评论 @@ -463,8 +496,8 @@ forumId : this.bfa_id, userId: this.userInfo.id, content: this.Pform.comment, - pid: '', - puserId: '', + pid: this.Pform.pid, + puserId: this.Pform.puserId, } this.$http .post("forum/articles/pushMsgToForum", data) @@ -478,7 +511,10 @@ // this.getCommPL() this.pingjiaShow = false this.Pform.comment = '' - this.pinglunId = null + this.Pform.name = '' + this.Pform.pid = '' + this.Pform.puserId = '' + // this.pinglunId = null } } }).catch((e)=>{ @@ -522,15 +558,39 @@