From 00c45de1525ad4145fbc7f03cf7425340dbe59fc Mon Sep 17 00:00:00 2001
From: yous1r <1443408729@qq.com>
Date: Tue, 29 Dec 2020 11:34:11 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=9E=B6=E5=AD=90?=
=?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
admin/comment/comment.html | 54 +++++++++++++++++++++++++++++++++-----
1 file changed, 47 insertions(+), 7 deletions(-)
diff --git a/admin/comment/comment.html b/admin/comment/comment.html
index b59b1d1..92c004a 100644
--- a/admin/comment/comment.html
+++ b/admin/comment/comment.html
@@ -1,10 +1,50 @@
-
-
- 评论模块
-
-
-
-
+
+
+
+ Document
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id |
+ 评论人 |
+ 评论内容 |
+ 评论时间 |
+ 操作 |
+
+
+
+
+
+ 1 |
+ 2016-11-29 |
+ 人生就像是一场修行 |
+ 贤心 |
+
+
+ |
+
+
+
+
+
+
+
+
\ No newline at end of file
--
Gitee
From ffa1eedadfff287dc3afc11edad56cc511ca5f9d Mon Sep 17 00:00:00 2001
From: yous1r <1443408729@qq.com>
Date: Tue, 29 Dec 2020 19:12:33 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E6=A8=A1=E5=9D=97ok!!!?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
admin/assets/js/comment/comment.js | 44 ++++++++++++++++++++++++++++
admin/comment/comment.html | 46 +++++++++++++++++++-----------
2 files changed, 74 insertions(+), 16 deletions(-)
diff --git a/admin/assets/js/comment/comment.js b/admin/assets/js/comment/comment.js
index e69de29..cf1da45 100644
--- a/admin/assets/js/comment/comment.js
+++ b/admin/assets/js/comment/comment.js
@@ -0,0 +1,44 @@
+$(function() {
+ // 引入layui方法
+ let layer = layui.layer;
+ // 获取列表
+ getList();
+ function getList() {
+ $.ajax({
+ url: 'admin/comments',
+ success: function (res) {
+ const paddZero = (n) => (n < 10 ? "0" + n : n);
+ // 1. 往模板中导入过滤器函数
+ template.defaults.imports.filterTime = function (time) {
+ // 得到年月日。。。
+ let d = new Date(time);
+ let y = d.getFullYear();
+ let m = paddZero(d.getMonth() + 1);
+ let day = paddZero(d.getDate());
+
+ return `${y}-${m}-${day}`;
+ };
+ htmlStr = template('tb',res)
+
+ $('.comm_list').html(htmlStr)
+
+ }
+ })
+ }
+
+ // 删除评论
+ $('body').on('click','.del_btn',function () {
+ $.ajax({
+ url: 'admin/comments/' + $(this).attr('data-id'),
+ type: 'DELETE',
+ success: function (res) {
+ if(res.status === 0) {
+ layer.msg('删除成功!');
+ } else {
+ layer.msg('删除失败!')
+ getList()
+ }
+ }
+ })
+ })
+})
\ No newline at end of file
diff --git a/admin/comment/comment.html b/admin/comment/comment.html
index 92c004a..60119ad 100644
--- a/admin/comment/comment.html
+++ b/admin/comment/comment.html
@@ -1,15 +1,17 @@
+
+
- Document
+ 评论模块
-
+
@@ -27,24 +29,36 @@
评论内容 |
评论时间 |
操作 |
-
-
-
- 1 |
- 2016-11-29 |
- 人生就像是一场修行 |
- 贤心 |
-
-
- |
-
-
-
+
+
+
+
+
+
+
-
\ No newline at end of file
+