feat(评论):添加评论查询功能

dev
zjb 8 months ago
parent 85b451b420
commit 656baa7bb1

@ -6,10 +6,22 @@
*/
import request from "@/utils/request";
export default {
getList(id, page, size) {
getList(page, size) {
return request({
url: `/luoo-comment/commentCms/${page}/${size}`,
method: "get"
});
},
getListById(id, page, size) {
return request({
url: `/luoo-comment/comment/${id}/${page}/${size}`,
method: "get"
});
},
delete(id) {
return request({
url: `/luoo-comment/commentCms/${id}`,
method: "delete"
});
}
};

@ -7,10 +7,13 @@
import request from "@/utils/request";
export default {
getList(data, page, size) {
let queryParam = { ...data };
queryParam["pageNum"] = page;
queryParam["pageSize"] = size;
return request({
url: `/user/cms/user/search/${page}/${size}`,
method: "post",
data: data
url: `/user/cms/user/search`,
method: "get",
param: queryParam
});
},
getDetail(id) {

@ -2,7 +2,7 @@
* @Author: zhangjiabao
* @Date: 2024-01-25 11:05:17
* @LastEditors: zhangjiabao
* @LastEditTime: 2024-02-01 22:16:25
* @LastEditTime: 2024-02-03 00:37:17
* @FilePath: \luoo_manage_fe\src\router\index.js
*/
import Vue from "vue";
@ -81,6 +81,14 @@ export const constantRouterMap = [
name: "ArticleIndex",
component: () => import("@/views/article"),
meta: { title: "期刊列表" }
},
{
path: "detail",
name: "ArticleManageDetail",
hidden: true,
component: () => import("@/views/article/articleDetailPage"),
meta: { title: "期刊详情" }
}
]
},

@ -53,9 +53,14 @@
<el-table-column prop="name" label="歌曲名称"></el-table-column>
<el-table-column prop="artist" label="歌手/乐队"></el-table-column>
<el-table-column prop="album" label="所属专辑"></el-table-column>
<el-table-column prop="duration" label="时长">
<el-table-column prop="duration" label="时长" width="300px">
<template slot-scope="scope">
<audio preload="none" :src="scope.row.url" controls></audio>
<audio
style="width:270px"
preload="none"
:src="scope.row.url"
controls
></audio>
</template>
</el-table-column>
</el-table>
@ -69,7 +74,10 @@
<div v-html="data.content"></div>
</el-form-item>
<el-form-item label="评论记录">
<div>
<div v-loading="commentLoading">
<span v-if="commentPage.total === 0" style="margin-left:40%;"
>无数据</span
>
<el-card
style="margin-top: 5px;background-color: rgba(249, 249, 249, 0.4980392156862745);padding: 5px 10px 5px 10px"
shadow="hover"
@ -156,7 +164,11 @@ export default {
fetchComment() {
this.commentLoading = true;
commentApi
.getList(this.data.id, this.commentPage.current, this.commentPage.size)
.getListById(
this.data.id,
this.commentPage.current,
this.commentPage.size
)
.then(res => {
if (res.code === 200) {
this.commentList = res.data.rows;
@ -229,4 +241,42 @@ export default {
text-align: right;
margin-top: 10px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both;
}
.card-header {
height: 23px;
}
.app-container {
font-family: "Microsoft YaHei Bold", "Microsoft YaHei Regular",
"Microsoft YaHei", sans-serif;
}
.card-header-text {
font-family: "Microsoft YaHei Bold", "Microsoft YaHei Regular",
"Microsoft YaHei", sans-serif;
font-weight: 700;
font-style: normal;
font-size: 16px;
text-align: left;
line-height: 20px;
letter-spacing: normal;
color: #333333;
}
.box-card {
min-height: 300px;
height: calc(100vh - 140px);
border-radius: 10px;
.el-card__header {
background-color: rgba(249, 249, 249, 1);
}
.el-card__body {
overflow: auto;
height: 100%;
}
}
</style>

@ -0,0 +1,171 @@
<!--
* @Author: zhangjiabao
* @Date: 2024-02-03 00:03:50
* @LastEditors: zhangjiabao
* @LastEditTime: 2024-02-03 00:54:34
* @FilePath: \luoo_manage_fe\src\views\article\articleDetailPage.vue
-->
<template>
<div class="app-container">
<el-card class="box-card" style="overflow:auto">
<div slot="header" class="card-header clearfix">
<span class="card-header-text">期刊详情</span>
</div>
<ArticleDetail
style="margin-left: -300px"
:data="data"
:remoteTagList="remoteData.tags"
:publisher="remoteData.publisher"
></ArticleDetail>
</el-card>
</div>
</template>
<script>
import ArticleDetail from "./articleDetail.vue";
import articleApi from "@/api/article";
import tagApi from "@/api/tag";
export default {
name: "",
components: { ArticleDetail },
props: {},
data() {
return {
remoteData: { tags: [], publisher: [] },
data: {
id: null,
title: null,
tag: [],
journalNo: null,
userId: null,
image: null,
songs: [],
size: 0,
content: "",
duration: 0
}
};
},
computed: {},
watch: {},
created() {
this.fetchDetail(this.$route.query.id);
this.fetchSuperFilterTags();
this.fetchCreaterList();
},
mounted() {},
methods: {
fetchDetail(id) {
articleApi.getDetail(id).then(res => {
if (res.code === 200) {
this.data = JSON.parse(JSON.stringify(res.data));
this.type = 1;
this.contentShow = true;
} else {
this.type = 0;
this.$message.error(res.message);
}
});
},
/**
* 创建人下拉框
*/
fetchCreaterList() {
tagApi.createrList().then(res => {
if (res.code === 200) {
this.remoteData.publisher = res.data;
} else {
this.remoteData.publisher = [];
}
});
},
/**
* 高级筛选tag
*/
fetchSuperFilterTags() {
tagApi.queryHierarchical().then(res => {
let newList = [];
for (let index in res.data) {
let item = res.data[index];
let newItem = { value: item.id, label: item.nameCh, children: [] };
for (let childrenIndex in item.children) {
let childrenItem = item.children[childrenIndex];
newItem.children.push({
value: childrenItem.id,
label: childrenItem.nameCh
});
}
newList.push(newItem);
}
this.remoteData.tags = newList;
});
}
}
};
</script>
<style scoped>
.pagination-right {
text-align: right;
margin-top: 10px;
}
.box-card {
min-height: 300px;
height: calc(100vh - 140px);
border-radius: 10px;
.el-card__header {
background-color: rgba(249, 249, 249, 1);
}
}
/deep/ .el-dialog {
border-radius: 5px;
}
.popup-dialog {
.el-dialog__header {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
height: 50px;
background-color: #f5f5f5f5;
}
.el-dialog__title {
font-size: 15px;
font-weight: bolder;
}
.el-dialog__footer {
border-top: solid;
border-top-width: thin;
border-top-color: rgb(233, 233, 233);
padding: 10px 20px 10px;
}
}
.in-card-form {
height: 60px;
display: flex;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both;
}
.card-header {
height: 23px;
}
.app-container {
font-family: "Microsoft YaHei Bold", "Microsoft YaHei Regular",
"Microsoft YaHei", sans-serif;
}
.card-header-text {
font-family: "Microsoft YaHei Bold", "Microsoft YaHei Regular",
"Microsoft YaHei", sans-serif;
font-weight: 700;
font-style: normal;
font-size: 16px;
text-align: left;
line-height: 20px;
letter-spacing: normal;
color: #333333;
}
</style>

@ -2,7 +2,7 @@
* @Author: zhangjiabao
* @Date: 2024-02-01 22:15:37
* @LastEditors: zhangjiabao
* @LastEditTime: 2024-02-01 22:15:43
* @LastEditTime: 2024-02-03 00:38:41
* @FilePath: \luoo_manage_fe\src\views\comment\index.vue
-->
<template>
@ -11,23 +11,151 @@
<div slot="header" class="card-header clearfix">
<span class="card-header-text">评论管理</span>
</div>
<el-table
stripe
:data="table.data"
height="calc(100vh - 290px)"
v-loading="table.loading"
element-loading-text="加载中"
:header-cell-style="{ background: '#f5f7fa', color: '#606266' }"
border
fit
>
<el-table-column align="center" label="序号" width="95">
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column prop="_id" label="编号"></el-table-column>
<el-table-column label="内容" prop="content"></el-table-column>
<el-table-column label="评价关联">
<template slot-scope="scope">
<el-button
type="text"
size="mini"
@click="jumpToArticle(scope.row.journalId)"
>{{ scope.row.journalId }}</el-button
>
</template>
</el-table-column>
<el-table-column label="获赞数" prop="thumbupCount"></el-table-column>
<el-table-column label="评论数" prop="commentCount"></el-table-column>
<el-table-column label="评论用户" prop="nickName"></el-table-column>
<el-table-column label="评论时间" prop="publishTime"></el-table-column>
<el-table-column label="操作" width="140">
<template slot-scope="scope">
<el-popconfirm
confirm-button-text="确定"
cancel-button-text="取消"
icon="el-icon-info"
icon-color="red"
title="是否确认删除歌曲?"
style="margin-left: 10px;"
@confirm="handleDeleteClick(scope.row)"
>
<el-button
slot="reference"
plain
icon="el-icon-delete"
type="danger"
size="mini"
>删除</el-button
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
class="pagination-right"
background
layout="total, prev, pager, next, sizes"
:current-page.sync="table.page.current"
:page-size="table.page.size"
:total="table.page.total"
@size-change="handlePageSizeChange"
@current-change="handlePageCurrentChange"
>
</el-pagination>
</el-card>
</div>
</template>
<script>
import commentApi from "@/api/comment";
export default {
name: "",
components: {},
props: {},
data() {
return {};
return {
table: {
loading: true,
data: [],
page: {
current: 1,
size: 10,
total: 0
}
}
};
},
computed: {},
watch: {},
created() {},
created() {
this.fetchData();
},
mounted() {},
methods: {}
methods: {
fetchData() {
this.table.loading = true;
commentApi
.getList(this.table.page.current, this.table.page.size)
.then(res => {
if (res.code === 200) {
this.table.data = res.data.rows;
this.table.page.total = res.data.total;
this.table.loading = false;
} else {
this.$message.error(res.message);
this.table.data = [];
this.table.page.total = 0;
this.table.loading = false;
}
});
},
/**
* 分页组件页数变化事件
*/
handlePageCurrentChange(val) {
this.table.page.current = val;
this.fetchData();
},
/**
* 分页组件大小变化事件
*/
handlePageSizeChange(val) {
this.table.page.size = val;
this.fetchData();
},
/**
* 删除操作
*/
handleDeleteClick(row) {
commentApi.delete(row._id).then(res => {
if (res.code === 200) {
this.$message.success("删除成功");
this.fetchData();
} else {
this.$message.error(res.message);
}
});
},
jumpToArticle(id) {
this.$router.push(`/article/detail?id=${id}`);
}
}
};
</script>

@ -1,9 +1,26 @@
<!--
* @Author: zhangjiabao
* @Date: 2024-01-02 21:12:35
* @LastEditors: zhangjiabao
* @LastEditTime: 2024-02-03 00:08:26
* @FilePath: \luoo_manage_fe\src\views\tree\index.vue
-->
<template>
<div class="app-container">
<el-input placeholder="Filter keyword" v-model="filterText" style="margin-bottom:30px;"></el-input>
<el-tree class="filter-tree" :data="data2" :props="defaultProps" default-expand-all :filter-node-method="filterNode" ref="tree2"></el-tree>
<el-input
placeholder="Filter keyword"
v-model="filterText"
style="margin-bottom:30px;"
></el-input>
<el-tree
class="filter-tree"
:data="data2"
:props="defaultProps"
default-expand-all
:filter-node-method="filterNode"
ref="tree2"
></el-tree>
</div>
</template>
@ -11,61 +28,75 @@
export default {
watch: {
filterText(val) {
this.$refs.tree2.filter(val)
this.$refs.tree2.filter(val);
}
},
methods: {
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
if (!value) return true;
return data.label.indexOf(value) !== -1;
}
},
data() {
return {
filterText: '',
data2: [{
id: 1,
label: 'Level one 1',
children: [{
id: 4,
label: 'Level two 1-1',
children: [{
id: 9,
label: 'Level three 1-1-1'
}, {
id: 10,
label: 'Level three 1-1-2'
}]
}]
}, {
id: 2,
label: 'Level one 2',
children: [{
id: 5,
label: 'Level two 2-1'
}, {
id: 6,
label: 'Level two 2-2'
}]
}, {
id: 3,
label: 'Level one 3',
children: [{
id: 7,
label: 'Level two 3-1'
}, {
id: 8,
label: 'Level two 3-2'
}]
}],
filterText: "",
data2: [
{
id: 1,
label: "Level one 1",
children: [
{
id: 4,
label: "Level two 1-1",
children: [
{
id: 9,
label: "Level three 1-1-1"
},
{
id: 10,
label: "Level three 1-1-2"
}
]
}
]
},
{
id: 2,
label: "Level one 2",
children: [
{
id: 5,
label: "Level two 2-1"
},
{
id: 6,
label: "Level two 2-2"
}
]
},
{
id: 3,
label: "Level one 3",
children: [
{
id: 7,
label: "Level two 3-1"
},
{
id: 8,
label: "Level two 3-2"
}
]
}
],
defaultProps: {
children: 'children',
label: 'label'
children: "children",
label: "label"
}
}
};
}
}
};
</script>

@ -2,8 +2,8 @@
* @Author: zhangjiabao
* @Date: 2024-02-01 22:12:08
* @LastEditors: zhangjiabao
* @LastEditTime: 2024-02-02 17:03:49
* @FilePath: /luoo_manage_fe/src/views/user/index.vue
* @LastEditTime: 2024-02-02 22:59:50
* @FilePath: \luoo_manage_fe\src\views\user\index.vue
-->
<template>
<div class="app-container">
@ -178,9 +178,9 @@
<el-table-column label="注册时间" prop="joinTime"></el-table-column>
<el-table-column label="性别">
<template slot-scope="scope">
<span v-if="scope.row.status === 0"></span>
<span v-if="scope.row.status === 1"></span>
<span v-if="scope.row.status === 2"></span>
<span v-if="scope.row.sex === 0"></span>
<span v-if="scope.row.sex === 1"></span>
<span v-if="scope.row.sex === 2"></span>
</template>
</el-table-column>
<el-table-column label="操作" width="200">

Loading…
Cancel
Save