yangsai@163.com 6 months ago
parent 5f416064f8
commit 5789d2b5f9
  1. 13
      application/controllers/Admin/User.php
  2. 1
      application/controllers/Api/Cage.php
  3. 8
      application/controllers/Api/Squirrel.php
  4. 6
      application/library/Ctrl/Admin.php
  5. 4
      application/views/admin/index/index.phtml
  6. 96
      application/views/admin/user/password.phtml

@ -111,10 +111,17 @@ class Admin_UserController extends Ctrl_Admin{
}
return json_encode(array_merge($diff,$excelarray));
}
public function updatePassAction(){
public function passwordAction(){
}
public function updatePsdAction(){
// $_P[]
$password = empty($_POST['password'])||!isset($_POST['password'])?Tool_Fnc::apiMsg('请输入新密码', '500'):Tool_Fnc::safe_string($_POST['password']);
$repassword = empty($_POST['repassword'])||!isset($_POST['repassword'])?Tool_Fnc::apiMsg('请确认新密码', '500'):Tool_Fnc::safe_string($_POST['repassword']);
$id = $_SESSION['admin']['id'];
$adminModel = new AdminModel();
if($password!=$repassword) Tool_Fnc::ajaxMsg('两次输入密码不一致', '500');
$up['id'] = $id;
$up['password'] = md5($password);
if(!$adminModel->update($up)) Tool_Fnc::ajaxMsg('密码未改变', '500');
Tool_Fnc::ajaxMsg('密码已变更', '1');
}
}

@ -148,6 +148,7 @@ class Api_CageController extends Ctrl_Api{
$sql = "select count(*) num from squirrel where cage={$data[$key]['id']} and is_kill=0 and is_delete=0 and sex=1";
$mannum = $this->Cagemodel->query($sql);
if(!empty($mannum)){
if($val['type']==2 && $squirrel['sex']==1) unset($data[$key]);
$data[$key]['mannum'] = $mannum[0]['num'];
}
//查询母鼠

@ -355,5 +355,13 @@ class Api_SquirrelController extends Ctrl_Api{
}
Tool_Fnc::apiMsg('获取成功', '200',$data);
}
public function jianweiAction(){
$number = empty($this->POST['number'])?Tool_Fnc::apiMsg('请输入编号', '500'):$this->POST['number'];
$bianhao = explode('-',$number);
$start = (int) filter_var($bianhao[0], FILTER_SANITIZE_NUMBER_INT);
$end = (int) filter_var($bianhao[1], FILTER_SANITIZE_NUMBER_INT);
echo $start;
echo $end;die;
}
}

@ -9,9 +9,9 @@ class Ctrl_Admin extends Ctrl_Base {
protected $disableController = false; //禁用控制器
protected $disableMethodPost = array(); //禁用POST提交控制器
//public function init(){
// if(!isset($_SESSION['admin'])){echo '<script>top.location.href="/admin_login/quit";</script>';exit();}
//}
public function init(){
if(!isset($_SESSION['admin'])){echo '<script>top.location.href="/admin_login/index";</script>';exit();}
}
/**
* Ajax 保存字段
*/

@ -22,7 +22,7 @@
<?=empty($_SESSION['admin']['name'])?'未登录':$_SESSION['admin']['name']?>
</a>
<dl class="layui-nav-child">
<dd><a href="">修改密码</a></dd>
<dd><a href="/admin_user/password">修改密码</a></dd>
<dd><a href="/admin_login/quit">退出登录</a></dd>
</dl>
</li>
@ -58,7 +58,7 @@
<dl class="layui-nav-child">
<dd><a href="javascript:;" id="/admin_gene/index">基因管理</a></dd>
<dd><a href="javascript:;" id="/admin_strains/index">品系管理</a></dd>
<dd><a href="javascript:;" id="/admin_index/company">修改密码</a></dd>
<dd><a href="javascript:;" id="/admin_user/password">修改密码</a></dd>
</dl>
</li>
<!-- <li class="layui-nav-item">-->

@ -0,0 +1,96 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>公司简介</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="/public/layui/css/layui.css" media="all">
<link rel="stylesheet" href="/public/style/edit.css" media="all">
<!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 -->
</head>
<body>
<style>
#editor—wrapper {
border: 1px solid #ccc;
z-index: 100; /* 按需定义 */
}
#toolbar-container { border-bottom: 1px solid #ccc; }
#editor-container { height: 400px; }
</style>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">修改密码</div>
<div class="layui-card-body" pad15>
<div class="layui-form" lay-filter="">
<div class="layui-form-item">
<label class="layui-form-label">新密码</label>
<div class="layui-input-inline">
<input type="password" name="password" lay-verify="pass" lay-verType="tips" autocomplete="off" id="LAY_password" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">6到16个字符</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">确认新密码</label>
<div class="layui-input-inline">
<input type="password" name="repassword" lay-verify="repass" lay-verType="tips" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="submit">确认修改</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/public/layui/layui.js" charset="utf-8"></script>
<script src="/public/style/edit.js" charset="utf-8"></script>
<script>
layui.use(['layedit','table','upload','element','form','layer'], function(){
var layedit = layui.layedit
,table = layui.table
,form = layui.form
,layer = layui.layer
,upload = layui.upload
,element = layui.element
,$ = layui.jquery;
//监听提交
form.on('submit(submit)', function(data){
var datas = data.field
$.post('/admin_user/updatePsd',datas,function(obj){
if(obj.status != 1){
return layer.msg(obj.msg);
}else{
//示范一个公告层
layer.open({
type: 1
,title: false //不显示标题栏
,closeBtn: false
,area: '300px;'
,shade: 0.8
,id: 'LAY_layuipro' //设定一个id,防止重复弹出
,btn: '返回列表'
,btnAlign: 'c'
,moveType: 1 //拖拽模式,0或者1
,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: bold;font-size: 20px;text-align: center;">添加成功</div>'
,yes: function(){
history.go(0)
}
});
}
});
});
})
</script>
</body>
</html>
Loading…
Cancel
Save