From 296c5d29651205bc33538f488ba1b81ce872413c Mon Sep 17 00:00:00 2001 From: cxdbz Date: Wed, 17 Oct 2018 22:17:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99=E7=94=A8=E6=88=B7=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Index.php | 26 +++++++++++++++++++++--- application/admin/view/index/index.html | 20 ++---------------- application/common/view/list.html | 16 ++++++--------- application/http/middleware/YanZheng.php | 2 +- config/login/app.php | 5 ----- config/member/app.php | 5 ----- 6 files changed, 32 insertions(+), 42 deletions(-) delete mode 100644 config/login/app.php delete mode 100644 config/member/app.php diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 58a2a0f0..eeb7c537 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -16,9 +16,7 @@ class Index extends Base $admin = new Admin(); // 获取管理员信息 - $list = $admin - ->where('id','>',1) - ->all(); + $list['title'] = '管理员列表'; // 模板赋值 $this->assign('list',$list); @@ -28,6 +26,28 @@ class Index extends Base } + + // 获取数据管理员数据 + public function ajaxData() + { + //实例化管理员数据模型类 + $admin = new Admin(); + + $data = $admin + ->field('id,username') + ->all(); + // $data =[ + // "data"=> [ + // [ + // "Tiger Nixon", + // "System Architect", + // ],]]; + // $data = $data->toArray(); + $data = ['data'=>$data]; + + return $data; + } + /** * 显示创建资源表单页. * diff --git a/application/admin/view/index/index.html b/application/admin/view/index/index.html index b3af58c3..63ace1c5 100644 --- a/application/admin/view/index/index.html +++ b/application/admin/view/index/index.html @@ -10,29 +10,13 @@ - ID - 用户名 - 性别 - 手机 - 邮箱 - 地址 - 加入时间 - 状态 - 操作 + - 1 - 张三 - 男 - 13000000000 - admin@mail.com - 北京市 海淀区 - 2014-6-11 11:11:42 - 已启用 - + diff --git a/application/common/view/list.html b/application/common/view/list.html index 3a060cc5..c5ce85a6 100644 --- a/application/common/view/list.html +++ b/application/common/view/list.html @@ -23,7 +23,7 @@ -{$list} +{$list.title} {block name="topnav"}{/block} @@ -31,16 +31,7 @@ {block name="bouttons"}{/block} {block name="tables"}{/block} - - - - - - - - - {js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.min.js"} {js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/layer/2.4/layer.js"} @@ -74,6 +65,11 @@ $(function(){ "sLast": " 最后一页 " }, }, + // 使用ajax到后台服务获取数据 + "ajax": { + "url": "{:url('ajaxdata')}", //请求数据的后台地址 + "type": "POST", // ajax的请求方法 + }, }); }); diff --git a/application/http/middleware/YanZheng.php b/application/http/middleware/YanZheng.php index 8dd11410..160ca260 100644 --- a/application/http/middleware/YanZheng.php +++ b/application/http/middleware/YanZheng.php @@ -27,7 +27,7 @@ class YanZheng extends Controller $username = cookie('username'); $password = cookie('password'); }else{ - $this->error('登录超时啦,请登录登录'); + $this->redirect('/login',302); } // 检验用户名或密码是否正确 diff --git a/config/login/app.php b/config/login/app.php deleted file mode 100644 index 3779064a..00000000 --- a/config/login/app.php +++ /dev/null @@ -1,5 +0,0 @@ -