diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php index f021d2e0..b1847bb9 100644 --- a/application/admin/model/Admin.php +++ b/application/admin/model/Admin.php @@ -7,6 +7,13 @@ use app\common\model\Base; class Admin extends Base { + // 用户角色获取器 + public function userGroup() + { + return $this->belongsToMany('AuthGroup','AuthGroupAccess','id','uid'); + } + + // 获取密码 public function password($username) { diff --git a/application/admin/model/AuthGroupAccess.php b/application/admin/model/AuthGroupAccess.php index 7edba059..b8cede76 100644 --- a/application/admin/model/AuthGroupAccess.php +++ b/application/admin/model/AuthGroupAccess.php @@ -3,9 +3,9 @@ namespace app\admin\model; // 引用用户数据模型 -use app\common\model\Base; +use think\model\Pivot; -class AuthGroupAccess extends Base +class AuthGroupAccess extends Pivot { // } diff --git a/application/common/view/create.html b/application/common/view/create.html index dd1199ff..aff1cbe9 100644 --- a/application/common/view/create.html +++ b/application/common/view/create.html @@ -1,84 +1,28 @@ - - - - - - - - - - - - -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/Hui-iconfont/1.0.8/iconfont.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/skin/default/skin.css" id="skin" /} -{css rel="stylesheet" type="text/css" href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/style.css" /} -{block name="mycss"}{/block} - - - - -{$list.title|default='添加信息'} - - - - -
- {block name="formaa"}{/block} -
- - -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/layer/2.4/layer.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/js/H-ui.min.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/js/H-ui.admin.js"} - - - -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/My97DatePicker/4.8/WdatePicker.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/jquery.validate.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/validate-methods.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery.validation/1.14.0/messages_zh.js"} -{block name="yanzheng"}{/block} - - - + + + + + + {$list.title} + + + + {load href="__STATIC__/xadmin/css/font.css" /} + {load href="__STATIC__/xadmin/css/xadmin.css" /} + {load href="__STATIC__/xadmin/js/jquery.min.js" /} + {load href="__STATIC__/xadmin/lib/layui/layui.js" /} + {load href="__STATIC__/xadmin/js/xadmin.js" /} + {load href="__STATIC__/xadmin/js/cookie.js" /} + + + + +
+ {block name="form"}{/block} +
+ {block name="myjs"}{/block} + \ No newline at end of file diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 4d3dda2a..728733e0 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -27,9 +27,12 @@ class Index extends Base // 查询系统信息 $list = $sysbasemod ->order(['id'=>'desc']) - ->field('webtitle,keywords,description') + ->field('id,webtitle,keywords,description') ->find(); + // 存储网站名 + session('webtitle',$list->webtitle); + // 获取版本号 $list->version = config('app.chengji.version'); // 获取用户名 @@ -50,7 +53,7 @@ class Index extends Base ]) ->order(['paixu']) ->select(); - // dump($list['menu']);halt('aa'); + // 模版赋值 $this->assign('list',$list); @@ -81,11 +84,8 @@ class Index extends Base $list['yuyan'] = request()->langset(); $list['server'] = request()->server(); $list['env'] = request()->env(); - - // $list['req'] = request(); - // dump($list); // 获取版本号 $list->version = config('app.chengji.version'); diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html index 646d6eff..1bc80a9c 100644 --- a/application/index/view/index/index.html +++ b/application/index/view/index/index.html @@ -2,7 +2,7 @@ - {$list.webtitle} v{$list['version']} + {php}echo session('webtitle'){/php} v{$list['version']} @@ -22,7 +22,7 @@
- +
diff --git a/application/index/view/index/welcome.html b/application/index/view/index/welcome.html index 4ade43a8..3fed3dc8 100644 --- a/application/index/view/index/welcome.html +++ b/application/index/view/index/welcome.html @@ -2,7 +2,7 @@ - {$list.webtitle} + {php}echo session('webtitle'){/php} diff --git a/application/login/controller/Index.php b/application/login/controller/Index.php index c2634def..a3cef54a 100644 --- a/application/login/controller/Index.php +++ b/application/login/controller/Index.php @@ -9,6 +9,8 @@ use app\admin\model\Admin as AD; use WhiteHat101\Crypt\APR1_MD5; // 引用Session类 use \think\facade\Session; +// 引用验证码类 +use think\captcha\Captcha; class Index extends Controller @@ -21,15 +23,7 @@ class Index extends Controller // 清除session(当前作用域) session(null); - //实例化数据模型 - $sysbasemod = new \app\system\model\SystemBase; - - // 查询系统信息 - $list['webtitle'] = $sysbasemod - ->order(['id'=>'desc']) - ->limit(1) - ->value('webtitle'); - + // 获取系统版本号 $list['version'] = config('app.chengji.version'); $this->assign('list',$list); @@ -48,22 +42,16 @@ class Index extends Controller // 获取表单数据 - $data = request()->only(['username','password']); + $data = request()->only(['username','password','captcha']); // 验证表单数据 $result = $validate->check($data); - $msg = $validate->getError(); if(!$result){ - $this->error($msg); + $data=['msg'=>$validate->getError(),'status'=>0]; + return json($data); } - // if(!captcha_check($data['captcha'])) - // { - // $this->error('验证码错误'); - // } - - // 验证用户名和密码 $check = $this->check($data['username'],$data['password']); @@ -132,5 +120,14 @@ class Index extends Controller } return $check; } - + + // 生成验证码 + public function verify() + { + $captcha = new Captcha(); + $captcha->fontSize = 30; + $captcha->length = 6; + $captcha->codeSet = '0123456789'; + return $captcha->entry(); + } } diff --git a/application/login/validate/Yanzheng.php b/application/login/validate/Yanzheng.php index a5e006d4..d9044341 100644 --- a/application/login/validate/Yanzheng.php +++ b/application/login/validate/Yanzheng.php @@ -13,12 +13,12 @@ class Yanzheng extends Validate * @var array */ protected $rule = [ - 'username' => 'require', - 'password' => 'require', + 'username|用户名' => 'require', + 'password|密码' => 'require', + 'captcha|验证码'=>'require|captcha', ]; protected $message = [ - 'username.require' => '用户名必须填写', - 'password.require' => '密码必须填写', + ]; } diff --git a/application/login/view/index/index.html b/application/login/view/index/index.html index 6fa102e5..1219ba08 100644 --- a/application/login/view/index/index.html +++ b/application/login/view/index/index.html @@ -2,7 +2,7 @@ - {$list['webtitle']} v{$list['version']} + 小学生成绩管理平台 v{$list['version']} @@ -26,6 +26,10 @@

