作者 开飞机的舒克

后台优化

... ... @@ -51,14 +51,12 @@ class Banner extends Backend
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->visible(['id','title','images','is_url','url','details','createtime']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
... ...
... ... @@ -8,10 +8,6 @@ use think\Model;
class Banner extends Model
{
// 表名
protected $name = 'banner';
... ... @@ -29,7 +25,6 @@ class Banner extends Model
];
public function getIsUrlList()
{
return ['0' => __('Is_url 0'), '1' => __('Is_url 1')];
... ... @@ -43,7 +38,4 @@ class Banner extends Model
return isset($list[$value]) ? $list[$value] : '';
}
}
... ...
... ... @@ -32,18 +32,25 @@
</div>
</div>
{switch name="isUrl"}
{case value="1"}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Url')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-url" class="form-control" name="row[url]" type="text">
</div>
</div>
{/case}
{case value="0"}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Details')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-details" class="form-control editor" rows="5" name="row[details]" cols="50"></textarea>
</div>
</div>
{/case}
{/switch}
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -34,8 +34,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'id', title: __('Id')},
{field: 'title', title: __('Title'), operate: 'LIKE'},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'is_url', title: __('Is_url'), searchList: {"0":__('Is_url 0'),"1":__('Is_url 1')}},
{field: 'is_url_text', title: __('Is_url'), searchList: {"0":__('Is_url 0'),"1":__('Is_url 1')}},
{field: 'url', title: __('Url'), operate: 'LIKE', formatter: Table.api.formatter.url},
// {field: 'details',title: '详情'},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
... ...