From 3da0058ac2ee8bf28a770db95cfbc94f60a6b53c Mon Sep 17 00:00:00 2001 From: toogee Date: Thu, 2 Apr 2020 23:41:48 +0800 Subject: [PATCH] admin auth --- app/admin/controller/Admin.php | 29 +-- app/admin/controller/AuthAccess.php | 146 +++++++++++ app/admin/controller/Forum.php | 21 +- app/admin/controller/Set.php | 27 +- app/admin/model/AuthGroupAccess.php | 17 ++ app/install/data/taoler.sql | 34 ++- public/static/admin/modules/appset.js | 1 - public/static/admin/modules/contlist.js | 9 +- public/static/admin/modules/forum.js | 4 +- public/static/admin/modules/useradmin.js | 104 +++++++- public/static/admin/modules/webset.js | 10 +- view/admin/admin/add.html | 9 - view/admin/admin/edit.html | 10 - view/admin/admin/index.html | 21 +- view/admin/auth_access/add.html | 44 ++++ view/admin/auth_access/edit.html | 47 ++++ view/admin/auth_access/index.html | 192 ++++++++++++++ view/admin/auth_group/edit-1.html | 119 --------- view/admin/auth_group/role.html | 11 +- view/admin/auth_rule/index.html | 26 +- view/admin/authgroup/edit.html | 119 --------- view/admin/authgroup/role-1.html | 164 ------------ view/admin/authgroup/role.html | 164 ------------ view/admin/authgroup/roleadd.html | 101 -------- view/admin/authgroup/roleedit-1.html | 154 ----------- view/admin/authgroup/roleedit.html | 129 ---------- view/admin/authrule/add.html | 65 ----- view/admin/authrule/edit.html | 68 ----- view/admin/authrule/index.html | 310 ----------------------- view/admin/forum/list.html | 8 +- view/admin/forum/replys.html | 7 +- view/admin/forum/tags.html | 61 ++++- view/admin/notice/index.html | 8 +- view/admin/set/system/server.html | 119 ++------- view/admin/set/system/website.html | 256 ++++++++++++------- view/admin/set/user/info.html | 6 +- view/admin/set/user/repass.html | 4 + view/admin/upgrade/index.html | 10 +- view/admin/user/list.html | 50 ++-- 39 files changed, 949 insertions(+), 1735 deletions(-) create mode 100644 app/admin/controller/AuthAccess.php create mode 100644 app/admin/model/AuthGroupAccess.php create mode 100644 view/admin/auth_access/add.html create mode 100644 view/admin/auth_access/edit.html create mode 100644 view/admin/auth_access/index.html delete mode 100644 view/admin/auth_group/edit-1.html delete mode 100644 view/admin/authgroup/edit.html delete mode 100644 view/admin/authgroup/role-1.html delete mode 100644 view/admin/authgroup/role.html delete mode 100644 view/admin/authgroup/roleadd.html delete mode 100644 view/admin/authgroup/roleedit-1.html delete mode 100644 view/admin/authgroup/roleedit.html delete mode 100644 view/admin/authrule/add.html delete mode 100644 view/admin/authrule/edit.html delete mode 100644 view/admin/authrule/index.html diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index 3d7e2f9..e45cb5e 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -25,13 +25,11 @@ class Admin extends AdminController public function index() { if(Request::isAjax()){ - $data = Request::only(['id','username','mobile','email','auth_group_id']); + $data = Request::only(['id','username','mobile','email']); $map = array_filter($data); $admins = Db::name('admin') - ->alias('a') - ->join('auth_group u','a.auth_group_id = u.id') - ->field('a.id as aid,username,mobile,email,auth_group_id,title,last_login_ip,a.status as astatus,last_login_time') - ->where('a.delete_time',0) + ->field('id,username,mobile,email,last_login_ip,status,last_login_time') + ->where('delete_time',0) ->where($map) ->select(); @@ -39,7 +37,7 @@ class Admin extends AdminController if($count){ $res = ['code'=>0,'msg'=>'','count'=>$count]; foreach($admins as $k => $v){ - $data = ['id'=>$v['aid'],'loginname'=>$v['username'],'telphone'=>$v['mobile'],'email'=>$v['email'],'role'=>$v['title'],'ip'=>$v['last_login_ip'],'check'=>$v['astatus'],'logintime'=>date("Y-m-d",$v['last_login_time'])]; + $data = ['id'=>$v['id'],'loginname'=>$v['username'],'telphone'=>$v['mobile'],'email'=>$v['email'],'ip'=>$v['last_login_ip'],'check'=>$v['status'],'logintime'=>date("Y-m-d",$v['last_login_time'])]; $res['data'][] = $data; } } else { @@ -47,8 +45,6 @@ class Admin extends AdminController } return json($res); } - $authGroup = Db::name('auth_group')->field('id,title')->select(); - View::assign('authGroup',$authGroup); return View::fetch(); } @@ -81,17 +77,18 @@ class Admin extends AdminController $data['create_time'] = time(); $salt = substr(md5($data['create_time']),-6); $data['password'] = substr_replace(md5($data['password']),$salt,0,6); - $adminId = Db::name('admin')->insertGetId($data); - Db::name('auth_group_access')->insert(['uid'=>$adminId,'group_id'=>$data['auth_group_id']]); - if($adminId){ + //$adminId = Db::name('admin')->insertGetId($data); + $admin = Db::name('admin')->save($data); + //Db::name('auth_group_access')->insert(['uid'=>$adminId,'group_id'=>$data['auth_group_id']]); + if($admin){ $res = ['code'=>0,'msg'=>'添加成功']; }else{ $res = ['code'=>-1,'msg'=>'添加失败']; } return json($res); } - $auth_group = Db::name('auth_group')->select(); - View::assign(['auth_group'=>$auth_group]); + //$auth_group = Db::name('auth_group')->select(); + //View::assign(['auth_group'=>$auth_group]); return View::fetch(); } @@ -111,7 +108,7 @@ class Admin extends AdminController } $data['update_time'] = time(); $result = $admin->update($data); - Db::name('auth_group_access')->where('uid',$data['id'])->update(['group_id'=>$data['auth_group_id']]); + //Db::name('auth_group_access')->where('uid',$data['id'])->update(['group_id'=>$data['auth_group_id']]); if($result){ $res = ['code'=>0,'msg'=>'编辑成功']; }else{ @@ -119,8 +116,8 @@ class Admin extends AdminController } return json($res); } - $auth_group = Db::name('auth_group')->select(); - View::assign(['admin'=>$admin,'auth_group'=>$auth_group]); + //$auth_group = Db::name('auth_group')->select();,'auth_group'=>$auth_group + View::assign(['admin'=>$admin]); return View::fetch(); } diff --git a/app/admin/controller/AuthAccess.php b/app/admin/controller/AuthAccess.php new file mode 100644 index 0000000..194ea9c --- /dev/null +++ b/app/admin/controller/AuthAccess.php @@ -0,0 +1,146 @@ +alias('c') + ->join('admin a','c.uid = a.id') + ->join('auth_group g','c.group_id = g.id') + ->field('c.id as id,username,title,c.status as status') + ->where(['c.status'=>1,'c.delete_time'=>0]) + ->where($map) + ->select(); + $count = $groups->count(); + $res = []; + if($count){ + $res = ['code'=>0,'msg'=>'','count'=>$count]; + foreach($groups as $k => $v){ + $data = ['id'=>$v['id'],'username'=>$v['username'],'title'=>$v['title'],'check'=>$v['status']]; + $res['data'][] = $data; + } + } else { + $res = ['code'=>-1,'msg'=>'没有查询结果!']; + } + return json($res); + } + $admins = Db::name('admin')->field('id,username')->select(); + + View::assign('admins',$admins); + return View::fetch(); + } + + //角色添加 + public function add() + { + if(Request::isAjax()){ + $data = Request::only(['uid','group_id']); + //检测重复权限 + $groups = Db::name('auth_group_access')->where('uid',$data['uid'])->column('group_id'); + if(in_array($data['group_id'],$groups)){ + $res = ['code'=>-1,'msg'=>'不能重复添加已存在权限']; + } else { + $result = AuthGroupAccess::create($data); + if($result) { + $res = ['code'=>0,'msg'=>'添加权限成功']; + } else { + $res = ['code'=>-1,'msg'=>'添加权限失败']; + } + } + return json($res); + } + + $admins = Db::name('admin')->field('id,username')->select(); + $auth_groups = Db::name('auth_group')->field('id,title')->select(); + View::assign(['admins'=>$admins,'auth_groups'=>$auth_groups]); + + return View::fetch(); + } + + //管理员权限编辑 + public function edit($id) + { + if(Request::isAjax()){ + $data = Request::only(['id','uid','group_id']); + //检测重复权限 + $groups = Db::name('auth_group_access')->where('uid',$data['uid'])->column('group_id'); + if(in_array($data['group_id'],$groups)){ + $res = ['code'=>-1,'msg'=>'不能重复添加已存在权限']; + } else { + $result = AuthGroupAccess::where('id',$data['id'])->update(['uid'=>$data['uid'],'group_id'=>$data['group_id']]); + if($result){ + $res = ['code'=>0,'msg'=>'编辑成功']; + } else { + $res = ['code'=>-1,'msg'=>'编辑失败']; + } + } + return json($res); + } + + $access = Db::name('auth_group_access')->group('uid')->find($id); + $admins = Db::name('admin')->field('id,username')->select(); + $auth_groups = Db::name('auth_group')->field('id,title')->select(); + + View::assign(['admins'=>$admins,'auth_groups'=>$auth_groups,'access'=>$access]); + return View::fetch(); + } + + //角色删除 + public function delete($id) + { + if(Request::isAjax()){ + $access = AuthGroupAccess::find($id); + $result = $access->delete(); + + if($result){ + $res = ['code'=>0,'msg'=>'删除成功']; + }else{ + $res = ['code'=>-1,'msg'=>'删除失败']; + } + return json($res); + } + } + + //角色审核 + public function check() + { + $data = Request::only(['id','status']); + + //获取状态 + $result = AuthGroupAccess::update($data); + if($result){ + if($data['status'] == 1){ + return json(['code'=>0,'msg'=>'开启权限','icon'=>6]); + } else { + return json(['code'=>0,'msg'=>'禁用权限','icon'=>5]); + } + + }else { + return json(['code'=>-1,'msg'=>'权限执行出错']); + } + + } + + +} diff --git a/app/admin/controller/Forum.php b/app/admin/controller/Forum.php index 2a6bf15..2535e56 100644 --- a/app/admin/controller/Forum.php +++ b/app/admin/controller/Forum.php @@ -147,7 +147,7 @@ class Forum extends AdminController $res['count']= count($list); $res['data'] = []; foreach($list as $k=>$v){ - $res['data'][] = ['sort'=>$v['sort'],'id' => $v['id'],'tags'=>$v['catename'],'ename'=>$v['ename'],'desc'=>$v['desc']]; + $res['data'][] = ['sort'=>$v['sort'],'id' => $v['id'],'tags'=>$v['catename'],'ename'=>$v['ename'],'is_hot'=>$v['is_hot'],'desc'=>$v['desc']]; } } return json($res); @@ -294,6 +294,25 @@ class Forum extends AdminController return json(['code'=>-1,'msg'=>'审核出错']); } } + + //帖子分类开启热点 + //评论审核 + public function tagshot() + { + $data = Request::only(['id','is_hot']); + $cate = Db::name('cate')->save($data); + if($cate){ + if($data['is_hot'] == 1){ + return json(['code'=>0,'msg'=>'设置热点成功','icon'=>6]); + } else { + return json(['code'=>0,'msg'=>'取消热点显示','icon'=>5]); + } + }else{ + $res = ['code'=>-1,'msg'=>'热点设置失败']; + } + return json($res); + } + //array_filter过滤函数 public function filtr($arr){ if($arr === '' || $arr === null){ diff --git a/app/admin/controller/Set.php b/app/admin/controller/Set.php index 37c736b..4f0ccf5 100644 --- a/app/admin/controller/Set.php +++ b/app/admin/controller/Set.php @@ -16,13 +16,19 @@ class Set extends AdminController { parent::initialize(); + } + //网站设置显示 + public function index() + { + $mailserver = MailServer::find(1); + $sysInfo = Db::name('system')->find(1); + $syscy = $this->check($sysInfo['base_url']); + + View::assign(['sysInfo'=>$sysInfo,'syscy'=>$syscy,'mailserver'=>$mailserver]); + return View::fetch('set/system/website'); } - /** - * 显示资源列表 - * - * @return \think\Response - */ + //网站设置 public function website() { if(Request::isAjax()){ @@ -37,16 +43,12 @@ class Set extends AdminController return json(['code'=>-1,'msg'=>'更新失败']); } } - $sysInfo = Db::name('system')->find(1); - $syscy = $this->check($sysInfo['base_url']); - View::assign(['sysInfo'=>$sysInfo,'syscy'=>$syscy]); - return View::fetch('set/system/website'); } //综合设置 public function server() { - return $this->email(); + return View::fetch('set/system/server'); } /**邮箱设置 @@ -57,7 +59,7 @@ class Set extends AdminController $mailserver = MailServer::find(1); //邮箱配置 if(Request::isAjax()){ - $data = Request::param(); + $data = Request::only(['host','port','mail','nickname','password']); $res = $mailserver->save($data); if($res){ return json(['code'=>0,'msg'=>'更新成功']); @@ -65,9 +67,6 @@ class Set extends AdminController return json(['code'=>-1,'msg'=>'更新失败']); } } - - View::assign('mailserver',$mailserver); - return View::fetch('set/system/server'); } /** diff --git a/app/admin/model/AuthGroupAccess.php b/app/admin/model/AuthGroupAccess.php new file mode 100644 index 0000000..39c3c94 --- /dev/null +++ b/app/admin/model/AuthGroupAccess.php @@ -0,0 +1,17 @@ + -
- -
-
-
- -
- -
-
diff --git a/view/admin/admin/index.html b/view/admin/admin/index.html index c610711..fa5b668 100644 --- a/view/admin/admin/index.html +++ b/view/admin/admin/index.html @@ -23,17 +23,6 @@ -
- -
- -
-
@@ -94,7 +87,7 @@ $.ajax({ type:"post", url:"{:url('admin/admin/index')}", - data:{"id":field.id,"username":field.username,"mobile":field.mobile,"email":field.email,"auth_group_id":field.auth_group_id}, + data:{"id":field.id,"username":field.username,"mobile":field.mobile,"email":field.email}, daType:"json", success:function (data){ if (data.code == 0) { diff --git a/view/admin/auth_access/add.html b/view/admin/auth_access/add.html new file mode 100644 index 0000000..406614f --- /dev/null +++ b/view/admin/auth_access/add.html @@ -0,0 +1,44 @@ + +{extend name="public:base" /} + +{block name="body"} + +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/auth_access/edit.html b/view/admin/auth_access/edit.html new file mode 100644 index 0000000..6507d8d --- /dev/null +++ b/view/admin/auth_access/edit.html @@ -0,0 +1,47 @@ + +{extend name="public:base" /} + +{block name="body"} + +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/view/admin/auth_access/index.html b/view/admin/auth_access/index.html new file mode 100644 index 0000000..52ae310 --- /dev/null +++ b/view/admin/auth_access/index.html @@ -0,0 +1,192 @@ +{extend name="public/base" /} + +{block name="body"} + +
+
+
+
+
+ 管理员筛选 +
+
+ +
+
+
+
+
+ + +
+ +
+ + +
+
+
+ +{/block} +{block name="js"} + +{/block} + diff --git a/view/admin/auth_group/edit-1.html b/view/admin/auth_group/edit-1.html deleted file mode 100644 index 0c3d30e..0000000 --- a/view/admin/auth_group/edit-1.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - - -
- -
- - - -
    -
  • - -
      - - - - -
    -
  • -
- -
    -
  • - -
      - - - - -
    -
  • -
- -
    -
  • - -
      - - - - -
    -
  • -
- -
-
- - - -//获取选中的checkbox的值 -var mId = ""; -var e =iframeWindow.$(":checkbox"); -e.each(function () { - if($(this).next().hasClass("layui-form-checked")){ - mId+=$(this).val()+","; - }; -}) -mId = mId.substring(0,mId.length-1); - diff --git a/view/admin/auth_group/role.html b/view/admin/auth_group/role.html index 4108fa8..1a2fb66 100644 --- a/view/admin/auth_group/role.html +++ b/view/admin/auth_group/role.html @@ -27,12 +27,17 @@
+ {else /} 编辑{/if} + {if condition="checkRuleButton('admin/AuthGroup/roledel')"} + 删除 + {else /} 删除{/if} + diff --git a/view/admin/auth_rule/index.html b/view/admin/auth_rule/index.html index 5d9d18f..907071e 100644 --- a/view/admin/auth_rule/index.html +++ b/view/admin/auth_rule/index.html @@ -12,29 +12,37 @@
@@ -43,12 +51,11 @@ {/block} {block name="js"} - - -
- -
- - - -
    -
  • - -
      - - - - -
    -
  • -
- -
    -
  • - -
      - - - - -
    -
  • -
- -
    -
  • - -
      - - - - -
    -
  • -
- -
-
- - - -//获取选中的checkbox的值 -var mId = ""; -var e =iframeWindow.$(":checkbox"); -e.each(function () { - if($(this).next().hasClass("layui-form-checked")){ - mId+=$(this).val()+","; - }; -}) -mId = mId.substring(0,mId.length-1); - diff --git a/view/admin/authgroup/role-1.html b/view/admin/authgroup/role-1.html deleted file mode 100644 index 8bf0b79..0000000 --- a/view/admin/authgroup/role-1.html +++ /dev/null @@ -1,164 +0,0 @@ -{extend name="public/base" /} - -{block name="body"} - -
-
-
-
-
- 角色筛选 -
-
- -
-
-
-
-
- - -
- -
- - -
-
-
- -{/block} -{block name="js"} - -{/block} - diff --git a/view/admin/authgroup/role.html b/view/admin/authgroup/role.html deleted file mode 100644 index eb0fc10..0000000 --- a/view/admin/authgroup/role.html +++ /dev/null @@ -1,164 +0,0 @@ -{extend name="public/base" /} - -{block name="body"} - -
-
-
-
-
- 角色筛选 -
-
- -
-
-
-
-
- - -
- -
- - -
-
-
- -{/block} -{block name="js"} - -{/block} - diff --git a/view/admin/authgroup/roleadd.html b/view/admin/authgroup/roleadd.html deleted file mode 100644 index 2f2ddad..0000000 --- a/view/admin/authgroup/roleadd.html +++ /dev/null @@ -1,101 +0,0 @@ -{extend name="public/base" /} - -{block name="body"} - -
-
- -
- -
-
- -
- - {volist name="menus" id="vo1"} -
    -
  • - - -
      - {if condition="isset($vo1['children'])"} - {volist name="vo1['children']" id="vo2"} - {if condition="isset($vo2['children'])"} - - {volist name="vo2['children']" id="vo3"} - - {/volist} - {else /} - - {/if} - {/volist} - {/if} -
    -
  • -
- {/volist} -
- -
- -
- -
-
-
- -
-
- -{/block} -{block name="js"} - -{/block} \ No newline at end of file diff --git a/view/admin/authgroup/roleedit-1.html b/view/admin/authgroup/roleedit-1.html deleted file mode 100644 index ceb7e5e..0000000 --- a/view/admin/authgroup/roleedit-1.html +++ /dev/null @@ -1,154 +0,0 @@ -{extend name="public/base" /} - -{block name="body"} - -
-
- -
-
- -
- -
-
- {volist name="menu" id="vo1"} -
- - -
- -
- {if condition="isset($vo1['children'])"} - {volist name="vo1['children']" id="vo2"} - {if condition="isset($vo2['children'])"} - {volist name="vo2['children']" id="vo3"} - - {/volist} - {else /} - - - - {/if} - {/volist} - {/if} -
-
- {/volist} -
- -
- -
-
-
- -
-
- -{/block} -{block name="js"} - - - - - -{/block} \ No newline at end of file diff --git a/view/admin/authgroup/roleedit.html b/view/admin/authgroup/roleedit.html deleted file mode 100644 index a6d34b4..0000000 --- a/view/admin/authgroup/roleedit.html +++ /dev/null @@ -1,129 +0,0 @@ -{extend name="public/base" /} - -{block name="body"} - -
-
- -
- -
- -
- -
-
- -
- - {volist name="menus" id="vo1"} -
    -
  • - - -
      - {if condition="isset($vo1['children'])"} - {volist name="vo1['children']" id="vo2"} - {if condition="isset($vo2['children'])"} - - {volist name="vo2['children']" id="vo3"} - - {/volist} - {else /} - - {/if} - {/volist} - {/if} -
    -
  • -
- {/volist} -
- - -
- -
- -
-
-
- -
-
- -{/block} -{block name="js"} - - - - - -{/block} \ No newline at end of file diff --git a/view/admin/authrule/add.html b/view/admin/authrule/add.html deleted file mode 100644 index 0ce8454..0000000 --- a/view/admin/authrule/add.html +++ /dev/null @@ -1,65 +0,0 @@ - -{extend name="public:base" /} - -{block name="body"} - -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- -{/block} -{block name="js"} - -{/block} \ No newline at end of file diff --git a/view/admin/authrule/edit.html b/view/admin/authrule/edit.html deleted file mode 100644 index a34a71a..0000000 --- a/view/admin/authrule/edit.html +++ /dev/null @@ -1,68 +0,0 @@ - -{extend name="public:base" /} - -{block name="body"} - -
-
- -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- -{/block} -{block name="js"} - -{/block} \ No newline at end of file diff --git a/view/admin/authrule/index.html b/view/admin/authrule/index.html deleted file mode 100644 index 7664c8f..0000000 --- a/view/admin/authrule/index.html +++ /dev/null @@ -1,310 +0,0 @@ -{extend name="public:base" /} - -{block name="body"} -
-
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
- -
-
- - -
- -
- - - - - - - - - -
-
-
- -{/block} -{block name="js"} - - -{/block} diff --git a/view/admin/forum/list.html b/view/admin/forum/list.html index 8eda653..5bb5487 100644 --- a/view/admin/forum/list.html +++ b/view/admin/forum/list.html @@ -77,11 +77,15 @@ {{# } }} diff --git a/view/admin/forum/replys.html b/view/admin/forum/replys.html index 61a54d2..c56aeb6 100644 --- a/view/admin/forum/replys.html +++ b/view/admin/forum/replys.html @@ -37,11 +37,14 @@ {{d.cardid}} diff --git a/view/admin/forum/tags.html b/view/admin/forum/tags.html index 6b5930e..eadce2c 100644 --- a/view/admin/forum/tags.html +++ b/view/admin/forum/tags.html @@ -4,13 +4,23 @@
+ {if condition="checkRuleButton('admin/forum/addtags')"} + {/if}
-
+
+
@@ -24,9 +34,10 @@ base: '/static/admin/' //静态资源所在路径 }).extend({ index: 'lib/index' //主入口模块 - }).use(['index', 'contlist', 'table'], function(){ + }).use(['index', 'contlist', 'table','form'], function(){ - var table = layui.table; + var table = layui.table, + form = layui.form; var $ = layui.$, active = { add: function(){ layer.open({ @@ -54,8 +65,6 @@ layer.msg(data.msg,{ icon:6, time:2000 - }, function(){ - location.reload(); }); } else { layer.open({ @@ -67,12 +76,48 @@ } } }); - //table.reload('LAY-app-content-tags'); + table.reload('LAY-app-content-tags'); layer.close(index); } }); } - } + } + +//分类热点控制 + form.on('checkbox(menu-show)', function(data){ + var data = data.elem; + if(data.checked == true){ + data.value = 1; + }else{ + data.value = 0; + } + $.ajax({ + type:'post', + url:"{:url('admin/Forum/tagshot')}", + data:{"id":data.id,"is_hot":data.value,}, + dataType:'json', + success:function(data){ + if(data.code == 0){ + layer.msg(data.msg,{ + icon:6, + time:2000 + } + //,function(){location.reload();} + ); + } else { + layer.open({ + title:'修改失败', + content:data.msg, + icon:5, + adim:6 + }) + } + } + }); + return false; + }); + + $('.layui-btn.layuiadmin-btn-tags').on('click', function(){ var type = $(this).data('type'); active[type] ? active[type].call(this) : ''; diff --git a/view/admin/notice/index.html b/view/admin/notice/index.html index c5a6bfc..861f480 100644 --- a/view/admin/notice/index.html +++ b/view/admin/notice/index.html @@ -35,7 +35,9 @@
- + {if condition="checkRuleButton('admin/notice/add')"} + + {/if}
@@ -48,8 +50,12 @@
diff --git a/view/admin/set/system/server.html b/view/admin/set/system/server.html index a580d4a..bd4f759 100644 --- a/view/admin/set/system/server.html +++ b/view/admin/set/system/server.html @@ -5,66 +5,22 @@
-
-
+ +
    -
  • 邮件设置
  • -
  • 积分设置
  • +
  • 积分设置
  • 用户等级
  • -
  • 商品管理
  • -
  • 订单管理
-
-
-
- -
- -
-
如:smtp.163.com
-
-
- -
- -
-
一般为 25 或 465
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- -
-
-
-
-
+
-
+
+ {if condition="checkRuleButton('admin/Sign/add')"} + {else /}{/if}
-
@@ -118,28 +79,34 @@
+ {if condition="checkRuleButton('admin/Vip/add')"} + {else /}{/if}
-
内容4
-
内容5
+
+ {/block} {block name="js"} @@ -148,53 +115,11 @@ base: '/static/admin/' //静态资源所在路径 }).extend({ index: 'lib/index' //主入口模块 - }).use(['index', 'set', 'webset', 'table', 'form'], function(){ + }).use(['index', 'element','table', 'webset', 'form'], function(){ var $ = layui.$ - ,admin = layui.admin ,element = layui.element ,table = layui.table - ,form = layui.form - ,router = layui.router(); - - element.render(); - - element.on('tab(component-tabs-brief)', function(obj){ - layer.msg(obj.index + ':' + this.innerHTML); - }); - - /* 触发事件 */ - var active = { - tabAdd: function(){ - /* 新增一个Tab项 */ - element.tabAdd('demo', { - title: '新选项'+ (Math.random()*1000|0) /* 用于演示 */ - ,content: '内容'+ (Math.random()*1000|0) - ,id: new Date().getTime() /* 实际使用一般是规定好的id,这里以时间戳模拟下 */ - }) - } - ,tabDelete: function(othis){ - /* 删除指定Tab项 */ - element.tabDelete('demo', '22'); - othis.addClass('layui-btn-disabled'); - } - ,tabChange: function(){ - /* 切换到指定Tab项 */ - element.tabChange('demo', '33'); - } - }; - - $('#component-tabs .site-demo-active').on('click', function(){ - var othis = $(this), type = othis.data('type'); - active[type] ? active[type].call(this, othis) : ''; - }); - - /* Hash地址的定位 */ - var layid = router.hash.replace(/^#layid=/, ''); - layid && element.tabChange('component-tabs-hash', layid); - - element.on('tab(component-tabs-hash)', function(elem){ - location.hash = '/'+ layui.router().path.join('/') + '#layid=' + $(this).attr('lay-id'); - }); + ,form = layui.form; //添加签到规则 form.on('submit(sign-rule-submit)',function(data){ @@ -253,7 +178,7 @@ }); return false; }); - + }); {/block} diff --git a/view/admin/set/system/website.html b/view/admin/set/system/website.html index ce55758..c6bd244 100644 --- a/view/admin/set/system/website.html +++ b/view/admin/set/system/website.html @@ -1,115 +1,174 @@ {extend name="public/base" /} {block name="body"} -
-
+
+
-
网站设置
-
- -
-
- -
- +
+ +
+
    +
  • 网站设置
  • +
  • 邮箱服务
  • +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + {if condition="checkRuleButton('admin/set/upload')"} + + + {else /}{/if} +
+
+
+ +
+ +
+
分钟
+
本地开发一般推荐设置为 0,线上环境建议设置为 10。
+
+
+ +
+ +
+
KB
+
提示:1 M = 1024 KB
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
提示:
+
未经授权用户,可不限制功能使用,但严禁私自改写版权脚本。一旦发现,永远禁止升级并追诉相关责任。
+
+
+
+
+ {if condition="checkRuleButton('admin/Set/website')"} + + {else /}{/if} +
+
+
-
-
- -
- +
+
+
+ +
+ +
+
如:smtp.163.com
+
+
+ +
+ +
+
一般为 25 或 465
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ {if condition="checkRuleButton('admin/Set/email')"} + + {else /}{/if} +
+
+
-
-
- -
- - - -
-
-
- -
- -
-
分钟
-
本地开发一般推荐设置为 0,线上环境建议设置为 10。
-
-
- -
- -
-
KB
-
提示:1 M = 1024 KB
-
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
提示:
-
未经授权用户,可不限制功能使用,但严禁私自改写版权脚本。一旦发现,永远禁止升级并追诉相关责任。
-
-
-
-
- -
-
+
- +
-
-
+
+
{/block} -{block name="js"} +{block name="js"} -{/block} \ No newline at end of file + +{/block} diff --git a/view/admin/set/user/info.html b/view/admin/set/user/info.html index d9c1300..e4c2769 100644 --- a/view/admin/set/user/info.html +++ b/view/admin/set/user/info.html @@ -72,8 +72,12 @@
+ {if condition="checkRuleButton('admin/admin/info')"} - + {else /} + + {/if} +
diff --git a/view/admin/set/user/repass.html b/view/admin/set/user/repass.html index 3828fc4..4f2bd7f 100644 --- a/view/admin/set/user/repass.html +++ b/view/admin/set/user/repass.html @@ -31,7 +31,11 @@
+ {if condition="checkRuleButton('admin/admin/info')"} + {else /} + + {/if}
diff --git a/view/admin/upgrade/index.html b/view/admin/upgrade/index.html index ef4e854..11ddc56 100644 --- a/view/admin/upgrade/index.html +++ b/view/admin/upgrade/index.html @@ -26,20 +26,28 @@
{$ver_num.key}
-
修改?
+
+ {if condition="checkRuleButton('admin/Upgrade/keyedit')"} + 修改? + {else /}修改?{/if} +
当前版本:Taole v_{$ver_num.sys_version_num}
+ {if condition="checkRuleButton('admin/Upgrade/check')"} + {else /}{/if}
+ {if condition="checkRuleButton('admin/Upgrade/uploadzip')"} + {else /}{/if}
diff --git a/view/admin/user/list.html b/view/admin/user/list.html index 3d0d769..84df9a7 100644 --- a/view/admin/user/list.html +++ b/view/admin/user/list.html @@ -61,21 +61,25 @@ @@ -96,27 +100,25 @@ //监听搜索 form.on('submit(LAY-user-front-search)', function(data){ var field = data.field; - //console.log(field); - //提交 Ajax 成功后,静态更新表格中的数据 - $.ajax({ - type:"post", - url:"{:url('admin/user/list')}", - data:{"id":field.id,"name":field.name,"email":field.email,"sex":field.sex}, - daType:"json", - success:function (data){ - if (data.code == 0) { - - } else { - layer.open({ - tiele:'搜索失败', - content:data.msg, - icon:5, - anim:6 - }); - } - } - }); + $.ajax({ + type:"post", + url:"{:url('admin/user/list')}", + data:{"id":field.id,"name":field.name,"email":field.email,"sex":field.sex}, + daType:"json", + success:function (data){ + if (data.code == 0) { + + } else { + layer.open({ + tiele:'搜索失败', + content:data.msg, + icon:5, + anim:6 + }); + } + } + }); //执行重载 table.reload('LAY-user-manage', {