From 641e2400e6d8e7040c785e8fd45755f796440bd3 Mon Sep 17 00:00:00 2001 From: tao Date: Wed, 15 Dec 2021 15:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/AuthRule.php | 26 +- app/admin/controller/Index.php | 20 +- app/admin/middleware.php | 1 - app/admin/model/AuthRule.php | 13 +- app/admin/view/addons/index.html | 14 +- app/admin/view/forum/list.html | 42 +- app/admin/view/index/home.html | 104 ++-- app/admin/view/login/login.html | 52 +- app/common/controller/AdminController.php | 7 +- app/common/controller/BaseController.php | 5 +- app/middleware/AdminLoginCookie.php | 33 -- app/middleware/Auth.php | 27 +- config/app.php | 4 +- config/database.php | 10 +- public/static/admin/modules/addons.js | 467 ++++++++++-------- public/static/admin/modules/forum.js | 87 ++-- view/taoler/index/article/ask/cate.html | 4 +- view/taoler/index/article/ask/detail.html | 72 +-- view/taoler/index/article/edit.html | 39 +- view/taoler/index/article/posts/cate.html | 4 +- view/taoler/index/article/posts/detail.html | 112 ++--- view/taoler/index/doc/timeline.html | 5 +- view/taoler/index/index/index.html | 8 +- view/taoler/index/index/search.html | 4 +- view/taoler/index/login/forget.html | 6 +- view/taoler/index/login/login.html | 57 +-- view/taoler/index/login/reg.html | 91 ++-- view/taoler/index/public/base.html | 16 +- view/taoler/index/public/flink.html | 11 +- view/taoler/index/public/footer.html | 31 +- view/taoler/index/public/header.html | 33 +- view/taoler/index/public/index-forumlist.html | 2 +- view/taoler/index/public/index-slider.html | 24 +- view/taoler/index/public/index-topforum.html | 2 +- view/taoler/index/public/jump.html | 60 --- view/taoler/index/public/layout.html | 79 --- view/taoler/index/public/link.html | 1 - view/taoler/index/public/menu.html | 48 +- view/taoler/index/public/user-nav.html | 74 +-- view/taoler/index/public/user.html | 10 +- view/taoler/index/user/activate.html | 74 ++- view/taoler/index/user/home.html | 12 +- view/taoler/index/user/message.html | 107 ++-- view/taoler/index/user/post.html | 2 +- view/taoler/index/user/set.html | 313 ++++++------ view/taoler/index/user/upimg.html | 31 -- 46 files changed, 1042 insertions(+), 1202 deletions(-) delete mode 100644 app/middleware/AdminLoginCookie.php delete mode 100644 view/taoler/index/public/jump.html delete mode 100644 view/taoler/index/public/layout.html delete mode 100644 view/taoler/index/user/upimg.html diff --git a/app/admin/controller/AuthRule.php b/app/admin/controller/AuthRule.php index c3c0ffd..72a5edd 100644 --- a/app/admin/controller/AuthRule.php +++ b/app/admin/controller/AuthRule.php @@ -9,10 +9,11 @@ use app\admin\model\AuthRule as AuthRuleModel; class AuthRule extends AdminController { - //权限列表 + /** + * 菜单列表 + */ public function index() { - //获取权限列表 if(Request::isAjax()){ $rule = new AuthRuleModel(); @@ -34,15 +35,15 @@ class AuthRule extends AdminController } - //权限树 + /** + *权限树 + * 支持获取三级菜单 + */ public function tree() { - //$res = $this->treeTr($this->getMenus()); //var_dump($res); - /* - 支持获取三级菜单 - */ + $result = $this->getMenus(1); $count = count($result); @@ -72,14 +73,11 @@ class AuthRule extends AdminController $children[] = ['id'=>$j['id'],'title'=>$j['title'],'pid'=>$j['pid'],'children'=>$chichi]; //子数据 } } - - - $data[] = ['id'=>$v['id'],'title'=>$v['title'],'pid'=>$v['pid'],'children'=>$children]; - + $data[] = ['id'=>$v['id'],'title'=>$v['title'],'pid'=>$v['pid'],'children'=>$children]; } - //构造一个顶级菜单pid=0的数组。把权限放入顶级菜单下子权限中 - $tree['data'][] = ['id'=>0,'title'=>'顶级','pid'=>0,'children'=>$data]; + //构造一个顶级菜单pid=0的数组。把权限放入顶级菜单下子权限中 + $tree['data'][] = ['id'=>0,'title'=>'顶级','pid'=>0,'children'=>$data]; } return json($tree); @@ -88,7 +86,6 @@ class AuthRule extends AdminController //添加权限 public function add() { - // if(Request::isAjax()){ $data = Request::param(); $plevel = Db::name('auth_rule')->field('level')->find($data['pid']); @@ -106,6 +103,7 @@ class AuthRule extends AdminController return json(['code'=>-1,'msg'=>'添加权限失败']); } } + $rule = new AuthRuleModel(); $auth_rules = $rule->authRuleTree(); View::assign('AuthRule',$auth_rules); diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index aee74a5..6fb707d 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -164,20 +164,16 @@ class Index extends AdminController //动态信息 public function news() { - $page = Request::param('page'); - $url = $this->api.'/v1/news?'.Request::query(); - $news = Cache::get('news'.$page); - if(is_null($news)){ + $data = Request::only(['page', 'limit']); + $url = $this->api.'/v1/news?'.'page='.$data['page'].'&'.'limit='.$data['limit']; + $news = Cache::get('news'.$data['page'].'_'.$data['limit']); + if(empty($news)){ $news = Api::urlGet($url); - Cache::set('news'.$page,$news,600); + if($news->code == 0){ + Cache::set('news'.$data['page'].'_'.$data['limit'],$news,600); + } } - - if($news){ - return $news; - }else{ - return json(['code'=>-1,'msg'=>'稍后获取内容...']); - } - + return $news; } //提交反馈 diff --git a/app/admin/middleware.php b/app/admin/middleware.php index da17ca4..786d990 100644 --- a/app/admin/middleware.php +++ b/app/admin/middleware.php @@ -1,6 +1,5 @@ where('id', $value ); } - //登陆校验 + /** + * 权限树 + */ public function authRuleTree() { $authRules = $this->order('sort asc')->select(); - return $this->sort($authRules); + //return $this->sort($authRules); + return $authRules; } - + /** + * id,pid,菜单排序 + * @var $data 数据 + * @var $pid 父级id + */ public function sort($data,$pid=0) { static $arr = array(); diff --git a/app/admin/view/addons/index.html b/app/admin/view/addons/index.html index 057a1d0..94b9e38 100644 --- a/app/admin/view/addons/index.html +++ b/app/admin/view/addons/index.html @@ -22,14 +22,14 @@ - + - - - diff --git a/app/admin/view/index/home.html b/app/admin/view/index/home.html index 33609b5..bf3607a 100644 --- a/app/admin/view/index/home.html +++ b/app/admin/view/index/home.html @@ -5,11 +5,12 @@
-
-
-
-
-
+
+
+
+
+
+
快捷方式
@@ -74,6 +75,7 @@
+
待办事项
@@ -120,6 +122,7 @@
+
数据概览
@@ -138,55 +141,55 @@
    -
  • 官方动态
  • +
  • 官方动态
  • 发送反馈
  • 今周发帖
  • 今周评论
- -
+ +
-
-
-
- -
- -
-
-
- -
- -
-
-
-
-
- -
-
-
- -
-
- -
-
-
-
- -
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+ +
- +
@@ -210,7 +213,7 @@ - + 当前系统 - + 核心框架 - + PHP版本 - + 运行时间 - + 当前授权 -
diff --git a/app/admin/view/login/login.html b/app/admin/view/login/login.html index 87b79f2..5cde107 100644 --- a/app/admin/view/login/login.html +++ b/app/admin/view/login/login.html @@ -46,7 +46,7 @@ 注册帐号 - {:hook('socialhook')} + {:hook('socialhook')}
@@ -93,8 +93,6 @@ form.render(); - - //回车登陆 $(document).keydown(function(e){ if(e.keyCode == 13){ @@ -107,41 +105,35 @@ //请求登入接口 admin.req({ - type: "post" - ,url: '{:url('login/index')}' //实际使用请改成服务端真实接口 + type: "post" + ,url: "{:url('login/index')}" //实际使用请改成服务端真实接口 ,data: obj.field ,success: function(res){ - if(res.code == 0){ + if(res.code == 0){ /* - //请求成功后,写入 access_token - layui.data(setter.tableName, { - key: setter.request.tokenName - ,value: res.data.access_token - }); + //请求成功后,写入 access_token + layui.data(setter.tableName, { + key: setter.request.tokenName + ,value: res.data.access_token + }); */ - //登入成功的提示与跳转 - layer.msg('登入成功', { - offset: '15px' - ,icon: 1 - ,time: 1000 - }, function(){ - location.href = "{:url('index/index')}"; //后台主页 - }); - } else { - layer.open({ - title:'登陆失败', - content:res.msg, - icon:5, - anim:6 - }); - layui.jquery('#LAY-user-get-vercode').attr('src', '{:captcha_src()}?'+Math.random()); - } + //登入成功的提示与跳转 + layer.msg('登入成功', { + offset: '15px' + ,icon: 1 + ,time: 1000 + }, function(){ + location.href = "{:url('index/index')}"; //后台主页 + }); + } else { + layer.open({title:'登陆失败', content:res.msg, icon:5, anim:6}); + layui.jquery('#LAY-user-get-vercode').attr('src', '{:captcha_src()}?'+Math.random()); + } } }); - return false; + return false; }); - }); diff --git a/app/common/controller/AdminController.php b/app/common/controller/AdminController.php index 07ca1cb..83e0e04 100644 --- a/app/common/controller/AdminController.php +++ b/app/common/controller/AdminController.php @@ -18,10 +18,13 @@ use think\facade\Lang; */ class AdminController extends \app\BaseController { - // 初始化 + /** + * 初始化菜单 + */ protected function initialize() { //权限auth检查 + $this->aid = Session::get('admin_id'); //$this->checkAuth(); $this->getMenu(); //系统配置 @@ -47,7 +50,7 @@ class AdminController extends \app\BaseController } $menu = !empty($menu) ? array2tree($menu) : []; - return View::assign('menu', $menu); + View::assign('menu', $menu); } /** diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index 37ecc58..12bc59b 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -15,7 +15,9 @@ use app\BaseController as BaseCtrl; */ class BaseController extends BaseCtrl { - // 初始化 + /** + * 初始化系统,导航,用户 + */ protected function initialize() { $this->uid = Session::get('user_id'); @@ -23,6 +25,7 @@ class BaseController extends BaseCtrl $this->showSystem(); //显示分类导航 $this->showNav(); + //用户 $this->showUser($this->uid); } diff --git a/app/middleware/AdminLoginCookie.php b/app/middleware/AdminLoginCookie.php deleted file mode 100644 index 9133938..0000000 --- a/app/middleware/AdminLoginCookie.php +++ /dev/null @@ -1,33 +0,0 @@ -where('id',$userId)->find(); - if(!is_null($user)){ - //验证cookie - $salt = Config::get('taoler.salt'); - $auth = md5($user['username'].$salt).":".$userId; - if($auth==$cooAuth){ - Session::set('admin_name',$user['username']); - Session::set('admin_id',$userId); - } - } - - } - return $next($request); - } -} diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php index da3cd98..fa2525a 100644 --- a/app/middleware/Auth.php +++ b/app/middleware/Auth.php @@ -5,6 +5,9 @@ namespace app\middleware; use taoser\think\Auth as UserAuth; use think\facade\Session; +use think\facade\Cookie; +use think\facade\Db; +use think\facade\Config; class Auth { @@ -17,8 +20,28 @@ class Auth */ public function handle($request, \Closure $next) { + //访问路径 $path = app('http')->getName().'/'.stristr($request->pathinfo(),".html",true); -//var_dump($path); + //登陆前获取加密的Cookie + $cooAuth = Cookie::get('adminAuth'); + + if(!empty($cooAuth)){ + $resArr = explode(':',$cooAuth); + $userId = end($resArr); + //检验用户 + $user = Db::name('admin')->where('id',$userId)->find(); + if(!empty($user)){ + //验证cookie + $salt = Config::get('taoler.salt'); + $auth = md5($user['username'].$salt).":".$userId; + if($auth==$cooAuth){ + Session::set('admin_name',$user['username']); + Session::set('admin_id',$userId); + } + } + + } + //没有登录及当前非登录页重定向登录页 if(!Session::has('admin_id') && $path !== 'admin/login/index' && !stristr($request->pathinfo(),"captcha.html") ) { @@ -43,6 +66,6 @@ class Auth return json(['code'=>-1,'msg'=>'无权限']); } } - return $next($request); + return $next($request); } } diff --git a/config/app.php b/config/app.php index 26bf926..ff51e3c 100644 --- a/config/app.php +++ b/config/app.php @@ -29,8 +29,8 @@ return [ 'deny_app_list' => [], // 异常页面的模板文件 - //'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', - 'exception_tmpl' => app()->getAppPath() . '404.html', + 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl', + //'exception_tmpl' => app()->getAppPath() . '404.html', // 错误显示信息,非调试模式有效 'error_message' => '页面错误!请稍后再试~', diff --git a/config/database.php b/config/database.php index e415fd6..f4dd0fa 100644 --- a/config/database.php +++ b/config/database.php @@ -16,13 +16,13 @@ return [ // 数据库类型 'type' => 'mysql', // 服务器地址 - 'hostname' => '', + 'hostname' => '127.0.0.1', // 数据库名 - 'database' => '', + 'database' => 'taoler', // 用户名 - 'username' => '', + 'username' => 'taoler', // 密码 - 'password' => '', + 'password' => 'taoler2022', // 端口 'hostport' => '3306', // 数据库连接参数 @@ -30,7 +30,7 @@ return [ // 数据库编码默认采用utf8 'charset' => 'utf8', // 数据库表前缀 - 'prefix' => '', + 'prefix' => 'tao_', // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 'deploy' => 0, // 数据库读写是否分离 主从式有效 diff --git a/public/static/admin/modules/addons.js b/public/static/admin/modules/addons.js index eb5bd3e..d581029 100644 --- a/public/static/admin/modules/addons.js +++ b/public/static/admin/modules/addons.js @@ -1,219 +1,264 @@ //网站app版本发布 -layui.define(['table', 'form','upload'], function(exports){ - var $ = layui.jquery - ,table = layui.table - ,form = layui.form - ,upload = layui.upload; +layui.define(["table", "form", "upload"], function (exports) { + var $ = layui.jquery, + table = layui.table, + form = layui.form, + upload = layui.upload; -function addList(type) - { - $.ajax({ - type: 'post', - url: addonsList , - data: {type:type}, - dataType: 'json', - success: function (res) { - //渲染表格 - table.render({ - elem: '#addons-list', - toolbar: '#toolbar', - defaultToolbar: [], - url: addonsList + '?type='+ type, - cols: [ - res['col'] - ] - , page: true - , limit: 10 - , height: 'full-220' - , text: '对不起,加载出现异常!' - }); - } - }); -} - -addList('installed'); - - //头工具栏事件 - table.on('toolbar(addons-list)', function(obj){ - var checkStatus = table.checkStatus(obj.config.id); - switch(obj.event){ - case 'installed': - addList("installed"); - break; - case 'onlineAddons': - addList("onlineAddons"); - break; - } - }); - -//监听工具条 - table.on('tool(addons-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){ - $.post(addonsDelete,{name:data.name},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('addons-list'); - layer.close(index); + function addList(type) { + $.ajax({ + type: "post", + url: addonsList, + data: { type: type }, + dataType: "json", + success: function (res) { + //渲染表格 + table.render({ + elem: "#addons-list", + toolbar: "#toolbar", + defaultToolbar: [], + url: addonsList + "?type=" + type, + cols: [res["col"]], + page: true, + limit: 10, + height: "full-220", + text: "对不起,加载出现异常!", }); - }); - } else if(obj.event === 'edit'){ - var tr = $(obj.tr); - layer.open({ - type: 2 - ,title: '编辑插件' - ,content: addonsEdit + '?id='+ data.id - ,maxmin: true - ,area: ['400px', '620px'] - ,btn: ['确定', '取消'] - ,yes: function(index, layero){ - var iframeWindow = window['layui-layer-iframe'+ index] - ,submitID = 'LAY-addons-submit' - ,submit = layero.find('iframe').contents().find('#'+ submitID); + }, + }); + } - //监听提交 - iframeWindow.layui.form.on('submit('+ submitID +')', function(data){ - var field = data.field; //获取提交的字段 - - //提交 Ajax 成功后,静态更新表格中的数据 - $.ajax({ - type:"post", - url:addonsEdit, - data:field, - 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('addons-list'); //数据刷新 - layer.close(index); //关闭弹层 - }); - - submit.trigger('click'); - } - ,success: function(layero, index){ - - } - }); - } else if (obj.event === 'start'){ - //提交 Ajax 成功后,静态更新表格中的数据 - $.ajax({ - type:"post", - url:addonsStart, - data:{name:data.name}, - 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}); - } - } - }); - } else if(obj.event === 'shutdown'){ - //提交 Ajax 成功后,静态更新表格中的数据 - $.ajax({ - type:"post", - url:addonsShut, - data:{name:data.name}, - 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}); - } - } - }); - } else if(obj.event === 'install'){ - //安装插件 - $.post(addonsInstall,{name:data.name,version:data.version},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}); - } - }); - } else if(obj.event === 'config'){ - layer.open({ - type: 2 - ,title: '配置插件' - ,content: addonsConfig + '?name='+ data.name - ,maxmin: true - ,area: ['780px', '90%'] - ,btn: ['确定', '取消'] - ,yes: function(index, layero){ - var iframeWindow = window['layui-layer-iframe'+ index] - ,submitID = 'LAY-addons-config-submit' - ,submit = layero.find('iframe').contents().find('#'+ submitID); - //监听提交 - iframeWindow.layui.form.on('submit('+ submitID +')', function(data){ - var field = data.field; //获取提交的字段 - $.ajax({ - type:"post", - url:addonsConfig, - data:field, - 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}); - } - } - }); - layer.close(index); //关闭弹层 - }); - submit.trigger('click'); - } - ,success: function(layero, index){ - var forms = layero.find('iframe').contents().find('.layui-form'); - var button = forms.find('button'); - //事件委托 - forms.on('click','button',function (data) { - var even = this.getAttribute('lay-event'); - var names = this.dataset.name; - if(even == 'addInput'){ - var html = '
\n' + - ' \n' + - '
\n' + - ' \n' + - '
\n' + - ' \n' + - '
'; + addList("onlineAddons"); - $(this).parent().parent().append(html); - } else { - $(this).parent().remove(); - } - }); - - } - }); - - } - table.reload('addons-list'); //数据刷新 + //头工具栏事件 + table.on("toolbar(addons-list)", function (obj) { + var checkStatus = table.checkStatus(obj.config.id); + switch (obj.event) { + case "installed": + addList("installed"); + break; + case "onlineAddons": + addList("onlineAddons"); + break; + } }); - exports('addons', {}) -}); \ No newline at end of file + //监听工具条 + table.on("tool(addons-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) { + $.post(addonsDelete, { name: data.name }, 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("addons-list"); + layer.close(index); + }); + } + ); + } else if (obj.event === "edit") { + var tr = $(obj.tr); + layer.open({ + type: 2, + title: "编辑插件", + content: addonsEdit + "?id=" + data.id, + maxmin: true, + area: ["400px", "620px"], + btn: ["确定", "取消"], + yes: function (index, layero) { + var iframeWindow = window["layui-layer-iframe" + index], + submitID = "LAY-addons-submit", + submit = layero + .find("iframe") + .contents() + .find("#" + submitID); + + //监听提交 + iframeWindow.layui.form.on( + "submit(" + submitID + ")", + function (data) { + var field = data.field; //获取提交的字段 + + //提交 Ajax 成功后,静态更新表格中的数据 + $.ajax({ + type: "post", + url: addonsEdit, + data: field, + 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("addons-list"); //数据刷新 + layer.close(index); //关闭弹层 + } + ); + + submit.trigger("click"); + }, + success: function (layero, index) {}, + }); + } else if (obj.event === "start") { + //提交 Ajax 成功后,静态更新表格中的数据 + $.ajax({ + type: "post", + url: addonsStart, + data: { name: data.name }, + 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, + }); + } + }, + }); + } else if (obj.event === "shutdown") { + //提交 Ajax 成功后,静态更新表格中的数据 + $.ajax({ + type: "post", + url: addonsShut, + data: { name: data.name }, + 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, + }); + } + }, + }); + } else if (obj.event === "install") { + //安装插件 + $.post( + addonsInstall, + { name: data.name, version: data.version }, + 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, + }); + } + } + ); + } else if (obj.event === "config") { + layer.open({ + type: 2, + title: "配置插件", + content: addonsConfig + "?name=" + data.name, + maxmin: true, + area: ["780px", "90%"], + btn: ["确定", "取消"], + yes: function (index, layero) { + var iframeWindow = window["layui-layer-iframe" + index], + submitID = "LAY-addons-config-submit", + submit = layero + .find("iframe") + .contents() + .find("#" + submitID); + //监听提交 + iframeWindow.layui.form.on( + "submit(" + submitID + ")", + function (data) { + var field = data.field; //获取提交的字段 + $.ajax({ + type: "post", + url: addonsConfig, + data: field, + 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, + }); + } + }, + }); + layer.close(index); //关闭弹层 + } + ); + submit.trigger("click"); + }, + success: function (layero, index) { + var forms = layero.find("iframe").contents().find(".layui-form"); + var button = forms.find("button"); + //事件委托 + forms.on("click", "button", function (data) { + var even = this.getAttribute("lay-event"); + var names = this.dataset.name; + if (even == "addInput") { + var html = '
\n' + + '\n' + + '
\n' + + ' \n' + + '
\n' + + '
\n' + + ' \n' + + '
\n' + + '\n' + + '
'; + + $(this).parent().parent().append(html); + } else { + $(this).parent().remove(); + } + }); + }, + }); + } + table.reload("addons-list"); //数据刷新 + }); + + exports("addons", {}); +}); diff --git a/public/static/admin/modules/forum.js b/public/static/admin/modules/forum.js index 2a0bf29..b4c4e9d 100644 --- a/public/static/admin/modules/forum.js +++ b/public/static/admin/modules/forum.js @@ -1,12 +1,3 @@ -/** - - @Name:layuiAdmin 社区系统 - @Author:star1029 - @Site:http://www.layui.com/admin/ - @License:LPPL - - */ - layui.define(['table', 'form'], function(exports){ var $ = layui.$ @@ -23,12 +14,12 @@ layui.define(['table', 'form'], function(exports){ ,{field: 'poster', title: '贴主',width: 100} ,{field: 'avatar', title: '头像', width: 80, templet: '#imgTpl'} ,{field: 'title', title: '标题', mWidth: 200,templet: '#title'} - ,{field: 'content', title: '内容', mWidth: 200} + ,{field: 'content', title: '内容', mWidth: 200} ,{field: 'posttime', title: '时间',width: 120, sort: true} ,{field: 'top', title: '置顶', templet: '#buttonTpl', width: 80, align: 'center'} - ,{field: 'hot', title: '精贴', templet: '#buttonHot', width: 80, align: 'center'} - ,{field: 'reply', title: '评论状态', templet: '#buttonReply', width: 80, align: 'center'} - ,{field: 'check', title: '审帖', templet: '#buttonCheck', width: 100, align: 'center'} + ,{field: 'hot', title: '加精', templet: '#buttonHot', width: 80, align: 'center'} + ,{field: 'reply', title: '禁评', templet: '#buttonReply', width: 80, align: 'center'} + ,{field: 'check', title: '审帖', templet: '#buttonCheck', width: 100, align: 'center'} ,{title: '操作', width: 60, align: 'center', toolbar: '#table-forum-list'} ]] ,page: true @@ -92,31 +83,30 @@ layui.define(['table', 'form'], function(exports){ //提交 Ajax 成功后,静态更新表格中的数据 //$.ajax({}); - $.ajax({ - type:"post", - url:"/admin/Forum/listform", - data:{"id":data.id,"poster":name,"sort":sort,"ename":ename}, - 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 - }); - } - } - }); - - + $.ajax({ + type:"post", + url:"/admin/Forum/listform", + data:{"id":data.id,"poster":name,"sort":sort,"ename":ename}, + 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 + }); + } + } + }); + table.reload('LAY-app-forum-list'); //数据刷新 layer.close(index); //关闭弹层 }); @@ -143,7 +133,7 @@ layui.define(['table', 'form'], function(exports){ ,{field: 'content', title: '评论', minWidth: 200} ,{field: 'replytime', title: '回复时间', width: 120, sort: true} ,{field: 'check', title: '审核', templet: '#buttonCheck', width: 100} - ,{title: '操作', width: 85, align: 'center', toolbar: '#table-forum-replys'} + ,{title: '操作', width: 60, align: 'center', toolbar: '#table-forum-replys'} ]] ,page: true ,limit: 15 @@ -216,16 +206,15 @@ layui.define(['table', 'form'], function(exports){ 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: 'detpl',title: '模板', align: 'center',width: 100,templet: '#inputSel'} - ,{title: '图标', align: 'center',width: 50,templet: '

'} - ,{field: 'is_hot', title: '热门', align: 'center',width: 50, templet: '#buttonHot'} - ,{field: 'desc', title: '描述', minWidth: 100} - ,{title: '操作', width: 100, align: 'center', toolbar: '#layuiadmin-app-cont-tagsbar'} + {field: 'sort', title: '排序', width: 80, sort: true} + ,{field: 'id', title: 'ID',width: 60} + ,{field: 'tags', title: '分类名', width: 100} + ,{field: 'ename', title: 'EN别名', width: 100} + ,{field: 'detpl',title: '模板', align: 'center',width: 100,templet: '#inputSel'} + ,{title: '图标', align: 'center',width: 50,templet: '

'} + ,{field: 'is_hot', title: '热门', align: 'center',width: 50, templet: '#buttonHot'} + ,{field: 'desc', title: '描述', minWidth: 200} + ,{title: '操作', width: 100, align: 'center', toolbar: '#layuiadmin-app-cont-tagsbar'} ]] ,text: '对不起,加载出现异常!' }); diff --git a/view/taoler/index/article/ask/cate.html b/view/taoler/index/article/ask/cate.html index d68d1dd..963af87 100644 --- a/view/taoler/index/article/ask/cate.html +++ b/view/taoler/index/article/ask/cate.html @@ -32,7 +32,7 @@ {/if} diff --git a/view/taoler/index/article/ask/detail.html b/view/taoler/index/article/ask/detail.html index 4611499..741db91 100644 --- a/view/taoler/index/article/ask/detail.html +++ b/view/taoler/index/article/ask/detail.html @@ -12,7 +12,7 @@
{//标题}
-

{$article.title}

+

{$article.title}

{if ($article.jie == 0)} {:lang('no finished')} {else /} @@ -149,7 +149,7 @@
{volist name="ad_comm" id="vo"} - {$vo.slid_name} + {$vo.slid_name} {/volist}
@@ -180,6 +180,7 @@ {/block} \ No newline at end of file diff --git a/view/taoler/index/doc/timeline.html b/view/taoler/index/doc/timeline.html index f5493f8..a4d903b 100644 --- a/view/taoler/index/doc/timeline.html +++ b/view/taoler/index/doc/timeline.html @@ -75,7 +75,7 @@
{volist name="ad_index" id="vo"} - {$vo.slid_name} + {$vo.slid_name} {/volist}
@@ -135,6 +135,7 @@ }); return false; }); - +}); + {/block} \ No newline at end of file diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 932222f..2db9991 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -56,7 +56,7 @@
{volist name="ad_index" id="vo"} - {$vo.slid_name} + {$vo.slid_name} {/volist}
@@ -104,9 +104,9 @@ var signJsonUrl = "{:url('sign/signJson')}"; $('#friend-link').on('click', function(){ layer.open({ - title: '申请友链', - content: '发送邮件至:{$adminEmail} ', - yes: function(index, layero){ + title: '申请友链', + content: '发送邮件至:{$adminEmail} ', + yes: function(index, layero){ layer.close(index); } }); diff --git a/view/taoler/index/index/search.html b/view/taoler/index/index/search.html index e9a83fe..b175ad1 100644 --- a/view/taoler/index/index/search.html +++ b/view/taoler/index/index/search.html @@ -12,7 +12,7 @@ “{$keywords}” 共{$counts}条结果
diff --git a/view/taoler/index/login/forget.html b/view/taoler/index/login/forget.html index 49bdd45..ec505ed 100644 --- a/view/taoler/index/login/forget.html +++ b/view/taoler/index/login/forget.html @@ -49,11 +49,9 @@
- -
- captcha +
+ captcha
-
diff --git a/view/taoler/index/login/login.html b/view/taoler/index/login/login.html index 63fa02c..a91b9f0 100644 --- a/view/taoler/index/login/login.html +++ b/view/taoler/index/login/login.html @@ -31,11 +31,11 @@
-
- captcha +
+ captcha
-
+
@@ -57,35 +57,26 @@ {block name="script"} {/block} \ No newline at end of file diff --git a/view/taoler/index/login/reg.html b/view/taoler/index/login/reg.html index 9f78025..4cd7d77 100644 --- a/view/taoler/index/login/reg.html +++ b/view/taoler/index/login/reg.html @@ -13,53 +13,53 @@
-
- -
- -
+
+ +
+
-
- -
- -
-
{:lang('the only way to get back your password')}
+
+
+ +
+
-
- -
- -
-
{:lang('strong type encryption')}
+
{:lang('the only way to get back your password')}
+
+
+ +
+
-
- -
- -
+
{:lang('strong type encryption')}
+
+
+ +
+
-
- -
- -
-
- -
- captcha -
-
-
-
-
- +
+
+ +
+
- +
+ +
+ captcha +
+
+
+
+
+ +
+
@@ -78,9 +78,7 @@ var layer = layui.layer; //注册 form.on('submit(user-register)', function(data){ var field = data.field; - var loading = layer.load(2, { - shade: [0.2, '#000'] - }); + var loading = layer.load(2, {shade: [0.2, '#000']}); $.ajax({ type:'post', url:"{:url('Login/reg')}", @@ -98,8 +96,9 @@ var layer = layui.layer; layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random()); }} }); - return false; + return false; }); }); + {/block} diff --git a/view/taoler/index/public/base.html b/view/taoler/index/public/base.html index ee59b38..740f5e6 100644 --- a/view/taoler/index/public/base.html +++ b/view/taoler/index/public/base.html @@ -4,8 +4,8 @@ {block name="title"}标题{/block} - - + + {block name="link"}{/block} @@ -15,7 +15,7 @@ display: none } {if strpos($Request.SERVER.HTTP_USER_AGENT,"Html5Plus") !== false} - html body{margin-top: 1px;} + html body{margin-top: 1px;} {/if} @@ -35,11 +35,11 @@ diff --git a/view/taoler/index/public/header.html b/view/taoler/index/public/header.html index 5f94f65..baf333a 100644 --- a/view/taoler/index/public/header.html +++ b/view/taoler/index/public/header.html @@ -9,11 +9,11 @@ {//移动端LOGO}
\ No newline at end of file diff --git a/view/taoler/index/public/index-forumlist.html b/view/taoler/index/public/index-forumlist.html index 372a4b2..b259e22 100644 --- a/view/taoler/index/public/index-forumlist.html +++ b/view/taoler/index/public/index-forumlist.html @@ -4,7 +4,7 @@

{if config('taoler.config.cate_show') == 1}{:cookie('think_lang') == 'en-us' ? $art.cate.ename : $art.cate.catename}{/if} - {$art.title} + {$art.title}

diff --git a/view/taoler/index/public/index-slider.html b/view/taoler/index/public/index-slider.html index a9acb3f..0a501c7 100644 --- a/view/taoler/index/public/index-slider.html +++ b/view/taoler/index/public/index-slider.html @@ -1,11 +1,13 @@ - \ No newline at end of file +
+ +
diff --git a/view/taoler/index/public/index-topforum.html b/view/taoler/index/public/index-topforum.html index 753335e..e07d13c 100644 --- a/view/taoler/index/public/index-topforum.html +++ b/view/taoler/index/public/index-topforum.html @@ -4,7 +4,7 @@

{if config('taoler.config.cate_show') == 1}{:cookie('think_lang') == 'en-us' ? $top.cate.ename : $top.cate.catename}{/if} - {$top.title} + {$top.title}

diff --git a/view/taoler/index/public/jump.html b/view/taoler/index/public/jump.html deleted file mode 100644 index 21197f0..0000000 --- a/view/taoler/index/public/jump.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - {block name="title"}这是title{/block} - - - - - - {include file="public/js" /} - - -{include file="public/header" /} - -{block name="column"} -{include file="/public/column" /} -{/block} - -{block name="content"} - - - -{/block} - -{include file="public/footer" /} - -{block name="script"} -{/block} - - - diff --git a/view/taoler/index/public/layout.html b/view/taoler/index/public/layout.html deleted file mode 100644 index 75840c6..0000000 --- a/view/taoler/index/public/layout.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - 用户中心 - - - - - - - -{include file="public/header" /} -
-{include file="public/nav" /} -
- {__CONTENT__} -
-
-{include file="public/footer" /} -{include file="public/js" /} - - - - - - - \ No newline at end of file diff --git a/view/taoler/index/public/link.html b/view/taoler/index/public/link.html index 9243b44..d763cd7 100644 --- a/view/taoler/index/public/link.html +++ b/view/taoler/index/public/link.html @@ -1,3 +1,2 @@ - \ No newline at end of file diff --git a/view/taoler/index/public/menu.html b/view/taoler/index/public/menu.html index d6b439f..331c992 100644 --- a/view/taoler/index/public/menu.html +++ b/view/taoler/index/public/menu.html @@ -1,29 +1,29 @@