diff --git a/.gitignore b/.gitignore index 0f905aab..06aad686 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /vendor /bak *.log -.env \ No newline at end of file +.env +composer.lock \ No newline at end of file diff --git a/app/controller/admin/Ad.php b/app/controller/admin/Ad.php index 55771ad9..f57ff093 100644 --- a/app/controller/admin/Ad.php +++ b/app/controller/admin/Ad.php @@ -19,9 +19,8 @@ class Ad extends Admin{ */ public function index(AdPlace $adp){ if ($this->request->isAjax()) { - $res = $adp->paginate(25, false, array( - 'query' => $this->request->param() - )); + $param = $this->request->param(); + $res = $adp->paginate($this->request->pageConfig); $data = $res->append(['show_type_text', 'status_text'])->toArray(); $this->data['data'] = $data; @@ -104,9 +103,7 @@ class Ad extends Admin{ */ public function lists(AdModel $ad){ if ($this->request->isAjax()) { - $res = $ad->paginate(25, false, array( - 'query' => $this->request->param() - )); + $res = $ad->paginate($this->request->pageConfig); $data = $res->append(['cover','status_text'])->toArray(); $this->data['data'] = $data; return $this->data; diff --git a/app/controller/admin/Channel.php b/app/controller/admin/Channel.php index b3a84469..7f0ee3ce 100644 --- a/app/controller/admin/Channel.php +++ b/app/controller/admin/Channel.php @@ -18,7 +18,12 @@ class Channel extends Admin{ public function index(ChannelModel $channel){ if($this->request->isAjax()){ $tree = $this->request->param('tree', 0); + $type = $this->request->param('type', 0); $map = array(); + + if($type){ + $map['type'] = $type; + } $res = $channel->where($map)->order('sort asc, id asc')->select(); diff --git a/app/controller/admin/Client.php b/app/controller/admin/Client.php index a2b74d2f..eb2e4758 100644 --- a/app/controller/admin/Client.php +++ b/app/controller/admin/Client.php @@ -20,9 +20,8 @@ class Client extends Admin{ */ public function index(ClientModel $client){ if ($this->request->isAjax()) { - $res = $client->paginate(25, false, array( - 'query' => $this->request->param() - )); + $param = $this->request->param(); + $res = $client->paginate($this->request->pageConfig); $data = $res->toArray(); $this->data['data'] = $data; return $this->data; diff --git a/app/controller/admin/Config.php b/app/controller/admin/Config.php index f2e9057e..68b343db 100644 --- a/app/controller/admin/Config.php +++ b/app/controller/admin/Config.php @@ -18,33 +18,34 @@ class Config extends Admin { * @title 系统首页 */ public function index(ConfigModel $config) { - $group = input('group', 0, 'trim'); - $name = input('name', '', 'trim'); - $system_config = Cache::get('system_config'); + if($this->request->isAjax()){ + $param = $this->request->param(); + $group = input('group', 0, 'trim'); + $name = input('name', '', 'trim'); + $system_config = Cache::get('system_config'); - /* 查询条件初始化 */ - $map = array('status' => 1); - if ($group) { - $map['group'] = $group; + /* 查询条件初始化 */ + $map = array('status' => 1); + if ($group) { + $map['group'] = $group; + } + + if ($name) { + $map['name'] = array('like', '%' . $name . '%'); + } + + $res = $config->where($map)->order('id desc')->paginate($this->request->pageConfig); + + $data = $res->append(['type_text','group_text'])->toArray(); + $this->data['data'] = $data; + return $this->data; + }else{ + $data = array( + 'group_id' => $this->request->get('group', 0), + ); + $this->data['data'] = $data; + return $this->data; } - - if ($name) { - $map['name'] = array('like', '%' . $name . '%'); - } - - $list = $config->where($map)->order('id desc')->paginate(25, false, array( - 'query' => $this->request->param(), - )); - // 记录当前列表页的cookie - Cookie('__forward__', $_SERVER['REQUEST_URI']); - - $data = array( - 'page' => $list->render(), - 'group_id' => $group, - 'list' => $list, - ); - $this->data['data'] = $data; - return $this->data; } /** diff --git a/app/controller/admin/Form.php b/app/controller/admin/Form.php index 04de9268..29981657 100644 --- a/app/controller/admin/Form.php +++ b/app/controller/admin/Form.php @@ -19,9 +19,7 @@ class Form extends Admin{ */ public function index(FormModel $form){ if ($this->request->isAjax()) { - $res = $form->paginate(25, false, array( - 'query' => $this->request->param() - )); + $res = $form->paginate($this->request->pageConfig); $data = $res->toArray(); $this->data['data'] = $data; return $this->data; diff --git a/app/controller/admin/Link.php b/app/controller/admin/Link.php index fc0334cd..4a9cea56 100644 --- a/app/controller/admin/Link.php +++ b/app/controller/admin/Link.php @@ -19,9 +19,7 @@ class Link extends Admin{ */ public function index(LinkModel $link){ if ($this->request->isAjax()) { - $res = $link->paginate(25, false, array( - 'query' => $this->request->param() - )); + $res = $link->paginate($this->request->pageConfig); $data = $res->toArray(); $this->data['data'] = $data; return $this->data; diff --git a/app/controller/admin/Seo.php b/app/controller/admin/Seo.php index c35e2947..74e2f02e 100644 --- a/app/controller/admin/Seo.php +++ b/app/controller/admin/Seo.php @@ -18,19 +18,16 @@ class Seo extends Admin{ * @title 系统首页 */ public function index(SeoRule $seo){ - //读取规则列表 - $map = array('status' => array('=', 0)); + if($this->request->isAjax()){ + //读取规则列表 + $map = array('status' => array('=', 0)); - $list = $seo->where($map)->order('sort asc')->paginate(10, false, array( - 'query' => $this->request->param() - )); + $res = $seo->where($map)->order('sort asc')->paginate($this->request->pageConfig); - $this->data['data'] = array( - 'list' => $list, - 'page' => $list->render() - ); - - return $this->data; + $this->data['data'] = $res->toArray(); + + return $this->data; + } } /** diff --git a/app/http/middleware/Admin.php b/app/http/middleware/Admin.php index 3e8025de..daf58705 100644 --- a/app/http/middleware/Admin.php +++ b/app/http/middleware/Admin.php @@ -18,6 +18,10 @@ class Admin { protected $data = []; public function handle($request, \Closure $next) { + $request->pageConfig = array( + 'list_rows' => $request->param('limit', 20), + 'page' => $request->param('page', 1) + ); $response = $next($request); if (is_array($response->getData())) { diff --git a/app/model/Config.php b/app/model/Config.php index 7e546c96..a936205e 100644 --- a/app/model/Config.php +++ b/app/model/Config.php @@ -35,6 +35,12 @@ class Config extends Model { return $type_text[0]; } + protected function getGroupTextAttr($value, $data) { + $config = Cache::get('system_config'); + $group = $config['config_group_list']; + return isset($group[$data['group']]) ? $group[$data['group']] : '未分组'; + } + public function lists() { $map = array('status' => 1); $res = $this->where($map)->field('type,name,value')->select(); diff --git a/public/static/admin/css/style.css b/public/static/admin/css/style.css index ab56532b..da5a5ced 100644 --- a/public/static/admin/css/style.css +++ b/public/static/admin/css/style.css @@ -979,6 +979,8 @@ label { } } +.btn-outline{border: 1px solid #dedede; color: #333333;} + .data-skin-box{position: fixed; z-index: 1000000; top: 50px; right: -280px;} .data-skin-box .content{width: 280px; height: 240px; padding: 10px; background: #181f23; color: #ffffff;} .data-skin-box .tool-bar{height: 50px; width: 50px; line-height: 50px; text-align: center; font-size: 24px; display: inline-block; background: #181f23; color: #ffffff; position: absolute; right: 0; cursor: pointer;} diff --git a/public/static/common/js/core.js b/public/static/common/js/core.js index 8560d5eb..cba3de49 100644 --- a/public/static/common/js/core.js +++ b/public/static/common/js/core.js @@ -16,8 +16,8 @@ sortName: "", sortOrder: "asc", pagination: true, - pageSize: 10, - pageList: [10, 25, 50], + pageSize: 20, + pageList: [20, 30, 50, 100], toolbar: "toolbar", striped: false, escape: false, @@ -98,11 +98,11 @@ queryParams: function(params) { var curParams = { // 传递参数查询参数 - pageSize: params.limit, - pageNum: params.offset / params.limit + 1, + limit: params.limit, + page: params.offset / params.limit + 1, searchValue: params.search, - orderByColumn: params.sort, - isAsc: params.order + sort: params.sort, + sortorder: params.order }; var currentId = $.common.isEmpty($.table._option.formId) ? $('form').attr('id') : $.table._option.formId; return $.extend(curParams, $.common.formToJSON(currentId)); diff --git a/view/admin/channel/index.html b/view/admin/channel/index.html index 12901261..cedf561f 100644 --- a/view/admin/channel/index.html +++ b/view/admin/channel/index.html @@ -38,6 +38,7 @@ {block name="script"} + + + + - if (url != undefined && url != '') { - window.location.href = url + '/ids/' + param; - } - }); - }); - + {/block} \ No newline at end of file