update
This commit is contained in:
parent
88ac18c252
commit
77373c2129
@ -1,23 +1,253 @@
|
|||||||
<template>
|
<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>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import axios from "axios";
|
||||||
|
import Vue from "vue";
|
||||||
export default {
|
export default {
|
||||||
name: "CommentManage",
|
name: "NoticeManage",
|
||||||
data() {
|
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() {
|
mounted() {
|
||||||
|
this.getFormatDate();
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.getUserInfo();
|
||||||
},
|
},
|
||||||
computed: {},
|
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位需*1000,时间戳为13位的话不需乘1000
|
||||||
|
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位需*1000,时间戳为13位的话不需乘1000
|
||||||
|
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>
|
</script>
|
||||||
<style scoped>
|
<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>
|
||||||
|
Loading…
Reference in New Issue
Block a user