From ec97e05d923dc7a343b16ddd5134f1dff8071051 Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Tue, 01 Mar 2022 18:53:37 +0800
Subject: [PATCH] 评论页实现

---
 src/components/mini/box12-comment.vue |  258 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 161 insertions(+), 97 deletions(-)

diff --git a/src/components/mini/box12-comment.vue b/src/components/mini/box12-comment.vue
index 7fccf8d..23d1b54 100644
--- a/src/components/mini/box12-comment.vue
+++ b/src/components/mini/box12-comment.vue
@@ -1,19 +1,9 @@
 <template>
-	<div class="myFriend">
+	<div class="myFriend" style="min-height: 950px;">
+		<h1 style="text-align: center;">碎碎念</h1>
 		<replyBox ref="commentBoxId"></replyBox>
-		<a-modal v-model="visible" title="回复Ta @xx" on-ok="handleOk"
+		<a-modal v-model="visible" :title="replyTaget" :footer="null"
 			:bodyStyle="{'overflow':'overlay','maxHeight': '550px'}">
-			<!-- <template slot="footer">
-				<a-button key="reset" @click="reset" type="danger">
-					擦掉重来
-				</a-button>
-				<a-button key="back" @click="handleCancel">
-					歇会
-				</a-button>
-				<a-button key="submit" type="primary" :loading="loading" @click="handleOk">
-					完事<span style="font-size: 10px;">儿</span>..
-				</a-button>
-			</template> -->
 			<replyBox ref="replyBoxId"></replyBox>
 		</a-modal>
 
@@ -21,123 +11,195 @@
 
 			<div class="commentGroup">
 				<a-comment>
-					<span slot="actions" key="comment-nested-reply-to" @click="replyCall">
-						<a-icon type="edit" />回复
+					<span slot="actions" key="comment-nested-reply-to">
+						<span style="cursor: default;">{{temp.createDate}} </span>
+						<span @click="replyCall(temp)">
+							<a-icon type="edit" />
+							回复
+						</span>
+
+						<span @click="loadMore()">
+							<a-icon type="down" />更多..
+						</span>
 					</span>
 
 					<div slot="avatar">
-						{{temp.userName}} :
+						<a :href="temp.userHomePage" target="_blank" class="no-underline">
+							{{temp.visitorNickName}} :
+						</a>
 					</div>
 
-					<p slot="content">{{temp.userComment}}</p>
+					<p slot="content">{{temp.commentContent}}</p>
 
-					<a-comment v-for="tempData in temp.replyList.listData">
-						<span slot="actions" key="comment-nested-reply-to" @click="replyCall">
+					<!-- <a-comment v-for="tempData in temp.replyList.listData">
+						<span slot="actions" key="comment-nested-reply-to" @click="replyCall(tempData)">
 							<a-icon type="edit" />回复
 						</span>
 						<div slot="avatar">
-							{{tempData.userName}} @ {{tempData.replyUserName}} :
+							<a :href="tempData.userHomePage" target="_blank" class="no-underline">
+								{{tempData.userName}}
+							</a>
+							@<p style="display: inline;">{{tempData.replyUserName}} </p>:
+							<a :href="tempData.replyUserHomePage" target="_blank" class="no-underline">
+								{{tempData.replyUserName}} :
+							</a>
 						</div>
 						<p slot="content">{{tempData.userComment}}</p>
-					</a-comment>
+					</a-comment> -->
 
-
-					<div class="loadMore" @click="loadMore()">
-						<a-icon type="down" /><span>更多...</span>
-					</div>
 				</a-comment>
 			</div>
 		</div>
+
+		<a-row type="flex" justify="center">
+			<div>
+				<a-pagination @change="onChange" :showQuickJumper="true" :size="page.size" v-model="page.current"
+					:defaultPageSize="page.defaultPageSize" :pageSize="page.pageSize" :total="page.total" />
+			</div>
+		</a-row>
 	</div>
 </template>
 
 
 <script>
 	import replyBox from "./box13-reply.vue"
