From f23e255619d2f1b9890b35ac2cec5206ce4379e7 Mon Sep 17 00:00:00 2001 From: augushong Date: Thu, 10 Oct 2019 13:20:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E5=B0=91=E6=9D=83=E9=99=90=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Admin.php | 68 +++++++++++++++++-- app/admin/controller/File.php | 2 +- app/admin/middleware.php | 1 + app/middleware/PermissionAuth.php | 11 +++ app/model/User.php | 5 ++ .../20190822043811_create_table_admin.php | 1 + view/admin/admin/admin_log.html | 7 +- view/admin/admin/create.html | 5 ++ view/admin/admin/edit.html | 5 ++ view/admin/admin/edit_account.html | 5 ++ view/admin/admin/index.html | 7 +- view/admin/admin/password.html | 5 ++ view/admin/admin_group/create.html | 5 ++ view/admin/admin_group/edit.html | 5 ++ view/admin/admin_group/index.html | 7 +- view/admin/admin_permission/index.html | 13 ++-- view/admin/common/_header.html | 14 ++-- view/admin/common/_require.html | 17 +++++ view/admin/common/left_admin.html | 4 +- view/admin/common/left_admin_manage.html | 8 +-- view/admin/common/left_file.html | 2 +- view/admin/common/left_index.html | 2 +- view/admin/common/left_system.html | 4 +- view/admin/common/left_user.html | 2 +- view/admin/common/模板.html | 5 ++ view/admin/file/index.html | 5 ++ view/admin/index/index.html | 7 +- view/admin/system/index.html | 5 ++ view/admin/system/others.html | 5 ++ view/admin/user/create.html | 5 ++ view/admin/user/edit.html | 7 +- view/admin/user/index.html | 5 ++ 32 files changed, 214 insertions(+), 35 deletions(-) create mode 100644 app/middleware/PermissionAuth.php diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index 91ff79e..db935eb 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -9,12 +9,19 @@ use app\UploadFiles as AppUploadFiles; use think\facade\View; use think\helper\Str; +/** + * 管理员账号管理 + */ class Admin extends Common { + /** + * 当前登录的管理员编辑账户 + * + * @return void + */ public function edit() { - $model_admin = AppAdmin::find($this->adminInfo['id']); View::assign('admin',$model_admin); @@ -22,11 +29,21 @@ class Admin extends Common return View::fetch(); } + /** + * 当前登录的管理员修改密码 + * + * @return void + */ public function password() { return View::fetch(); } + /** + * 当前登陆的管理员保存修改密码 + * + * @return void + */ public function passwordUpdate() { @@ -54,6 +71,11 @@ class Admin extends Common } + /** + * 当前登陆的管理员更新账户 + * + * @return void + */ public function update() { $post_data = $this->request->post(); @@ -64,7 +86,6 @@ class Admin extends Common AppUploadFiles::use($post_data['avatar']); } - $model_admin->data($post_data); $model_admin->save(); @@ -72,14 +93,24 @@ class Admin extends Common return $this->success('保存成功','Admin/edit'); } + /** + * 管理员列表 + * + * @return void + */ public function index() { - $admin_list = AppAdmin::where('id','<>',1)->paginate(); + $admin_list = AppAdmin::where('id','<>',1)->order('id desc')->paginate(); View::assign('list',$admin_list); return View::fetch(); } + /** + * 添加管理员账号 + * + * @return void + */ public function create() { @@ -90,6 +121,12 @@ class Admin extends Common return View::fetch(); } + + /** + * 保存添加的管理员账号 + * + * @return void + */ public function save() { $post_data = $this->request->post(); @@ -104,8 +141,7 @@ class Admin extends Common $post_data['password'] = '123456'; } - if($admin_model->getData('avatar') != $post_data['avatar']){ - AppUploadFiles::delete($admin_model->getData('avatar')); + if(!empty($post_data['avatar'])){ AppUploadFiles::use($post_data['avatar']); } @@ -119,6 +155,12 @@ class Admin extends Common } + /** + * 编辑管理员账号 + * + * @param [type] $id + * @return void + */ public function editAccount($id) { $model_admin = AppAdmin::find($id); @@ -128,6 +170,11 @@ class Admin extends Common return View::fetch(); } + /** + * 更新管理员账号 + * + * @return void + */ public function updateAccount() { $post_data = $this->request->post(); @@ -152,6 +199,11 @@ class Admin extends Common } + /** + * 管理员操作日志 + * + * @return void + */ public function adminLog() { @@ -162,6 +214,12 @@ class Admin extends Common return View::fetch(); } + /** + * 删除管理员 + * + * @param [type] $id + * @return void + */ public function delete($id) { AppAdmin::destroy($id); diff --git a/app/admin/controller/File.php b/app/admin/controller/File.php index 6698ecc..5b6c907 100644 --- a/app/admin/controller/File.php +++ b/app/admin/controller/File.php @@ -21,7 +21,7 @@ class File extends Common $type = $this->request->param('type',1); $status = $this->request->param('status',''); - $model_list = UploadFiles::where('type',$type)->order('id desc'); + $model_list = UploadFiles::withTrashed()->where('type',$type)->order('id desc'); if($status != ''){ $model_list->where('status',$status); diff --git a/app/admin/middleware.php b/app/admin/middleware.php index a01674a..7c703c7 100644 --- a/app/admin/middleware.php +++ b/app/admin/middleware.php @@ -1,6 +1,7 @@ addColumn('avatar','string',['limit'=>40,'comment'=>'头像地址']); $table->addColumn('create_time','integer',['limit'=>10,'default'=>0,'comment'=>'添加时间']); $table->addColumn('delete_time','integer',['limit'=>10,'default'=>0,'comment'=>'删除时间']); + $table->addColumn('group_id','integer',['limit'=>10,'default'=>0,'comment'=>'管理员组']); $table->addIndex('account'); $table->addIndex('delete_time'); $table->create(); diff --git a/view/admin/admin/admin_log.html b/view/admin/admin/admin_log.html index ec1a4f7..e9d32d5 100644 --- a/view/admin/admin/admin_log.html +++ b/view/admin/admin/admin_log.html @@ -7,6 +7,11 @@ 应用管理 {include file="common/_require"} + + @@ -22,7 +27,7 @@
首页 - 系统信息 + 操作日志
diff --git a/view/admin/admin/create.html b/view/admin/admin/create.html index 01072dc..7613430 100644 --- a/view/admin/admin/create.html +++ b/view/admin/admin/create.html @@ -7,6 +7,11 @@ 基本资料 {include file="common/_require"} + + diff --git a/view/admin/admin/edit.html b/view/admin/admin/edit.html index 31ba850..5c409e6 100644 --- a/view/admin/admin/edit.html +++ b/view/admin/admin/edit.html @@ -6,6 +6,11 @@ 基本资料 {include file="common/_require"} + + diff --git a/view/admin/admin/edit_account.html b/view/admin/admin/edit_account.html index 4d65524..b77064d 100644 --- a/view/admin/admin/edit_account.html +++ b/view/admin/admin/edit_account.html @@ -6,6 +6,11 @@ 应用管理 {include file="common/_require"} + + diff --git a/view/admin/admin/index.html b/view/admin/admin/index.html index fc7e99a..2aa924d 100644 --- a/view/admin/admin/index.html +++ b/view/admin/admin/index.html @@ -5,8 +5,13 @@ - 应用管理 + 管理员管理 {include file="common/_require"} + + diff --git a/view/admin/admin/password.html b/view/admin/admin/password.html index 63e4c52..9684e98 100644 --- a/view/admin/admin/password.html +++ b/view/admin/admin/password.html @@ -6,6 +6,11 @@ 基本资料 {include file="common/_require"} + + diff --git a/view/admin/admin_group/create.html b/view/admin/admin_group/create.html index 9bb429c..f28f5c9 100644 --- a/view/admin/admin_group/create.html +++ b/view/admin/admin_group/create.html @@ -6,6 +6,11 @@ 应用管理 {include file="common/_require"} + + diff --git a/view/admin/admin_group/edit.html b/view/admin/admin_group/edit.html index 1271c02..dd338e9 100644 --- a/view/admin/admin_group/edit.html +++ b/view/admin/admin_group/edit.html @@ -6,6 +6,11 @@ 应用管理 {include file="common/_require"} + + diff --git a/view/admin/admin_group/index.html b/view/admin/admin_group/index.html index 08fe80f..776177d 100644 --- a/view/admin/admin_group/index.html +++ b/view/admin/admin_group/index.html @@ -6,6 +6,11 @@ 应用管理 {include file="common/_require"} + + @@ -20,7 +25,7 @@
diff --git a/view/admin/admin_permission/index.html b/view/admin/admin_permission/index.html index fafbf9c..93dfb02 100644 --- a/view/admin/admin_permission/index.html +++ b/view/admin/admin_permission/index.html @@ -7,6 +7,11 @@ 应用管理 {include file="common/_require"} + + @@ -22,15 +27,11 @@
-
-
-
添加权限
-
-
+
diff --git a/view/admin/common/_header.html b/view/admin/common/_header.html index ca3a0d0..ed53967 100644 --- a/view/admin/common/_header.html +++ b/view/admin/common/_header.html @@ -1,15 +1,15 @@
- +
    -
  • +
  • {$admin.nickname} diff --git a/view/admin/common/_require.html b/view/admin/common/_require.html index 1fb6346..a60a34d 100644 --- a/view/admin/common/_require.html +++ b/view/admin/common/_require.html @@ -17,5 +17,22 @@ var element = layui.element; }); + + $(function(){ + if(typeof currentHeaderNavItem != "undefined"){ + $('.header-nav-item').each(function(i,e){ + if($(e).data('name') == currentHeaderNavItem){ + $(e).addClass('layui-this') + } + }) + } + if(typeof currentLeftNavItem != "undefined"){ + $('.left-nav-item').each(function(i,e){ + if($(e).data('name') == currentLeftNavItem){ + $(e).addClass('layui-this') + } + }) + } + }) {:get_system_config('site_tongji')} \ No newline at end of file diff --git a/view/admin/common/left_admin.html b/view/admin/common/left_admin.html index c65df59..497d780 100644 --- a/view/admin/common/left_admin.html +++ b/view/admin/common/left_admin.html @@ -2,10 +2,10 @@
    diff --git a/view/admin/common/left_admin_manage.html b/view/admin/common/left_admin_manage.html index 45719b0..e072aa9 100644 --- a/view/admin/common/left_admin_manage.html +++ b/view/admin/common/left_admin_manage.html @@ -2,16 +2,16 @@
    diff --git a/view/admin/common/left_file.html b/view/admin/common/left_file.html index cfe0ccb..e7e2970 100644 --- a/view/admin/common/left_file.html +++ b/view/admin/common/left_file.html @@ -6,7 +6,7 @@ 文件管理
    {volist name=":config('upload_type')" id="vo"} -
    {$vo}
    +
    {$vo}
    {/volist}
  • diff --git a/view/admin/common/left_index.html b/view/admin/common/left_index.html index e5d152c..5d186c2 100644 --- a/view/admin/common/left_index.html +++ b/view/admin/common/left_index.html @@ -2,7 +2,7 @@
    diff --git a/view/admin/common/left_system.html b/view/admin/common/left_system.html index 5350d81..c3f6616 100644 --- a/view/admin/common/left_system.html +++ b/view/admin/common/left_system.html @@ -2,10 +2,10 @@
    diff --git a/view/admin/common/left_user.html b/view/admin/common/left_user.html index 922d521..8328982 100644 --- a/view/admin/common/left_user.html +++ b/view/admin/common/left_user.html @@ -2,7 +2,7 @@
    diff --git a/view/admin/common/模板.html b/view/admin/common/模板.html index ff00a3a..24eb354 100644 --- a/view/admin/common/模板.html +++ b/view/admin/common/模板.html @@ -6,6 +6,11 @@ 应用管理 {include file="common/_require"} + + diff --git a/view/admin/file/index.html b/view/admin/file/index.html index d4b4d04..c71020b 100644 --- a/view/admin/file/index.html +++ b/view/admin/file/index.html @@ -7,6 +7,11 @@ 文件管理 {include file="common/_require"} + + diff --git a/view/admin/index/index.html b/view/admin/index/index.html index 8a51eaa..75be70b 100644 --- a/view/admin/index/index.html +++ b/view/admin/index/index.html @@ -4,7 +4,7 @@ - layout 后台大布局 - Layui + {:get_system_config('site_name')} {include file="common/_require"} + + diff --git a/view/admin/system/index.html b/view/admin/system/index.html index b2bad27..9310a49 100644 --- a/view/admin/system/index.html +++ b/view/admin/system/index.html @@ -7,6 +7,11 @@ 系统管理 {include file="common/_require"} + + diff --git a/view/admin/system/others.html b/view/admin/system/others.html index 9c9b48e..a9a9252 100644 --- a/view/admin/system/others.html +++ b/view/admin/system/others.html @@ -7,6 +7,11 @@ 系统管理 {include file="common/_require"} + +