diff --git a/README.md b/README.md index bbe6716b..b07f90e6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@  -# 免费学生成绩统计系统 +# 尚码免费小学成绩管理系统   坦率地讲,在不久的将来,这也许会是辽东半岛上第二好用的成绩统计系统。如果你觉得还可以,还不赶紧 Watch 、 Start 一下。如果觉得不好,何不给个改进意见再离开,反正已经来了,是吧? diff --git a/app/common.php b/app/common.php index a97978d0..36cfb32e 100644 --- a/app/common.php +++ b/app/common.php @@ -29,17 +29,17 @@ function getCategory($id = '0') } -// 获取类别名称 -function getCategoryTitle($id) -{ - $category = new \app\system\model\Category; - // 根据id查询类别名 - $value = $category - ->where('id',$id) - ->vlaue('title'); - // 返回类别名 - return $value; -} +// // 获取类别名称 +// function getCategoryTitle($id) +// { +// $category = new \app\system\model\Category; +// // 根据id查询类别名 +// $value = $category +// ->where('id',$id) +// ->vlaue('title'); +// // 返回类别名 +// return $value; +// } function nianjiList($riqi=0) @@ -322,3 +322,24 @@ function enddate($kaoshiid) return $data; } + + + +/** + * 获取参加考试的学科 + * 返回 $data + * */ +function subjectList() +{ + $sbj = new \app\teach\model\Subject; + $data = $sbj::where('status',1) + ->where('kaoshi',1) + ->field('id,title,jiancheng,lieming') + ->select(); + return $data; +} + + + + + diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index c426ab0a..47b4d592 100644 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -17,13 +17,13 @@ class Index extends BaseController // 设置要给模板赋值的信息 $list['webtitle'] = '考试列表'; - $list['dataurl'] = 'category/data'; + $list['dataurl'] = 'index/data'; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染模板 - return $this->fetch(); + return $this->view->fetch(); } @@ -76,14 +76,14 @@ class Index extends BaseController 'webtitle'=>'新建考试', 'butname'=>'创建', 'formpost'=>'POST', - 'url'=>'/kaoshi', + 'url'=>'save', ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -146,14 +146,14 @@ class Index extends BaseController 'webtitle'=>'编辑考试', 'butname'=>'修改', 'formpost'=>'PUT', - 'url'=>'/kaoshi/'.$id, + 'url'=>'/kaoshi/index/update/'.$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch('create'); + return $this->view->fetch('create'); } @@ -197,7 +197,7 @@ class Index extends BaseController // 设置考试信息 - public function kaoshiset($id) + public function kaoshiSet($id) { // 获取考试信息 @@ -242,15 +242,15 @@ class Index extends BaseController 'webtitle'=>'设置考试', 'butname'=>'设置', 'formpost'=>'PUT', - 'url'=>'/kaoshiset/'.$id, + 'url'=>'/kaoshi/index/updateset/'.$id, 'kaoshi'=>$id, ); // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch(); + return $this->view->fetch(); } @@ -259,7 +259,7 @@ class Index extends BaseController // 更新考试信息 - public function updateset($id) + public function updateSet($id) { $validate = new \app\kaoshi\validate\Kaoshiset; @@ -378,8 +378,8 @@ class Index extends BaseController $list['kaoshiid'] = $kaoshi['id']; // 模板赋值 - $this->assign('list',$list); + $this->view->assign('list',$list); // 渲染 - return $this->fetch(); + return $this->view->fetch(); } } diff --git a/app/kaoshi/route/kaoshi.php b/app/kaoshi/route/kaoshi.php index 603aff94..4010a7b0 100644 --- a/app/kaoshi/route/kaoshi.php +++ b/app/kaoshi/route/kaoshi.php @@ -11,23 +11,53 @@ use think\facade\Route; -//系统设置路由 -Route::resource('kaoshi','kaoshi/Index'); -Route::resource('kaohao','kaoshi/Kaohao'); -// 考试更多操作 -Route::get('kaoshi/:kaoshi/more','kaoshi/Index/moreAction'); -// 考试设置保存 -Route::get('kaoshiset/:id','kaoshi/Index/kaoshiset'); -Route::put('kaoshiset/:id','kaoshi/Index/updateset'); -// 考号保存 -Route::get('kaoshi/:kaoshi/kaohao','kaoshi/Kaohao/index'); -Route::post('kaoshi/kaohao','kaoshi/Kaohao/save'); -// 下载成绩采集表 -Route::get('kaoshi/:kaoshi/caiji','kaoshi/Kaohao/caiji'); -Route::post('kaoshi/caiji','kaoshi/Kaohao/dwcaiji'); -// 下载试卷标签 -Route::get('kaoshi/:kaoshi/biaoqian','kaoshi/Kaohao/biaoqian'); -Route::post('kaoshi/:kaoshi/biaoqianXls','kaoshi/Kaohao/biaoqianXls'); +// //系统设置路由 +// Route::resource('kaoshi','kaoshi/Index'); +// Route::resource('kaohao','kaoshi/Kaohao'); +// // 考试更多操作 +// Route::get('kaoshi/:kaoshi/more','kaoshi/Index/moreAction'); +// // 考试设置保存 +// Route::get('kaoshiset/:id','kaoshi/Index/kaoshiset'); +// Route::put('kaoshiset/:id','kaoshi/Index/updateset'); +// // 考号保存 +// Route::get('kaoshi/:kaoshi/kaohao','kaoshi/Kaohao/index'); +// Route::post('kaoshi/kaohao','kaoshi/Kaohao/save'); +// // 下载成绩采集表 +// Route::get('kaoshi/:kaoshi/caiji','kaoshi/Kaohao/caiji'); +// Route::post('kaoshi/caiji','kaoshi/Kaohao/dwcaiji'); +// // 下载试卷标签 +// Route::get('kaoshi/:kaoshi/biaoqian','kaoshi/Kaohao/biaoqian'); +// Route::post('kaoshi/:kaoshi/biaoqianXls','kaoshi/Kaohao/biaoqianXls'); + +// 考试管理 +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::rule('set/','Index/kaoshiSet','get'); # 修改信息 + Route::rule('updateset/','Index/updateSet','put'); # 更新信息 + Route::rule('more/','Index/moreAction','get'); # 修改信息 + }); + + +// 考号管理 +Route::group('kaohao', function () { + Route::rule('','Kaohao/index','get'); # 信息列表 + Route::rule('data','Kaohao/ajaxdata','post'); # 获取数据 + Route::rule('create','Kaohao/create','get'); # 添加信息 + Route::rule('save','Kaohao/save','post'); # 保存信息 + // Route::rule('read/','Kaohao/read','get'); # 读取信息 + Route::rule('edit/','Kaohao/edit','get'); # 修改信息 + Route::rule('update/','Kaohao/update','put'); # 更新信息 + Route::rule('delete/','Kaohao/delete','delete'); # 删除信息 + Route::rule('status','Kaohao/setStatus','post'); # 删除信息 + }); diff --git a/app/kaoshi/view/index/create.html b/app/kaoshi/view/index/create.html index d4c0f7b6..9ee3023f 100644 --- a/app/kaoshi/view/index/create.html +++ b/app/kaoshi/view/index/create.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"}
diff --git a/app/kaoshi/view/index/index.html b/app/kaoshi/view/index/index.html index 7c6ae650..e471b2b1 100644 --- a/app/kaoshi/view/index/index.html +++ b/app/kaoshi/view/index/index.html @@ -1,5 +1,5 @@ -{extend name="common@list" /} +{extend name=".././view/list.html" /} {block name="jsset"} {/block} @@ -37,13 +37,10 @@ @@ -52,7 +49,8 @@ // 设置列 options.cols=[[ //表头 {type:'checkbox', fixed: 'left'}, - {field: 'title', title: '单位名称',sort: true, minWidth:240}, + {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:130}, + {field: 'title', title: '考试名称',sort: true, minWidth:240}, // {field: 'category', title: '考试分类', minWidth:100,sort: true,templet:function(d){ // var str=''; // if(d.ks_category) @@ -63,13 +61,13 @@ // }}, {field: "",title: '参考年级', minWidth:180,templet:function(d){ var str=''; - if(d.ks_nianji.length>0) + if(d.ksNianji.length>0) { - for (var k = 0, length = d.ks_nianji.length; k < length; k++) { + for (var k = 0, length = d.ksNianji.length; k < length; k++) { if(k == 0){ - str = d.ks_nianji[k].nianjiname; + str = d.ksNianji[k].nianjiname; }else{ - str =str+'、'+d.ks_nianji[k].nianjiname; + str =str+'、'+d.ksNianji[k].nianjiname; } } } @@ -77,13 +75,13 @@ }}, {field: '', title: '参考学科', minWidth:100,templet:function(d){ var str=''; - if(d.ks_subject.length>0) + if(d.ksSubject.length>0) { - for (var k = 0, length = d.ks_subject.length; k < length; k++) { + for (var k = 0, length = d.ksSubject.length; k < length; k++) { if(k == 0){ - str = d.ks_subject[k].subject_name.jiancheng; + str = d.ksSubject[k].subjectName.jiancheng; }else{ - str =str+'、'+d.ks_subject[k].subject_name.jiancheng; + str =str+'、'+d.ksSubject[k].subjectName.jiancheng; } } } @@ -98,7 +96,7 @@ return endate; }}, {field: 'status', title: '状态', minWidth:80,templet:'#status', sort: true}, - {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:175} + ]]; // 提交搜索条件后重载表格 @@ -110,10 +108,10 @@ switch(obj.event){ case 'dels': var checkStatus = table.checkStatus('mytable'); //idmytable 即为基础参数 id 对应的值 - cjgl.delAll(checkStatus,'/kaoshi','mytable'); + cjgl.delAll(checkStatus,'index/delete','mytable'); break; case 'add': - cjgl.add('新建考试','/kaoshi/create','','',true); + cjgl.add('新建考试','index/create','','',true); break; }; }); @@ -124,20 +122,17 @@ 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,"/kaoshi"); + cjgl.del(obj,"kaoshi"); break; case 'edit':// 编辑 - cjgl.add('编辑考试','/kaoshi/'+obj.data.id+'/edit','','',true); + cjgl.add('编辑考试','index/edit/'+obj.data.id,'','',true); break; case 'set':// 编辑 - cjgl.add('设置考试','/kaoshiset/'+obj.data.id,'','',true); + cjgl.add('设置考试','index/set/'+obj.data.id,'','',true); break; case 'more':// 状态 - parent.x_admin_add_to_tab(obj.data.title + ' 操作','kaoshi/'+obj.data.id+'/more',true); + parent.xadmin.add_tab(obj.data.title + ' 操作','/kaoshi/index/more/'+obj.data.id,true); break; }; }); diff --git a/app/kaoshi/view/index/kaoshiset.html b/app/kaoshi/view/index/kaoshi_set.html similarity index 98% rename from app/kaoshi/view/index/kaoshiset.html rename to app/kaoshi/view/index/kaoshi_set.html index c9097816..80b949b1 100644 --- a/app/kaoshi/view/index/kaoshiset.html +++ b/app/kaoshi/view/index/kaoshi_set.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} @@ -50,7 +50,8 @@ {php} - $subject = action('teach/Subject/subjectlist'); + + $subject = subjectList(); {/php} diff --git a/app/kaoshi/view/index/more_action.html b/app/kaoshi/view/index/more_action.html index c06f0140..173630d7 100644 --- a/app/kaoshi/view/index/more_action.html +++ b/app/kaoshi/view/index/more_action.html @@ -46,7 +46,7 @@
+ onclick="addteb('生成考号','kaoshi/{$kaoshiid}/kaohao')" class="x-admin-backlog-body">
生成考号
diff --git a/app/kaoshi/view/kaohao/biaoqian.html b/app/kaoshi/view/kaohao/biaoqian.html index 653a7758..11ebb7db 100644 --- a/app/kaoshi/view/kaohao/biaoqian.html +++ b/app/kaoshi/view/kaohao/biaoqian.html @@ -1,4 +1,4 @@ -{extend name="common@createhref" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/kaoshi/view/kaohao/caiji.html b/app/kaoshi/view/kaohao/caiji.html index 68c530ef..543f6e2c 100644 --- a/app/kaoshi/view/kaohao/caiji.html +++ b/app/kaoshi/view/kaohao/caiji.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/kaoshi/view/kaohao/index.html b/app/kaoshi/view/kaohao/index.html index bdd7900f..4f9469f4 100644 --- a/app/kaoshi/view/kaohao/index.html +++ b/app/kaoshi/view/kaohao/index.html @@ -1,4 +1,4 @@ -{extend name="common@create" /} +{extend name=".././view/create.html" /} {block name="form"} diff --git a/app/keti/controller/KetiInfo.php b/app/keti/controller/KetiInfo.php index dd888c3f..2e17a33d 100644 --- a/app/keti/controller/KetiInfo.php +++ b/app/keti/controller/KetiInfo.php @@ -518,8 +518,8 @@ class KetiInfo extends BaseController if($list->isEmpty()) { - // $this->error('兄弟,没有要下载的信息呀~'); - return '没有找到记录,下载失败'; + $this->error('兄弟,没有要下载的信息呀~'); + // return '没有找到记录,下载失败'; }else{ $keticename = $list[0]['KtCe']['title']; $lxdanwei = $list[0]['KtCe']['ktLxdanwei']['title']; diff --git a/app/teach/controller/Subject.php b/app/teach/controller/Subject.php index 062b6cd6..b4587633 100644 --- a/app/teach/controller/Subject.php +++ b/app/teach/controller/Subject.php @@ -223,13 +223,33 @@ class Subject extends BaseController - // 学科列表 - public function subjectlist(){ - $data = SJ::where('status',1) - ->where('kaoshi',1) - ->field('id,title,jiancheng,lieming') - ->select(); - return $data; + // 设置学期状态 + public function kaoshi() + { + + // 获取id变量 + $id = request()->post('id'); + $value = request()->post('value'); + + // 获取学期信息 + $data = SJ::where('id',$id)->update(['kaoshi'=>$value]); + + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); } + + + // // 学科列表 + // public function subjectlist(){ + // $data = SJ::where('status',1) + // ->where('kaoshi',1) + // ->field('id,title,jiancheng,lieming') + // ->select(); + // return $data; + // } + } diff --git a/app/teach/model/Subject.php b/app/teach/model/Subject.php index be5840d5..82edf975 100644 --- a/app/teach/model/Subject.php +++ b/app/teach/model/Subject.php @@ -34,9 +34,9 @@ class Subject extends Base } - // 是否参加考试获取器 - public function getKaoshiAttr($value){ - $kaoshi = array(0=>'否',1=>'是'); - return $kaoshi[$value]; - } + // // 是否参加考试获取器 + // public function getKaoshiAttr($value){ + // $kaoshi = array(0=>'否',1=>'是'); + // return $kaoshi[$value]; + // } } diff --git a/app/teach/route/teach.php b/app/teach/route/teach.php index 5b3875fc..0416054b 100644 --- a/app/teach/route/teach.php +++ b/app/teach/route/teach.php @@ -65,6 +65,7 @@ Route::group('subject', function () { Route::rule('update/','subject/update','put'); # 更新信息 Route::rule('delete/','subject/delete','delete'); # 删除信息 Route::rule('status','subject/setStatus','post'); # 删除信息 + Route::rule('kaoshi','subject/kaoshi','post'); # 删除信息 }); diff --git a/app/teach/view/subject/index.html b/app/teach/view/subject/index.html index 2e22d06f..bae0cfd4 100644 --- a/app/teach/view/subject/index.html +++ b/app/teach/view/subject/index.html @@ -42,6 +42,11 @@
+ + + {/block} \ No newline at end of file diff --git a/config/app.php b/config/app.php index 39465593..0e5e53cf 100644 --- a/config/app.php +++ b/config/app.php @@ -34,7 +34,7 @@ return [ // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', // 显示错误信息 - 'show_error_msg' => true, + 'show_error_msg' => false, // 版本号 'chengji' => [ 'version' => '1.3', diff --git a/public/static/x-admin2.2/js/cjgl.js b/public/static/x-admin2.2/js/cjgl.js index e721e895..98e3b0f7 100644 --- a/public/static/x-admin2.2/js/cjgl.js +++ b/public/static/x-admin2.2/js/cjgl.js @@ -83,7 +83,7 @@ layui.define(['table'],function(exports){ //提示:模块也可以依赖其它 statusval=0; title='禁用'; } - console.log(url); + // console.log(url); // console.log(obj.elem); // 设置修改后的状态值 layer.confirm('确认要'+title+'吗?',function(index){ diff --git a/view/list.html b/view/list.html index 4a0fdc79..861515c9 100644 --- a/view/list.html +++ b/view/list.html @@ -96,11 +96,11 @@ //监听指定开关 lForm.on('switch(status)', function(data){ - var status = "{$list.status ? $list.status : ''}"; - if(typeof status == "undefined" || status == null || status == "") - { - status = "{:url('status')}"; - } + var status = "{$list.status ? $list.status : url('status')}"; + // if(typeof status == "undefined" || status == null || status == "") + // { + // status = "{:url('status')}"; + // } cjgl.status(data,status); });