+
+	import {
+		queryBlogCommentList
+	} from '../../api/blogArticleComment.js'
+
 	export default {
 		components: {
 			replyBox
 		},
+		beforeMount() {
+			queryBlogCommentList({
+				pageNo: this.page.current,
+				pageSize: this.page.pageSize,
+				articleId: this.articleId
+			}).then((res) => {
+				this.page.total = Number(res.data.total)
+				this.page.pageSize = Number(res.data.size);
+				this.commentListData = res.data.records;
+				return res
+			})
+		},
 		methods: {
-			handleOk(e) {},
-			loadMore() {
-				this.commentListData[0].replyList.listData = this.commentListData[0].replyList.listData.concat(this
-					.commentListData[0].replyList.listData)
+			onChange(current) {
+				this.page.current = current;
+				queryBlogCommentList({
+					pageNo: this.page.current,
+					pageSize: this.page.pageSize,
+					articleId: this.articleId
+				}).then((res) => {
+					this.page.total = Number(res.data.total)
+					this.page.pageSize = Number(res.data.size);
+					this.commentListData = res.data.records;
+					return res
+				})
 			},
-			replyCall() {
+			loadMore() {
+				this.$message.info("11")
+			},
+			replyCall(obj, replyId) {
 				this.visible = true;
+				this.replyTaget = "回复Ta @" + obj.userName;
 				var msgInfo = {
-					useName: "22",
-					userComment: "11",
+					useName: obj.visitorNickName,
+					userComment: obj.commentContent,
+					parentId: obj.parentId == 0 ? obj.id : obj.parentId,
+					replyId: obj.id
 				};
 				this.$nextTick(() => {
-
 					this.$refs.replyBoxId.getMsgInfo(msgInfo);
 				});
 			}
 		},
 		data() {
 			return {
+				articleId: null,
+				page: {
+					size: "small",
+					total: 1,
+					pageSize: 2,
+					current: 1,
+					defaultPageSize: 10
+				},
+				replyTaget: "",
 				visible: false,
-				commentListData: [{
-					userName: "bimo",
-					userComment: "1+1=2?",
-					commentTime: "2022-02-22 22:22:22",
-					id: "1",
-					parentId: null,
-					replyId: null,
-					replyUserName: null,
-					replyList: {
-						total: "3",
-						current: "1",
-						listData: [{
-							userName: "inleft",
-							userComment: "2",
-							commentTime: "2022-02-22 23:22:22",
-							id: "2",
-							parentId: "1",
-							replyId: "1",
-							replyUserName: "bimo",
-						}, {
-							userName: "air",
-							userComment: "不对是3",
-							commentTime: "2022-02-23 13:13:13",
-							id: "3",
-							parentId: "1",
-							replyId: "2",
-							replyUserName: "inleft",
-						}]
-					},
-				}, {
-					userName: "bimo",
-					userComment: "1+1=2?",
-					commentTime: "2022-02-22 22:22:22",
-					id: "1",
-					parentId: null,
-					replyId: null,
-					replyUserName: null,
-					replyList: {
-						total: "3",
-						current: "1",
-						listData: [{
-							userName: "inleft",
-							userComment: "2",
-							commentTime: "2022-02-22 23:22:22",
-							id: "2",
-							parentId: "1",
-							replyId: "1",
-							replyUserName: "bimo",
-						}, {
-							userName: "air",
-							userComment: "不对是3",
-							commentTime: "2022-02-23 13:13:13",
-							id: "3",
-							parentId: "1",
-							replyId: "2",
-							replyUserName: "inleft",
-						}]
-					},
-				}],
+				commentListData: [
+					// 	{
+					// 	userName: "bimo",
+					// 	userComment: "1+1=2?",
+					// 	commentTime: "2022-02-22 22:22:22",
+					// 	id: "1",
+					// 	parentId: null,
+					// 	replyId: null,
+					// 	replyUserName: null,
+					// 	userHomePage: "",
+					// 	replyUserHomePage: "",
+					// 	replyList: {
+					// 		total: "3",
+					// 		current: "1",
+					// 		listData: [{
+					// 			userName: "inleft",
+					// 			userComment: "2",
+					// 			commentTime: "2022-02-22 23:22:22",
+					// 			id: "2",
+					// 			parentId: "1",
+					// 			replyId: "1",
+					// 			replyUserName: "bimo",
+					// 			userHomePage: "",
+					// 			replyUserHomePage: "",
+					// 		}, {
+					// 			userName: "air",
+					// 			userComment: "不对是3",
+					// 			commentTime: "2022-02-23 13:13:13",
+					// 			id: "3",
+					// 			parentId: "1",
+					// 			replyId: "2",
+					// 			replyUserName: "inleft",
+					// 			userHomePage: "",
+					// 			replyUserHomePage: "",
+					// 		}]
+					// 	},
+					// }, {
+					// 	userName: "bimo",
+					// 	userComment: "1+1=2?",
+					// 	commentTime: "2022-02-22 22:22:22",
+					// 	id: "1",
+					// 	parentId: null,
+					// 	replyId: null,
+					// 	replyUserName: null,
+					// 	userHomePage: "",
+					// 	replyUserHomePage: "",
+					// 	replyList: {
+					// 		total: "3",
+					// 		current: "1",
+					// 		listData: [{
+					// 			userName: "inleft",
+					// 			userComment: "2",
+					// 			commentTime: "2022-02-22 23:22:22",
+					// 			id: "2",
+					// 			parentId: "1",
+					// 			replyId: "1",
+					// 			replyUserName: "bimo",
+					// 			userHomePage: "",
+					// 			replyUserHomePage: "",
+					// 		}, {
+					// 			userName: "air",
+					// 			userComment: "不对是3",
+					// 			commentTime: "2022-02-23 13:13:13",
+					// 			id: "3",
+					// 			parentId: "1",
+					// 			replyId: "2",
+					// 			replyUserName: "inleft",
+					// 			userHomePage: "",
+					// 			replyUserHomePage: "",
+					// 		}]
+					// 	},
+					// },
+				],
 
 			}
 		}
@@ -150,9 +212,16 @@
 	}
 
 	.commentList {
+		a {
+			color: black;
+		}
 
 		img {
 			user-select: none;
+		}
+
+		.ant-comment-avatar {
+			cursor: default;
 		}
 
 		.ant-comment-actions {
@@ -172,11 +241,6 @@
 			border-top: 1px solid #e5e9ef;
 			margin-bottom: 10px;
 			padding-bottom: 15px;
-
-
-			.loadMore:hover {
-				color: skyblue;
-			}
 		}
 
 		.ant-comment-content-detail {

--
Gitblit v1.9.1