知识模块新增评论功能
This commit is contained in:
parent
d77cee295c
commit
fab35810a0
@ -33,10 +33,13 @@ CREATE TABLE `oa_article` (
|
|||||||
`uid` int(11) NOT NULL DEFAULT 0 COMMENT '作者',
|
`uid` int(11) NOT NULL DEFAULT 0 COMMENT '作者',
|
||||||
`did` int(11) NOT NULL DEFAULT 0 COMMENT '部门',
|
`did` int(11) NOT NULL DEFAULT 0 COMMENT '部门',
|
||||||
`origin_url` varchar(255) NOT NULL DEFAULT '' COMMENT '来源地址',
|
`origin_url` varchar(255) NOT NULL DEFAULT '' COMMENT '来源地址',
|
||||||
|
`file_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '相关附件',
|
||||||
|
`is_share` tinyint(1) NOT NULL DEFAULT 1 COMMENT '分享,0私有,1所有人,2部门,3人员',
|
||||||
|
`share_dids` varchar(500) NOT NULL DEFAULT '' COMMENT '分享部门',
|
||||||
|
`share_uids` varchar(500) NOT NULL DEFAULT '' COMMENT '分享用户',
|
||||||
`content` text NOT NULL COMMENT '文章内容',
|
`content` text NOT NULL COMMENT '文章内容',
|
||||||
`read` int(11) NOT NULL DEFAULT 0 COMMENT '阅读量',
|
`read` int(11) NOT NULL DEFAULT 0 COMMENT '阅读量',
|
||||||
`type` tinyint(2) NOT NULL DEFAULT 0 COMMENT '属性:1精华 2热门 3推荐',
|
`type` tinyint(2) NOT NULL DEFAULT 0 COMMENT '属性:1精华 2热门 3推荐',
|
||||||
`is_share` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否分享,0否,1是',
|
|
||||||
`status` int(1) NOT NULL DEFAULT 1 COMMENT '状态:1正常-1下架',
|
`status` int(1) NOT NULL DEFAULT 1 COMMENT '状态:1正常-1下架',
|
||||||
`sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
|
`sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
|
||||||
`create_time` int(11) NOT NULL DEFAULT 0,
|
`create_time` int(11) NOT NULL DEFAULT 0,
|
||||||
@ -49,10 +52,12 @@ CREATE TABLE `oa_article` (
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Records of oa_article
|
-- Records of oa_article
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
INSERT INTO `oa_article` VALUES (1, '勾股OA——简单实用的开源免费的企业办公系统框架', 2, '', '勾股办公是一款简单实用的开源免费的企业办公系统框架。系统集成了系统设置、人事管理模块、消息管理模块、日常办公、财务管理等基础模块。系统简约,易于功...', 1, 1, 1, '', '勾股办公是一款简单实用的开源免费的企业办公系统框架。系统集成了系统设置、人事管理模块、消息管理模块、日常办公、财务管理等基础模块。系统简约,易于功能扩展,方便二次开发,让开发者更专注于业务深度需求的开发,帮助开发者简单高效降低二次开发成本,通过二次开发之后可以用来做CRM,ERP,业务管理等系统。', 1, 2, 1, 1, 1, 1637985280, 1650817107, 0);
|
INSERT INTO `oa_article` VALUES (1, '勾股OA——简单实用的开源免费的企业办公系统框架', 2, '', '勾股办公是一款简单实用的开源免费的企业办公系统框架。系统集成了系统设置、人事管理模块、消息管理模块、日常办公、财务管理等基础模块。系统简约,易于功...', 0, 1, 1, '','',1,'','', '<p>勾股办公是一款简单实用的开源免费的企业办公系统框架。系统集成了系统设置、人事管理模块、消息管理模块、日常办公、财务管理等基础模块。系统简约,易于功能扩展,方便二次开发,让开发者更专注于业务深度需求的开发,帮助开发者简单高效降低二次开发成本,通过二次开发之后可以用来做CRM,ERP,业务管理等系统。</p><p>项目体验地址:https://www.gougucms.com/home/pages/detail/s/gouguoa.html</p><p>项目开源地址:https://gitee.com/gouguopen/office</p>', 1, 2, 1, 1, 1637985280, 1650817107, 0);
|
||||||
INSERT INTO `oa_article` VALUES (2, '勾股CMS——轻量级、高性能极速后台开发框架', 2, '', '勾股CMS是一套轻量级、高性能极速后台开发框架。通用型的后台权限管理框架,极低门槛、操作简单、开箱即用。系统易于功能扩展,代码维护,方便二次开发,让...', 0, 1, 1, '', '勾股CMS是一套轻量级、高性能极速后台开发框架。通用型的后台权限管理框架,极低门槛、操作简单、开箱即用。系统易于功能扩展,代码维护,方便二次开发,让开发者更专注于业务深度需求的开发,帮助开发者简单高效降低二次开发成本。', 0, 0, 1, 1, 0, 1650817085, 0, 0);
|
INSERT INTO `oa_article` VALUES (2, '勾股Admin——优秀的前端Web UI解决方案', 2, '', '勾股Admin是一款开基于Layui的最新版扩展的Web UI解决方案。封装了Layui的自身调用方法和一些常用的工具函数,整合部分第三方开源的组件。', 0, 1, 1, '','',1,'','', '<p>勾股Admin是一款开基于Layui的最新版扩展的Web UI解决方案。封装了Layui的自身调用方法和一些常用的工具函数,整合部分第三方开源的组件。更多是为服务端程序员量身定做,为使用者提供相对完善的前端UI开发方案,相信她是一个很好的前端轮子。</p>
|
||||||
INSERT INTO `oa_article` VALUES (3, '勾股BLOG——简约,易用开源的个人博客系统', 2, '', '勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约,易用,内存占用低等特点,可以用来做个人博客,工作室官网,自...', 0, 1, 1, '', '勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约,易用,内存占用低等特点,可以用来做个人博客,工作室官网,自媒体官网等网站,二次开发之后也可以作为资讯、展品展示等网站。', 0, 0, 1, 1, 0, 1650817152, 0, 0);
|
<p>项目体验地址:http://admin.gougucms.com</p><p>项目开源地址:https://gitee.com/gouguopen/guoguadmin</p>', 0, 0, 1, 1, 1650817189, 0, 0);
|
||||||
INSERT INTO `oa_article` VALUES (4, '勾股DEV——研发管理与团队协作的工具软件', 2, '', '勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件,可以在线管理团队的工作、项目和任务,覆盖从需求提出到研发完成上线整个过程的项目协作。', 0, 1, 1, '', '勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件,可以在线管理团队的工作、项目和任务,覆盖从需求提出到研发完成上线整个过程的项目协作。', 0, 0, 1, 1, 0, 1650817189, 0, 0);
|
INSERT INTO `oa_article` VALUES (3, '勾股CMS——轻量级、高性能极速后台开发框架', 2, '', '勾股CMS是一套轻量级、高性能极速后台开发框架。通用型的后台权限管理框架,极低门槛、操作简单、开箱即用。系统易于功能扩展,代码维护,方便二次开发,让...', 0, 1, 1, '', '',1,'','','<p>勾股CMS是一套轻量级、高性能极速后台开发框架。通用型的后台权限管理框架,极低门槛、操作简单、开箱即用。系统易于功能扩展,代码维护,方便二次开发,让开发者更专注于业务深度需求的开发,帮助开发者简单高效降低二次开发成本。</p><p>项目体验地址:http://www.gougucms.com</p><p>项目开源地址:https://gitee.com/gouguopen/gougucms</p>', 0, 0, 1, 1, 1650817085, 0, 0);
|
||||||
|
INSERT INTO `oa_article` VALUES (4, '勾股BLOG——简约,易用开源的个人博客系统', 2, '', '勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约,易用,内存占用低等特点,可以用来做个人博客,工作室官网,自...', 0, 1, 1, '', '',1,'','','<p>勾股BLOG是一款实用的开源免费的个人博客系统。集成了系统管理、基础数据、博客文章、博客动态、语雀知识库、用户管理、访问统计等功能。具有简约,易用,内存占用低等特点,可以用来做个人博客,工作室官网,自媒体官网等网站,二次开发之后也可以作为资讯、展品展示等网站。</p><p>项目体验地址:http://blog.gougucms.com</p><p>项目开源地址:https://gitee.com/gouguopen/blog</p>', 0, 0, 1, 1, 1650817152, 0, 0);
|
||||||
|
INSERT INTO `oa_article` VALUES (5, '勾股DEV——研发管理与团队协作的工具', 2, '', '勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具,可以在线管理团队的工作、项目和任务,覆盖从需求提出到研发完成上线整个过程的项目协作。', 0, 1, 1, '', '',1,'','','<p>勾股DEV是一款专为IT行业研发团队打造的智能化项目管理与团队协作的工具软件,可以在线管理团队的工作、项目和任务,覆盖从需求提出到研发完成上线整个过程的项目协作。</p><p>项目体验地址:https://www.gougucms.com/home/pages/detail/s/gougudev.html</p><p>项目开源地址:https://gitee.com/gouguopen/dev</p>', 0, 0, 1, 1, 1650817189, 0, 0);
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for oa_article_keywords
|
-- Table structure for oa_article_keywords
|
||||||
@ -75,4 +80,21 @@ CREATE TABLE `oa_article_keywords` (
|
|||||||
INSERT INTO `oa_article_keywords` VALUES (1, 1, 1, 1, 1638093082);
|
INSERT INTO `oa_article_keywords` VALUES (1, 1, 1, 1, 1638093082);
|
||||||
INSERT INTO `oa_article_keywords` VALUES (2, 2, 2, 1, 1638093082);
|
INSERT INTO `oa_article_keywords` VALUES (2, 2, 2, 1, 1638093082);
|
||||||
INSERT INTO `oa_article_keywords` VALUES (3, 3, 3, 3, 1638093082);
|
INSERT INTO `oa_article_keywords` VALUES (3, 3, 3, 3, 1638093082);
|
||||||
INSERT INTO `oa_article_keywords` VALUES (4, 4, 4, 4, 1638093082);
|
INSERT INTO `oa_article_keywords` VALUES (4, 4, 4, 4, 1638093082);
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for oa_article_comment
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `oa_article_comment`;
|
||||||
|
CREATE TABLE `oa_article_comment` (
|
||||||
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`article_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联知识文章id',
|
||||||
|
`pid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '回复内容id',
|
||||||
|
`padmin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '回复内容用户id',
|
||||||
|
`admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
|
||||||
|
`content` text NULL COMMENT '评论内容',
|
||||||
|
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间',
|
||||||
|
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '修改时间',
|
||||||
|
`delete_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1000 COMMENT = '知识评论表' ROW_FORMAT = Compact;
|
66
app/article/controller/Api.php
Normal file
66
app/article/controller/Api.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2022 勾股工作室
|
||||||
|
* @license https://opensource.org/licenses/GPL-3.0
|
||||||
|
* @link https://www.gougucms.com
|
||||||
|
*/
|
||||||
|
declare (strict_types = 1);
|
||||||
|
namespace app\article\controller;
|
||||||
|
|
||||||
|
use app\api\BaseController;
|
||||||
|
use app\article\model\ArticleComment;
|
||||||
|
use think\facade\Db;
|
||||||
|
use think\facade\View;
|
||||||
|
|
||||||
|
class Api extends BaseController
|
||||||
|
{
|
||||||
|
//获取评论列表
|
||||||
|
public function article_comment()
|
||||||
|
{
|
||||||
|
$param = get_params();
|
||||||
|
$list = new ArticleComment();
|
||||||
|
$content = $list->get_list($param);
|
||||||
|
return to_assign(0, '', $content);
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加修改评论内容
|
||||||
|
public function add_comment()
|
||||||
|
{
|
||||||
|
$param = get_params();
|
||||||
|
if (!empty($param['id']) && $param['id'] > 0) {
|
||||||
|
$param['update_time'] = time();
|
||||||
|
unset($param['pid']);
|
||||||
|
unset($param['padmin_id']);
|
||||||
|
$res = ArticleComment::where(['admin_id' => $this->uid,'id'=>$param['id']])->strict(false)->field(true)->update($param);
|
||||||
|
if ($res) {
|
||||||
|
add_log('edit', $param['id'], $param,'评论');
|
||||||
|
return to_assign();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$param['create_time'] = time();
|
||||||
|
$param['admin_id'] = $this->uid;
|
||||||
|
$cid = ArticleComment::strict(false)->field(true)->insertGetId($param);
|
||||||
|
if ($cid) {
|
||||||
|
add_log('add', $cid, $param,'评论');
|
||||||
|
return to_assign();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除评论内容
|
||||||
|
public function delete_comment()
|
||||||
|
{
|
||||||
|
if (request()->isDelete()) {
|
||||||
|
$id = get_params("id");
|
||||||
|
$res = ArticleComment::where('id',$id)->strict(false)->field(true)->update(['delete_time'=>time()]);
|
||||||
|
if ($res) {
|
||||||
|
add_log('delete', $id,[],'评论');
|
||||||
|
return to_assign(0, "删除成功");
|
||||||
|
} else {
|
||||||
|
return to_assign(1, "删除失败");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return to_assign(1, "错误的请求");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -210,6 +210,25 @@ class Index extends BaseController
|
|||||||
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
|
||||||
$detail['fileArray'] = $fileArray;
|
$detail['fileArray'] = $fileArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$comment = Db::name('ArticleComment')
|
||||||
|
->field('a.*,u.name,u.thumb')
|
||||||
|
->alias('a')
|
||||||
|
->join('Admin u', 'u.id = a.admin_id')
|
||||||
|
->order('a.create_time desc')
|
||||||
|
->where(['a.article_id'=>$detail['id'],'a.delete_time' => 0])
|
||||||
|
->select()->toArray();
|
||||||
|
foreach ($comment as $k => &$v) {
|
||||||
|
$v['times'] = time_trans($v['create_time']);
|
||||||
|
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||||
|
if($v['update_time']>0){
|
||||||
|
$v['update_time'] = ',最后编辑时间:'.time_trans($v['update_time']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$v['update_time'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$detail['comment'] = $comment;
|
||||||
// read 字段加 1
|
// read 字段加 1
|
||||||
Db::name('article')->where('id', $id)->inc('read')->update();
|
Db::name('article')->where('id', $id)->inc('read')->update();
|
||||||
View::assign('detail', $detail);
|
View::assign('detail', $detail);
|
||||||
|
40
app/article/model/ArticleComment.php
Normal file
40
app/article/model/ArticleComment.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2022 勾股工作室
|
||||||
|
* @license https://opensource.org/licenses/GPL-3.0
|
||||||
|
* @link https://www.gougucms.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare (strict_types = 1);
|
||||||
|
namespace app\Article\model;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class ArticleComment extends Model
|
||||||
|
{
|
||||||
|
public function get_list($param = [])
|
||||||
|
{
|
||||||
|
$where = array();
|
||||||
|
$where['a.article_id'] = $param['tid'];
|
||||||
|
$where['a.delete_time'] = 0;
|
||||||
|
$content = \think\facade\Db::name('ArticleComment')
|
||||||
|
->field('a.*,u.name,u.thumb,pu.name as pname')
|
||||||
|
->alias('a')
|
||||||
|
->join('Admin u', 'u.id = a.admin_id')
|
||||||
|
->leftjoin('Admin pu', 'pu.id = a.padmin_id')
|
||||||
|
->order('a.create_time desc')
|
||||||
|
->where($where)
|
||||||
|
->select()->toArray();
|
||||||
|
foreach ($content as $k => &$v) {
|
||||||
|
$v['times'] = time_trans($v['create_time']);
|
||||||
|
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||||
|
if($v['update_time']>0){
|
||||||
|
$v['update_time'] = ',最后编辑时间:'.time_trans($v['update_time']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$v['update_time'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,12 @@
|
|||||||
.text-detial-content table th {font-weight: 800;}
|
.text-detial-content table th {font-weight: 800;}
|
||||||
.text-detial-content li {list-style: initial;margin-left: 20px;}
|
.text-detial-content li {list-style: initial;margin-left: 20px;}
|
||||||
:not(pre)>code[class*=language-], pre[class*=language-]{background:#fff!important;border:1px solid #e8e8e8!important; border-radius:3px;}
|
:not(pre)>code[class*=language-], pre[class*=language-]{background:#fff!important;border:1px solid #e8e8e8!important; border-radius:3px;}
|
||||||
|
|
||||||
|
.comment-box{border-top:1px solid #eee; background-color:#fff;width:100%; overflow:hidden}
|
||||||
|
.comment-name{font-size:16px; margin-bottom:8px;}
|
||||||
|
.comment-img{width:100px; height:100px; padding:3px; background-color:#fff;}
|
||||||
|
.comment-img img{border-radius:3px;}
|
||||||
|
.comment-tips{line-height:25px; color:#999;font-size:12px;}
|
||||||
</style>
|
</style>
|
||||||
{/block}
|
{/block}
|
||||||
<!-- 主体 -->
|
<!-- 主体 -->
|
||||||
@ -31,14 +37,7 @@
|
|||||||
<span>发表于:{$detail.create_time | date='Y-m-d H:i:s'}</span>
|
<span>发表于:{$detail.create_time | date='Y-m-d H:i:s'}</span>
|
||||||
<span>发布人:{$detail.user}</span>
|
<span>发布人:{$detail.user}</span>
|
||||||
<span>部门:{$detail.department}</span>
|
<span>部门:{$detail.department}</span>
|
||||||
<span>阅读量:{$detail.read}</span>
|
<span>分类:{$detail.cate_title}</span>
|
||||||
<span>文章分类:{$detail.cate_title}</span>
|
|
||||||
<span>关键字:{$detail.keyword_names}</span>
|
|
||||||
{notempty name="$detail.origin_url"}
|
|
||||||
<p>
|
|
||||||
<span>来源链接:{$detail.origin_url}</span>
|
|
||||||
</p>
|
|
||||||
{/notempty}
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-detial-content">
|
<div class="text-detial-content">
|
||||||
{$detail.content|raw}
|
{$detail.content|raw}
|
||||||
@ -60,11 +59,87 @@
|
|||||||
</div>
|
</div>
|
||||||
{/notempty}
|
{/notempty}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="px-4" id="commentBox">
|
||||||
|
<h3 class="py-3">相关评论</h3>
|
||||||
|
{volist name="$detail.comment" id="vo"}
|
||||||
|
<div class="comment-box py-3">
|
||||||
|
<div style="float:left;">
|
||||||
|
<p class="comment-name">{$vo.name}</p>
|
||||||
|
<img src="{$vo.thumb}" alt="{vo.name}" class="comment-img">
|
||||||
|
</div>
|
||||||
|
<div style="margin-left:128px;">
|
||||||
|
<p class="comment-tips">发表于:{$vo.create_time}{$vo.update_time} {eq name="$vo.admin_id" value="$login_user"} <button class="layui-btn layui-btn-xs layui-btn-danger layui-del" data-cid="{$vo.id}">删除</button>{/eq}</p>
|
||||||
|
<div class="py-2">{$vo.content|raw}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/volist}
|
||||||
|
<form class="layui-form">
|
||||||
|
<textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container" style="border:0;padding:0"></textarea>
|
||||||
|
<input type="hidden" name="article_id" value="{$detail.id}">
|
||||||
|
<div class="py-3">
|
||||||
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">评论回复</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{/block}
|
{/block}
|
||||||
<!-- /主体 -->
|
<!-- /主体 -->
|
||||||
|
|
||||||
<!-- 脚本 -->
|
<!-- 脚本 -->
|
||||||
{block name="script"}
|
{block name="script"}
|
||||||
<script src="{__GOUGU__}/third_party/prism/prism.js"></script>
|
<script src="{__GOUGU__}/third_party/prism/prism.js"></script>
|
||||||
|
<script>
|
||||||
|
const moduleInit = ['tool','tinymce'];
|
||||||
|
function gouguInit() {
|
||||||
|
var form = layui.form,tool=layui.tool;
|
||||||
|
|
||||||
|
//编辑器初始化
|
||||||
|
var editor = layui.tinymce;
|
||||||
|
var edit = editor.render({
|
||||||
|
menubar:false,
|
||||||
|
toolbar: 'code undo redo removeformat | alignleft aligncenter alignright alignjustify outdent indent | bullist numlist link image',
|
||||||
|
selector: "#container",
|
||||||
|
images_upload_url: '/api/index/upload/sourse/tinymce',//图片上传接口
|
||||||
|
height: 200
|
||||||
|
});
|
||||||
|
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(webform)', function (data) {
|
||||||
|
data.field.content = tinyMCE.editors['container'].getContent();
|
||||||
|
if (data.field.content == '') {
|
||||||
|
layer.msg('请先输入评论内容');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if (e.code == 0) {
|
||||||
|
setTimeout(function () {
|
||||||
|
location.reload();
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tool.post("/article/api/add_comment", data.field, callback);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#commentBox').on('click','.layui-del', function () {
|
||||||
|
let cid =$(this).data('cid');
|
||||||
|
layer.confirm('确定要删除该评论吗?', { icon: 3, title: '提示' }, function (index) {
|
||||||
|
let callback = function (e) {
|
||||||
|
layer.closeAll();
|
||||||
|
layer.msg(e.msg);
|
||||||
|
if(e.code==0){
|
||||||
|
setTimeout(function () {
|
||||||
|
location.reload();
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let postData = { "id": cid };
|
||||||
|
tool.delete("/article/api/delete_comment", postData, callback);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{/block}
|
{/block}
|
||||||
<!-- /脚本 -->
|
<!-- /脚本 -->
|
@ -1926,3 +1926,20 @@ INSERT INTO `oa_article_keywords` VALUES (1, 1, 1, 1, 1638093082);
|
|||||||
INSERT INTO `oa_article_keywords` VALUES (2, 2, 2, 1, 1638093082);
|
INSERT INTO `oa_article_keywords` VALUES (2, 2, 2, 1, 1638093082);
|
||||||
INSERT INTO `oa_article_keywords` VALUES (3, 3, 3, 3, 1638093082);
|
INSERT INTO `oa_article_keywords` VALUES (3, 3, 3, 3, 1638093082);
|
||||||
INSERT INTO `oa_article_keywords` VALUES (4, 4, 4, 4, 1638093082);
|
INSERT INTO `oa_article_keywords` VALUES (4, 4, 4, 4, 1638093082);
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for oa_article_comment
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `oa_article_comment`;
|
||||||
|
CREATE TABLE `oa_article_comment` (
|
||||||
|
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`article_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联知识文章id',
|
||||||
|
`pid` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '回复内容id',
|
||||||
|
`padmin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '回复内容用户id',
|
||||||
|
`admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
|
||||||
|
`content` text NULL COMMENT '评论内容',
|
||||||
|
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间',
|
||||||
|
`update_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '修改时间',
|
||||||
|
`delete_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1000 COMMENT = '知识评论表' ROW_FORMAT = Compact;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user