This commit is contained in:
Zhang HaoYang 2023-12-29 00:28:38 +08:00
parent 88ac18c252
commit 77373c2129

View File

@ -1,23 +1,253 @@
<template>
<div class="main" style="text-shadow: 0 0 20px var(--font-border);overflow: scroll">
<div class="HeadLine" style="margin-top:30px;margin-left:15px;">
<div class="HeadSquare" ></div>
<div class="TitleFont" style="color:var(--theme-color)"><i class="el-icon-s-grid"></i>评论管理</div>
</div>
<div class="base-style" style="margin-top:20px;font-family: SimHei;font-size:18px;font-weight:600;margin-left:20px">
<el-table class="MyTable"
:data="List"
header-row-class-name="table_header_class"
border>
<el-table-column
align="center"
prop="id"
label="评论id"
width="150">
</el-table-column>
<el-table-column
align="center"
prop="id"
label="评论内容"
width="150">
</el-table-column>
<el-table-column
align="center"
prop="title"
label="评论者"
width="180">
</el-table-column>
<el-table-column
align="center"
prop="title"
label="评论时间"
width="180">
</el-table-column>
<el-table-column
align="center"
prop="title"
label="点赞数"
width="180">
</el-table-column>
<el-table-column prop="date" label="操作" width="100">
<template slot-scope="scope">
<div class="ButtonBlock">
<img class="MyButton" @click="handleDelete(scope.row)"
src="../../../assets/img/DeleteButton.svg" style="width:60px">
</div>
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import axios from "axios";
import Vue from "vue";
export default {
name: "CommentManage",
name: "NoticeManage",
data() {
return {}
return {
//
titlename:null,
//
openAddCategory:false,
//
dialogVisible:false,
//
isEdit:true,
searchCate:'',
userId:null,
List:[],
form:{
title: null,
content: null,
url: null,
},
//
rules: {
title: [{ required: 'true', message: '请输入通标题', trigger: 'blur' }],
content: [{ required: 'true', message: '请输入通知内容', trigger: 'blur' }],
// needLogin: [{ required: 'true', message: '', trigger: 'blur' }],
// status: [{ required: 'true', message: '', trigger: 'blur' }],
url: [{ required: 'true', message: '请慎入跳转连接', trigger: 'blur' }],
}
}
},
mounted() {
this.getFormatDate();
},
created() {
this.getUserInfo();
},
computed: {},
methods: {}
methods: {
//
handleDelete(index) {
var that=this;
this.$confirm('此操作将永久删除该评论, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios({
method: 'get',
//
url: '/api/comment/deleteByCommentId',
// URL
params: {
commentId: index.id,
}
}).then(function (res) {
if (res.data.code === 500) {
Vue.prototype.$notify.error({
title: '错误',
message: res.data.msg,
offset: 50
});
} else {
Vue.prototype.$notify({
title: '成功',
message: ('i', {style: 'color: teal'}, "删除成功"),
type: 'success',
offset: 50
});
that.GetData();
}
});
}).catch(() => {
// :
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
//
handleEdit(index) {
var _this = this;
this.openAddCategoryFun();
_this.titlename="编辑通知";
//
this.form = index;
},
//
getFormatDate() {
var that = this;
for(let i = 0 ; i < that.List.length; i++){
var date = new Date(that.List[i].createtime);// 10*1000131000
var Y = date.getFullYear() + '年';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
var D = date.getDate() + '日 ';
console.log("date: " + Y + M + D);
that.List[i].createtime = "" + Y + M + D;
}
},
// ID
getUserInfo() {
let _this = this;
if(localStorage.getItem("Authorization") && localStorage.getItem("userId")){
_this.userId = localStorage.getItem("userId")
_this.GetData();
} else {
Vue.prototype.$notify.error({
title: '错误',
message: "登录状态失效,请重新登录!",
offset: 0
});
}
},
GetData(){
//
var that = this;
axios({
method:'get',
url:'/api/notice/select',
params:{
}
}).then(function(res){
that.List = res.data;
for(let i = 0 ; i < that.List.length; i++){
var date = new Date(that.List[i].createtime);// 10*1000131000
var Y = date.getFullYear() + '年';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月';
var D = date.getDate() + '日 ';
that.List[i].createtime = "" + Y + M + D;
}
})
// /selectAllArticleByadmin
that.form.userId = that.userId;
},
}
}
</script>
<style scoped>
.base-style{
display: flex;
flex-direction: column;
}
/**表格样式,直接复制**/
::v-deep .table_header_class th{
background-color: var(--table-bg-color)!important;
color:var(--theme-color);
text-align: center;
}
.MyTable{
margin-top:10px;
width: 100%;
background-color:var(--table-bg-color);
color:var(--theme-color);
border-radius: 5px;
}
</style>
::v-deep .el-table__body tr:hover > td {
background-color: var(--table-bg-color-hover) !important;
}
::v-deep .el-table tr,
.el-table th.el-table__cell {
background-color: var(--table-bg-color);
border: var(--table-border) solid 3px;
}
::v-deep .el-table--border{
border: var(--table-border) solid 3px;
}
.login_container {
width: 400px;
border: 1px solid #eaeaea;
margin: 100px auto;
padding: 35px 35px 15px 35px;
box-sizing: border-box;
border-radius: 15px;
background-color: #fff;
box-shadow: 0 0 25px #cac6c6;
.login_title{
color: #505458;
text-align: center;
margin-bottom: 40px;}
}
::v-deep .el-dialog__body{
background-image: url("../../../assets/img/SkyPic.jpg");
margin-top:15px;
height:400px;
}
</style>