From ec03c5fb6b6619e1cbb1019bf38ef66328e131e7 Mon Sep 17 00:00:00 2001 From: hdm Date: Sun, 28 Nov 2021 17:05:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=BB=86=E8=8A=82=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/home/BaseController.php | 5 +++ app/home/controller/Admin.php | 16 ++++----- app/home/view/admin/edit_password.html | 45 ++++++++++++++------------ app/home/view/plan/calendar.html | 2 +- app/home/view/plan/index.html | 6 ++-- app/home/view/schedule/calendar.html | 2 +- 6 files changed, 42 insertions(+), 34 deletions(-) diff --git a/app/home/BaseController.php b/app/home/BaseController.php index 48764ac..552d19d 100644 --- a/app/home/BaseController.php +++ b/app/home/BaseController.php @@ -89,6 +89,11 @@ abstract class BaseController View::assign('login_user', $this->uid); // 验证用户访问权限 if ($this->controller !== 'index' && $this->controller !== 'api') { + $reg_pwd = Db::name('Admin')->where(['id' => $this->uid])->value('reg_pwd'); + if($reg_pwd!==''){ + redirect('/home/api/edit_password.html')->send(); + exit; + } if (!$this->checkAuth()) { if ($this->request->isAjax()) { return to_assign(202, '你没有权限,请联系管理员或者人事部'); diff --git a/app/home/controller/Admin.php b/app/home/controller/Admin.php index 0d67886..b8e121b 100644 --- a/app/home/controller/Admin.php +++ b/app/home/controller/Admin.php @@ -67,6 +67,10 @@ class Admin extends BaseController $username = $pinyin->name($param['name'], PINYIN_UMLAUT_V); $param['username'] = implode('', $username); if (!empty($param['id']) && $param['id'] > 0) { + $count = Db::name('Admin')->where([['username', '=', $param['username']], ['id', '<>', $param['id']]])->count(); + if ($count > 0) { + $param['username'] = implode('', $username) . $count; + } try { validate(AdminCheck::class)->scene('edit')->check($param); } catch (ValidateException $e) { @@ -76,10 +80,6 @@ class Admin extends BaseController // 启动事务 Db::startTrans(); try { - $count = Db::name('Admin')->where([['username', '=', $param['username']], ['id', '<>', $param['id']]])->count(); - if ($count > 0) { - $param['username'] = implode('', $username) . $count; - } Db::name('Admin')->where(['id' => $param['id']])->strict(false)->field(true)->update($param); if (!isset($param['thumb']) || $param['thumb'] == '') { $char = mb_substr($param['name'], 0, 1, 'utf-8'); @@ -97,16 +97,16 @@ class Admin extends BaseController return to_assign(1, '提交失败:' . $e->getMessage()); } } else { + $count = Db::name('Admin')->where('username', $param['username'])->count(); + if ($count > 0) { + $param['username'] = implode('', $username) . $count; + } try { validate(AdminCheck::class)->scene('add')->check($param); } catch (ValidateException $e) { // 验证失败 输出错误信息 return to_assign(1, $e->getError()); } - $count = Db::name('Admin')->where('username', $param['username'])->count(); - if ($count > 0) { - $param['username'] = implode('', $username) . $count; - } $param['salt'] = set_salt(20); $param['pwd'] = set_password($param['reg_pwd'], $param['salt']); // 启动事务 diff --git a/app/home/view/admin/edit_password.html b/app/home/view/admin/edit_password.html index d56aeff..e66d710 100644 --- a/app/home/view/admin/edit_password.html +++ b/app/home/view/admin/edit_password.html @@ -2,27 +2,30 @@ {block name="body"}
-

重置密码

- - - - - - - - - - - - - -
旧密码* - - 用户名{$admin.username}
新密码 * - - 确认新密码 * - -
+ {notempty name="$admin.reg_pwd"} +
初始化密码才能正常使用系统
+ {/notempty} +

重置密码

+ + + + + + + + + + + + + +
旧密码* + + 用户名{$admin.username}
新密码 * + + 确认新密码 * + +
diff --git a/app/home/view/plan/calendar.html b/app/home/view/plan/calendar.html index 45c6092..d5f010f 100644 --- a/app/home/view/plan/calendar.html +++ b/app/home/view/plan/calendar.html @@ -85,7 +85,7 @@ detail['start_time_a']=''; detail['end_time_a']=''; detail['start_time_b']='08:30'; - detail['end_time_b']='09:00'; + detail['end_time_b']='18:00'; detail['remark']=''; detail['type']=0; detail['remind_type']=0; diff --git a/app/home/view/plan/index.html b/app/home/view/plan/index.html index 6eb8e94..da028f4 100644 --- a/app/home/view/plan/index.html +++ b/app/home/view/plan/index.html @@ -72,8 +72,8 @@ ids: ids, names: names, type: 0, - department_url:"{:url('/home/api/get_department_tree')}", - employee_url:"{:url('/home/api/get_employee')}", + department_url:"{:url('home/api/get_department_tree')}", + employee_url:"{:url('home/api/get_employee')}", callback: function (ids, names, dids, departments) { $('[name="uid"]').val(ids); that.val(names); @@ -235,7 +235,7 @@ detail['start_time_a']=''; detail['end_time_a']=''; detail['start_time_b']='08:30'; - detail['end_time_b']='09:00'; + detail['end_time_b']='18:00'; detail['remark']=''; detail['type']=0; detail['remind_type']=0; diff --git a/app/home/view/schedule/calendar.html b/app/home/view/schedule/calendar.html index 671343f..9e05f01 100644 --- a/app/home/view/schedule/calendar.html +++ b/app/home/view/schedule/calendar.html @@ -211,7 +211,7 @@ } console.log(detail); $.ajax({ - url:"{:url('home/schedule/save')}", + url:"{:url('home/schedule/add')}", type:'post', data:detail, success:function(e){