From a6529ec6866f758c808b08cf17255fbbaa26c6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Wed, 3 Mar 2021 15:47:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/view/index/create.html | 2 +- app/{tools => kaoshi}/controller/KsCanyu.php | 8 +- app/kaoshi/model/LuruFengong.php | 2 +- app/kaoshi/view/luru_fengong/index.html | 8 +- app/student/controller/Index.php | 1 - app/student/view/index/create.html | 2 +- app/teach/model/BanZhuRen.php | 16 +- app/tools/route/tools.php | 16 +- config/view.php | 1 + public/static/{ => mayi/js}/Convert_Pinyin.js | 0 public/static/mayi/js/caozuo.js | 196 +++++++++++ public/static/{x-admin2.2 => mayi}/js/cjgl.js | 0 public/static/mayi/js/create.js | 307 ++++++++++++++++++ public/static/x-admin2.2/js/createinput.js | 19 -- view/create.html | 6 +- view/createhref.html | 6 +- view/list.html | 4 +- 17 files changed, 545 insertions(+), 49 deletions(-) rename app/{tools => kaoshi}/controller/KsCanyu.php (96%) mode change 100755 => 100644 rename public/static/{ => mayi/js}/Convert_Pinyin.js (100%) mode change 100755 => 100644 create mode 100644 public/static/mayi/js/caozuo.js rename public/static/{x-admin2.2 => mayi}/js/cjgl.js (100%) mode change 100755 => 100644 create mode 100644 public/static/mayi/js/create.js delete mode 100644 public/static/x-admin2.2/js/createinput.js diff --git a/app/admin/view/index/create.html b/app/admin/view/index/create.html index 286ef692..139aefdb 100755 --- a/app/admin/view/index/create.html +++ b/app/admin/view/index/create.html @@ -24,7 +24,7 @@ padding-top: 10px; } -{load href="__STATIC__/Convert_Pinyin.js" /} +{load href="__MAYI__/js/Convert_Pinyin.js" /} {/block} {block name="form"}
diff --git a/app/tools/controller/KsCanyu.php b/app/kaoshi/controller/KsCanyu.php old mode 100755 new mode 100644 similarity index 96% rename from app/tools/controller/KsCanyu.php rename to app/kaoshi/controller/KsCanyu.php index 093e3092..25533f81 --- a/app/tools/controller/KsCanyu.php +++ b/app/kaoshi/controller/KsCanyu.php @@ -1,12 +1,12 @@ where('user_id', $admin_id) ->where('kaoshi_id', $src['kaoshi_id']) - ->->group('banji_id') + ->group('banji_id') ->column(['banji_id']); return $data; } diff --git a/app/kaoshi/view/luru_fengong/index.html b/app/kaoshi/view/luru_fengong/index.html index d51b5bbf..c1862234 100644 --- a/app/kaoshi/view/luru_fengong/index.html +++ b/app/kaoshi/view/luru_fengong/index.html @@ -32,7 +32,6 @@
-
{/block} @@ -140,6 +139,13 @@ cjgl.createCheckbox('subject_id', formval, '/tools/kscy/subject', 'subject_id'); } + // 添加班级列表 + function addNianji(){ + // 获取参数 + formval = form.val("search"); + cjgl.createCheckbox('subject_id', formval, '/tools/kscy/subject', 'subject_id'); + } + // 统计成绩 function defenlv(obj){ var val; diff --git a/app/student/controller/Index.php b/app/student/controller/Index.php index 736175f5..1c15b6c1 100755 --- a/app/student/controller/Index.php +++ b/app/student/controller/Index.php @@ -56,7 +56,6 @@ class Index extends AdminBase } $mybanji = event('mybanji'); - halt($mybanji); // 根据条件查询数据 $stu = new STU; diff --git a/app/student/view/index/create.html b/app/student/view/index/create.html index ff355405..a03f2a91 100755 --- a/app/student/view/index/create.html +++ b/app/student/view/index/create.html @@ -1,6 +1,6 @@ {extend name=".././view/create.html" /} {block name="jscss"} - {load href="__STATIC__/Convert_Pinyin.js" /} + {load href="__MAYI__/js/Convert_Pinyin.js" /} {/block} {block name="form"} diff --git a/app/teach/model/BanZhuRen.php b/app/teach/model/BanZhuRen.php index 4cd8bb68..f0519601 100755 --- a/app/teach/model/BanZhuRen.php +++ b/app/teach/model/BanZhuRen.php @@ -149,19 +149,25 @@ class BanZhuRen extends BaseModel public function srcTeacherNow($admin_id) { $teacher = $this->where('teacher_id', $admin_id) - // ->field('id, banji_id, before') ->order(['bfdate'=>'desc']) ->find(); - $banji = $this->where('banji_id', $teacher->banji_id) + if(!isset($teacher->banji_id)) + { + $tempid = -1; + } else { + $tempid = $teacher->banji_id; + } + $banji = $this->where('banji_id', $tempid) ->order(['bfdate'=>'desc']) // ->field('id, before') ->find(); - if($teacher->id == $banji->id) + if(isset($banji->teacher_id) && $banji->teacher_id == $admin_id) { - $banji_id = $teacher->banji_id; + $banji_id = $banji->id; }else{ $banji_id = 0; - } + } + return $banji_id; } diff --git a/app/tools/route/tools.php b/app/tools/route/tools.php index c66a765e..1a6679aa 100755 --- a/app/tools/route/tools.php +++ b/app/tools/route/tools.php @@ -10,14 +10,14 @@ // +---------------------------------------------------------------------- use think\facade\Route; -// 教师管理 -Route::group('kscy', function () { - Route::rule('school','KsCanyu/school','post'); # 参与学科 - Route::rule('grade','KsCanyu/grade','post'); # 参与学科 - Route::rule('class','KsCanyu/class','post'); # 参与学科 - Route::rule('tjclass','KsCanyu/tjClass','post'); # 参与学科 - Route::rule('subject','KsCanyu/subject','post'); # 参与学科 -}); +// // 教师管理 +// Route::group('kscy', function () { +// Route::rule('school','KsCanyu/school','post'); # 参与学科 +// Route::rule('grade','KsCanyu/grade','post'); # 参与学科 +// Route::rule('class','KsCanyu/class','post'); # 参与学科 +// Route::rule('tjclass','KsCanyu/tjClass','post'); # 参与学科 +// Route::rule('subject','KsCanyu/subject','post'); # 参与学科 +// }); // 教师管理 Route::group('file', function () { diff --git a/config/view.php b/config/view.php index ce8f8250..9e99c83b 100755 --- a/config/view.php +++ b/config/view.php @@ -30,6 +30,7 @@ return [ '__STATIC__'=>'/static', '__UPLOAD__'=>'/uploads', '__XADMIN__'=>'/static/x-admin2.2', + '__MAYI__'=>'/static/mayi', ] ]; diff --git a/public/static/Convert_Pinyin.js b/public/static/mayi/js/Convert_Pinyin.js old mode 100755 new mode 100644 similarity index 100% rename from public/static/Convert_Pinyin.js rename to public/static/mayi/js/Convert_Pinyin.js diff --git a/public/static/mayi/js/caozuo.js b/public/static/mayi/js/caozuo.js new file mode 100644 index 00000000..1b21e5ab --- /dev/null +++ b/public/static/mayi/js/caozuo.js @@ -0,0 +1,196 @@ +/** + 扩展cjgl模块 + **/ + +layui.define(['table', 'form'],function(exports){ //提示:模块也可以依赖其它模块,如:layui.define('layer', callback); + var table = layui.table + form = layui.form; + var obj = { + + // 新建弹窗 + add: function(title,url,width='',height='',max=false){ + xadmin.open(title,url,width,height,max); + }, + // 新建Tab + addTab: function(title,url,max=false){ + parent.xadmin.add_tab(title,url,max); + }, + + // 删除单条记录 + del:function(obj,url){ + layer.confirm('确认要删除吗?',function(index){ + $.ajax({ + url:url + '/m', + type:'DELETE', + data:{ + id:obj.data.id + }, + success:function(result){ + if(result.val == 1) + { + obj.del(); + layer.msg(result.msg); + }else{ + layer.msg(result.msg,function(){}); + } + }, + error:function(result){ + layer.msg('数据扔半道啦。',function(){}); + }, + }); + }); + }, + + // 恢复单条记录 + redel:function(obj,url){ + layer.confirm('确认要恢复删除吗?',function(index){ + $.ajax({ + url:url+'/'+obj.data.id, + type:'DELETE', + data:{ + id:obj.data.id + }, + success:function(result){ + if(result.val == 1) + { + obj.del(); + layer.msg(result.msg); + }else{ + layer.msg(result.msg,function(){}); + } + }, + error:function(result){ + layer.msg('数据扔半道啦。',function(){}); + }, + }); + }); + }, + + // 删除全部 + delAll:function(obj,url,tableid){ + //判断是否选择数据 + if(obj.data.length==0){ + parent.layer.msg('请先选择要删除的数据行!',function(){}); + return ; + } + + layer.confirm('确认要删除吗?',function(index){ + // 捉一下所有被选中的数据 + var ids = ""; + for(var i=0;i
请选择
'); + // 声明变量 + var mydl = srcInput.next().children('dl'); + + // 获取数据 + $.post( + "/admin/index/srcteacher", + { + "str":val, + }, + function(data,status){ + data = data.data; + if($.isEmptyObject(data)) + { + return true; + } + var str; + for (var i = data.length - 1; i >= 0; i--) { + str = ''; + str = '
'; + str = str + data[i].xingming+' '+data[i].adSchool.jiancheng+' '+data[i].shengri; + str = str + '
'; + mydl.append(str); + } + } + ); + }, + + + // Select获取焦点 + searchTeacherOld:function(myobj,val,addname,myfunction){ + // 声明变量 + var srcInput = $(myobj); + // 删除原来列表 + srcInput.next().remove(); + // 添加列表div + srcInput.after('
请选择
'); + // 声明变量 + var mydl = srcInput.next().children('dl'); + + // 获取数据 + $.post( + "/teacher/index/srcteacher", + { + "str":val, + }, + function(data,status){ + data = data.data; + if($.isEmptyObject(data)) + { + return true; + } + var str; + for (var i = data.length - 1; i >= 0; i--) { + str = ''; + str = '
'; + str = str + data[i].xingming+' '+data[i].jsDanwei.jiancheng+' '+data[i].shengri; + str = str + '
'; + mydl.append(str); + } + } + ); + }, + + // 添加教师 + addTeacher:function(myobj){ + var myId = $(myobj).attr('id') + ,teachername = $(myobj).attr('teachername') + ,addname = $(myobj).attr('addname') + ,myTitle = $(myobj).text() + ,myList = $(myobj).parent().parent() + ,myBut = $(myList).parent().parent() + ,schoolName = $(myobj).attr('schoolName'); + if(myId){ + var str = '
'; + str = str + '
'; + str = str + teachername; + str = str + '
' + $(myBut).append(str); + } + $(myList).prev().val(''); + $(myList).remove(); + }, + + // 添加教师ID + addTeacherID:function(myobj){ + var myId = $(myobj).attr('id') + ,teachername = $(myobj).attr('teachername') + ,addname = $(myobj).attr('addname') + ,myTitle = $(myobj).text() + ,myList = $(myobj).parent().parent() + ,myBut = $(myList).parent().parent(); + + $(myList).prev().val(myId); + $(myList).remove(); + }, + + // 删除教师 + delTeacher:function(myobj){ + $(myobj).parent().remove(); + }, + + /** + * 动太获取复选框列表并添加列表 + * + * @access public + * @param parentId 要添加checkbox的divID + * @param array val post时需要的参数 + * @param url post地址 + * @param createName 新checkbox名 + * @param title 输出返回数组的列 + * @return array 返回类型 + */ + createCheckbox:function(parentId,val,url,createName,title='title'){ + $('#'+parentId).children().remove(); + $.post( + url, + val, + function(data,status){ + if(data.count > 0){ + cnt = data.count; + mydata = data.data; + + }else{ + cnt = 0; + mydata = Array(); + } + + // if(cnt>0){ + $('#'+parentId).append(''); + // } + for(x in mydata){ + $('#'+parentId).append(''); + } + form.render(); + } + ); + }, + + + /** + * 动太获取复选框列表并添加列表 + * + * @access public + * @param idd 要添加select的ID + * @param array val post时需要的参数 + * @param url post地址 + * @param createName 新checkbox名 + * @param title 输出返回数组的列 + * @return array 返回类型 + */ + createSelectOption:function(id, val, url, cloval='id', cloname='title', checkval=null){ + $('#' + id).children().remove(); + $.post( + url, + val, + function(data,status){ + cnt = data.count; + mydata = data.data; + if(cnt>0){ + $('#' + id).append(''); + } + for(x in mydata){ + if(mydata[x][cloval] == checkval) + { + $('#' + id).append(''); + }else{ + $('#' + id).append(''); + } + } + form.render(); + } + ); + }, + + /** + * 单击全选按钮,全部选中或取消选中后面的checkbox + * 选中所有全部checkbox + * + * @access public + * @param parentId 选中checkbox父级div的id + * @param checked post时需要的参数 + * @return array 返回类型 + */ + checkboxAll:function(parentId,checked){ + if(checked==true) + { + $('#'+parentId).find("input[checkall='c']").prop('checked',true); + }else{ + $('#'+parentId).find("input[checkall='c']").prop('checked',false); + } + form.render(); + }, + + /** + * 如果有选中的checkbox,那么就选中全选按钮,否则取消选中 + * + * @access public + * @param parentId 选中checkbox父级div的id + * @return array 返回类型 + */ + checkboxParent:function(parentId){ + children = $('#'+parentId).find(".layui-form-checked").prev("input[checkall='c']"); + children = children.length; + if(children==0) + { + $('#'+parentId).find("input[checkall='p']").prop('checked',false); + }else{ + $('#'+parentId).find("input[checkall='p']").prop('checked',true); + } + form.render(); + }, + + /** + * 如果二级checkbox全部选中,那么就选中全选按钮,否则取消选中 + * + * @access public + * @param parentId 选中checkbox父级div的id + * @return array 返回类型 + */ + checkboxParentList:function(parentId){ + cnt = $('#'+parentId).children("input[checkall='c']").length; + checkedCnt = $('#'+parentId).children("input:checkbox[checkall='c']:checked").length; + if(cnt == checkedCnt) + { + $('#'+parentId).find("input[checkall='p']").prop('checked',true); + }else{ + $('#'+parentId).find("input[checkall='p']").prop('checked',false); + } + + form.render(); + }, + + /** + * 在创建角色中,选中类别时的动作 + * + * @access public + * @param id 选中复选框的ID + * @param checked 选中复选框的状态 + * @return array 返回类型 + */ + checkedAuth:function(id,checed){ + obj = $('#p'+id).html(); + aa = $('#p'+id).find("input[type='checkbox']").prop('checked',checked); + form.render(); + }, + + /** + * 成绩统计 + * @access public + * @param id 选中复选框的ID + * @param checked 选中复选框的状态 + * @return array 返回类型 + */ + tongjiCj:function(url,val){ + $.ajax({ + url:url, + type:'POST', + async: true, + data:val, + beforeSend: function () { + $("body").append('
'); + }, + complete: function () { + $("#load").remove(); + }, + success:function(result){ + layer.msg(result.msg); + }, + error:function(result){ + layer.msg('数据扔半道,回不来啦。',function(){}); + }, + }); + }, + + }; + //输出test接口 + exports('cjgl', obj); +}); diff --git a/public/static/x-admin2.2/js/createinput.js b/public/static/x-admin2.2/js/createinput.js deleted file mode 100644 index 691960e1..00000000 --- a/public/static/x-admin2.2/js/createinput.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - 扩展cjgl模块 - **/ - -layui.define(['from'],function(exports){ //提示:模块也可以依赖其它模块,如:layui.define('layer', callback); - var form = layui.form; - var obj = { - - // 获取可以录入成绩的考试列表 - lurukaoshiSelect: function () { - - } - - - - }; - //输出test接口 - exports('createinput', obj); -}); diff --git a/view/create.html b/view/create.html index eb69090e..f300f0d7 100755 --- a/view/create.html +++ b/view/create.html @@ -38,15 +38,15 @@