From bd00d5733747fbbe2c1ff4fe04bff7f4ce00052d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=BE=E6=A0=91?= Date: Tue, 9 Apr 2019 16:45:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=A7=92=E8=89=B2js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 + application/admin/controller/AuthGroup.php | 86 +++--- application/admin/model/AuthGroup.php | 17 +- application/admin/model/AuthRule.php | 62 ++--- application/admin/view/auth_group/create.html | 246 ++++++++--------- application/admin/view/auth_group/index.html | 240 +++++++++------- application/admin/view/index/create.html | 173 ++++-------- application/admin/view/index/index.html | 260 +++++++++--------- application/common/view/list.html | 4 +- application/system/view/category/edit1.html | 68 ----- application/system/view/category/index.html | 27 -- application/system/view/category/index1.html | 122 -------- application/system/view/school/index.html | 27 -- 13 files changed, 508 insertions(+), 830 deletions(-) delete mode 100644 application/system/view/category/edit1.html delete mode 100644 application/system/view/category/index1.html diff --git a/README.md b/README.md index 7a09dfff..5b852b6b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ http://www.xiaoshongshu.cn 帐号 test1 密码 123456 +## 更新内容 +更新版本号 学生成绩统计系统v2.0 xadmin前端版 +更换前端显示,重新整理后端代码。 +升级提示 +修改 cj_system_base 表 title字段名冲突,修改为 webtitle + ## 更详细信息请查阅官方手册 https://www.kancloud.cn/llblax/abcd/789222 diff --git a/application/admin/controller/AuthGroup.php b/application/admin/controller/AuthGroup.php index 27d9061c..7e70e7f9 100644 --- a/application/admin/controller/AuthGroup.php +++ b/application/admin/controller/AuthGroup.php @@ -14,68 +14,48 @@ class AuthGroup extends Base public function index() { - // 设置数据总数 - $list['count'] = AG::count(); - // 设置页面标题 - $list['title'] = '角色列表'; - + // 设置要给模板赋值的信息 + $list['webtitle'] = '角色列表'; // 模板赋值 - $this->assign('list', $list); + $this->assign('list',$list); // 渲染模板 return $this->fetch(); } - // 获取角色列表 public function ajaxData() { - - // 获取DT的传值 - $getdt = request()->param(); - - //得到排序的方式 - $order = $getdt['order'][0]['dir']; - //得到排序字段的下标 - $order_column = $getdt['order'][0]['column']; - //根据排序字段的下标得到排序字段 - $order_field = $getdt['columns'][$order_column]['data']; - //得到limit参数 - $limit_start = $getdt['start']; - $limit_length = $getdt['length']; - //得到搜索的关键词 - $search = $getdt['search']['value']; + // 获取参数 + $src = $this->request + ->only([ + 'page'=>'1', + 'limit'=>'10', + 'field'=>'id', + 'order'=>'asc', + 'searchval'=>'' + ],'POST'); - // 获取记录集总数 - $cnt = AG::count(); - //查询数据 - $data = AG::field('id,title,miaoshu,status') - ->order([$order_field=>$order]) - ->limit($limit_start,$limit_length) - ->all(); - - - // 如果需要查询 - if($search){ - $data = AG::field('id,title,miaoshu,status') - ->order([$order_field=>$order]) - ->limit($limit_start,$limit_length) - ->where('title|miaoshu','like','%'.$search.'%') - ->all(); - } - - $datacnt = $data->count(); - - - + // 实例化 + $ag = new AG; + // 查询要显示的数据 + $data = $ag->search($src); + // 获取符合条件记录总数 + $cnt = $data->count(); + // 获取当前页数据 + $limit_start = $src['page'] * $src['limit'] - $src['limit']; + $limit_length = $src['limit']-1; + $data = $data->slice($limit_start,$limit_length); + + // 重组返回内容 $data = [ - 'draw'=> $getdt["draw"] , // ajax请求次数,作为标识符 - 'recordsTotal'=>$datacnt, // 获取到的结果数(每页显示数量) - 'recordsFiltered'=>$cnt, // 符合条件的总数据量 + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>$cnt, // 符合条件的总数据量 'data'=>$data, //获取到的数据结果 ]; @@ -83,12 +63,17 @@ class AuthGroup extends Base } - // 创建角色 public function create() { // 设置页面标题 - $list['title'] = '添加角色'; + $list['set'] = array( + 'webtitle'=>'添加角色', + 'butname'=>'添加', + 'formpost'=>'POST', + 'url'=>'/authgroup', + ); + // 模板赋值 $this->assign('list',$list); @@ -96,7 +81,6 @@ class AuthGroup extends Base // 渲染 return $this->fetch(); } - // 保存角色信息 @@ -236,4 +220,6 @@ class AuthGroup extends Base // 返回信息 return json($data); } + + } diff --git a/application/admin/model/AuthGroup.php b/application/admin/model/AuthGroup.php index b19b3c14..473569ec 100644 --- a/application/admin/model/AuthGroup.php +++ b/application/admin/model/AuthGroup.php @@ -7,5 +7,20 @@ use app\common\model\Base; class AuthGroup extends Base { - // 状态获取器 + // 查询所有角色 + public function search($src) + { + // 整理变量 + $searchval = $src['searchval']; + + // 查询数据 + $data = $this + ->order([$src['field'] =>$src['order']]) + ->when(strlen($searchval)>0,function($query) use($searchval){ + $query->where('title','like','%'.$searchval.'%'); + }) + ->select(); + return $data; + } + } diff --git a/application/admin/model/AuthRule.php b/application/admin/model/AuthRule.php index 640a0b89..9cfab476 100644 --- a/application/admin/model/AuthRule.php +++ b/application/admin/model/AuthRule.php @@ -15,56 +15,26 @@ class AuthRule extends Base } - // 子菜单数据模型关联 public function authCid() { return $this->hasMany('AuthRule','pid','id'); } + - - - // // 顶级权限列表 - // public function getRule($pid = 0) - // { - // return $this - // ->where('pid',$pid) - // ->where('status',1) - // ->field('id,title') - // ->order(['paixu']) - // ->select(); - // } - - - // // 是否是菜单获取器 - // public function getIsmenuAttr($value) - // { - // $arr = array('0'=>'否','1'=>'是'); - - // return $arr[$value]; - // } - - - // // 父级菜单名获取器 - // public function getPidAttr($value) - // { - - // return $this->where('id',$value)->value('title'); - // } - - - // // 获取二级菜单 - // public function getMymenuAttr($value) - // { - // return $this - // ->where('pid',$this->getAttr('id')) - // ->where('status&ismenu',1) - // ->field('title,url,name') - // ->order(['paixu']) - // ->select(); - // } - - - - + // 获取全部权限列表 + public function all() + { + return $this + ->where('status',1) + ->where('pid',0) + ->with(['authCid'=>function($query){ + $query->with(['authCid'=>function($q){ + $q->field('id,title,pid,paixu'); + }])->field('id,title,pid,paixu'); + }]) + ->field('id,title,pid,paixu') + ->order(['paixu']) + ->select(); + } } diff --git a/application/admin/view/auth_group/create.html b/application/admin/view/auth_group/create.html index e1c73066..e297d009 100644 --- a/application/admin/view/auth_group/create.html +++ b/application/admin/view/auth_group/create.html @@ -1,136 +1,124 @@ {extend name="common@create" /} -{block name="formaa"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} - $rule = new app\admin\model\AuthRule;; - $plist = $rule->getRule(); - {/php} - {volist name="plist" id="p"} -
-
- -
- {php} - $clist = $rule->getRule($p['id']); - {/php} -
- {volist name = "clist" id = "c" key = "k"} -
-
- -
- {php} - $slist = $rule->getRule($c['id']); - {/php} -
- {volist name="slist" id="s"} - - {/volist} -
-
- {/volist} -
-
- {/volist} - -
-
-
-
- -
-
-
+ +{block name="form"} +
+
+ +
+ +
+
+
+ +
+ +
+
+ {php} + $authrule = new \app\admin\model\AuthRule; + $authrulelist = $authrule->all(); + {/php} +
+ {volist name="authrulelist" id="vo"} +
+ +
+
+ {volist name="vo.auth_cid" id="vc"} +
+ + {volist name="vc.auth_cid" id="vd"} + + {/volist} +
+ {/volist} +
+ {/volist} +
+
+ +
+
{/block} -{block name="yanzheng"} - -{/block} \ No newline at end of file + +{/block} + diff --git a/application/admin/view/auth_group/index.html b/application/admin/view/auth_group/index.html index 2dea584b..5431ffef 100644 --- a/application/admin/view/auth_group/index.html +++ b/application/admin/view/auth_group/index.html @@ -1,120 +1,146 @@ + {extend name="common@list" /} -{block name="topnav"} - +{block name="jsset"} + {/block} -{block name="bouttons"} -
- - - - - 批量删除 - - - - - 添加角色 - - - - 共有数据:{$list.count} 条 - +{block name="nav"} + + 管理员管理 + 角色管理 + 角色列表 + +{/block} +{block name="search"} + {/block} -{block name="tables"} - - - - - - - - - - - - -
角色名称描述状态操作
- - +{block name="table"} +
{/block} {block name="myjs"} - + + + + {/block} \ No newline at end of file diff --git a/application/admin/view/index/create.html b/application/admin/view/index/create.html index 51ad007a..e5e6714e 100644 --- a/application/admin/view/index/create.html +++ b/application/admin/view/index/create.html @@ -1,128 +1,53 @@ {extend name="common@create" /} -{block name="formaa"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- - {php} $school = schlist('校级','区级');{/php} - - -
-
-
- - {php} - $group = db('auth_group')->where('status',true)->field('id,title')->all(); - {/php} -
-
{foreach $group as $key=>$vo } - {/foreach} -
-
-
-
- -
-
- - -
-
- - -
-
- - -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -

0/80

-
-
-
-
- -
-
-
+ +{block name="form"} +
+
+ +
+ +
+
+
+ +
+ {php} $category = getCategory(0);{/php} + +
+
+
+ +
+ +
+
+
+ +
+
{/block} -{block name="yanzheng"} - -{/block} \ No newline at end of file diff --git a/application/admin/view/index/index.html b/application/admin/view/index/index.html index b377ccb6..c61ca4e5 100644 --- a/application/admin/view/index/index.html +++ b/application/admin/view/index/index.html @@ -1,140 +1,146 @@ + {extend name="common@list" /} -{block name="topnav"} - +{block name="jsset"} + {/block} -{block name="bouttons"} -
- - - - - 批量删除 - - - - - 添加管理员 - - - - 共有数据:{$list.count} 条 - +{block name="nav"} + + 管理员管理 + 角色管理 + 角色列表 + +{/block} +{block name="search"} + {/block} -{block name="tables"} - - - - - - - - - - - - - - - - - - - -
单位姓名帐号性别出生日期手机号码角色登录次数创建时间状态操作
- - +{block name="table"} +
{/block} {block name="myjs"} - + + + + {/block} \ No newline at end of file diff --git a/application/common/view/list.html b/application/common/view/list.html index 75d5690e..ff9fe9e6 100644 --- a/application/common/view/list.html +++ b/application/common/view/list.html @@ -29,8 +29,8 @@

筛选

-
-
+
+
{block name="search"}{/block}
diff --git a/application/system/view/category/edit1.html b/application/system/view/category/edit1.html deleted file mode 100644 index 47a8ea8f..00000000 --- a/application/system/view/category/edit1.html +++ /dev/null @@ -1,68 +0,0 @@ -{extend name="common@create" /} -{block name="formaa"} - -
-
- -
- -
-
-
- -
- - {php} $ctp = getCategory();{/php} - - -
-
-
- -
- -
-
-
-
- -
-
-
-{/block} -{block name="yanzheng"} - -{/block} \ No newline at end of file diff --git a/application/system/view/category/index.html b/application/system/view/category/index.html index 377a4635..e517dd5e 100644 --- a/application/system/view/category/index.html +++ b/application/system/view/category/index.html @@ -56,23 +56,6 @@ - - {/block} \ No newline at end of file diff --git a/application/system/view/category/index1.html b/application/system/view/category/index1.html deleted file mode 100644 index f2c1ab80..00000000 --- a/application/system/view/category/index1.html +++ /dev/null @@ -1,122 +0,0 @@ -{extend name="common@list" /} -{block name="topnav"} - -{/block} -{block name="bouttons"} -
- - - - - 批量删除 - - - - - 添加类别 - - - - 共有数据:{$list.count} 条 - -
-{/block} -{block name="tables"} - - - - - - - - - - - - - -
名称父级类别排序状态操作
- - -{/block} -{block name="myjs"} - -{/block} \ No newline at end of file diff --git a/application/system/view/school/index.html b/application/system/view/school/index.html index a13c4f5d..9f1cc3ee 100644 --- a/application/system/view/school/index.html +++ b/application/system/view/school/index.html @@ -55,23 +55,6 @@ - - {/block} \ No newline at end of file