From c10e75def82f0c95e76ff5e450f8eaacef0a7b37 Mon Sep 17 00:00:00 2001 From: win7 Date: Fri, 6 Dec 2019 16:44:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=8A=A1=E7=AE=A1=E7=90=86=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/AuthGroup.php | 15 ++--- app/admin/controller/AuthRule.php | 24 +++----- app/admin/controller/Index.php | 31 +++++----- app/admin/model/Admin.php | 10 ++-- app/admin/route/admin.php | 52 ++++++++++++++--- .../{auth_group => authgroup}/create.html | 2 +- .../view/{auth_group => authgroup}/index.html | 13 ++--- .../view/{auth_rule => authrule}/create.html | 2 +- .../view/{auth_rule => authrule}/index.html | 10 ++-- app/admin/view/index/create.html | 2 +- app/admin/view/index/edit_password.html | 2 +- app/admin/view/index/index.html | 32 +++++------ app/common.php | 6 +- app/index/view/index/index.html | 4 +- app/kaoshi/controller/Index.php | 1 + app/renshi/controller/Index.php | 1 + app/renshi/controller/Student.php | 1 + app/system/route/system.php | 23 ++------ app/teach/controller/Banji.php | 24 ++++---- app/teach/controller/Subject.php | 19 ++++--- app/teach/controller/Xueqi.php | 32 +++++++---- app/teach/model/Banji.php | 1 + app/teach/route/teach.php | 41 +++++++++++++ app/teach/view/banji/create.html | 2 +- app/teach/view/banji/index.html | 57 +++++++++++++++---- app/teach/view/subject/create.html | 2 +- app/teach/view/subject/index.html | 10 ++-- app/teach/view/xueqi/create.html | 2 +- app/teach/view/xueqi/index.html | 14 ++--- database/seeds/Rule.php | 12 ++-- 30 files changed, 277 insertions(+), 170 deletions(-) rename app/admin/view/{auth_group => authgroup}/create.html (99%) rename app/admin/view/{auth_group => authgroup}/index.html (87%) rename app/admin/view/{auth_rule => authrule}/create.html (99%) rename app/admin/view/{auth_rule => authrule}/index.html (91%) diff --git a/app/admin/controller/AuthGroup.php b/app/admin/controller/AuthGroup.php index 41618546..fde381b9 100644 --- a/app/admin/controller/AuthGroup.php +++ b/app/admin/controller/AuthGroup.php @@ -15,12 +15,13 @@ class AuthGroup extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '角色列表'; + $list['dataurl'] = 'authgroup/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -75,10 +76,10 @@ class AuthGroup extends BaseController // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch(); + return $this->view->fetch(); } @@ -142,13 +143,13 @@ class AuthGroup extends BaseController 'webtitle'=>'编辑角色', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/authgroup/'.$id, + 'url'=>'/admin/authgroup/update/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } diff --git a/app/admin/controller/AuthRule.php b/app/admin/controller/AuthRule.php index 35bfc38b..1684193f 100644 --- a/app/admin/controller/AuthRule.php +++ b/app/admin/controller/AuthRule.php @@ -14,12 +14,13 @@ class AuthRule extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '权限列表'; + $list['dataurl'] = 'authrule/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -69,14 +70,14 @@ class AuthRule extends BaseController 'webtitle'=>'添加权限', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/authrule', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -112,13 +113,6 @@ class AuthRule extends BaseController return json($data); } - // - public function read($id) - { - // - } - - // 修改权限信息 @@ -134,14 +128,14 @@ class AuthRule extends BaseController 'webtitle'=>'编辑权限', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/authrule/'.$id, + 'url'=>'/admin/authrule/update/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 2ec58ecc..8ac9c9a3 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -16,12 +16,13 @@ class Index extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '管理员列表'; + $list['dataurl'] = 'index/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -71,14 +72,14 @@ class Index extends BaseController 'webtitle'=>'添加管理员', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/admin', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -146,10 +147,10 @@ class Index extends BaseController $list->groupnames = $ad->getGroupnames($id); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -173,11 +174,11 @@ class Index extends BaseController $list['webtitle'] = '我的信息'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch('read'); + return $this->view->fetch('read'); } @@ -205,14 +206,14 @@ class Index extends BaseController 'webtitle'=>'编辑管理员', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/admin/'.$id, + 'url'=>'/admin/index/update/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -325,14 +326,14 @@ class Index extends BaseController 'webtitle'=>'修改密码', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/editpassword/'.session('userid'), + 'url'=>'/admin/index/updatepassword/'.session('userid'), ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php index 2d89a907..ca4f18c0 100644 --- a/app/admin/model/Admin.php +++ b/app/admin/model/Admin.php @@ -84,11 +84,11 @@ class Admin extends Base } - // 最后登录时间取器 - public function getLasttimeAttr($value) - { - return date('Y年m月d日 H:i:s',$value); - } + // // 最后登录时间取器 + // public function getLasttimeAttr($value) + // { + // return date('Y年m月d日 H:i:s',$value); + // } // 本次登录时间取器 public function getThistimeAttr($value) diff --git a/app/admin/route/admin.php b/app/admin/route/admin.php index 4160ae73..3519486b 100644 --- a/app/admin/route/admin.php +++ b/app/admin/route/admin.php @@ -10,13 +10,47 @@ // +---------------------------------------------------------------------- use think\facade\Route; +// 管理员管理 +Route::group('index', function () { + Route::rule('','index/index','get'); # 信息列表 + Route::rule('data','index/ajaxdata','post'); # 获取数据 + Route::rule('create','index/create','get'); # 添加信息 + Route::rule('save','index/save','post'); # 保存信息 + Route::rule('read/','index/read','get'); # 读取信息 + Route::rule('edit/','index/edit','get'); # 修改信息 + Route::rule('update/','index/update','put'); # 更新信息 + Route::rule('delete/','index/delete','delete'); # 删除信息 + Route::rule('status','index/setStatus','post'); # 删除信息 -//系统设置路由 -Route::resource('admin','admin/Index'); -Route::resource('authgroup','admin/AuthGroup'); -Route::resource('authrule','admin/AuthRule'); -Route::resource('authgroup','admin/AuthGroup'); -Route::post('resetpassword/:id','admin/Index/resetpassword'); -Route::get('editpassword/edit','admin/Index/editPassword'); -Route::put('editpassword/:id','admin/Index/updatePassword'); -Route::get('myinfo','admin/Index/myinfo'); \ No newline at end of file + Route::rule('resetpassword/','admin/Index/resetpassword','post'); # 重置密码 + Route::rule('editpassword','admin/Index/editPassword','get'); # 修改密码 + Route::rule('updatepassword/','admin/Index/updatePassword','put'); # 更新密码 + Route::rule('myinfo','admin/Index/myinfo','get'); # 用户信息 + + }); + +// 权限管理 +Route::group('authrule', function () { + Route::rule('','authrule/index','get'); # 信息列表 + Route::rule('data','authrule/ajaxdata','post'); # 获取数据 + Route::rule('create','authrule/create','get'); # 添加信息 + Route::rule('save','authrule/save','post'); # 保存信息 + // Route::rule('read/','authrule/read','get'); # 读取信息 + Route::rule('edit/','authrule/edit','get'); # 修改信息 + Route::rule('update/','authrule/update','put'); # 更新信息 + Route::rule('delete/','authrule/delete','delete'); # 删除信息 + Route::rule('status','authrule/setStatus','post'); # 删除信息 + }); + +// 角色管理 +Route::group('authgroup', function () { + Route::rule('','authgroup/index','get'); # 信息列表 + Route::rule('data','authgroup/ajaxdata','post'); # 获取数据 + Route::rule('create','authgroup/create','get'); # 添加信息 + Route::rule('save','authgroup/save','post'); # 保存信息 + // Route::rule('read/','authgroup/read','get'); # 读取信息 + Route::rule('edit/','authgroup/edit','get'); # 修改信息 + Route::rule('update/','authgroup/update','put'); # 更新信息 + Route::rule('delete/','authgroup/delete','delete'); # 删除信息 + Route::rule('status','authgroup/setStatus','post'); # 删除信息 + }); \ No newline at end of file diff --git a/app/admin/view/auth_group/create.html b/app/admin/view/authgroup/create.html similarity index 99% rename from app/admin/view/auth_group/create.html rename to app/admin/view/authgroup/create.html index 78097456..fdf9df26 100644 --- a/app/admin/view/auth_group/create.html +++ b/app/admin/view/authgroup/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"}
diff --git a/app/admin/view/auth_group/index.html b/app/admin/view/authgroup/index.html similarity index 87% rename from app/admin/view/auth_group/index.html rename to app/admin/view/authgroup/index.html index 763a00b6..da3ec1cb 100644 --- a/app/admin/view/auth_group/index.html +++ b/app/admin/view/authgroup/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -61,10 +61,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/authgroup','mytable'); + cjgl.delAll(checkStatus,'authgroup/delete','mytable'); break; case 'add': - cjgl.add('添加角色','/authgroup/create','','',true); + cjgl.add('添加角色','authgroup/create','','',true); break; }; }); @@ -75,14 +75,11 @@ var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ - case 'detail':// 查看 - layer.msg('查看' + data.id); - break; case 'del':// 删除 - cjgl.del(obj,"/authgroup"); + cjgl.del(obj,"authgroup/delete/"); break; case 'edit':// 编辑 - cjgl.add('编辑角色','/authgroup/'+obj.data.id+'/edit','','',true); + cjgl.add('编辑角色','authgroup/edit/'+obj.data.id,'','',true); break; }; }); diff --git a/app/admin/view/auth_rule/create.html b/app/admin/view/authrule/create.html similarity index 99% rename from app/admin/view/auth_rule/create.html rename to app/admin/view/authrule/create.html index f4223d3a..ec89a636 100644 --- a/app/admin/view/auth_rule/create.html +++ b/app/admin/view/authrule/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/admin/view/auth_rule/index.html b/app/admin/view/authrule/index.html similarity index 91% rename from app/admin/view/auth_rule/index.html rename to app/admin/view/authrule/index.html index de704a8c..bc88c48d 100644 --- a/app/admin/view/auth_rule/index.html +++ b/app/admin/view/authrule/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -71,10 +71,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/authrule','mytable'); + cjgl.delAll(checkStatus,'authrule/delete','mytable'); break; case 'add': - cjgl.add('添加权限','/authrule/create','','',true); + cjgl.add('添加权限','authrule/create','','',true); break; }; }); @@ -89,10 +89,10 @@ layer.msg('查看' + data.id); break; case 'del':// 删除 - cjgl.del(obj,"/authrule"); + cjgl.del(obj,"authrule/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑权限','/authrule/'+obj.data.id+'/edit','','',true); + cjgl.add('编辑权限','authrule/edit/'+obj.data.id,'','',true); break; }; }); diff --git a/app/admin/view/index/create.html b/app/admin/view/index/create.html index 25beaac3..a46c46a0 100644 --- a/app/admin/view/index/create.html +++ b/app/admin/view/index/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/admin/view/index/edit_password.html b/app/admin/view/index/edit_password.html index 4a348e8c..bad43d89 100644 --- a/app/admin/view/index/edit_password.html +++ b/app/admin/view/index/edit_password.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index f5dac00f..f29dc69c 100644 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -52,27 +52,27 @@ {field: "shengri",title: '生日', minWidth:100,sort: true}, {field: 'username', title: '帐号',sort: true} , {field: 'school', title: '所在单位', minWidth:100,sort: true ,templet:function(d){ - if(d.ad_school){ - return d.ad_school.jiancheng; + if(d.adSchool){ + return d.adSchool.jiancheng; } }}, - {title: '用户组', minWidth:140,templet:function(d){ + {title: '用户组', minWidth:130,templet:function(d){ var str = ''; - if(d.gl_group.length>0){ - for (var k = 0, length = d.gl_group.length; k < length; k++) { + if(d.glGroup.length>0){ + for (var k = 0, length = d.glGroup.length; k < length; k++) { if(k == 0){ - str = d.gl_group[k].title; + str = d.glGroup[k].title; }else{ - str =str+'、'+d.gl_group[k].title; + str =str+'、'+d.glGroup[k].title; } } } return str; }}, - {field: 'phone', title: '联系电话', minWidth:130, sort: true}, + {field: 'phone', title: '联系电话', minWidth:120, sort: true}, {field: 'denglucishu', title: '登录次数', minWidth:100, sort: true}, {field: 'thistime', title: '最后登录时间', minWidth:180, sort: true}, - {field: 'ip', title: '最后登录地址', minWidth:150, sort: true}, + {field: 'ip', title: '最后登录地址', minWidth:130, sort: true}, {field: 'status', title: '状态',templet:'#status', sort: true}, {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} ]]; @@ -86,10 +86,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/admin','mytable'); + cjgl.delAll(checkStatus,'index/delete','mytable'); break; case 'add': - cjgl.add('添加管理员','/admin/create','','',true); + cjgl.add('添加管理员','index/create','','',true); break; }; }); @@ -101,16 +101,16 @@ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ case 'detail':// 查看 - cjgl.add(obj.data.xingming+'信息','/admin/'+obj.data.id,'','',true); + cjgl.add(obj.data.xingming+'信息','index/read/'+obj.data.id,'','',true); break; case 'del':// 删除 - cjgl.del(obj,"/admin"); + cjgl.del(obj,"index/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑管理员','/admin/'+obj.data.id+'/edit','','',true); + cjgl.add('编辑管理员','index/edit/'+obj.data.id,'','',true); break; case 'reset':// 编辑 - cjgl.resetpassword(obj.data.xingming,"/resetpassword/"+obj.data.id); + cjgl.resetpassword(obj.data.xingming,"index/resetpassword/"+obj.data.id); break; }; }); diff --git a/app/common.php b/app/common.php index b54b3d64..822a897f 100644 --- a/app/common.php +++ b/app/common.php @@ -46,11 +46,10 @@ function nianjiList($riqi=0) { // 定义学年时间节点日期为每年的8月10日 // $yd = '8-10'; - $time = new think\helper\Time(); if($riqi == 0) { $jiedian = strtotime(date('Y').'-8-1'); - $thisday = $time->today(); + $thisday = time(); }else{ $jiedian = strtotime(date('Y',$riqi).'-8-1'); $thisday = $riqi; @@ -158,6 +157,7 @@ function excelLieming() // 单位列表 function schlist($low='班级',$high='其它级',$xueduan=array()) { + // 实例化单位模型 $sch = new \app\system\model\School; // 实例化类别数据模型 @@ -165,7 +165,7 @@ function schlist($low='班级',$high='其它级',$xueduan=array()) // 获取获取级别列表 $catlist = $cat->where('pid',102) ->where('status',1) - ->column('title,id'); + ->column('id','title'); // 获取学段列表 if(count($xueduan)>0){ diff --git a/app/index/view/index/index.html b/app/index/view/index/index.html index eeaa1487..f71c43aa 100644 --- a/app/index/view/index/index.html +++ b/app/index/view/index/index.html @@ -59,10 +59,10 @@
- + 个人信息
- + 修改密码
切换帐号
diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index f3c0d8b5..c426ab0a 100644 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -17,6 +17,7 @@ class Index extends BaseController // 设置要给模板赋值的信息 $list['webtitle'] = '考试列表'; + $list['dataurl'] = 'category/data'; // 模板赋值 $this->assign('list',$list); diff --git a/app/renshi/controller/Index.php b/app/renshi/controller/Index.php index f93392a1..8e55d076 100644 --- a/app/renshi/controller/Index.php +++ b/app/renshi/controller/Index.php @@ -16,6 +16,7 @@ class Index extends BaseController // 设置要给模板赋值的信息 $list['webtitle'] = '教师列表'; + $list['dataurl'] = 'category/data'; // 模板赋值 $this->assign('list',$list); diff --git a/app/renshi/controller/Student.php b/app/renshi/controller/Student.php index 9b641f37..df51f7d5 100644 --- a/app/renshi/controller/Student.php +++ b/app/renshi/controller/Student.php @@ -17,6 +17,7 @@ class Student extends BaseController // 设置要给模板赋值的信息 $list['webtitle'] = '学生列表'; + $list['dataurl'] = 'category/data'; // 模板赋值 $this->assign('list',$list); diff --git a/app/system/route/system.php b/app/system/route/system.php index a41c3acf..c407468d 100644 --- a/app/system/route/system.php +++ b/app/system/route/system.php @@ -10,26 +10,13 @@ // +---------------------------------------------------------------------- use think\facade\Route; - -//系统设置路由 -// Route::get('/','systembase/edit'); -// Route::group('sys', function () { -// Route::get('/', 'systembase/edit'); -// // Route::rule(':name', 'blog/read'); -// })->ext('html')->pattern(['id' => '\d+', 'name' => '\w+']); -// Route::resource('sysbase','system/SystemBase'); -// Route::resource('category','system/Category'); -// Route::resource('school','system/School'); -// Route::resource('fields','system/Fields'); - // 系统设置systembase - Route::group('/', function () { Route::rule('','systembase/edit','get'); # 系统配置页面 Route::rule('update/','systembase/update','put'); # 配置更新 }); -// 文件管理fields +// 文件管理 Route::group('file', function () { Route::rule('','fields/index','get'); # 文件列表 Route::rule('data','fields/ajaxdata','post'); # 获取数据 @@ -38,13 +25,13 @@ Route::group('file', function () { }); -// 单位管理fields +// 单位管理 Route::group('school', function () { Route::rule('','school/index','get'); # 信息列表 Route::rule('data','school/ajaxdata','post'); # 获取数据 Route::rule('create','school/create','get'); # 添加信息 Route::rule('save','school/save','post'); # 保存信息 - // Route::rule('read','school/read','get'); # 读取信息 + // Route::rule('read/','school/read','get'); # 读取信息 Route::rule('edit/','school/edit','get'); # 修改信息 Route::rule('update/','school/update','put'); # 更新信息 Route::rule('delete/','school/delete','delete'); # 删除信息 @@ -52,13 +39,13 @@ Route::group('school', function () { }); -// 类别管理category +// 类别管理 Route::group('category', function () { Route::rule('','category/index','get'); # 信息列表 Route::rule('data','category/ajaxdata','post'); # 获取数据 Route::rule('create','category/create','get'); # 添加信息 Route::rule('save','category/save','post'); # 保存信息 - // Route::rule('read','category/read','get'); # 读取信息 + // Route::rule('read/','category/read','get'); # 读取信息 Route::rule('edit/','category/edit','get'); # 修改信息 Route::rule('update/','category/update','put'); # 更新信息 Route::rule('delete/','category/delete','delete'); # 删除信息 diff --git a/app/teach/controller/Banji.php b/app/teach/controller/Banji.php index a66357a9..a561cd80 100644 --- a/app/teach/controller/Banji.php +++ b/app/teach/controller/Banji.php @@ -14,12 +14,13 @@ class Banji extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '班级列表'; + $list['dataurl'] = 'banji/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -32,7 +33,7 @@ class Banji extends BaseController ->only([ 'page'=>'1', 'limit'=>'10', - 'field'=>'update_time', + 'field'=>'school', 'type'=>'asc', 'school'=>'', 'ruxuenian'=>'', @@ -73,13 +74,13 @@ class Banji extends BaseController 'webtitle'=>'添加班级', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/banji', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -152,12 +153,12 @@ class Banji extends BaseController // 获取班级信息 $list = BJ::field('id,school,ruxuenian,paixu') - ->get($id); + ->find($id); - $this->assign('list',$list); + $this->view->assign('list',$list); - return $this->fetch(); + return $this->view->fetch(); } @@ -207,6 +208,8 @@ class Banji extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = BJ::destroy($id); // 根据更新结果设置返回提示信息 @@ -243,7 +246,8 @@ class Banji extends BaseController $caozuo = input('post.cz'); // 获取当前班级信息 - $thisbj = BJ::get($id); + $thisbj = BJ::find($id); + // 获取别一个班级信息 if( $caozuo > 0 ) diff --git a/app/teach/controller/Subject.php b/app/teach/controller/Subject.php index 50a885f4..062b6cd6 100644 --- a/app/teach/controller/Subject.php +++ b/app/teach/controller/Subject.php @@ -14,12 +14,13 @@ class Subject extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '学科列表'; + $list['dataurl'] = 'subject/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -71,13 +72,13 @@ class Subject extends BaseController 'webtitle'=>'添加学科', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/subject', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -135,13 +136,13 @@ class Subject extends BaseController 'webtitle'=>'编辑学科', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/subject/'.$id, + 'url'=>'/teach/subject/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -189,6 +190,8 @@ class Subject extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = SJ::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/teach/controller/Xueqi.php b/app/teach/controller/Xueqi.php index c0265f87..8c09ff70 100644 --- a/app/teach/controller/Xueqi.php +++ b/app/teach/controller/Xueqi.php @@ -14,12 +14,13 @@ class Xueqi extends BaseController { // 设置要给模板赋值的信息 $list['webtitle'] = '学期列表'; + $list['dataurl'] = 'xueqi/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -71,13 +72,13 @@ class Xueqi extends BaseController 'webtitle'=>'添加学期', 'butname'=>'添加', 'formpost'=>'POST', - 'url'=>'/xueqi', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -128,20 +129,20 @@ class Xueqi extends BaseController // 获取学期信息 $list['data'] = XQ::field('id,title,xuenian,category,bfdate,enddate') - ->get($id); + ->find($id); // 设置页面标题 $list['set'] = array( 'webtitle'=>'编辑学期', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/xueqi/'.$id, + 'url'=>'/teach/xueqi/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -167,9 +168,14 @@ class Xueqi extends BaseController // 更新数据 - $xq = new XQ(); - $data = $xq->save($list,['id'=>$id]); - // $data = XQ::where('id',$id)->update($list); + $xueqilist = XQ::find($id); + $xueqilist->title = $list['title']; + $xueqilist->xuenian = $list['xuenian']; + $xueqilist->category = $list['category']; + $xueqilist->bfdate = $list['bfdate']; + $xueqilist->enddate = $list['enddate']; + $data = $xueqilist->save(); + // 根据更新结果设置返回提示信息 $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; @@ -191,6 +197,8 @@ class Xueqi extends BaseController $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 } + $id = explode(',', $id); + $data = XQ::destroy($id); // 根据更新结果设置返回提示信息 diff --git a/app/teach/model/Banji.php b/app/teach/model/Banji.php index 61bd5843..526f378e 100644 --- a/app/teach/model/Banji.php +++ b/app/teach/model/Banji.php @@ -18,6 +18,7 @@ class Banji extends Base // 查询数据 $data = $this + ->order('school','ruxuenian','paixu') ->order([$src['field'] =>$src['type']]) ->when(strlen($school)>0,function($query) use($school){ $query->where('school',$school); diff --git a/app/teach/route/teach.php b/app/teach/route/teach.php index 6ea872eb..cee92ce6 100644 --- a/app/teach/route/teach.php +++ b/app/teach/route/teach.php @@ -25,5 +25,46 @@ Route::get('kaoshi/:id/biaoqian','teach/Kaoshi/biaoqian'); Route::get('kaoshi/:id/caiji','teach/Kaoshi/caiji'); Route::post('kaoshi/caiji','teach/Kaoshi/cankaomingdan'); +// 学期管理 +Route::group('xueqi', function () { + Route::rule('','xueqi/index','get'); # 信息列表 + Route::rule('data','xueqi/ajaxdata','post'); # 获取数据 + Route::rule('create','xueqi/create','get'); # 添加信息 + Route::rule('save','xueqi/save','post'); # 保存信息 + // Route::rule('read/','xueqi/read','get'); # 读取信息 + Route::rule('edit/','xueqi/edit','get'); # 修改信息 + Route::rule('update/','xueqi/update','put'); # 更新信息 + Route::rule('delete/','xueqi/delete','delete'); # 删除信息 + Route::rule('status','xueqi/setStatus','post'); # 删除信息 + }); + +// 班级管理 +Route::group('banji', function () { + Route::rule('','banji/index','get'); # 信息列表 + Route::rule('data','banji/ajaxdata','post'); # 获取数据 + Route::rule('create','banji/create','get'); # 添加信息 + Route::rule('save','banji/save','post'); # 保存信息 + // Route::rule('read/','banji/read','get'); # 读取信息 + Route::rule('edit/','banji/edit','get'); # 修改信息 + Route::rule('update/','banji/update','put'); # 更新信息 + Route::rule('delete/','banji/delete','delete'); # 删除信息 + Route::rule('status','banji/setStatus','post'); # 删除信息 + Route::rule('yidong/','banji/yidong','post'); # 删除信息 + }); + + +// 学科管理 +Route::group('subject', function () { + Route::rule('','subject/index','get'); # 信息列表 + Route::rule('data','subject/ajaxdata','post'); # 获取数据 + Route::rule('create','subject/create','get'); # 添加信息 + Route::rule('save','subject/save','post'); # 保存信息 + // Route::rule('read/','subject/read','get'); # 读取信息 + Route::rule('edit/','subject/edit','get'); # 修改信息 + Route::rule('update/','subject/update','put'); # 更新信息 + Route::rule('delete/','subject/delete','delete'); # 删除信息 + Route::rule('status','subject/setStatus','post'); # 删除信息 + }); + diff --git a/app/teach/view/banji/create.html b/app/teach/view/banji/create.html index 7f0e43d6..1c72628d 100644 --- a/app/teach/view/banji/create.html +++ b/app/teach/view/banji/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/teach/view/banji/index.html b/app/teach/view/banji/index.html index 58cbf1f1..9030f7ef 100644 --- a/app/teach/view/banji/index.html +++ b/app/teach/view/banji/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -72,9 +72,9 @@ {field: 'banjiTitle', title: '班级名称', minWidth:100}, {field: 'school', title: '单位名称',sort: true, minWidth:240,templet:function(d){ var str=''; - if(d.gl_school) + if(d.glSchool) { - str = d.gl_school.title; + str = d.glSchool.title; } return str; }}, @@ -94,10 +94,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/banji','mytable'); + cjgl.delAll(checkStatus,'banji/delete','mytable'); break; case 'add': - cjgl.add('添加班级','/banji/create','600','300'); + cjgl.add('添加班级','banji/create','600','300'); break; }; }); @@ -108,23 +108,56 @@ var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ - case 'detail':// 查看 - layer.msg('查看' + data.id); - break; case 'befo':// 前移 - yidong(this,'/banji/'+data.id+'/yidong',-1); + yidong(this,'banji/yidong/'+data.id,-1); break; case 'end':// 后移 - yidong(this,'/banji/'+data.id+'/yidong',1); + yidong(this,'banji/yidong/'+data.id,1); break; case 'del':// 删除 - cjgl.del(obj,"/banji"); + cjgl.del(obj,"banji/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑班级','/banji/'+obj.data.id+'/edit','600','300'); + cjgl.add('编辑班级','banji/edit/'+obj.data.id,'600','300'); break; }; }); }); + + /*班级移动*/ + function yidong(obj,url,caozuo){ + layer.confirm('确认要移动班级位置吗?',function(index){ + $.ajax({ + type: 'POST', + url: url, + data: { + cz:caozuo, + }, + dataType: 'json', + success: function(data){ + + if(data.val == false){ + layer.alert(data.msg); + return true; + } + var yd = $(obj).parents("tr").html(); + // if( caozuo === 1) + // { + // $(obj).parents("tr").prev().before('' + yd + ''); + + // } else { + // $(obj).parents("tr").next().after('' + yd + ''); + // } + $(obj).parents("tr").remove(); + layer.alert(data.msg); + return true; + }, + error:function(data) { + layer.alert('移动失败'); + }, + }); + }); + } + {/block} \ No newline at end of file diff --git a/app/teach/view/subject/create.html b/app/teach/view/subject/create.html index 1cc40c4a..44ee31a6 100644 --- a/app/teach/view/subject/create.html +++ b/app/teach/view/subject/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/teach/view/subject/index.html b/app/teach/view/subject/index.html index 7fb061ce..2e22d06f 100644 --- a/app/teach/view/subject/index.html +++ b/app/teach/view/subject/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -72,10 +72,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/subject','mytable'); + cjgl.delAll(checkStatus,'subject/delete','mytable'); break; case 'add': - cjgl.add('添加学科','/subject/create','650','450'); + cjgl.add('添加学科','subject/create','650','450'); break; }; }); @@ -90,10 +90,10 @@ layer.msg('查看' + data.id); break; case 'del':// 删除 - cjgl.del(obj,"/subject"); + cjgl.del(obj,"subject/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑学科','/subject/'+obj.data.id+'/edit','650','450'); + cjgl.add('编辑学科','subject/edit/'+obj.data.id,'650','450'); break; }; }); diff --git a/app/teach/view/xueqi/create.html b/app/teach/view/xueqi/create.html index 7fd22178..f69e034c 100644 --- a/app/teach/view/xueqi/create.html +++ b/app/teach/view/xueqi/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/teach/view/xueqi/index.html b/app/teach/view/xueqi/index.html index 2e5f88ce..767bf23c 100644 --- a/app/teach/view/xueqi/index.html +++ b/app/teach/view/xueqi/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -51,9 +51,9 @@ {field: 'xuenian', title: '学年',sort: true}, {field: "category",title: '分类',sort: true,templet:function(d){ var str=''; - if(d.gl_category) + if(d.glCategory) { - str = d.gl_category.title; + str = d.glCategory.title; } return str; }}, @@ -72,10 +72,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/xueqi','mytable'); + cjgl.delAll(checkStatus,'xueqi/delete','mytable'); break; case 'add': - cjgl.add('添加学期','/xueqi/create','','',true); + cjgl.add('添加学期','xueqi/create','','',true); break; }; }); @@ -90,10 +90,10 @@ layer.msg('查看' + data.id); break; case 'del':// 删除 - cjgl.del(obj,"/xueqi"); + cjgl.del(obj,"xueqi/delete"); break; case 'edit':// 编辑 - cjgl.add('编辑学期','/xueqi/'+obj.data.id+'/edit','','',true); + cjgl.add('编辑学期','xueqi/edit/'+obj.data.id,'','',true); break; }; }); diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index c3a02a3a..6305e6c7 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -40,15 +40,15 @@ class Rule extends Seeder ['id'=>402,'title'=>'教师列表','name'=>'renshi/Index/index','paixu'=>2,'ismenu' =>1,'pid' =>4,'url'=>'/teacher',], // 教务管理 - ['id'=>501,'title'=>'学期列表','name'=>'teach/Xueqi/index','paixu'=>1,'ismenu' =>1,'pid' =>5,'url'=>'/xueqi',], - ['id'=>502,'title'=>'班级列表','name'=>'teach/Banji/index','paixu'=>2,'ismenu' =>1,'pid' =>5,'url'=>'/banji',], - ['id'=>503,'title'=>'学科列表','name'=>'teach/Subject/index','paixu'=>3,'ismenu' =>1,'pid' =>5,'url'=>'/subject',], + ['id'=>501,'title'=>'学期列表','name'=>'teach/Xueqi/index','paixu'=>1,'ismenu' =>1,'pid' =>5,'url'=>'/teach/xueqi',], + ['id'=>502,'title'=>'班级列表','name'=>'teach/Banji/index','paixu'=>2,'ismenu' =>1,'pid' =>5,'url'=>'/teach/banji',], + ['id'=>503,'title'=>'学科列表','name'=>'teach/Subject/index','paixu'=>3,'ismenu' =>1,'pid' =>5,'url'=>'/teach/subject',], // 管理员管理 - ['id'=>601,'title'=>'管理员列表','name'=>'admin/Index/index','paixu'=>1,'ismenu' =>1,'pid' =>6,'url'=>'/admin',], - ['id'=>602,'title'=>'权限列表','name'=>'admin/AuthRule/index','paixu'=>2,'ismenu' =>1,'pid' =>6,'url'=>'/authrule',], - ['id'=>603,'title'=>'角色列表','name'=>'admin/AuthGroup/index','paixu'=>3,'ismenu' =>1,'pid' =>6,'url'=>'/authgroup',], + ['id'=>601,'title'=>'管理员列表','name'=>'admin/Index/index','paixu'=>1,'ismenu' =>1,'pid' =>6,'url'=>'/admin/',], + ['id'=>602,'title'=>'权限列表','name'=>'admin/AuthRule/index','paixu'=>2,'ismenu' =>1,'pid' =>6,'url'=>'/admin/authrule',], + ['id'=>603,'title'=>'角色列表','name'=>'admin/AuthGroup/index','paixu'=>3,'ismenu' =>1,'pid' =>6,'url'=>'/admin/authgroup',], // 系统设置 ['id'=>701,'title'=>'类别管理','name'=>'system/Category/index','paixu'=>1,'ismenu' =>1,'pid' =>7,'url'=>'/system/category',],