+ +
+ captcha +

@@ -35,18 +39,21 @@ $(function () { layui.use('form', function(){ var form = layui.form; + //监听提交 form.on('submit(login)', function(data){ $.post("/login",data.field,function(data,status){ if(status != 'success') { layer.msg('数据传输错误'); + $('#captchaimg').onclick(); } if(data.status == 1) { - window.location.href='/'; + window.location.href="/"; }else{ layer.msg(data.msg); + $('#captchaimg').click(); } }); return false; diff --git a/application/system/controller/School.php b/application/system/controller/School.php index c7b9fa0c..5852af80 100644 --- a/application/system/controller/School.php +++ b/application/system/controller/School.php @@ -30,7 +30,7 @@ class School extends Base // 获取单位列表数据 - public function ajaxData() + public function ajaxData1() { // 获取DT的传值 $getdt = request()->param(); @@ -84,6 +84,29 @@ class School extends Base } + // 获取单位列表数据 + public function ajaxData() + { + + // 实例化 + $sch = new sch; + + // 获取荣誉总数 + $data = $sch->select(); + + + // 重组返回内容 + $data = [ + 'code'=> 0 , // ajax请求次数,作为标识符 + 'msg'=>"", // 获取到的结果数(每页显示数量) + 'count'=>100, // 符合条件的总数据量 + 'data'=>$data, //获取到的数据结果 + ]; + + return json($data); + } + + // 添加单位 public function create() diff --git a/application/system/controller/SystemBase.php b/application/system/controller/SystemBase.php index b0b50df7..af1994fd 100644 --- a/application/system/controller/SystemBase.php +++ b/application/system/controller/SystemBase.php @@ -40,7 +40,7 @@ class SystemBase extends Base $validate = new \app\system\validate\SystemBase; // 获取表单数据 - $list = request()->only(['title','keywords','description','thinks','danwei'],'put');; + $list = request()->only(['webtitle','keywords','description','thinks','danwei'],'put');; // 验证表单数据 $result = $validate->check($list); @@ -55,7 +55,7 @@ class SystemBase extends Base $data = sysbasemod::where('id',$id)->update($list); // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + $data>=0 ? $data=['msg'=>'设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; // 返回信息 return json($data); diff --git a/application/system/validate/SystemBase.php b/application/system/validate/SystemBase.php index 72865af9..283a7a5e 100644 --- a/application/system/validate/SystemBase.php +++ b/application/system/validate/SystemBase.php @@ -13,7 +13,7 @@ class SystemBase extends Validate * @var array */ protected $rule = [ - 'title|标题' => 'require|length:2,50', + 'webtitle|标题' => 'require|length:2,50', 'keywords|关键字' => 'require|length:2,60', 'description|描述' => 'require|length:1,100', 'thinks|感谢' => 'require|length:1,80', diff --git a/application/system/view/school/index.html b/application/system/view/school/index.html index 11023dae..b6024cad 100644 --- a/application/system/view/school/index.html +++ b/application/system/view/school/index.html @@ -1,171 +1,111 @@ -{extend name="common@list" /} -{block name="topnav"} - -{/block} -{block name="bouttons"} -
- - - - - 批量删除 - - - - - 添加单位 - - - - 共有数据:{$list.count} 条 - -
-
-
筛选单位
-
-
- {php}$category = getCategory(101);{/php} - -
-
- {foreach $category as $key=>$vo } - - {/foreach} -
- -
-
-
-{/block} -{block name="tables"} - - - - - - - - - - - - - - - - - -
单位名称简称性质级别学段排序教师数状态操作
+ + + + + + {$list.title} + + + + {load href="__STATIC__/xadmin/css/font.css" /} + {load href="__STATIC__/xadmin/css/xadmin.css" /} + {load href="__STATIC__/xadmin/js/jquery.min.js" /} + {load href="__STATIC__/xadmin/lib/layui/layui.js" /} + {load href="__STATIC__/xadmin/js/xadmin.js" /} + {load href="__STATIC__/xadmin/js/cookie.js" /} + + + + + +
+ + 系统管理 + 单位管理 + + 单位列表 + + + ဂ +
+
+
+
+ + + + +
+
+
+
+ + + + -{/block} \ No newline at end of file + + + + + + + }); + + + \ No newline at end of file diff --git a/application/system/view/system_base/index.html b/application/system/view/system_base/index.html index 25cd4801..32176faa 100644 --- a/application/system/view/system_base/index.html +++ b/application/system/view/system_base/index.html @@ -1,75 +1,49 @@ - - - - - - {$list.webtitle} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - - - - -
-
+{extend name="common@create" /} + +{block name="form"} +
-
-
-
-
-
@@ -78,7 +52,9 @@ 设置
-
+{/block} + +{block name="myjs"} - - +{/block} - \ No newline at end of file diff --git a/config/session.php b/config/session.php index 77e0eabd..194318b2 100644 --- a/config/session.php +++ b/config/session.php @@ -24,5 +24,5 @@ return [ // 是否自动开启 SESSION 'auto_start' => true, // 过期时间 - 'expire' => 600, + 'expire' => 60000, ]; diff --git a/public/static/xadmin/member-list1.html b/public/static/xadmin/member-list1.html index f1be3e34..98672f00 100644 --- a/public/static/xadmin/member-list1.html +++ b/public/static/xadmin/member-list1.html @@ -112,6 +112,39 @@ break; }; }); + + + + + + var table = layui.table; + + //第一个实例 + table.render({ + elem: '#demo', + height: 312, + url: '/demo/table/user/' //数据接口, + page: true //开启分页, + cols: [[ //表头 + {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'} + ,{field: 'username', title: '用户名', width:80} + ,{field: 'sex', title: '性别', width:80, sort: true} + ,{field: 'city', title: '城市', width:80} + ,{field: 'sign', title: '签名', width: 177} + ,{field: 'experience', title: '积分', width: 80, sort: true} + ,{field: 'score', title: '评分', width: 80, sort: true} + ,{field: 'classify', title: '职业', width: 80} + ,{field: 'wealth', title: '财富', width: 135, sort: true} + ]] + }); + + + + + + + + });