From 85b451b420b0338507b341f87158d8020ac98df2 Mon Sep 17 00:00:00 2001 From: zhangjiabao Date: Fri, 2 Feb 2024 18:27:44 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(=E7=94=A8=E6=88=B7=20=E6=9C=9F?= =?UTF-8?q?=E5=88=8A):=20=E7=94=A8=E6=88=B7=E8=81=94=E8=B0=83=20=E6=9C=9F?= =?UTF-8?q?=E5=88=8A=E6=B7=BB=E5=8A=A0=E8=AF=A6=E6=83=85=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/comment.js | 4 +- src/api/user.js | 29 +++ src/views/article/articleDetail.vue | 139 +++++++------- src/views/article/articleModify.vue | 7 +- src/views/article/index.vue | 19 +- src/views/song/index.vue | 7 +- src/views/user/detail.vue | 278 +++++++++++++++++++++++++--- src/views/user/index.vue | 239 ++++++++++++++++++++---- 8 files changed, 585 insertions(+), 137 deletions(-) create mode 100644 src/api/user.js diff --git a/src/api/comment.js b/src/api/comment.js index cda400e..a6c825d 100644 --- a/src/api/comment.js +++ b/src/api/comment.js @@ -6,9 +6,9 @@ */ import request from "@/utils/request"; export default { - getList(volid) { + getList(id, page, size) { return request({ - url: `/luoo-comment/comment/findByVolid/${volid}`, + url: `/luoo-comment/comment/${id}/${page}/${size}`, method: "get" }); } diff --git a/src/api/user.js b/src/api/user.js new file mode 100644 index 0000000..e6cf88a --- /dev/null +++ b/src/api/user.js @@ -0,0 +1,29 @@ +/* + * @Description: + * @version: v1 + * @Author: zhangjiabao + * @Date: 2024-01-19 23:38:16 + */ +import request from "@/utils/request"; +export default { + getList(data, page, size) { + return request({ + url: `/user/cms/user/search/${page}/${size}`, + method: "post", + data: data + }); + }, + getDetail(id) { + return request({ + url: `/user/cms/user/${id}`, + method: "get" + }); + }, + updata(id, data) { + return request({ + url: `/user/cms/user/${id}`, + method: "put", + data + }); + } +}; diff --git a/src/views/article/articleDetail.vue b/src/views/article/articleDetail.vue index b24884a..c3fa5a7 100644 --- a/src/views/article/articleDetail.vue +++ b/src/views/article/articleDetail.vue @@ -13,7 +13,7 @@ label-width="100px" > - VOL.{{ data.number }} {{ data.name }} + VOL.{{ data.journalNo }} {{ data.title }} {{ getTagNameById(data.tag) }} @@ -24,8 +24,8 @@ @@ -36,18 +36,17 @@ style="width: calc(50% + 400px); margin: 0 0 auto auto;" stripe class="draggable-table" - row-key="name" border fit element-loading-text="加载中" :header-cell-style="{ background: '#f5f7fa', color: '#606266' }" > - + @@ -56,7 +55,7 @@ @@ -67,29 +66,43 @@ label-suffix=":" > - {{ data.summary }} +
- - {{ c["nickname"] }} + - {{ c["publishtime"] }} - {{ c["thumbup"] }} -
- {{ c["content"] }} -
+ {{ c["nickName"] }} + {{ c["publishTime"] }} + {{ c["thumbupCount"] }} +
+ {{ c["content"] }} +
+ + +
@@ -124,7 +137,13 @@ export default { }, data() { return { - commentList: [] + commentList: [], + commentLoading: true, + commentPage: { + current: 1, + size: 10, + total: 0 + } }; }, filters: {}, @@ -135,45 +154,27 @@ export default { mounted() {}, methods: { fetchComment() { - // this.$message.success(this.data.number) - // commentApi.getList(this.data.number).then(res => { - // console.log(res) - // }) - let res = { - code: 0, - data: [ - { - _id: "1", - articleid: "", - comment: 0, - content: "wowowowowowow", - nickname: "nickname1", - parentid: "", - publishtime: "2023-01-01", - share: 0, - state: "", - thumbup: 333, - userid: "123", - visits: 0 - }, - { - _id: "2", - articleid: "", - comment: 0, - content: "ninininininin", - nickname: "nickname2", - parentid: "", - publishtime: "2023-01-01", - share: 0, - state: "", - thumbup: 12, - userid: "123", - visits: 0 + this.commentLoading = true; + commentApi + .getList(this.data.id, this.commentPage.current, this.commentPage.size) + .then(res => { + if (res.code === 200) { + this.commentList = res.data.rows; + this.commentPage.total = res.data.total; + this.commentLoading = false; + } else { + this.$message(res.message); + this.commentList = []; + this.commentPage.total = 0; + this.commentLoading = false; } - ], - message: "" - }; - this.commentList = res.data; + }); + }, + handlePageSizeChange() { + this.fetchComment(); + }, + handlePageCurrentChange() { + this.fetchComment(); }, // ************************* 数据处理 ************************* getAuthorNameById(userId) { @@ -224,4 +225,8 @@ export default { text-align: left; line-height: 22px; } +.pagination-right { + text-align: right; + margin-top: 10px; +} diff --git a/src/views/article/articleModify.vue b/src/views/article/articleModify.vue index e0fbac5..20fb142 100644 --- a/src/views/article/articleModify.vue +++ b/src/views/article/articleModify.vue @@ -158,7 +158,12 @@ diff --git a/src/views/article/index.vue b/src/views/article/index.vue index 28f563c..8f6a04e 100644 --- a/src/views/article/index.vue +++ b/src/views/article/index.vue @@ -156,7 +156,7 @@