发布测试版2.3.3

This commit is contained in:
2021-06-08 18:23:48 +08:00
parent 45ec21fdc1
commit f92fc8dce1
27 changed files with 96 additions and 2399 deletions
@@ -16,7 +16,7 @@ class WidgetController extends DefaultController
*/
public function index()
{
if (Request::isJson()) {
if (Request::method() == 'POST') {
$model = DB::table('article')
->permission('receive_id')
->orderBy('created_at', 'desc');
+31 -29
View File
@@ -1,32 +1,34 @@
<table id="widget-article-index">
<thead>
<tr>
<th data-field="title" data-formatter="titleFormatter" data-align="left">标题</th>
<th data-field="created_at" data-width="200" data-formatter="datetimeFormatter" data-sortable="true" data-align="center">发布时间</th>
</tr>
</thead>
</table>
<div class="wrapper-sm p-t-none">
<div class="gdoo-list-grid">
<div id="widget-article-index" class="ag-theme-balham" style="width:100%;height:200px;"></div>
</div>
</div>
<script>
function datetimeFormatter(value, row) {
return format_datetime(value);
}
function titleFormatter(value, row) {
return '<a href="'+app.url('article/article/view', {id: row.id})+'">' + value + '</a>';
}
(function($) {
var $table = $('#widget-article-index');
$table.bootstrapTable({
sidePagination: 'server',
showColumns: false,
showHeader: false,
height: 200,
pagination: false,
url: '{{url("article/widget/index")}}',
});
(function ($) {
var gridDiv = document.querySelector("#widget-article-index");
var options = new agGridOptions();
options.remoteDataUrl = '{{url()}}';
options.remoteParams = {};
options.defaultColDef.suppressMenu = true;
var columnDefs = [
{type:'sn', cellClass:'text-center', headerName: '序号', width: 60},
{field: "name", cellClass:'text-center', headerName: '标题', width: 240},
{field: "created_at", cellClass:'text-center', type:'datetime', headerName: '发布时间', width: 140},
];
options.columnDefs = columnDefs;
options.onRowDoubleClicked = function (params) {
if (params.node.rowPinned) {
return;
}
if (params.data == undefined) {
return;
}
if (params.data.id > 0) {
top.addTab('article/article/show?id=' + params.data.id, 'article_article_show', '新闻公告');
}
};
new agGrid.Grid(gridDiv, options);
options.remoteData({page: 1});
gdoo.widgets['article_widget_index'] = options;
})(jQuery);
</script>