- 在 User 控制器中加入 Club 模型引用,用于获取俱乐部信息 - 在 Circle 控制器中添加 approve 方法,用于审核圈子帖子 - 更新圈子列表查询逻辑,支持按状态筛选 - 修改圈子添加和编辑页面,增加状态选择字段 - 更新圈子列表页面,显示帖子状态并支持状态筛选
64 lines
3.2 KiB
JavaScript
64 lines
3.2 KiB
JavaScript
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
var Controller = {
|
|
index: function () {
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
extend: {
|
|
index_url: 'zy/circle/circle/index' + location.search,
|
|
add_url: 'zy/circle/circle/add',
|
|
edit_url: 'zy/circle/circle/edit',
|
|
del_url: 'zy/circle/circle/del',
|
|
multi_url: 'zy/circle/circle/multi',
|
|
import_url: 'zy/circle/circle/import',
|
|
table: 'zy_circle',
|
|
}
|
|
});
|
|
|
|
var table = $("#table");
|
|
|
|
// 初始化表格
|
|
table.bootstrapTable({
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
pk: 'id',
|
|
sortName: 'id',
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
columns: [
|
|
[
|
|
{ checkbox: true },
|
|
{ field: 'id', title: __('Id') },
|
|
// {field: 'club.name', title: __('Club.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'content', title: __('Content')},
|
|
{ field: 'club_name', title: __('Club_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{ field: 'nickname', title: __('Nickname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{ field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image },
|
|
{ field: 'gender', title: __('Gender'), formatter: Table.api.formatter.label, searchList: { 1: __('Male'), 0: __('Female') } },
|
|
{ field: 'club_name', title: __('Club_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content },
|
|
{ field: 'status', title: __('Status'), formatter: Table.api.formatter.label, searchList: { '-1': __('Status-1'), 0: __('Status0'), 1: __('Status1') } },
|
|
{ field: 'create_time', title: __('Create_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
|
|
{ field: 'update_time', title: __('Update_time'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false },
|
|
|
|
{ field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
|
|
]
|
|
]
|
|
});
|
|
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
},
|
|
add: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
edit: function () {
|
|
Controller.api.bindevent();
|
|
},
|
|
api: {
|
|
bindevent: function () {
|
|
Form.api.bindevent($("form[role=form]"));
|
|
}
|
|
}
|
|
};
|
|
return Controller;
|
|
});
|