diff --git a/app/admin/controller/AdminInfo.php b/app/admin/controller/AdminInfo.php index 39de322b..6b3aec5e 100644 --- a/app/admin/controller/AdminInfo.php +++ b/app/admin/controller/AdminInfo.php @@ -138,6 +138,16 @@ class AdminInfo extends AdminBase } + public function myQuanxian() + { + $id = session('user_id'); + $ad = new AD; + // $adInfo = $ad->where('id', session('user_id')) + // ->field('zhiwu_id, ') + // ->find(); + } + + // 查询教师荣誉 public function srcRy() { @@ -212,4 +222,74 @@ class AdminInfo extends AdminBase return json($data); } + + + // 修改信息 + public function edit() + { + $id = session('user_id'); + // 获取用户信息 + $list['data'] = AD::where('id', $id) + ->field('id, xingming, quanpin, shoupin, username, shengri, sex, phone, zhiwu_id, zhicheng_id, xueli_id, biye, zhuanye, worktime') + ->with([ + 'adSchool'=>function($query){ + $query->field('id, jiancheng'); + } + ]) + ->find(); + + // 设置页面标题 + $list['set'] = array( + 'webtitle' => '编辑管理员' + ,'butname' => '修改' + ,'formpost' => 'PUT' + ,'url' => '/admin/info/update/' . $id + ); + + // 模板赋值 + $this->view->assign('list', $list); + // 渲染 + return $this->view->fetch('edit'); + } + + + // 更新管理员信息 + public function update($id) + { + // 获取表单数据 + $list = request()->only([ + 'xingming' + ,'quanpin' + ,'shoupin' + ,'username' + ,'shengri' + ,'sex' + ,'phone' + ,'school_id' + ,'zhicheng_id' + ,'xueli_id' + ,'biye' + ,'zhuanye' + ,'worktime' + ], 'PUT'); + $list['id'] = $id; + + // 验证表单数据 + $validate = new \app\admin\validate\Admin; + $result = $validate->scene('infoedit')->check($list); + $msg = $validate->getError(); + if(!$result){ + return json(['msg' => $msg, 'val' => 0]);; + } + + // 更新我的信息 + $admindata = AD::update($list); + + // 根据更新结果设置返回提示信息 + $admindata ? $data = ['msg' => '更新成功', 'val' => 1] + : $data = ['msg' => '数据处理错误', 'val' => 0]; + + // 返回信息 + return json($data); + } } diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 4b433003..d290136a 100755 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -88,14 +88,22 @@ class Index extends AdminBase // 获取表单数据 $list = request()->only([ 'xingming' - ,'school_id' + ,'quanpin' + ,'shoupin' ,'username' - ,'teacher_id' - ,'sex' ,'shengri' + ,'sex' ,'phone' - ,'beizhu' + ,'school_id' ,'group_id' + ,'zhiwu_id' + ,'zhicheng_id' + ,'xueli_id' + ,'biye' + ,'zhuanye' + ,'worktime' + ,'tuixiu' + ,'beizhu' ], 'POST'); // 设置密码,默认为123456 @@ -104,7 +112,7 @@ class Index extends AdminBase // 验证表单数据 $validate = new \app\admin\validate\Admin; - $result = $validate->check($list); + $result = $validate->scene('admincreate')->check($list); $msg = $validate->getError(); if(!$result){ return json(['msg' => $msg, 'val' => 0]);; @@ -128,7 +136,7 @@ class Index extends AdminBase { // 获取用户信息 $list['data'] = AD::where('id',$id) - ->field('id, school_id, username, xingming, teacher_id, sex, shengri, phone, beizhu') + ->field('id, xingming, quanpin, shoupin, username, shengri, sex, phone, school_id, zhiwu_id, zhicheng_id, xueli_id, biye, zhuanye, worktime, tuixiu, beizhu') ->with([ 'adSchool'=>function($query){ $query->field('id, jiancheng'); @@ -160,14 +168,22 @@ class Index extends AdminBase // 获取表单数据 $list = request()->only([ 'xingming' - ,'school_id' + ,'quanpin' + ,'shoupin' ,'username' - ,'teacher_id' - ,'sex' ,'shengri' + ,'sex' ,'phone' + ,'school_id' + ,'group_id' => array() + ,'zhiwu_id' + ,'zhicheng_id' + ,'xueli_id' + ,'biye' + ,'zhuanye' + ,'worktime' + ,'tuixiu' ,'beizhu' - ,'group_id' ], 'PUT'); $list['id'] = $id; @@ -175,7 +191,7 @@ class Index extends AdminBase // 验证表单数据 $validate = new \app\admin\validate\Admin; - $result = $validate->check($list); + $result = $validate->scene('adminedit')->check($list); $msg = $validate->getError(); if(!$result){ return json(['msg' => $msg, 'val' => 0]);; @@ -309,7 +325,7 @@ class Index extends AdminBase $teacherinfo = \app\facade\File::readXls(public_path() . 'uploads/' . $list['url']); // 判断表格是否正确 - if("教师基本情况表" != $teacherinfo[0][0] || '姓名*' != $teacherinfo[2][1] || '性别*' != $teacherinfo[2][2]) + if("教师基本情况表" != $teacherinfo[0][0] || '姓名*' != $teacherinfo[2][1] || '帐号*' != $teacherinfo[2][2]) { $this->error('请使用模板上传', '/login/err'); return json($data); diff --git a/app/admin/controller/Tongbu.php b/app/admin/controller/Tongbu.php index 3461df1f..13964ec6 100644 --- a/app/admin/controller/Tongbu.php +++ b/app/admin/controller/Tongbu.php @@ -1,14 +1,12 @@ $value) { - $phone = str_replace(' ', '', $value[4]); + $phone = str_replace(' ', '', $value[5]); + $temp = $this->wherePhone($phone)->find(); + if($temp) + { + continue; + } + $temp = $this->whereUsername(trim($value[2]))->find(); + if($temp) + { + continue; + } $teacherlist[$i]['xingming'] = $value[1]; - $teacherlist[$i]['sex'] = $this->cutStr($value[2]); - $teacherlist[$i]['shengri'] = $value[3]; + $teacherlist[$i]['username'] = $value[2]; + $teacherlist[$i]['sex'] = $this->cutStr($value[3]); + $teacherlist[$i]['shengri'] = $value[4]; $teacherlist[$i]['phone'] = $phone; - $teacherlist[$i]['worktime'] = $value[5]; - $teacherlist[$i]['zhiwu_id'] = $this->cutStr($value[6]); - $teacherlist[$i]['zhicheng_id'] = $this->cutStr($value[7]); + $teacherlist[$i]['worktime'] = $value[6]; + $teacherlist[$i]['zhiwu_id'] = $this->cutStr($value[7]); + $teacherlist[$i]['zhicheng_id'] = $this->cutStr($value[8]); $teacherlist[$i]['school_id'] = $School_id; $teacherlist[$i]['biye'] = $value[9]; - $teacherlist[$i]['subject_id'] = $this->cutStr($value[8]); - $teacherlist[$i]['zhuanye'] = $value[9]; + $teacherlist[$i]['zhuanye'] = $value[10]; $teacherlist[$i]['xueli_id'] = $this->cutStr($value[11]); $quanpin = $pinyin->sentence($value[1]); $jianpin = $pinyin->abbr($value[1]); $teacherlist[$i]['quanpin'] = trim(strtolower(str_replace(' ', '', $quanpin))); $teacherlist[$i]['shoupin'] = trim(strtolower($jianpin)); - $teacherlist[$i]['username'] = $teacherlist[$i]['quanpin'] .'.'. \app\facade\Tools::sjStr(3); - $temp = $this->whereOrPhone($phone)->find(); - if($temp) - { - if($temp->delete_time > 0) - { - $temp->restore(); - } - $teacherlist[$i]['id'] = $temp->id; - } $i++; } - - // 查找相同值,如果重复则重新命名。 - $teacherlist = \app\facade\Tools::sortArrByManyField($teacherlist,'username'); - foreach ($teacherlist as $key => $value) { - if ($key > 1) { - if($value['username'] == $teacherlist[$key-1]['username']){ - $teacherlist[$key]['username'] = $teacherlist[$key]['quanpin'] .'.'. \app\facade\Tools::sjStr(4); - }else{ - break; - } - } - } - $teacherlist = array_filter($teacherlist, function($q){ ## 过滤姓名、身份证号或班级为空的数据 - return $q['xingming'] != null && $q['sex'] != null && $q['zhiwu_id'] != null && $q['zhicheng_id'] != null && $q['subject_id'] != null && $q['xueli_id'] != null; + return $q['xingming'] != null && $q['username'] != null && $q['sex'] != null && $q['zhiwu_id'] != null && $q['zhicheng_id'] != null && $q['xueli_id'] != null; }); // 保存或更新信息 @@ -313,7 +300,7 @@ class Admin extends BaseModel // 退休获取器 public function getTuixiuAttr($value) { - $sex = array('0' => '退休', '1' => '在职'); + $sex = array('0' => '在职', '1' => '退休'); $str = ''; if(isset($sex[$value])) { diff --git a/app/admin/route/admin.php b/app/admin/route/admin.php index 813c662e..b9a60acb 100755 --- a/app/admin/route/admin.php +++ b/app/admin/route/admin.php @@ -91,4 +91,6 @@ Route::group('info', function () { Route::rule('srcry','AdminInfo/srcRy','post'); # 查询荣誉 Route::rule('srckt','AdminInfo/srcKt','post'); # 查询课题 Route::rule('srcbzr','AdminInfo/srcBzr','post'); # 查询课题 + Route::rule('edit', 'AdminInfo/edit', 'get'); # 修改信息 + Route::rule('update/', 'AdminInfo/update', 'put'); # 更新信息 }); diff --git a/app/admin/validate/Admin.php b/app/admin/validate/Admin.php index 64a05c6e..f21d9a7d 100755 --- a/app/admin/validate/Admin.php +++ b/app/admin/validate/Admin.php @@ -13,14 +13,24 @@ class Admin extends Validate * @var array */ protected $rule = [ + 'id|用户编号' => 'require:number', 'xingming|用户姓名' => 'require|chs|length:2,6', + 'quanpin|姓名全拼' => 'require|alpha|length:1,30', + 'shoupin|姓名首拼' => 'require|alpha|length:1,5', 'username|帐号' => ['require', 'uset'=>'/^[a-z][a-z0-9-_]*$/'], - 'teacher_id|用户编号' => 'require|number|length:1,11', 'group_id|角色' => 'require|array', 'shengri|出生日期' => 'date', - 'xingbie|性别' => 'in:0,1,2', + 'sex|性别' => 'in:0,1,2', 'phone|手机' => 'mobile', 'beizhu|备注' => 'max:80', + 'zhiwu_id|职务' => 'number', + 'zhicheng_id|职称' => 'number', + 'xueli_id|学历' => 'number', + 'biye|毕业院校' => 'length:1,50', + 'zhuanye|专业' => 'length:1,20', + 'worktime|参加工作时间' => 'date', + 'tuixiu|退休' => 'require|number|max:2', + 'beizhu|备注' => 'max:80', ]; /** @@ -30,4 +40,59 @@ class Admin extends Validate * @var array */ protected $message = []; + + protected $scene = [ + 'admincreate' => [ + 'xingming' + ,'username' + ,'shoupin' + ,'quanpin' + ,'group_id' + ,'shengri' + ,'sex' + ,'phone' + ,'beizhu' + ,'zhiwu_id' + ,'zhicheng_id' + ,'xueli_id' + ,'biye' + ,'zhuanye' + ,'worktime' + ,'tuixiu' + ], + 'adminedit' => [ + 'id' + ,'xingming' + ,'username' + ,'shoupin' + ,'quanpin' + ,'group_id' + ,'shengri' + ,'sex' + ,'phone' + ,'beizhu' + ,'zhiwu_id' + ,'zhicheng_id' + ,'xueli_id' + ,'biye' + ,'zhuanye' + ,'worktime' + ,'tuixiu' + ], + 'infoedit' => [ + 'id' + ,'xingming' + ,'username' + ,'shoupin' + ,'quanpin' + ,'shengri' + ,'sex' + ,'phone' + ,'zhicheng_id' + ,'xueli_id' + ,'biye' + ,'zhuanye' + ,'worktime' + ], + ]; } diff --git a/app/admin/view/admin_info/edit.html b/app/admin/view/admin_info/edit.html new file mode 100644 index 00000000..bebac3ac --- /dev/null +++ b/app/admin/view/admin_info/edit.html @@ -0,0 +1,207 @@ +{extend name=".././view/create.html" /} +{block name="jscss"} + +{load href="__STATIC__/Convert_Pinyin.js" /} +{/block} +{block name="form"} +
+
+ +
+ +
+
+
+
+ +
+ +
+
+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ {php} $category = categoryChildren(106);{/php} + +
+
+
+ +
+ {php} $category = categoryChildren(105);{/php} + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+{/block} + +{block name="myjs"} + +{/block} + diff --git a/app/admin/view/auth_group/index.html b/app/admin/view/auth_group/index.html index 772997ee..ae4a1c12 100755 --- a/app/admin/view/auth_group/index.html +++ b/app/admin/view/auth_group/index.html @@ -47,6 +47,7 @@ // 设置列 options.cols=[[ //表头 {type:'checkbox', fixed: 'left'}, + {field: 'id', title: 'ID',sort: true}, {field: 'title', title: '名称',sort: true, minWidth:240}, {field: "miaoshu",title: '描述',sort: true}, {field: 'status', title: '状态',templet:'#status', sort: true}, diff --git a/app/admin/view/index/create.html b/app/admin/view/index/create.html index 852de115..132d09e0 100755 --- a/app/admin/view/index/create.html +++ b/app/admin/view/index/create.html @@ -24,6 +24,7 @@ padding-top: 10px; } +{load href="__STATIC__/Convert_Pinyin.js" /} {/block} {block name="form"}
@@ -33,65 +34,31 @@
+ autocomplete="off" class="layui-input " value="{$list.data.xingming|default=''}" placeholder="中文2-25个字符" onBlur="convertName()">
+
+
+ +
+ +
+
+ +
+
+
+ autocomplete="off" class="layui-input" value="{$list.data.username|default=''}" placeholder="由字母、数字-_组成 6-12个字符">
-
- -
- -
-
-
- -
- {php} $schlist = danweiJibie('校级', '区级');{/php} - -
-
-
- -
- {php} - $authgroup = new \app\admin\model\AuthGroup; - $authgrouplist = $authgroup->where('status',1)->select(); - {/php} - {volist name="authgrouplist" id="vo"} - - {/volist} - -
-
+
+ +
+ {php} $schlist = danweiJibie('校级', '区级');{/php} + +
+
+
+ +
+ {php} + $authgroup = new \app\admin\model\AuthGroup; + $authgrouplist = $authgroup->where('status',1)->select(); + {/php} + {volist name="authgrouplist" id="vo"} + + {/volist} + +
+
+
+ +
+ {php} $category = categoryChildren(107);{/php} + +
+
+
+ +
+ {php} $category = categoryChildren(106);{/php} + +
+
+
+ +
+ {php} $category = categoryChildren(105);{/php} + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ {if (isset($list.data.tuixiu)) } + + + + {else /} + + + {/if} +
+
- +
-
- -
{/block} @@ -159,16 +263,24 @@ ,trigger: 'click' //采用click弹出 ,format: 'yyyy-M-d' //可任意组合 }); + //参加工作时间 + laydate.render({ + elem: '#worktime' //指定元素 + ,trigger: 'click' //采用click弹出 + }); }); - var cjgl = parent.layui.cjgl; - // 搜索教师 - $('#teacher_id').bind({ - keyup:function(){ - var val = $.trim($(this).val()); - cjgl.searchTeacherOld(this, val, 'teacher_id', 'addTeacherID'); - }, - }); + function convertName(){ + 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/app/base/controller/AdminBase.php b/app/base/controller/AdminBase.php index 5c564089..543e1eae 100755 --- a/app/base/controller/AdminBase.php +++ b/app/base/controller/AdminBase.php @@ -4,7 +4,6 @@ namespace app\base\controller; // 引用控制器基类 use app\BaseController; - /** * 控制器基础类 */ @@ -26,7 +25,7 @@ abstract class AdminBase extends BaseController $this->online = session('onlineCategory'); if($this->online != 'admin') { - \app\facade\OnLine::jump('/login', '请使用管理员帐号登录'); + \app\facade\OnLine::jump('/login', '请使用教师帐号登录'); } } } diff --git a/app/event/MyEvent.php b/app/event/MyEvent.php index 4a10f60b..ac321614 100755 --- a/app/event/MyEvent.php +++ b/app/event/MyEvent.php @@ -52,4 +52,13 @@ class MyEvent return $data; } + + // 获取考试状态 + public function userInfo() + { + $ad = new AdminInfo; + $adinfo = $kaoshi->myInfo(); + return $adinfo; + } + } diff --git a/app/index/view/index/index.html b/app/index/view/index/index.html index 3c85bbbf..d0d16642 100755 --- a/app/index/view/index/index.html +++ b/app/index/view/index/index.html @@ -71,6 +71,9 @@
个人信息
+
+ + 修改信息
diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php index 48b0f530..60cb6e8c 100755 --- a/app/middleware/Auth.php +++ b/app/middleware/Auth.php @@ -27,6 +27,7 @@ class Auth }else{ $admin = false; } + // 获取当前地址 $mod = strtolower(app('http')->getName()); @@ -34,6 +35,8 @@ class Auth $act = strtolower($request->action()); $url = $mod.'/'.$con.'/'.$act; + // dump($admin); + // halt($url); // 排除应用 $uneed_m = array('index'); @@ -60,6 +63,8 @@ class Auth 'admin/admininfo/srcry', # 获取当前教师荣誉列表 'admin/admininfo/srckt', # 获取当前教师课题列表 'admin/admininfo/srcbzr', # 获取当前教师担任班主任情况列表 + 'admin/admininfo/edit', # 修改自己信息 + 'admin/admininfo/update', # 更新自己信息 // Teach应用 'teach/banji/mybanji', # 获取班级数据 'teach/banji/banjilist', # 获取班级数据 diff --git a/app/middleware/Login.php b/app/middleware/Login.php index 5f757e6f..87b16010 100755 --- a/app/middleware/Login.php +++ b/app/middleware/Login.php @@ -17,7 +17,10 @@ class Login public function handle($request, \Closure $next) { $category = session('onlineCategory'); - $ya = 0; + $yz = [ + 'val' => 0 + ,'msg' => '已经掉线啦~' + ]; switch ($category) { case 'admin': $yz = yz::admin(session('username'), session('password')); diff --git a/app/middleware/Online.php b/app/middleware/Online.php index 8c8c195a..69cbfa4a 100755 --- a/app/middleware/Online.php +++ b/app/middleware/Online.php @@ -14,7 +14,6 @@ class Online */ public function handle($request, \Closure $next) { - $weihu = config('shangma.weihu'); // 判断是否在线,如果不在线则跳转 $online = session('?onlineCategory'); diff --git a/app/tools/controller/File.php b/app/tools/controller/File.php index 3c2ffcad..a49bbe22 100755 --- a/app/tools/controller/File.php +++ b/app/tools/controller/File.php @@ -13,11 +13,6 @@ use PhpOffice\PhpSpreadsheet\IOFactory; class File extends BaseController { - - // 初始化变量 - protected function initialize() - { - /** * 获取文件信息并保存 * @@ -39,7 +34,7 @@ class File extends BaseController if($serFile) { - $serFile->user_id = $this->luruTeacherId; + $serFile->user_id = session('user_id'); $serFile->save(); $data['msg'] = '文件已经存在'; $data['val'] = true; diff --git a/database/seeds/Category.php b/database/seeds/Category.php index ad02549b..fa499234 100755 --- a/database/seeds/Category.php +++ b/database/seeds/Category.php @@ -277,6 +277,7 @@ class Category extends Seeder // 课题或荣誉角色 ['id' => 12101,'title' => '班级统计','p_id' => 121,'paixu' => 1,'isupdate' => 0], ['id' => 12102,'title' => '班级排序','p_id' => 121,'paixu' => 2,'isupdate' => 0], + // 统计项目 ['id' => 122 ,'title' => '统计项目' ,'p_id' => 0 @@ -296,6 +297,18 @@ class Category extends Seeder ['id' => 12210,'title' => '管理员-学生成绩列表-下载左','p_id' => 122,'paixu' => 10,'isupdate' => 0], ['id' => 12211,'title' => '管理员-学生成绩列表-成绩条(学生)','p_id' => 122,'paixu' => 10,'isupdate' => 0], ['id' => 12212,'title' => '管理员-学生成绩列表-成绩条(班级)','p_id' => 122,'paixu' => 10,'isupdate' => 0], + // 教师评语 + ['id' => 123 + ,'title' => '教师评语' + ,'p_id' => 0 + ,'paixu' => 23 + ,'isupdate' => 0 + ], + // 教师评语 + ['id' => 12301,'title' => '学年评语','p_id' => 123,'paixu' => 1,'isupdate' => 0], + ['id' => 12302,'title' => '学期评语','p_id' => 123,'paixu' => 1,'isupdate' => 0], + ['id' => 12303,'title' => '月评语','p_id' => 123,'paixu' => 1,'isupdate' => 0], + ['id' => 12304,'title' => '周评语','p_id' => 123,'paixu' => 1,'isupdate' => 0], ]; $serRows = $this->fetchAll('select * from cj_category'); diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index c9fecda6..ab2a04fb 100755 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -1300,12 +1300,12 @@ class Rule extends Seeder ,'paixu' => 1 ,'pid' => 705 ], - ['id' => 70502 - ,'title' => '初始化' - ,'name' => 'system/systembase/resetmayi' - ,'paixu' => 2 - ,'pid' => 705 - ], + // ['id' => 70502 + // ,'title' => '初始化' + // ,'name' => 'system/systembase/resetmayi' + // ,'paixu' => 2 + // ,'pid' => 705 + // ], ['id' => 706 ,'title' => '统计项目' ,'name' => 'kaoshi/tongjixiangmu/index' diff --git a/public/uploads/admin/AdminInfo.xlsx b/public/uploads/admin/AdminInfo.xlsx index cfc2a7d5..b2038ff8 100644 Binary files a/public/uploads/admin/AdminInfo.xlsx and b/public/uploads/admin/AdminInfo.xlsx differ