更改登录界面,完善修改密码界面

dev
曾超新 5 years ago
parent 266f7aef98
commit 43fc5dca5a
  1. 13
      frontend/controllers/CommonController.php
  2. 2
      frontend/views/common/login.php
  3. 117
      frontend/views/common/update-pwd.php
  4. BIN
      frontend/web/assets/img/login_bj.jpg

@ -25,6 +25,7 @@ class CommonController extends \yii\web\Controller
public $my = null;
public $web = null;
public $enableCsrfValidation = false;
public $layout = 'blue-main';
public function init()
{
@ -237,6 +238,7 @@ class CommonController extends \yii\web\Controller
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '更改失败';
if($request->isPost){
$user_id = $request->post('id');
@ -260,20 +262,19 @@ class CommonController extends \yii\web\Controller
if($user!= '' && $user_pwd != '') {
$user->salt = MyLib::randomStr(4);
$user->password = MyLib::hashPwd($user_pwd,$user->salt);
$user_res = $user->save();
if(!$user_res){
throw new \Exception('操作失败!');
if(!$user->save()) {
throw new \Exception(print_r($user->getErrors(), true));
}
$result['success'] = true;
$result['msg'] = '保存成功';
$tran->commit();
}
$tran->commit();
}catch(\Exception $e){
$tran->rollBack();
throw $e;
$result['msg'] = $e->getMessage();
}
return $result;
}
return $result;
}
public function actionLeft()

@ -30,7 +30,7 @@
</div>
<div class="col-sm-5">
<form method="post">
<h2 class="m-t-md text-center">汇盈车险业务系统</h2>
<h2 class="m-t-md text-center" style="color: #000;">汇盈车险业务系统</h2>
<input type="text" id="username" name="username" class="form-control uname" placeholder="用户名" />
<input type="password" id="password" name="password" class="form-control pword m-b" placeholder="密码" />
<button id="login" class="btn btn-danger btn-block">登录</button>

@ -1,53 +1,86 @@
<table width="50%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" style="margin-top:200px;">
<form id="theFrm">
<input type="hidden" name="id" value="<?= $user_info->id ?>">
<tr>
<td width="100" height="25" align="center" class="td_bg">工号</td>
<td height="25" class="td_bg" align="center"><?=$user_info->username?></td>
</tr>
<tr>
<td width="100" height="25" align="center" class="td_bg">姓名</td>
<td height="25" class="td_bg" align="center"><?=$user_info->name?></td>
</tr>
<tr>
<td width="100" height="25" align="center" class="td_bg">电话</td>
<td height="25" class="td_bg" align="center"><?=$user_info->phone?></td>
</tr>
<tr>
<td width="100" height="25" align="center" class="td_bg">修改密码</td>
<td height="25" class="td_bg" align="center">
<input type="Password" name="pwd" placeholder="在这里输入新密码" />
</td>
</tr>
<tr>
<td width="100" height="25" align="center" class="td_bg">确认密码</td>
<td height="25" class="td_bg" align="center">
<input type="Password" name="re_pwd" placeholder="在这里确认新密码" />
</td>
</tr>
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/iCheck/custom.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>修改密码</h5>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="id" value="<?=$user_info->id?>">
<div class="form-group">
<label class="col-md-1 control-label">工号</label>
<div class="col-md-6">
<label class="form-control-static"><?=$user_info->username?></label>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">姓名</label>
<div class="col-md-6">
<label class="form-control-static"><?=$user_info->name?></label>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">电话</label>
<div class="col-md-6">
<label class="form-control-static"><?=$user_info->phone?></label>
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">新密码</label>
<div class="col-md-6">
<input type="password" name="pwd" value="" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">确认密码</label>
<div class="col-md-6">
<input type="password" name="re_pwd" value="" class="form-control">
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong>修改密码</strong>
</button>
</div>
</div>
</div>
</form>
<tr>
<td height="22" colspan="2" align="center" class="td_bg">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/>
</td>
</tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$("#submit-btn").click(function(){
if(confirm('是否确认提交?')) {
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/common/update-pwd-save',params,function(obj){
alert(obj.msg);
if(obj.success){
$.post('/common/update-pwd-save',params,function(data){
parent.layer.msg(data.msg);
if(data.success) {
window.top.location.href = "/common/logout";
}
},'json');
}
}, function(){
//
});
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Loading…
Cancel
Save