评论管理

This commit is contained in:
2024-10-15 15:32:55 +08:00
parent cd13e8635a
commit be61850df2
4 changed files with 94 additions and 17 deletions

View File

@@ -1,8 +1,8 @@
<script type="text/javascript">
const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端
// const baseUrl = "http://192.168.110.100:9200/pb"; //张川川后端
// const baseUrl = 'http://59.110.212.44:9100/pb'
// const baseUrl = "https://testapi.nuttyreading.com";
// const baseUrl = 'https://api.nuttyreading.com'
const baseUrl = 'https://api.nuttyreading.com'
// function commonFun() {
// console.log("公共方法")
// }

View File

@@ -24,13 +24,21 @@
>查询</el-button
>
</el-form-item>
<el-button type="text"
<el-button
v-if="tableData.length > 0"
style="position: absolute;right: 0;"
type="danger"
size="small"
@click="deleteHandle('all')"
>批量删除</el-button
>
<!-- <el-button type="text"
@click="changeDefalutExpand()"
style="position: absolute;right: 0;"
:style="`color:${defaultExpand?'#17B3A3':'#333'}`"
>{{ !defaultExpand ? "收起" : "展开" }}全部评论
<i class="el-icon-s-comment" ></i
></el-button>
></el-button> -->
</el-form>
<!-- -->
@@ -40,10 +48,18 @@
:default-expand-all="defaultExpand"
:data="tableData"
style="width: 100%"
height="calc(100% - 100px)"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
height="calc(100% - 40px)"
@selection-change="handleSelectionChange"
:default-sort="{ prop: 'date', order: 'descending' }"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column
fixed
prop="createTime"
label="日期"
width="200"
sortable
>
<el-table-column fixed prop="createTime" label="日期" width="200">
</el-table-column>
<el-table-column prop="name" label="姓名" width="120">
<template slot-scope="scope">
@@ -51,9 +67,8 @@
<el-tooltip placement="top" v-if="scope.row.user">
<div slot="content">
<div>
<p v-if="scope.row.user.nickname ">
<p v-if="scope.row.user.nickname">
昵称{{ scope.row.user.nickname }}
</p>
<p v-if="scope.row.user.name">
姓名{{ scope.row.user.name }}
@@ -91,7 +106,7 @@
<template slot-scope="scope">
<span
style="color: red;cursor: pointer;"
@click="deleteHandle(scope.row.id)"
@click="deleteHandle('one', scope.row.id)"
>
删除
</span>
@@ -118,6 +133,7 @@ export default {
data() {
return {
tableData: [],
selectData: [],
query: {
content: ""
},
@@ -130,6 +146,10 @@ export default {
},
created() {},
methods: {
handleSelectionChange(data) {
console.log("data at line 141:", data);
this.selectData = data;
},
changeDefalutExpand() {
this.refreshTable = false;
this.$nextTick(() => {
@@ -161,7 +181,7 @@ export default {
limit: this.pageSize,
page: this.pageIndex,
type: 0, //类型0课程1章节
courseId: this.courseId,
courseId: this.courseId ? this.courseId : "",
chapterId: "",
content: this.query.content //内容
@@ -182,19 +202,27 @@ export default {
});
},
deleteHandle(id) {
this.$confirm("请确认是否删除?", "提示", {
deleteHandle(type, id) {
if (type == "all") {
if (this.selectData.length == 0) {
this.$message.error("请至少选择一条评论");
return false;
}
}
this.$confirm(`请确认是否${type == "all" ? "批量" : ""}删除?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
var ids = this.selectData.map(e => e.id).join(",");
console.log("ids at line 205:", ids);
this.$http({
url: this.$http.adornUrl(
`/master/courseGuestbook/delCourseGuestbook`
),
method: "post",
data: this.$http.adornData({
id: id
ids: type == "all" ? ids : id
})
}).then(({ data }) => {
if (data && data.code === 0) {

View File

@@ -0,0 +1,49 @@
<template>
<div class="mod-config">
<div
style="padding:0 20px;box-sizing: border-box;height:calc(100% - 100px);"
>
<common-commont
ref="commonCommont"
></common-commont>
</div>
</div>
</template>
<script>
import commonCommont from "@/views/components/courseList/commont.vue";
export default {
data() {
return {
aaa:111,
};
},
components: {
commonCommont
},
activated() {
this.$nextTick(() => {
this.$refs.commonCommont.init();
});
},
created(){
this.$nextTick(() => {
this.$refs.commonCommont.init();
});
},
methods: {
}
};
</script>
<style lang="less" scoped>
.mod-config{
height: 80vh;
}
</style>

View File

@@ -169,7 +169,7 @@
fixed="right"
header-align="center"
align="center"
width="340"
width="280"
label="操作"
>
<template slot-scope="scope">
@@ -195,12 +195,12 @@
@click="handleQuestionBank(scope.row)"
>题库管理</el-button
>
<el-button
<!-- <el-button
type="text"
size="small"
@click="showLinkComment(scope.row)"
>评论管理<i class="el-icon-s-comment"></i
></el-button>
></el-button> -->
<el-button type="text" size="small" @click="showLinkTags(scope.row)"
>查看引用</el-button
>