From 4bfbe964b0006f8f291a67df4f07e6099b195cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=BE=E6=A0=91?= Date: Sat, 13 Mar 2021 08:47:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=83=E8=AF=95=E5=89=8D?= =?UTF-8?q?=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/validate/Admin.php | 2 +- app/admin/view/auth_group/create.html | 2 +- app/admin/view/index/create.html | 2 +- app/kaoshi/controller/Index.php | 7 +- app/kaoshi/controller/LuruFengong.php | 1 + app/kaoshi/validate/LuruFengong.php | 2 +- app/kaoshi/view/index/create.html | 4 +- app/kaoshi/view/index/create_setp1.html | 13 +- app/kaoshi/view/index/create_setp2.html | 53 +++-- app/kaoshi/view/index/create_setp3.html | 60 ++++- app/kaoshi/view/index/create_setp4.html | 251 +++++++++------------ app/kaoshi/view/luru_fengong/create.html | 53 +---- public/static/x-admin2.2/js/createInput.js | 67 +++++- 13 files changed, 265 insertions(+), 252 deletions(-) diff --git a/app/admin/validate/Admin.php b/app/admin/validate/Admin.php index f21d9a7d..b7096acf 100755 --- a/app/admin/validate/Admin.php +++ b/app/admin/validate/Admin.php @@ -21,7 +21,7 @@ class Admin extends Validate 'group_id|角色' => 'require|array', 'shengri|出生日期' => 'date', 'sex|性别' => 'in:0,1,2', - 'phone|手机' => 'mobile', + 'phone|手机' => 'require|mobile', 'beizhu|备注' => 'max:80', 'zhiwu_id|职务' => 'number', 'zhicheng_id|职称' => 'number', diff --git a/app/admin/view/auth_group/create.html b/app/admin/view/auth_group/create.html index 2fbc0886..c086d015 100755 --- a/app/admin/view/auth_group/create.html +++ b/app/admin/view/auth_group/create.html @@ -75,7 +75,7 @@ layui.use(['form', 'createInput'], function() { } form.on('checkbox(auth)', function(data) { - cInput.checkboxChecked(data); + cInput.checkboxCheckedAuth(data); }); }); diff --git a/app/admin/view/index/create.html b/app/admin/view/index/create.html index 883f6f7c..a7d78020 100755 --- a/app/admin/view/index/create.html +++ b/app/admin/view/index/create.html @@ -52,7 +52,7 @@ *电话号码
- +
diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index b80aa34f..6c95b070 100755 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -115,8 +115,8 @@ class Index extends AdminBase // 获取考试时间 $ks = new \app\kaoshi\model\Kaoshi; $enddate = $ks->kaoshiInfo($kaoshi_id); - $enddate = $enddate->getData('enddate'); - $list['set']['nianji'] = nianJiNameList('str', $enddate); + $list['enddate'] = $enddate->getData('enddate'); + // $list['set']['nianji'] = \app\facade\Tools::nianJiNameList('str', $enddate); // 模板赋值 $this->view->assign('list', $list); @@ -249,8 +249,7 @@ class Index extends AdminBase // 获取考试时间 $ks = new \app\kaoshi\model\Kaoshi; $enddate = $ks->kaoshiInfo($kaoshi_id); - $enddate = $enddate->getData('enddate'); - $list['set']['nianji'] = nianJiNameList('str', $enddate); + $list['enddate'] = $enddate->getData('enddate'); // 模板赋值 $this->view->assign('list', $list); diff --git a/app/kaoshi/controller/LuruFengong.php b/app/kaoshi/controller/LuruFengong.php index ddc3590a..0fac3463 100644 --- a/app/kaoshi/controller/LuruFengong.php +++ b/app/kaoshi/controller/LuruFengong.php @@ -126,6 +126,7 @@ class LuruFengong extends AdminBase // 整理参数 $list = array(); + $src['admin_id'] = explode(',', $src['admin_id']); foreach ($src['admin_id'] as $admin_k => $admin_v) { foreach ($src["banji_id"] as $banji_k => $banji_v) { foreach ($src["subject_id"] as $sbj_k => $sbj_v) { diff --git a/app/kaoshi/validate/LuruFengong.php b/app/kaoshi/validate/LuruFengong.php index 68dc52d1..f26ec378 100644 --- a/app/kaoshi/validate/LuruFengong.php +++ b/app/kaoshi/validate/LuruFengong.php @@ -15,7 +15,7 @@ class LuruFengong extends Validate */ protected $rule = [ 'kaoshi_id|考试' => 'require|length:1,25', - 'admin_id|教师' => 'require|array', + 'admin_id|教师' => 'require', 'banji_id|班级' => 'require|array', 'subject_id|学科' => 'require|array', ]; diff --git a/app/kaoshi/view/index/create.html b/app/kaoshi/view/index/create.html index b798244a..28aee7c5 100755 --- a/app/kaoshi/view/index/create.html +++ b/app/kaoshi/view/index/create.html @@ -74,7 +74,7 @@ layui.use(['laydate', 'createInput'], function() { elem: '#bfdate', type: 'datetime', trigger: 'click', //采用click弹出 - min: -30, //今天 + min: -15, //今天 max: 30, //20天后 format: 'yyyy-M-d' //可任意组合 }); @@ -83,7 +83,7 @@ layui.use(['laydate', 'createInput'], function() { elem: '#enddate', type: 'datetime', trigger: 'click', //采用click弹出 - min: -30, //今天 + min: -15, //今天 max: 30, //20天后 format: 'yyyy-M-d' //可任意组合 }); diff --git a/app/kaoshi/view/index/create_setp1.html b/app/kaoshi/view/index/create_setp1.html index 698088c2..752e4fa4 100644 --- a/app/kaoshi/view/index/create_setp1.html +++ b/app/kaoshi/view/index/create_setp1.html @@ -92,9 +92,10 @@ {block name="myjs"} {/block} diff --git a/app/kaoshi/view/index/create_setp3.html b/app/kaoshi/view/index/create_setp3.html index b3c387b3..bf3c8de2 100644 --- a/app/kaoshi/view/index/create_setp3.html +++ b/app/kaoshi/view/index/create_setp3.html @@ -54,11 +54,11 @@
- 上一步 + 上一步 - 下一步 + 下一步
{/block} @@ -69,9 +69,11 @@ layui.use(['form', 'createInput', 'canyuKaoshi'], function() { cInput = layui.createInput, canyu = layui.canyuKaoshi; + cInput.schoolSelect('school_id', '校级', '校级', "{$list.data.school_id|default=''}", true); canyu.gradeSelect('ruxuenian', "{$list.set.kaoshi_id}"); + form.on('select()', function(data) { data = form.val("myform"); if (data.school_id > 0 && data.ruxuenian > 0) { @@ -79,20 +81,56 @@ layui.use(['form', 'createInput', 'canyuKaoshi'], function() { } }); + form.on('checkbox(mycheackbox)', function(data) { cInput.checkboxChecked(data); }); + + + //监听提交 + form.on('submit(kssubmit)', function(data){ + $.ajax({ + url:"{$list.set.url}", + type:"{$list.set.formpost}", + data:data.field, + dataType:'json', + success:function(result){ + if(result.val == 1) + { + // $(location).attr('href', '/kaoshi/kaoshiset/create/' + "{$list['set']['kaoshi_id']}"); + parent.layer.msg(result.msg); + }else{ + layer.msg(result.msg); + } + }, + error:function(xhr,status,error) { + layer.msg('数据处理错误',{ + icon: 2, + time: 2000 //2秒关闭(如果不配置,默认是3秒) + }); + } + }); + return false; + }); + + + + $('#preSet').click(function(){ + $(location).attr('href', '/kaoshi/index/setp2/' + "{$list['set']['kaoshi_id']}"); + return false; + }) + + + + $('#nextSet').click(function(){ + $(location).attr('href', '/kaoshi/index/setp4/' + "{$list['set']['kaoshi_id']}"); + return false; + }) + + + }); -function nextSet() { - $(location).attr('href', '/kaoshi/index/setp4/' + "{$list['set']['kaoshi_id']}"); - return false; -} - -function preSet() { - $(location).attr('href', '/kaoshi/index/setp2/' + "{$list['set']['kaoshi_id']}"); - return false; -} {/block} diff --git a/app/kaoshi/view/index/create_setp4.html b/app/kaoshi/view/index/create_setp4.html index d4c897e6..935693c7 100644 --- a/app/kaoshi/view/index/create_setp4.html +++ b/app/kaoshi/view/index/create_setp4.html @@ -62,174 +62,127 @@
-
- -
-
- -
- {present name="$list.data.kt_zcr"} - {volist name="$list.data.kt_zcr" id="vo"} -
-
- {$vo.admin.xingming} +
+ +
+
+
+
+ +
+
-
- {/volist} - {/present} -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
-
- -
-
-
+
+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
- 上一步 + 上一步 - 完成 + 完成
{/block} {block name="myjs"} {/block} diff --git a/app/kaoshi/view/luru_fengong/create.html b/app/kaoshi/view/luru_fengong/create.html index 65a295bc..6bf9ca4f 100644 --- a/app/kaoshi/view/luru_fengong/create.html +++ b/app/kaoshi/view/luru_fengong/create.html @@ -32,7 +32,7 @@ -
+
@@ -83,17 +83,10 @@ layui.use(['createInput','canyuKaoshi','form'], function(){ form = layui.form; // 搜索教师 - xmselect = cInput.searchTeacher('teacher_id', true); + xmselect = cInput.searchTeacher('admin_id'); canyu.schoolSelect('school_id', "{$list.set.kaoshi_id}"); canyu.gradeSelect('ruxuenian', "{$list.set.kaoshi_id}"); - // // 加载学校列表 - // addSchool(); - - // // 监听学校下拉菜单 - // form.on('select(school_id)', function (data) { - // addNianji(); - // }) // 监听学校下拉菜单 form.on('select(src)', function (data) { data = form.val("myform"); @@ -106,48 +99,6 @@ layui.use(['createInput','canyuKaoshi','form'], function(){ form.on('checkbox(mycheackbox)', function(data) { cInput.checkboxChecked(data); }); - - // // 添加学校 - // function addSchool(){ - // // 获取参数 - // formval = form.val("myform"); - // cjgl.createSelectOption('school_id', formval, '/kaoshi/kscy/school', 'id', 'title'); - // } - - // // 添加年级 - // function addNianji(){ - // // 获取参数 - // formval = form.val("myform"); - // cjgl.createSelectOption('ruxuenian', formval, '/kaoshi/kscy/grade', 'ruxuenian', 'nianjiname'); - // } - - // // 添加学科 - // function addBanji(){ - // // 获取参数 - // formval = form.val("myform"); - // console.log(formval); - // cjgl.createCheckbox('banji_id', formval, '/kaoshi/kscy/class', 'banji_id', 'banTitle'); - // } - - - // // 添加学校 - // function addSubject(){ - // // 获取参数 - // formval = form.val("myform"); - // cjgl.createCheckbox('subject_id', formval, '/kaoshi/kscy/subject', 'subject_id', 'title'); - // } - - - // // 搜索教师 - // $('#admin_id').bind({ - // keyup:function(){ - // var val = $.trim($(this).val()); - // if(val.length>0){ - // cjgl.searchTeacher(this, val, 'admin_id[]', 'addTeacher'); - // } - // }, - // }) - }); diff --git a/public/static/x-admin2.2/js/createInput.js b/public/static/x-admin2.2/js/createInput.js index 1b5c38e2..3159330b 100644 --- a/public/static/x-admin2.2/js/createInput.js +++ b/public/static/x-admin2.2/js/createInput.js @@ -46,44 +46,89 @@ layui.extend({ }); }, + // 选中checkbox - checkboxChecked: function(data) { - pid = $(data.elem).attr('pid'); + checkboxCheckedAuth: function(data) { + pid = $(data.elem).attr('pid'); cid = $(data.elem).attr('cid'); check = data.elem.checked; editCid(cid, check); editPid(pid, check); function editCid(cid, check) { - myInput = $(data.elem).siblings("input[pid='" + cid + "']"); - myInput.each(function(i, el) { + $("input[pid='" + cid + "']").each(function(i, el) { this.checked = check; cid = $(this).attr('cid'); editCid(cid, check); }); - return false; } function editPid(pid, check) { - myInput = $(data.elem).siblings("input[pid='" + pid + "']"); if (check == true) { - myInput.each(function(i, el) { + $("input[cid='" + pid + "']").each(function(i, el) { this.checked = check; pid = $(this).attr('pid'); - console.log(pid); editPid(pid, check); }); } else { - myCid = $(data.elem).siblings("input[pid='" + pid + "']"); - cnt = myInput.length; + cnt = $("input[pid='" + pid + "']:checked").length; if (cnt == 0) { - myInput.each(function(i, el) { + $("input[cid='" + pid + "']").each(function(i, el) { this.checked = check; pid = $(this).attr('pid'); editPid(pid, check); }); } } + } + + form.render('checkbox'); + + }, + + + // 选中checkbox + checkboxChecked: function(data) { + check = data.elem.checked; + editCid(data.elem, check); + editPid(data.elem, check); + + function editCid(elem, check) { + cid = $(elem).attr("cid"); + if(typeof(cid)!="undefined") + { + myCid = $(elem).siblings("input[pid='" + cid + "']"); + layui.each(myCid, function(i, el){ + this.checked = check; + // editCid(el); + }) + } + return false; + } + + function editPid(elem, check) { + pid = $(elem).attr("pid"); + if(typeof(pid)!="undefined") + { + cid = $(elem).attr("cid"); + myPid = $(elem).siblings("input[cid='" + pid + "']"); + if(check == true) + { + layui.each(myPid, function(i, el){ + this.checked = check; + // editPid(el, check); + }) + }else{ + myTongji = $(elem).siblings("input[pid='" + pid + "']:checked"); + if(myTongji.length == 0) + { + layui.each(myPid, function(i, el){ + this.checked = check; + // editPid(el, check); + }) + } + } + } return false; }