diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index a43c149d..c2035e46 100755 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -406,13 +406,13 @@ class Index extends AdminBase { if($src['id'] > 0) { - + if($src['id'] == $list->id){ $data = ['msg' => '', 'val' => 1]; } } }else{ - $data = ['msg' => '', 'val' => 1]; + $data = ['msg' => '', 'val' => 1]; } return json($data); } @@ -436,20 +436,20 @@ class Index extends AdminBase $ad = new AD(); $list = $ad->where('phone', $src['searchval']) ->find(); - + // 根据更新结果设置返回提示信息 $data = ['msg' => '电话号码已经存在!', 'val' => 0]; if($list) { if($src['id'] > 0) { - + if($src['id'] == $list->id){ $data = ['msg' => '', 'val' => 1]; } } }else{ - $data = ['msg' => '', 'val' => 1]; + $data = ['msg' => '', 'val' => 1]; } return json($data); } diff --git a/app/admin/view/index/tongji.html b/app/admin/view/index/tongji.html index bde1c26d..4e022264 100644 --- a/app/admin/view/index/tongji.html +++ b/app/admin/view/index/tongji.html @@ -1,8 +1,9 @@ {extend name=".././view/create.html" /} {block name="form"} -
- 将教师信息同步到管理员表说明:1、教师信息与管理员信息已经有关联cj_admin表中teacher_id字段:使用教师信息替换管理员信息(不包括密码);2、教师与管理员信息未关联:在管理员表中创建教师信息。帐号为手机号,密码为原密码。原来cj_admin表中数据不变。 +
+ 同步前先看说明。
+
diff --git a/app/student/controller/Index.php b/app/student/controller/Index.php index 92b7faf3..007a9ad2 100755 --- a/app/student/controller/Index.php +++ b/app/student/controller/Index.php @@ -645,4 +645,42 @@ class Index extends AdminBase } + + // 查询用户名是否重复 + public function srcSfzh() + { + // 获取参数 + $srcfrom = $this->request + ->only([ + 'searchval' => '' + ,'id' + ], 'POST'); + $src = [ + 'searchval' => '' + ,'id' => '' + ]; + $src = array_cover($srcfrom, $src); + + $stu = new STU(); + $list = $stu->where('shenfenzhenghao', $src['searchval']) + ->find(); + + // 根据更新结果设置返回提示信息 + $data = ['msg' => '身份证号已经存在!', 'val' => 0]; + if($list) + { + if($src['id'] > 0) + { + + if($src['id'] == $list->id){ + $data = ['msg' => '', 'val' => 1]; + } + } + }else{ + $data = ['msg' => '', 'val' => 1]; + } + return json($data); + } + + } diff --git a/app/student/route/student.php b/app/student/route/student.php index aa8cb4f8..551944ec 100755 --- a/app/student/route/student.php +++ b/app/student/route/student.php @@ -34,6 +34,7 @@ Route::group('index', function () { Route::rule('dellist','Index/delList','get'); # 信息列表 Route::rule('datadel','Index/ajaxdataDel','post'); # 获取数据 Route::rule('resetpassword/','Index/resetpassword','post'); # 重置教师密码 + Route::rule('srcsfzh','Index/srcSfzh','post'); # 获取学生成绩 }); diff --git a/app/student/view/index/create.html b/app/student/view/index/create.html index 73e9348d..685d37b7 100755 --- a/app/student/view/index/create.html +++ b/app/student/view/index/create.html @@ -30,7 +30,7 @@ *身份证号
- +
@@ -135,18 +135,53 @@ layui.use(['laydate', 'form', 'mytable', 'createInput'], function() { } }) + form.verify({ + //将用户名是否可用作为验证条件 表单提交时触发 + shenfenzhenghao: function(value) { + var datas = { + searchval: value, + id: "{$list.data.shenfenzhenghao|default=''}" + }; + var message = ''; + $.ajax({ + type: "POST", + url: '/student/index/srcsfzh', + async: false, //改为同步请求 + contentType: 'application/json;charset=UTF-8', + data: JSON.stringify(datas), + dataType: 'json', + success: function(data) { + if (data) { + if(data.val == 0){ + message = data.msg + } + } else { + message = data.msg + } + } + }); + //需要注意 需要将返回信息写在ajax方法外 + if (message !== '') + return message; + }, + }) + + + $('#xingming').blur(function() { + var xingming = $('#xingming').val(); + //获取全写拼音(调用js中方法) + var quanpin = pinyin.getFullChars(xingming); + //获取简写拼音(调用js中方法) + var shoupin = pinyin.getCamelChars(xingming); + //给两个文本框赋值 + $('#quanpin').val(quanpin); + $('#shoupin').val(shoupin); + }) + + }); -$('#xingming').blur(function() { - var xingming = $('#xingming').val(); - //获取全写拼音(调用js中方法) - var quanpin = pinyin.getFullChars(xingming); - //获取简写拼音(调用js中方法) - var shoupin = pinyin.getCamelChars(xingming); - //给两个文本框赋值 - $('#quanpin').val(quanpin); - $('#shoupin').val(shoupin); -}) + {/block} diff --git a/view/list.html b/view/list.html index 96e7b985..6974497d 100755 --- a/view/list.html +++ b/view/list.html @@ -88,10 +88,10 @@ options = {