From 2da915d9452a3655d37a652c73eca90f14030c0d Mon Sep 17 00:00:00 2001 From: toogee Date: Tue, 28 Apr 2020 18:44:40 +0800 Subject: [PATCH] admin domain bind --- app/admin/controller/AuthGroup.php | 2 +- app/admin/controller/Notice.php | 4 +- app/admin/controller/User.php | 4 +- app/install/data/taoler.sql | 32 ++-- public/static/admin/modules/contlist.js | 216 +++++++++++------------ public/static/admin/modules/forum.js | 118 ++++++++++++- public/static/admin/modules/notice.js | 197 +++++++++++++++++++++ public/static/admin/modules/set.js | 8 +- public/static/admin/modules/useradmin.js | 42 +++-- public/static/admin/modules/webset.js | 16 +- view/admin/admin/index.html | 15 ++ view/admin/article/comment.html | 113 ------------ view/admin/article/contform.html | 44 ----- view/admin/article/list.html | 147 --------------- view/admin/article/listform.html | 82 --------- view/admin/article/tags.html | 66 ------- view/admin/article/tagsform.html | 38 ---- view/admin/auth_access/index.html | 15 ++ view/admin/auth_group/role.html | 15 ++ view/admin/auth_rule/index.html | 22 ++- view/admin/forum/list.html | 16 +- view/admin/forum/replys.html | 11 +- view/admin/forum/tags.html | 11 +- view/admin/notice/edit.html | 5 +- view/admin/notice/index.html | 8 +- view/admin/set/system/server.html | 6 + view/admin/set/system/website.html | 5 +- view/admin/set/user/info.html | 1 + view/admin/set/user/repass.html | 2 +- view/admin/user/list.html | 21 ++- view/index/index/index.html | 2 +- 31 files changed, 605 insertions(+), 679 deletions(-) create mode 100644 public/static/admin/modules/notice.js delete mode 100644 view/admin/article/comment.html delete mode 100644 view/admin/article/contform.html delete mode 100644 view/admin/article/list.html delete mode 100644 view/admin/article/listform.html delete mode 100644 view/admin/article/tags.html delete mode 100644 view/admin/article/tagsform.html diff --git a/app/admin/controller/AuthGroup.php b/app/admin/controller/AuthGroup.php index 86282fd..bc7dc68 100644 --- a/app/admin/controller/AuthGroup.php +++ b/app/admin/controller/AuthGroup.php @@ -100,7 +100,7 @@ class AuthGroup extends AdminController } //角色删除 - public function roledel($id) + public function roleDel($id) { if(Request::isAjax()){ $role =AuthGroupModel::find($id); diff --git a/app/admin/controller/Notice.php b/app/admin/controller/Notice.php index 4828f53..25d2528 100644 --- a/app/admin/controller/Notice.php +++ b/app/admin/controller/Notice.php @@ -17,8 +17,8 @@ class Notice extends AdminController public function index() { if(Request::isAjax()){ - $notices = MessageModel::where(['type'=>0,'delete_time'=>0])->select(); - $count = $notices->count(); + $notices = MessageModel::where(['type'=>0,'delete_time'=>0])->paginate(15); + $count = $notices->total(); $res = []; if($count){ $res = ['code'=>0,'msg'=>'','count'=>$count]; diff --git a/app/admin/controller/User.php b/app/admin/controller/User.php index eda72fc..ad64f33 100644 --- a/app/admin/controller/User.php +++ b/app/admin/controller/User.php @@ -28,8 +28,8 @@ class User extends AdminController if(Request::isAjax()){ $datas = Request::only(['id','name','email','sex']); $map = array_filter($datas,[$this,'filtrArr']); - $user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->select(); - $count = $user->count(); + $user = Db::name('user')->where(['delete_time'=>0])->where($map)->order('id desc')->paginate(30); + $count = $user->total(); $res = []; if($count){ $res = ['code'=>0,'msg'=>'','count'=>$count]; diff --git a/app/install/data/taoler.sql b/app/install/data/taoler.sql index 9df2cc4..7c6edbe 100644 --- a/app/install/data/taoler.sql +++ b/app/install/data/taoler.sql @@ -115,14 +115,14 @@ INSERT INTO `tao_auth_rule` VALUES ('6', 'admin/User/list', '用户管理', '1', INSERT INTO `tao_auth_rule` VALUES ('7', 'admin/Admin/index', '管理员', '1', '1', '1', '1', '', '1', '6', '', '0', '1578901133', '0'); INSERT INTO `tao_auth_rule` VALUES ('8', 'admin/AuthGroup/list', '角色管理', '1', '1', '1', '1', '', '1', '11', '', '0', '1578901282', '0'); INSERT INTO `tao_auth_rule` VALUES ('9', 'admin/AuthRule/index', '权限管理', '1', '1', '1', '1', '', '1', '16', '', '0', '1578981541', '0'); -INSERT INTO `tao_auth_rule` VALUES ('10', 'admin/set/index', '网站设置', '1', '1', '2', '1', '', '1', '1', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('11', 'admin/set/server', '综合服务', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('10', 'admin/Set/index', '网站设置', '1', '1', '2', '1', '', '1', '1', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('11', 'admin/Set/server', '综合服务', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('12', 'admin/Admin/info', '基本资料', '1', '1', '3', '1', '', '1', '50', '', '0', '1578980034', '0'); INSERT INTO `tao_auth_rule` VALUES ('13', 'admin/Admin/repass', '修改密码', '1', '1', '3', '1', '', '1', '51', '', '0', '1578980034', '0'); INSERT INTO `tao_auth_rule` VALUES ('15', 'admin/Forum/list', '帖子管理', '1', '1', '5', '1', '', '1', '1', '', '0', '1578902605', '0'); INSERT INTO `tao_auth_rule` VALUES ('16', 'admin/Forum/tags', '分类管理', '1', '1', '5', '1', '', '1', '11', '', '0', '1578904950', '0'); INSERT INTO `tao_auth_rule` VALUES ('17', 'admin/Forum/replys', '评论管理', '1', '1', '5', '1', '', '1', '7', '', '0', '1578904590', '0'); -INSERT INTO `tao_auth_rule` VALUES ('18', 'admin/slider/index', '广告投放', '1', '1', '2', '1', '', '1', '4', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('18', 'admin/Slider/index', '广告投放', '1', '1', '2', '1', '', '1', '4', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('19', 'admin/Upgrade/index', '系统升级', '1', '1', '2', '1', '', '1', '8', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('21', 'admin/Forum/listform', '编辑帖子', '1', '1', '5', '1', '', '0', '2', '', '0', '1578903229', '0'); INSERT INTO `tao_auth_rule` VALUES ('22', 'admin/Forum/listdel', '删除帖子', '1', '1', '5', '1', '', '0', '3', '', '0', '1578903919', '0'); @@ -132,32 +132,32 @@ INSERT INTO `tao_auth_rule` VALUES ('25', 'admin/Forum/tagsform', '编辑分类' INSERT INTO `tao_auth_rule` VALUES ('26', 'admin/Forum/tagsdelete', '删除分类', '1', '1', '5', '1', '', '0', '13', '', '0', '1578904996', '0'); INSERT INTO `tao_auth_rule` VALUES ('27', 'admin/Forum/replysform', '编辑评论', '1', '1', '5', '1', '', '0', '8', '', '0', '1578904627', '0'); INSERT INTO `tao_auth_rule` VALUES ('28', 'admin/Forum/redel', '删除评论', '1', '1', '5', '1', '', '0', '9', '', '0', '1578904856', '0'); -INSERT INTO `tao_auth_rule` VALUES ('35', 'admin/User/userform', '添加用户', '1', '1', '1', '1', '', '0', '2', '', '0', '1578901074', '0'); -INSERT INTO `tao_auth_rule` VALUES ('36', 'admin/User/useredit', '编辑用户', '1', '1', '1', '1', '', '0', '3', '', '0', '1578901089', '0'); +INSERT INTO `tao_auth_rule` VALUES ('35', 'admin/User/userForm', '添加用户', '1', '1', '1', '1', '', '0', '2', '', '0', '1578901074', '0'); +INSERT INTO `tao_auth_rule` VALUES ('36', 'admin/User/userEdit', '编辑用户', '1', '1', '1', '1', '', '0', '3', '', '0', '1578901089', '0'); INSERT INTO `tao_auth_rule` VALUES ('37', 'admin/User/delete', '删除用户', '1', '1', '1', '1', '', '0', '4', '', '0', '1578901099', '0'); INSERT INTO `tao_auth_rule` VALUES ('38', 'admin/User/check', '审核用户', '1', '1', '1', '1', '', '0', '5', '', '0', '1578905291', '0'); INSERT INTO `tao_auth_rule` VALUES ('39', 'admin/Admin/add', '添加管理员', '1', '1', '1', '1', '', '0', '7', '', '0', '1578901163', '0'); INSERT INTO `tao_auth_rule` VALUES ('40', 'admin/Admin/edit', '编辑管理员', '1', '1', '1', '1', '', '0', '8', '', '0', '1578901184', '0'); INSERT INTO `tao_auth_rule` VALUES ('41', 'admin/Admin/delete', '删除管理员', '1', '1', '1', '1', '', '0', '9', '', '0', '1578901198', '0'); INSERT INTO `tao_auth_rule` VALUES ('42', 'admin/Admin/check', '审核管理员', '1', '1', '1', '1', '', '0', '10', '', '0', '1578901216', '0'); -INSERT INTO `tao_auth_rule` VALUES ('43', 'admin/AuthGroup/roleadd', '添加角色', '1', '1', '1', '1', '', '0', '12', '', '0', '1578981437', '0'); -INSERT INTO `tao_auth_rule` VALUES ('44', 'admin/AuthGroup/roleedit', '编辑角色', '1', '1', '1', '1', '', '0', '13', '', '0', '1578901349', '0'); +INSERT INTO `tao_auth_rule` VALUES ('43', 'admin/AuthGroup/roleAdd', '添加角色', '1', '1', '1', '1', '', '0', '12', '', '0', '1578981437', '0'); +INSERT INTO `tao_auth_rule` VALUES ('44', 'admin/AuthGroup/roleEdit', '编辑角色', '1', '1', '1', '1', '', '0', '13', '', '0', '1578901349', '0'); INSERT INTO `tao_auth_rule` VALUES ('45', 'admin/AuthGroup/roledel', '删除角色', '1', '1', '1', '1', '', '0', '14', '', '0', '1578971659', '0'); INSERT INTO `tao_auth_rule` VALUES ('46', 'admin/AuthRule/add', '添加权限', '1', '1', '1', '1', '', '0', '21', '', '0', '1578981581', '0'); INSERT INTO `tao_auth_rule` VALUES ('47', 'admin/AuthRule/edit', '编辑权限', '1', '1', '1', '1', '', '0', '17', '', '0', '1578901457', '0'); INSERT INTO `tao_auth_rule` VALUES ('48', 'admin/AuthRule/delete', '删除权限', '1', '1', '1', '1', '', '0', '18', '', '0', '1578901469', '0'); INSERT INTO `tao_auth_rule` VALUES ('49', 'admin/AuthRule/check', '审核权限', '1', '1', '1', '1', '', '0', '19', '', '0', '1578901484', '0'); INSERT INTO `tao_auth_rule` VALUES ('50', 'admin/AuthRule/menushow', '菜单权限', '1', '1', '1', '1', '', '0', '20', '', '0', '1578901495', '0'); -INSERT INTO `tao_auth_rule` VALUES ('51', 'admin/set/upload', '上传logo', '1', '1', '2', '1', '', '0', '2', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('52', 'admin/slider/add', '添加广告', '1', '1', '2', '1', '', '0', '5', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('53', 'admin/slider/edit', '编辑广告', '1', '1', '2', '1', '', '0', '14', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('54', 'admin/slider/delete', '删除广告', '1', '1', '2', '1', '', '0', '6', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('51', 'admin/Set/upload', '上传logo', '1', '1', '2', '1', '', '0', '2', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('52', 'admin/Slider/add', '添加广告', '1', '1', '2', '1', '', '0', '5', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('53', 'admin/Slider/edit', '编辑广告', '1', '1', '2', '1', '', '0', '14', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('54', 'admin/Slider/delete', '删除广告', '1', '1', '2', '1', '', '0', '6', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('55', 'admin/Slider/uploadimg', '上传广告图片', '1', '1', '2', '1', '', '0', '7', '', '0', '1578906577', '0'); -INSERT INTO `tao_auth_rule` VALUES ('56', 'admin/upgrade/key', '设置key', '1', '1', '2', '1', '', '0', '9', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('57', 'admin/upgrade/keyedit', '修改key', '1', '1', '2', '1', '', '0', '10', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('58', 'admin/upgrade/check', '升级检测', '1', '1', '2', '1', '', '0', '11', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('59', 'admin/upgrade/upload', '自动升级', '1', '1', '2', '1', '', '0', '12', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('60', 'admin/upgrade/uploadzip', '上传升级包', '1', '1', '2', '1', '', '0', '13', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('56', 'admin/Upgrade/key', '设置key', '1', '1', '2', '1', '', '0', '9', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('57', 'admin/Upgrade/keyedit', '修改key', '1', '1', '2', '1', '', '0', '10', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('58', 'admin/Upgrade/check', '升级检测', '1', '1', '2', '1', '', '0', '11', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('59', 'admin/Upgrade/upload', '自动升级', '1', '1', '2', '1', '', '0', '12', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('60', 'admin/Upgrade/uploadzip', '上传升级包', '1', '1', '2', '1', '', '0', '13', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('62', 'admin/Forum/top', '置顶帖子', '1', '1', '5', '1', '', '0', '4', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('63', 'admin/Forum/hot', '加精帖子', '1', '1', '5', '1', '', '0', '5', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('64', 'admin/Froum/recheck', '审核评论', '1', '1', '5', '1', '', '0', '10', '', '0', '0', '0'); diff --git a/public/static/admin/modules/contlist.js b/public/static/admin/modules/contlist.js index cbf5264..6c9f208 100644 --- a/public/static/admin/modules/contlist.js +++ b/public/static/admin/modules/contlist.js @@ -76,115 +76,115 @@ layui.define(['table', 'form'], function(exports){ } }); - //分类管理 - table.render({ - elem: '#LAY-app-content-tags' - ,url: '/Forum/tags' //模拟接口 - ,cols: [[ - {type: 'numbers', fixed: 'left'} - ,{field: 'sort', title: '排序', width: 80, sort: true} - ,{field: 'id', title: 'ID',width: 60} - ,{field: 'tags', title: '分类名', minWidth: 100} - ,{field: 'ename', title: 'EN别名', minWidth: 100} - ,{field: 'is_hot', title: '热门', templet: '#buttonHot'} - ,{field: 'desc', title: '描述', minWidth: 100} - ,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#layuiadmin-app-cont-tagsbar'} - ]] - ,text: '对不起,加载出现异常!' - }); - - //监听工具条 - table.on('tool(LAY-app-content-tags)', function(obj){ - var data = obj.data; - if(obj.event === 'del'){ - layer.confirm('确定删除此分类?', function(index){ - $.ajax({ - type:'post', - url:"/admin/Forum/tagsdelete", - data:{id:data.id}, - 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 - }) - } - } - }); - //obj.del(); - layer.close(index); - }); - } else if(obj.event === 'edit'){ - var tr = $(obj.tr); - layer.open({ - type: 2 - ,title: '编辑分类' - ,content: '/admin/Forum/tagsform?id='+ data.id - ,area: ['450px', '300px'] - ,btn: ['确定', '取消'] - ,yes: function(index, layero){ - //获取iframe元素的值 - var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags") - ,sort = othis.find('input[name="sort"]').val() - ,tags = othis.find('input[name="tags"]').val() - ,ename = othis.find('input[name="ename"]').val() - ,desc = othis.find('input[name="desc"]').val(); - - if(!tags.replace(/\s/g, '')) return; - - $.ajax({ - type:"post", - url:"/admin/Forum/tagsform", - data:{"id":data.id,"sort":sort,"catename":tags,"ename":ename,"desc":desc}, - daType:"json", - success:function (data){ - if (data.code == 0) { - layer.msg(data.msg,{ - icon:6, - time:2000 - }, function(){ - location.reload(); - }); - } else { - layer.open({ - tiele:'修改失败', - content:data.msg, - icon:5, - anim:6 - }); - } - } - }); -/* - obj.update({ - tags: tags - ,ename: ename - ,sort: sort - }); -*/ - layer.close(index); + //文章分类管理 + table.render({ + elem: '#LAY-app-content-tags' + ,url: '/Forum/tags' //模拟接口 + ,cols: [[ + {type: 'numbers', fixed: 'left'} + ,{field: 'sort', title: '排序', width: 80, sort: true} + ,{field: 'id', title: 'ID',width: 60} + ,{field: 'tags', title: '分类名', minWidth: 100} + ,{field: 'ename', title: 'EN别名', minWidth: 100} + ,{field: 'is_hot', title: '热门', templet: '#buttonHot'} + ,{field: 'desc', title: '描述', minWidth: 100} + ,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#layuiadmin-app-cont-tagsbar'} + ]] + ,text: '对不起,加载出现异常!' + }); + + //监听工具条 + table.on('tool(LAY-app-content-tags)', function(obj){ + var data = obj.data; + if(obj.event === 'del'){ + layer.confirm('确定删除此分类?', function(index){ + $.ajax({ + type:'post', + url:"/admin/Forum/tagsdelete", + data:{id:data.id}, + 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 + }) + } + } + }); + //obj.del(); + layer.close(index); + }); + } else if(obj.event === 'edit'){ + var tr = $(obj.tr); + layer.open({ + type: 2 + ,title: '编辑分类' + ,content: '/admin/Forum/tagsform?id='+ data.id + ,area: ['450px', '300px'] + ,btn: ['确定', '取消'] + ,yes: function(index, layero){ + //获取iframe元素的值 + var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags") + ,sort = othis.find('input[name="sort"]').val() + ,tags = othis.find('input[name="tags"]').val() + ,ename = othis.find('input[name="ename"]').val() + ,desc = othis.find('input[name="desc"]').val(); + + if(!tags.replace(/\s/g, '')) return; + + $.ajax({ + type:"post", + url:"/admin/Forum/tagsform", + data:{"id":data.id,"sort":sort,"catename":tags,"ename":ename,"desc":desc}, + daType:"json", + success:function (data){ + if (data.code == 0) { + layer.msg(data.msg,{ + icon:6, + time:2000 + }, function(){ + location.reload(); + }); + } else { + layer.open({ + tiele:'修改失败', + content:data.msg, + icon:5, + anim:6 + }); + } + } + }); + /* + obj.update({ + tags: tags + ,ename: ename + ,sort: sort + }); + */ + layer.close(index); + } + ,success: function(layero, index){ + //给iframe元素赋值 + var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags").click(); + othis.find('input[name="sort"]').val(data.sort) + ,othis.find('input[name="tags"]').val(data.tags) + ,othis.find('input[name="ename"]').val(data.ename) + ,othis.find('input[name="desc"]').val(data.desc); + } + }); } - ,success: function(layero, index){ - //给iframe元素赋值 - var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags").click(); - othis.find('input[name="sort"]').val(data.sort) - ,othis.find('input[name="tags"]').val(data.tags) - ,othis.find('input[name="ename"]').val(data.ename) - ,othis.find('input[name="desc"]').val(data.desc); - } - }); - } - }); + }); //评论管理 table.render({ diff --git a/public/static/admin/modules/forum.js b/public/static/admin/modules/forum.js index 889e72f..38cd6ff 100644 --- a/public/static/admin/modules/forum.js +++ b/public/static/admin/modules/forum.js @@ -16,7 +16,7 @@ layui.define(['table', 'form'], function(exports){ //帖子管理 table.render({ elem: '#LAY-app-forum-list' - ,url: '/admin/Forum/list' //帖子数据接口 + ,url: forumList //帖子数据接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 55, title: 'ID', sort: true} @@ -44,7 +44,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/Forum/listdel", + url:forumListdel, data:{id:data.id}, dataType:'json', success:function(data){ @@ -132,7 +132,7 @@ layui.define(['table', 'form'], function(exports){ //评论管理 table.render({ elem: '#LAY-app-forumreply-list' - ,url: '/admin/Forum/replys' + ,url: forumReplys ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 100, title: 'ID', sort: true} @@ -158,7 +158,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/Forum/redel", + url:forumRedel, data:{id:data.id}, dataType:'json', success:function(data){ @@ -209,6 +209,116 @@ layui.define(['table', 'form'], function(exports){ }); } }); + + //帖子分类管理 + table.render({ + elem: '#LAY-app-content-tags' + ,url: forumTags //帖子分类接口 + ,cols: [[ + {type: 'numbers', fixed: 'left'} + ,{field: 'sort', title: '排序', width: 80, sort: true} + ,{field: 'id', title: 'ID',width: 60} + ,{field: 'tags', title: '分类名', minWidth: 100} + ,{field: 'ename', title: 'EN别名', minWidth: 100} + ,{field: 'is_hot', title: '热门', templet: '#buttonHot'} + ,{field: 'desc', title: '描述', minWidth: 100} + ,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#layuiadmin-app-cont-tagsbar'} + ]] + ,text: '对不起,加载出现异常!' + }); + + //监听工具条 + table.on('tool(LAY-app-content-tags)', function(obj){ + var data = obj.data; + if(obj.event === 'del'){ + layer.confirm('确定删除此分类?', function(index){ + $.ajax({ + type:'post', + url:forumTagsDelete, + data:{id:data.id}, + 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 + }) + } + } + }); + //obj.del(); + layer.close(index); + }); + } else if(obj.event === 'edit'){ + var tr = $(obj.tr); + layer.open({ + type: 2 + ,title: '编辑分类' + ,content: forumTagsForm + '?id='+ data.id + ,area: ['450px', '300px'] + ,btn: ['确定', '取消'] + ,yes: function(index, layero){ + //获取iframe元素的值 + var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags") + ,sort = othis.find('input[name="sort"]').val() + ,tags = othis.find('input[name="tags"]').val() + ,ename = othis.find('input[name="ename"]').val() + ,desc = othis.find('input[name="desc"]').val(); + + if(!tags.replace(/\s/g, '')) return; + + $.ajax({ + type:"post", + url:forumTagsForm, + data:{"id":data.id,"sort":sort,"catename":tags,"ename":ename,"desc":desc}, + daType:"json", + success:function (data){ + if (data.code == 0) { + layer.msg(data.msg,{ + icon:6, + time:2000 + }, function(){ + location.reload(); + }); + } else { + layer.open({ + tiele:'修改失败', + content:data.msg, + icon:5, + anim:6 + }); + } + } + }); + /* + obj.update({ + tags: tags + ,ename: ename + ,sort: sort + }); + */ + layer.close(index); + } + ,success: function(layero, index){ + //给iframe元素赋值 + var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags").click(); + othis.find('input[name="sort"]').val(data.sort) + ,othis.find('input[name="tags"]').val(data.tags) + ,othis.find('input[name="ename"]').val(data.ename) + ,othis.find('input[name="desc"]').val(data.desc); + } + }); + } + }); exports('forum', {}) }); \ No newline at end of file diff --git a/public/static/admin/modules/notice.js b/public/static/admin/modules/notice.js new file mode 100644 index 0000000..3bb5075 --- /dev/null +++ b/public/static/admin/modules/notice.js @@ -0,0 +1,197 @@ +//网站后台综合设置 + +layui.define(['table', 'form', 'layedit','upload'], function(exports){ + var $ = layui.$ + ,table = layui.table + ,form = layui.form + ,layedit = layui.layedit + ,upload = layui.upload; + + //编辑器 + var index = layedit.build('L_content',{ + height: 180 //设置编辑器高度 + ,tool: [ + 'strong' //加粗 + ,'italic' //斜体 + ,'underline' //下划线 + ,'del' //删除线 + ,'|' //分割线 + ,'left' //左对齐 + ,'center' //居中对齐 + ,'right' //右对齐 + ,'link' //超链接 + ,'unlink' //清除链接 + ,'face' //表情 + ,'image' //插入图片 + ], + }); + + //得到编辑器内容异步到表单中 + form.verify({ + content: function(value){ + return layedit.sync(index); + } + }); + + //通知列表 + table.render({ + elem: '#notice-list', + url: noticeIndex, + limit: 5, + cols:[[ + {type: 'numbers', fixed: 'left'}, + {field: 'type',title: '类型'}, + {field: 'title',title: '标题'}, + {field: 'user_id',title: '发信ID'}, + {field: 'content',title: '内容'}, + {field: 'ctime',title: '时间'}, + {title: '操作', width: 150, align:'center', fixed: 'right', toolbar: '#notice-tool'} + ]] + ,page: true + ,limit: 15 + ,height: 'full-220' + ,text: '对不起,加载出现异常!' + }); + //发站内通知信息 + form.on('select(type)', function(data){ + var tpl = '
\ + \ +
\ + \ +
\ +
'; + //如果选择是用户追加收件人 + if(data.value == 1){ + $(this).parents('div .layui-col-md3').next('div').after(tpl); + }else{ + $(this).parents('div .layui-col-md3').nextAll('div .layui-col-md12').remove(); + } + }); + + //发布通知 + form.on('submit(notice-add)', function(data){ + var field = data.field; + $.ajax({ + type:"post", + url:noticeAdd, + data:field, + dataType:"json", + success:function (data){ + if (data.code == 0) { + conosle.log('123'); + $('#L_title').text(''); + + $('#L_content').text(''); + layer.msg(data.msg,{ + icon:6, + time:2000 + }); + } else { + layer.open({ + content:data.msg, + icon:5, + anim:6 + }); + } + } + }); + table.reload('notice-list'); //数据刷新 + return false; + }); + + + //监听工具条 + table.on('tool(notice-list)', function(obj){ + var data = obj.data; + if(obj.event === 'del'){ + layer.prompt({ + formType: 1 + ,title: '敏感操作,请验证口令' + }, function(value, index){ + layer.close(index); + + layer.confirm('真的删除行么', function(index){ + //obj.del(); + $.ajax({ + type:'post', + url:noticeDelete, + data:{id:data.id}, + dataType:'json', + success:function(data){ + if(data.code == 0){ + layer.msg(data.msg,{ + icon:6, + time:2000 + }); + } else { + layer.open({ + title:'删除失败', + content:data.msg, + icon:5, + adim:6 + }) + } + } + }); + table.reload('notice-list'); + layer.close(index); + }); + }); + } else if(obj.event === 'edit'){ + var tr = $(obj.tr); + layer.open({ + type: 2 + ,title: '编辑通知' + ,content: noticeEdit +'?id='+ data.id + ,maxmin: true + ,area: ['500px', '450px'] + ,btn: ['确定', '取消'] + ,yes: function(index, layero){ + + var iframeWindow = window['layui-layer-iframe'+ index] + ,submitID = 'notice-edit' + ,submit = layero.find('iframe').contents().find('#'+ submitID); + + //监听提交 + iframeWindow.layui.form.on('submit('+ submitID +')', function(data){ + var field = data.field; //获取提交的字段 + + //提交 Ajax 成功后,静态更新表格中的数据 + $.ajax({ + type:"post", + url:noticeEdit, + data:{id:field.id,title:field.title,content:field.content,type:field.type}, + daType:"json", + success:function (res){ + if (res.code == 0) { + layer.msg(res.msg,{ + icon:6, + time:2000 + }); + } else { + layer.open({ + tiele:'修改失败', + content:res.msg, + icon:5, + anim:6 + }); + } + } + }); + + table.reload('notice-list'); //数据刷新 + layer.close(index); //关闭弹层 + }); + + submit.trigger('click'); + } + ,success: function(layero, index){ + + } + }); + } + }); + + + exports('notice', {}) +}); \ No newline at end of file diff --git a/public/static/admin/modules/set.js b/public/static/admin/modules/set.js index f077987..69c6d3a 100644 --- a/public/static/admin/modules/set.js +++ b/public/static/admin/modules/set.js @@ -58,7 +58,7 @@ layui.define(['form', 'upload'], function(exports){ admin.req({ type: "post" - ,url: '/admin/set/website' + ,url: setWebSite ,data: obj.field ,success: function(data){ if (data.code == 0) { @@ -93,7 +93,7 @@ layui.define(['form', 'upload'], function(exports){ admin.req({ type: 'post' - ,url: '/admin/set/email' + ,url: setEmail ,data: obj.field ,success: function(data){ if (data.code == 0) { @@ -126,7 +126,7 @@ layui.define(['form', 'upload'], function(exports){ admin.req({ type: 'post' - ,url: '/admin/Admin/infoSet' + ,url: adminInfoSet ,data: obj.field ,success: function(res){ if(res.code == 0){ @@ -190,7 +190,7 @@ layui.define(['form', 'upload'], function(exports){ //提交修改 admin.req({ type: 'post' - ,url: '/admin/Admin/repassSet' + ,url: adminRepassSet ,data: obj.field ,success: function(res){ if(res.code == 0){ diff --git a/public/static/admin/modules/useradmin.js b/public/static/admin/modules/useradmin.js index 5c3f5d7..1fde569 100644 --- a/public/static/admin/modules/useradmin.js +++ b/public/static/admin/modules/useradmin.js @@ -16,7 +16,7 @@ layui.define(['table', 'form'], function(exports){ //用户管理 table.render({ elem: '#LAY-user-manage' - ,url: '/admin/User/list' //模拟接口 + ,url: userList //模拟接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 50, title: 'ID', sort: true} @@ -53,7 +53,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/User/delete", + url:userDelete, data:{id:data.id}, dataType:'json', success:function(data){ @@ -84,7 +84,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑用户' - ,content: '/admin/User/userEdit?id='+ data.id + ,content: userEdit +'?id='+ data.id ,maxmin: true ,area: ['500px', '450px'] ,btn: ['确定', '取消'] @@ -101,7 +101,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/User/userEdit", + url:userEdit, data:{"id":field.id,"name":field.username,"phone":field.phone,"email":field.email,"user_img":field.avatar,"sex":field.sex}, daType:"json", success:function (res){ @@ -139,7 +139,7 @@ layui.define(['table', 'form'], function(exports){ //管理员管理 table.render({ elem: '#LAY-user-back-manage' - ,url: '/admin/Admin/index' //模拟接口 + ,url: adminIndex //模拟接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 80, title: 'ID', sort: true} @@ -167,7 +167,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/Admin/delete", + url:adminDelete, data:{id:data.id}, dataType:'json', success:function(data){ @@ -198,7 +198,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑管理员' - ,content: '/admin/Admin/edit?id='+ data.id + ,content: adminEdit +'?id='+ data.id ,area: ['420px', '420px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ @@ -213,7 +213,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/Admin/edit", + url:adminEdit, data:{"id":field.id,"password":field.password,"mobile":field.mobile,"email":field.email}, daType:"json", success:function (res){ @@ -244,15 +244,13 @@ layui.define(['table', 'form'], function(exports){ } }) } - //执行管理员审核 - $('#adcheck').click(function() {}) }); //角色管理 table.render({ elem: '#LAY-user-back-role' - ,url: '/admin/AuthGroup/list' //模拟接口 + ,url: authGroupList //role接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 80, title: 'ID', sort: true} @@ -274,7 +272,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/AuthGroup/roledel", + url:authGroupRoledel, data:{id:data.id}, dataType:'json', success:function(data){ @@ -303,7 +301,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑角色' - ,content: '/admin/AuthGroup/roleEdit?id='+ data.id + ,content: authGroupRoleEdit +'?id='+ data.id ,area: ['500px', '480px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ @@ -335,7 +333,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/AuthGroup/roleEdit", + url:authGroupRoleEdit, data:{"id":field.id,"rules":rules,"title":field.title,"descr":field.descr}, daType:"json", success:function (res){ @@ -372,7 +370,7 @@ layui.define(['table', 'form'], function(exports){ //用户组管理 table.render({ elem: '#LAY-user-back-group' - ,url: '/admin/AuthAccess/index' //接口 + ,url: authAccessIndex //用户组access接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 80, title: 'ID', sort: true} @@ -393,7 +391,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/AuthAccess/delete", + url:authAccessDelete, data:{id:data.id}, dataType:'json', success:function(data){ @@ -421,7 +419,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑用户权限' - ,content: '/admin/AuthAccess/edit?id='+ data.id + ,content: authAccessEdit +'?id='+ data.id ,area: ['350px', '420px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ @@ -434,7 +432,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/AuthAccess/edit", + url:authAccessEdit, data:field, daType:"json", success:function (res){ @@ -470,7 +468,7 @@ layui.define(['table', 'form'], function(exports){ //权限管理 table.render({ elem: '#LAY-user-auth-rule' - ,url: '/admin/AuthRule/index' //权限接口 + ,url: authRuleIndex //权限接口 ,cols: [[ {type: 'checkbox', fixed: 'left'} ,{field: 'id', width: 50, title: 'ID', align: 'center'} @@ -500,7 +498,7 @@ layui.define(['table', 'form'], function(exports){ //console.log(data.id); $.ajax({ type:'post', - url:"/admin/AuthRule/delete", + url:authRuleDelete, data:{id:data.id}, dataType:'json', success:function(data){ @@ -530,7 +528,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑权限' - ,content: '/admin/AuthRule/edit?id='+ data.id + ,content: authRuleEdit +'?id='+ data.id ,area: ['420px', '420px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ @@ -551,7 +549,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/AuthRule/edit", + url:authRuleEdit, data:{"id":field.id,"pid":field.pid,"title":field.title,"name":field.name,"icon":field.icon,"sort":field.sort,"ishidden":field.ishidden}, daType:"json", success:function (res){ diff --git a/public/static/admin/modules/webset.js b/public/static/admin/modules/webset.js index 7c87afb..d1d4475 100644 --- a/public/static/admin/modules/webset.js +++ b/public/static/admin/modules/webset.js @@ -8,7 +8,7 @@ layui.define(['table', 'form'], function(exports){ //签到规则 table.render({ elem: '#sign-rule', - url: '/admin/Sign/signRule', + url: signSignRule, cols:[[ {type: 'numbers', fixed: 'left'}, {field: 'days',title: '天数'}, @@ -37,7 +37,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/Sign/delete", + url:signDelete, data:{id:data.id}, dataType:'json', success:function(data){ @@ -66,7 +66,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑签到' - ,content: '/admin/Sign/signEdit?id='+ data.id + ,content: signSignEdit +'?id='+ data.id ,maxmin: true ,area: ['350px', '300px'] ,btn: ['确定', '取消'] @@ -83,7 +83,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/Sign/signEdit", + url:signSignEdit, data:field, daType:"json", success:function (res){ @@ -120,7 +120,7 @@ layui.define(['table', 'form'], function(exports){ //Vip规则 table.render({ elem: '#vip-rule', - url: '/admin/Vip/vipRule', + url: vipRule, cols:[[ {type: 'numbers', fixed: 'left'}, {field: 'vip',title: '等级'}, @@ -151,7 +151,7 @@ layui.define(['table', 'form'], function(exports){ //obj.del(); $.ajax({ type:'post', - url:"/admin/Vip/delete", + url:vipDelete, data:{id:data.id}, dataType:'json', success:function(data){ @@ -180,7 +180,7 @@ layui.define(['table', 'form'], function(exports){ layer.open({ type: 2 ,title: '编辑VIP' - ,content: '/admin/Vip/vipEdit?id='+ data.id + ,content: vipEdit +'?id='+ data.id ,maxmin: true ,area: ['400px', '370px'] ,btn: ['确定', '取消'] @@ -197,7 +197,7 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ type:"post", - url:"/admin/Vip/vipEdit", + url:vipEdit, data:field, daType:"json", success:function (res){ diff --git a/view/admin/admin/index.html b/view/admin/admin/index.html index fa5b668..aa6c45e 100644 --- a/view/admin/admin/index.html +++ b/view/admin/admin/index.html @@ -72,6 +72,21 @@ {/block} {block name="js"} - - - - - - - - - diff --git a/view/admin/article/contform.html b/view/admin/article/contform.html deleted file mode 100644 index 244c7c4..0000000 --- a/view/admin/article/contform.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - layuiAdmin 评论管理 iframe 框 - - - - - - - - -
-
- -
- -
-
-
- -
- -
-
-
- - - - - \ No newline at end of file diff --git a/view/admin/article/list.html b/view/admin/article/list.html deleted file mode 100644 index 99c1c93..0000000 --- a/view/admin/article/list.html +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - layuiAdmin 内容系统 - 文章列表 - - - - - - - - -
-
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
- -
-
- - -
-
- - -
-
-
- - - - - diff --git a/view/admin/article/listform.html b/view/admin/article/listform.html deleted file mode 100644 index 80f81bd..0000000 --- a/view/admin/article/listform.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - layuiAdmin 文章管理 iframe 框 - - - - - - - -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- - -
-
- - - - - \ No newline at end of file diff --git a/view/admin/article/tags.html b/view/admin/article/tags.html deleted file mode 100644 index ab179c7..0000000 --- a/view/admin/article/tags.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - layuiAdmin 内容系统-分类管理 - - - - - - - - -
-
-
- -
-
-
- -
-
-
- - - - - diff --git a/view/admin/article/tagsform.html b/view/admin/article/tagsform.html deleted file mode 100644 index 5ed7579..0000000 --- a/view/admin/article/tagsform.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - layuiAdmin 分类管理 iframe 框 - - - - - - - - - -
-
- -
- -
-
-
- - - - - \ No newline at end of file diff --git a/view/admin/auth_access/index.html b/view/admin/auth_access/index.html index 52ae310..82d1ebb 100644 --- a/view/admin/auth_access/index.html +++ b/view/admin/auth_access/index.html @@ -44,6 +44,21 @@ {/block} {block name="js"} + {/block} diff --git a/view/admin/forum/replys.html b/view/admin/forum/replys.html index c56aeb6..6b911dc 100644 --- a/view/admin/forum/replys.html +++ b/view/admin/forum/replys.html @@ -53,7 +53,16 @@ {/block} {block name="js"} - {/block} \ No newline at end of file diff --git a/view/admin/notice/index.html b/view/admin/notice/index.html index 7cc6266..907fe0c 100644 --- a/view/admin/notice/index.html +++ b/view/admin/notice/index.html @@ -66,12 +66,16 @@ {/block} {block name="js"} - {/block} \ No newline at end of file