mirror of https://github.com/1099438829/apeblog
This commit is contained in:
parent
509028dc4f
commit
0450e84961
|
|
@ -4,6 +4,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\common\model\Document as aModel;
|
||||
use app\common\model\DocumentCategory as cModel;
|
||||
use app\common\model\DocumentPage;
|
||||
use app\common\model\Tag as TagModel;
|
||||
use app\common\model\DocumentArticle;
|
||||
use app\common\model\Comment as CommentModel;
|
||||
|
|
@ -208,7 +209,11 @@ class Article extends AuthController
|
|||
['id', '']
|
||||
]);
|
||||
if ($where['id'] == '') {
|
||||
return $this->error('数据不存在');
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
$info = (new DocumentArticle())->getInfo($where["id"]);
|
||||
if (empty($info)) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
$category = cModel::systemPage($where);
|
||||
$category = get_tree_list($category);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace app\admin\controller;
|
|||
|
||||
use app\common\model\Document as aModel;
|
||||
use app\common\model\DocumentCategory as cModel;
|
||||
use app\common\model\DocumentPage;
|
||||
use app\common\model\Tag as TagModel;
|
||||
use app\common\model\DocumentArticle;
|
||||
use app\common\model\Comment as CommentModel;
|
||||
|
|
@ -52,6 +53,7 @@ class Page extends AuthController
|
|||
['page', 1],
|
||||
['limit', 20],
|
||||
]);
|
||||
$where["type"] = aModel::DOCUMENT_TYPE_PAGE;
|
||||
return app("json")->layui(aModel::systemPage($where));
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +175,6 @@ class Page extends AuthController
|
|||
|
||||
/**
|
||||
* 新增文章
|
||||
* @param $category_id
|
||||
* @return string
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
|
|
@ -181,44 +182,57 @@ class Page extends AuthController
|
|||
* @author 李玉坤
|
||||
* @date 2021-03-10 14:46
|
||||
*/
|
||||
public function add($category_id = '')
|
||||
public function add()
|
||||
{
|
||||
$where = [
|
||||
'name' => '',
|
||||
'status' => ''
|
||||
];
|
||||
// 获取页面模板列表
|
||||
$themeList = [];
|
||||
$themeDir = public_path('template').system_config('web_template').'/pc/page';
|
||||
if ($dh = opendir($themeDir)) {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
|
||||
$this->assign("category", $category);
|
||||
$this->assign("category_id", $category_id);
|
||||
if ( $file != "." && $file != "..") {
|
||||
$themeList[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
$this->assign("themeList", $themeList);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑页
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-20 17:00
|
||||
* @return string|void
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$where = Util::postMore([
|
||||
['name', ''],
|
||||
['id', '']
|
||||
]);
|
||||
if ($where['id'] == '') {
|
||||
return $this->error('数据不存在');
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
$category = cModel::systemPage($where);
|
||||
$category = get_tree_list($category);
|
||||
$info = aModel::get($where['id']);
|
||||
$content = DocumentArticle::get($where['id']);
|
||||
if ($content) {
|
||||
$info->content = $content->content;
|
||||
} else {
|
||||
$info->content = '';
|
||||
$info = (new DocumentPage())->getInfo($where["id"]);
|
||||
if (empty($info)) {
|
||||
$this->error('数据不存在');
|
||||
}
|
||||
$this->assign("category", $category);
|
||||
// 获取页面模板列表
|
||||
$themeList = [];
|
||||
$themeDir = public_path('template/');
|
||||
$defaultTheme = system_config('web_template');
|
||||
if ($dh = opendir($themeDir.'/'.$defaultTheme.'/pc/page')) {
|
||||
if ((is_dir($themeDir . "/" . $file)) && $file != "." && $file != "..") {
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
$pageList[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
}
|
||||
$this->assign("themeList", $themeList);
|
||||
$this->assign("info", $info);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,20 +17,18 @@
|
|||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">文章设置</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;">返 回</a></li>
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="home">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label>文章名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value=""
|
||||
placeholder="文章名称"/>
|
||||
<input type="text" class="form-control" id="title" name="title" value="{$info.title}" placeholder="文章名称"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>别名</label>
|
||||
<input type="text" class="form-control" id="alias" name="alias" value=""
|
||||
placeholder="别名索引"/>
|
||||
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}" placeholder="别名索引"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="category_id">栏目分类</label>
|
||||
|
|
@ -38,9 +36,7 @@
|
|||
<select name="category_id" id="category_id" class="form-control">
|
||||
<option value="0">请选择</option>
|
||||
{volist name="category" id="vo"}
|
||||
<option value="{$vo.id}"
|
||||
{notempty name="pid" }{if $vo.id==$category_id}selected{/if} {/notempty}
|
||||
>{$vo.html}{$vo.title}</option>
|
||||
<option value="{$vo.id}">{$vo.html}{$vo.title}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">文章设置</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;">返 回</a></li>
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="home">
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">SEO设置</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;">返 回</a></li>
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="home">
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">SEO设置</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;">返 回</a></li>
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="home">
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<div class="card-body">
|
||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回" onclick="history.back(-1);return false;">返 回</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回" onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
|
|
@ -23,35 +23,28 @@
|
|||
<label>页面名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="" placeholder="页面名称"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="col-xs-4">
|
||||
<label>展示模板</label>
|
||||
<input class="form-control" name="theme" type="text" placeholder="展示模板">
|
||||
<div class="form-group form-controls">
|
||||
<select name="theme" id="theme" class="form-control">
|
||||
<option value="0">请选择</option>
|
||||
{volist name="themeList" id="vo"}
|
||||
<option value="{$vo}">{$vo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label>URL名称</label>
|
||||
<input class="form-control" id="alias" name="alias" type="text" placeholder="URL名称">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<div class="col-xs-4">
|
||||
<label for="abstract">排序</label>
|
||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="99">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="link_str">外链</label>
|
||||
<input type="text" class="form-control" name="link_str" id="link_str" placeholder="外链">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="keywords">seo关键字</label>
|
||||
<input type="text" class="form-control" id="keywords" name="keywords"
|
||||
placeholder="请输入seo关键字">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="description">seo描述</label>
|
||||
<input type="text" class="form-control" name="description" id="description"
|
||||
placeholder="seo描述">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>主图</label>
|
||||
|
|
@ -70,6 +63,20 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="link_str">外链</label>
|
||||
<input type="text" class="form-control" name="link_str" id="link_str" placeholder="外链">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="keywords">seo关键字</label>
|
||||
<input type="text" class="form-control" id="keywords" name="keywords"
|
||||
placeholder="请输入seo关键字">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="description">seo描述</label>
|
||||
<input type="text" class="form-control" name="description" id="description"
|
||||
placeholder="seo描述">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="abstract">摘要</label>
|
||||
<input type="text" class="form-control" name="abstract" id="abstract"
|
||||
|
|
|
|||
|
|
@ -1,286 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<title>文章评论管理 - {:system_config('title')}后台管理系统</title>
|
||||
{include file="public/header" /}
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid p-t-15">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>搜索</h4>
|
||||
<ul class="card-actions">
|
||||
<li>
|
||||
<button type="button" data-toggle="tooltip" title="" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form class="form-inline searchForm" onsubmit="return false;">
|
||||
<div class="form-group">
|
||||
<label for="author">姓名</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="author" name="author"
|
||||
placeholder="请输入姓名">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">邮箱</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="email" name="email" placeholder="邮箱">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="url">网址</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="url" name="url" placeholder="网址">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="start_time">操作时间</label>
|
||||
<div class="input-group">
|
||||
<input class="form-control js-datetimepicker" type="text" id="start_time"
|
||||
name="start_time" autocomplete="off" data-side-by-side="true" data-locale="zh-cn"
|
||||
data-format="YYYY-MM-DD" placeholder="开始时间">
|
||||
<span class="input-group-addon">~</span>
|
||||
<input class="form-control js-datetimepicker" type="text" id="end_time" name="end_time"
|
||||
autocomplete="off" data-side-by-side="true" data-locale="zh-cn"
|
||||
data-format="YYYY-MM-DD" placeholder="结束时间">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success" style="margin: -10px 0 0 10px;" id="search">搜索
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-toolbar clearfix">
|
||||
<div class="toolbar-btn-action">
|
||||
<a class="btn btn-warning" href="#!" onclick="delSelect()"><i class="mdi mdi-window-close"></i>
|
||||
删除</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="tb_departments"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{include file="public/footer"/}
|
||||
<script type="text/javascript">
|
||||
var id = GetQueryString("id");
|
||||
$('#tb_departments').bootstrapTable({
|
||||
classes: 'table table-bordered table-hover table-striped',
|
||||
url: '/admin/article/commentList?id=' + id,
|
||||
method: 'post',
|
||||
dataType: 'json', // 因为本示例中是跨域的调用,所以涉及到ajax都采用jsonp,
|
||||
uniqueId: 'id',
|
||||
idField: 'id', // 每行的唯一标识字段
|
||||
toolbar: '#toolbar', // 工具按钮容器
|
||||
showColumns: false, // 是否显示所有的列
|
||||
showRefresh: false, // 是否显示刷新按钮
|
||||
responseHandler: function (res) {
|
||||
return {
|
||||
"total": res.count,
|
||||
"rows": res.data,
|
||||
};
|
||||
},
|
||||
pagination: true,
|
||||
queryParams: function (params) {
|
||||
let temp = toArrayList($(".searchForm").serializeArray());
|
||||
temp['document_id'] = id;
|
||||
temp['limit'] = params.limit;
|
||||
temp['page'] = (params.offset / params.limit) + 1;
|
||||
return temp;
|
||||
},
|
||||
sidePagination: "server",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
pageList: [10, 20, 50, 100],
|
||||
columns: [{
|
||||
checkbox: true, // 是否显示复选框
|
||||
}, {
|
||||
field: 'id',
|
||||
title: 'ID'
|
||||
}, {
|
||||
field: 'author',
|
||||
title: '姓名'
|
||||
}, {
|
||||
field: 'email',
|
||||
title: '邮箱',
|
||||
}, {
|
||||
field: 'url',
|
||||
title: '网址',
|
||||
}, {
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
formatter: function (value, row, index) {
|
||||
if (value == 0) {
|
||||
is_checked = '';
|
||||
} else if (value == 1) {
|
||||
is_checked = 'checked="checked"';
|
||||
}
|
||||
var field = "display";
|
||||
result = '<label class="lyear-switch switch-primary switch-solid lyear-status"><input type="checkbox" ' + is_checked + '><span onClick="updateStatus(' + row.id + ', ' + value + ', \'' + field + '\')"></span></label>';
|
||||
return result;
|
||||
},
|
||||
}, {
|
||||
field: 'create_time',
|
||||
title: '留言时间',
|
||||
}, {
|
||||
field: 'operate',
|
||||
title: '操作',
|
||||
formatter: function (value, row, index) {
|
||||
let html = '<a href="#!" class="btn btn-xs btn-default m-r-5 btn-detail" title="详情" data-toggle="tooltip" data-trigger="hover"><i class="mdi mdi-eye-outline"></i></a> \n' +
|
||||
'<a class="btn btn-xs btn-default btn-del" href="#!" title="删除" data-toggle="tooltip" onclick="delOne(' + row.id + ')"><i class="mdi mdi-window-close"></i></a>';
|
||||
return html;
|
||||
},
|
||||
events: {
|
||||
'click .btn-detail': function (event, value, row, index) {
|
||||
//职位描述+任职要求
|
||||
let content = ' <div class="p-lr-15">\n' +
|
||||
' <div class="row show-grid">\n' +
|
||||
' <div class="col-xs-12 col-md-4">姓名:</div>\n' +
|
||||
' <div class="col-xs-12 col-md-8">' + row.author + '</div>\n' +
|
||||
' </div>\n' +
|
||||
' <div class="row show-grid">\n' +
|
||||
' <div class="col-xs-12 col-md-4">网址:</div>\n' +
|
||||
' <div class="col-xs-12 col-md-8">' + row.url + '</div>\n' +
|
||||
' </div>\n' +
|
||||
' <div class="row show-grid">\n' +
|
||||
' <div class="col-xs-12 col-md-4">邮箱:</div>\n' +
|
||||
' <div class="col-xs-12 col-md-8">' + row.email + '</div>\n' +
|
||||
' </div>\n' +
|
||||
' <div class="row show-grid">\n' +
|
||||
' <div class="col-xs-12 col-md-4">评论内容:</div>\n' +
|
||||
' <div class="col-xs-12 col-md-8" style="white-space: pre-wrap;">' + row.content + '</div>\n' +
|
||||
' </div>\n' +
|
||||
' </div>';
|
||||
$.alert({
|
||||
title: '详情',
|
||||
content: content,
|
||||
boxWidth: '50%', //定义弹窗宽度
|
||||
useBootstrap: false, //定义宽度必须设置
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: '关闭',
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}],
|
||||
onLoadSuccess: function (data) {
|
||||
$("[data-toggle='tooltip']").tooltip();
|
||||
}
|
||||
});
|
||||
|
||||
//搜索
|
||||
$("#search").click(function () {
|
||||
let start_time = $('#start_time').val();
|
||||
let end_time = $('#end_time').val();
|
||||
if (start_time && end_time && start_time > end_time) {
|
||||
alert('开始时间不能大于结束时间');
|
||||
return false;
|
||||
}
|
||||
$("#tb_departments").bootstrapTable('refresh', {query: {page: 1}, pageNumber: 1});
|
||||
});
|
||||
|
||||
function updateStatus(id, value, field) {
|
||||
var newstate = (value == 1) ? 0 : 1; // 发送参数值跟当前参数值相反
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/admin/article/commentField?id=" + id,
|
||||
data: {field: field, value: newstate},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.status == 200) {
|
||||
parent.lightyear.notify('修改成功', 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
$(".tree-table").bootstrapTable('refresh');
|
||||
} else parent.lightyear.notify('修改失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
},
|
||||
error: function () {
|
||||
parent.lightyear.notify('修改失败', 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delOne(id) {
|
||||
$.confirm({
|
||||
title: '重要提醒!',
|
||||
content: '删除后将不可恢复,请谨慎操作!',
|
||||
backgroundDismiss: true,
|
||||
buttons: {
|
||||
ok: {
|
||||
text: '确认',
|
||||
btnClass: 'btn-danger',
|
||||
action: function () {
|
||||
$.post("/admin/message/del", data = {id: id}, function (res) {
|
||||
if (res.status == 200 || res.code == 200) lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||
location.reload();
|
||||
})
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '取消',
|
||||
btnClass: 'btn-primary'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delSelect() {
|
||||
var checkID = "";
|
||||
var selectedItem = $('#tb_departments').bootstrapTable('getSelections');
|
||||
if (selectedItem == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||
for (var i = 0; i < selectedItem.length; i++) {
|
||||
checkID += selectedItem[i]['id'] + ",";
|
||||
}
|
||||
if (checkID == "") return lightyear.notify("没有选中项", 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||
$.confirm({
|
||||
title: '重要提醒!',
|
||||
content: '选中项删除后将不可恢复,请谨慎操作!',
|
||||
backgroundDismiss: true,
|
||||
buttons: {
|
||||
ok: {
|
||||
text: '确认',
|
||||
btnClass: 'btn-danger',
|
||||
action: function () {
|
||||
$.post("/admin/message/del", data = {id: checkID}, function (res) {
|
||||
if (res.status == 200 || res.code == 200) {
|
||||
lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
||||
location.reload();
|
||||
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-neutral', 'top', 'center');
|
||||
})
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '取消',
|
||||
btnClass: 'btn-primary'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function GetQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) return unescape(r[2]);
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -15,36 +15,36 @@
|
|||
<div class="card-body">
|
||||
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
||||
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
||||
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">文章设置</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回"
|
||||
onclick="history.back(-1);return false;">返 回</a></li>
|
||||
<li class="tab-right"><a data-toggle="tooltip" data-original-title="返回" onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></a></li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="home">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group col-md-12">
|
||||
<label>文章名称</label>
|
||||
<input type="hidden" name="id" value="{$info.id}">
|
||||
<input type="text" class="form-control" id="title" name="title" placeholder="文章名称" value="{$info.title}"/>
|
||||
<label>页面名称</label>
|
||||
<input type="text" class="form-control" id="title" name="title" value="" placeholder="页面名称"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>别名</label>
|
||||
<input type="text" class="form-control" id="alias" name="alias" value="{$info.alias}"
|
||||
placeholder="别名索引"/>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="category_id">栏目分类</label>
|
||||
<div class="form-controls">
|
||||
<select name="category_id" id="category_id" class="form-control">
|
||||
{volist name="category" id="vo"}
|
||||
<option value="{$vo.id}" {if $vo.id == $info.category_id}selected{/if}>{$vo.html}{$vo.title}</option>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<label>展示模板</label>
|
||||
<div class="form-group form-controls">
|
||||
<select name="theme" id="theme" class="form-control">
|
||||
<option value="0">请选择</option>
|
||||
{volist name="themeList" id="vo"}
|
||||
<option value="{$vo}" {if $vo == $info.theme}selected{/if}>{$vo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="author">作者</label>
|
||||
<input type="text" class="form-control" id="author" name="author" placeholder="原作者" value="{$info.author}"/>
|
||||
<div class="col-xs-4">
|
||||
<label>URL名称</label>
|
||||
<input class="form-control" id="alias" name="alias" type="text" value="{$info.alias}" placeholder="URL名称">
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<label for="abstract">排序</label>
|
||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="{$info.sort}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>主图</label>
|
||||
|
|
@ -82,18 +82,28 @@
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="link_str">外链</label>
|
||||
<input type="text" class="form-control" name="link_str" id="link_str" value="{$info.link_str}" placeholder="外链">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="keywords">seo关键字</label>
|
||||
<input type="text" class="form-control" id="keywords" name="keywords" value="{$info.keywords}" placeholder="请输入seo关键字">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="description">seo描述</label>
|
||||
<input type="text" class="form-control" name="description" id="description" value="{$info.description}" placeholder="seo描述">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="abstract">摘要</label>
|
||||
<input type="text" class="form-control" name="abstract" id="abstract"
|
||||
placeholder="请输入摘要" value="{$info.abstract}">
|
||||
<input type="text" class="form-control" name="abstract" id="abstract" value="{$info.abstract}" placeholder="请输入摘要">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="abstract">标签</label>
|
||||
<input class="form-control js-tags-input" type="text" name="tags" data-height="38px"
|
||||
placeholder="请输入标签" value="{$info.tags}">
|
||||
<input class="form-control js-tags-input" type="text" name="tags" data-height="38px" value="{$info.tags}" placeholder="请输入标签">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="content">文章内容</label>
|
||||
<label for="content">页面内容</label>
|
||||
<textarea id="content" name="content" data-provide="summernote" data-toolbar="full">{$info.content}</textarea>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
|
|
@ -102,62 +112,6 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="profile">
|
||||
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
||||
<div class="form-group row col-md-2">
|
||||
<div class="col-xs-6">推荐</div>
|
||||
<div class="col-xs-6">
|
||||
<label class="lyear-switch switch-solid switch-primary">
|
||||
<input type="checkbox" name="is_recommend" {if $info.is_recommend}checked{/if}>
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row col-md-2">
|
||||
<div class="col-xs-6">热门</div>
|
||||
<div class="col-xs-6">
|
||||
<label class="lyear-switch switch-solid switch-primary">
|
||||
<input type="checkbox" name="is_hot" {if $info.is_hot}checked{/if}>
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row col-md-2">
|
||||
<div class="col-xs-6">置顶</div>
|
||||
<div class="col-xs-6">
|
||||
<label class="lyear-switch switch-solid switch-primary">
|
||||
<input type="checkbox" name="is_top" {if $info.is_top}checked{/if}>
|
||||
<span></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="abstract">排序</label>
|
||||
<input type="text" class="form-control" name="sort" placeholder="请输入排序"
|
||||
value="{$info.sort}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="link_str">外链</label>
|
||||
<input type="text" class="form-control" name="link_str" id="link_str" placeholder="外链"
|
||||
value="{$info.link_str}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="keywords">seo关键字</label>
|
||||
<input type="text" class="form-control" id="keywords" name="keywords"
|
||||
placeholder="请输入seo关键字" value="{$info.keywords}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="description">seo描述</label>
|
||||
<input type="text" class="form-control" name="description" id="description"
|
||||
placeholder="seo描述" value="{$info.description}">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ use think\db\exception\ModelNotFoundException;
|
|||
*/
|
||||
class Document extends BaseModel
|
||||
{
|
||||
//文档类型
|
||||
const DOCUMENT_TYPE_ARTICLE = "article";
|
||||
const DOCUMENT_TYPE_PAGE = "page";
|
||||
const DOCUMENT_TYPE_CATEGORY = "product";
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
|
|
@ -28,6 +33,7 @@ class Document extends BaseModel
|
|||
public static function systemPage($where): array
|
||||
{
|
||||
$model = new self;
|
||||
$model = $model->where("type", "=",$where['type']?:self::DOCUMENT_TYPE_ARTICLE);
|
||||
if ($where['title'] != '') $model = $model->where("title", "like", "%$where[title]%");
|
||||
if ($where['start_time'] != '') $model = $model->where("create_time", ">", strtotime($where['start_time'] . " 00:00:00"));
|
||||
if ($where['end_time'] != '') $model = $model->where("create_time", "<", strtotime($where['end_time'] . " 23:59:59"));
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\Document as aModel;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
|
@ -16,23 +17,19 @@ use think\db\exception\ModelNotFoundException;
|
|||
*/
|
||||
class DocumentArticle extends BaseModel
|
||||
{
|
||||
/**
|
||||
* 列表
|
||||
* @param $where
|
||||
* @return array
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:24
|
||||
*/
|
||||
public static function systemPage($where): array
|
||||
public function getInfo($id)
|
||||
{
|
||||
$model = new self;
|
||||
$count = self::counts($model);
|
||||
if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'], (int)$where['limit']);
|
||||
$data = $model->select();
|
||||
if ($data) $data = $data->toArray();
|
||||
return compact('data', 'count');
|
||||
if (empty($id)){
|
||||
return [];
|
||||
}
|
||||
$info = aModel::alias('a')
|
||||
->leftJoin('document_article p','a.id = p.id')
|
||||
->where("a.id",$id)
|
||||
->where("a.type",Document::DOCUMENT_TYPE_PAGE)
|
||||
->find();
|
||||
if (!$info){
|
||||
return [];
|
||||
}
|
||||
return $info->toArray();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\Document as aModel;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* Class DocumentPage
|
||||
* @package app\admin\model\system
|
||||
* @author 李玉坤
|
||||
* @date 2021-02-15 23:22
|
||||
*/
|
||||
class DocumentPage extends BaseModel
|
||||
{
|
||||
public function getInfo($id)
|
||||
{
|
||||
if (empty($id)){
|
||||
return [];
|
||||
}
|
||||
$info = aModel::alias('a')
|
||||
->leftJoin('document_page p','a.id = p.id')
|
||||
->where("a.id",$id)
|
||||
->where("a.type",Document::DOCUMENT_TYPE_PAGE)
|
||||
->find();
|
||||
if (!$info){
|
||||
return [];
|
||||
}
|
||||
return $info->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -118,7 +118,11 @@ class Article extends Base
|
|||
}
|
||||
//获取该文章
|
||||
$documentModel = new Document();
|
||||
$article = $documentModel->where('status', 1)->where('id|alias', $id)->find();
|
||||
if (is_numeric($id)){
|
||||
$article = $documentModel->where('status', 1)->where('id', $id)->find();
|
||||
}else{
|
||||
$article = $documentModel->where('status', 1)->where('alias', $id)->find();
|
||||
}
|
||||
if (!$article) {
|
||||
$this->error('文章不存在或已删除!');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue