ambition/public/pages/user_detail.html

239 lines
11 KiB
HTML
Raw Permalink Normal View History

2016-12-08 10:10:37 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ambition-敏捷开发项目管理工具</title>
2016-12-08 10:10:37 +08:00
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Font Awesome -->
<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.css">
<!-- Theme style -->
<link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
<!-- AdminLTE Skins. We have chosen the skin-blue for this starter
page. However, you can choose any other skin. Make sure you
apply the skin class to the body tag so the changes take effect.
-->
<link rel="stylesheet" href="../dist/css/skins/skin-green.min.css">
<!-- date picker -->
<link rel="stylesheet" href="../dist/css/datepicker.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-green sidebar-mini" style="overflow-x:hidden;">
<div class="wrapper">
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="margin-left:0px;">
<section class="content-header">
<h1>
修改信息
<small>Who I am?</small>
</h1>
</section>
<!-- header section -->
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<!-- Widget: user widget style 1 -->
<div class="box box-widget widget-user">
<!-- Add the bg color to the header using any of the bg-* classes -->
<div class="widget-user-header bg-blue">
<h3 class="widget-user-username">基本信息修改</h3>
</div>
<div class="widget-user-image">
<img class="img-circle" src="../dist/img/avatar5.png" alt="User Avatar">
</div>
<div class="box-footer">
<div class="row">
</div>
<!-- /.row -->
&nbsp
<div class="box-body">
<form id="alter">
<div class="form-group row has-feedback">
<label for="inputEmail3" class="col-sm-2 col-md-push-2 control-label">昵称</label>
<div class="col-sm-6 col-md-push-2">
2016-12-28 13:34:43 +08:00
<input type="name" class="form-control" value="" id="name_alter" name="name" placeholder="">
2016-12-08 10:10:37 +08:00
</div>
</div>
<!-- ./form-group -->
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">联系方式</label>
<div class="col-sm-6 col-md-push-2">
2016-12-28 13:34:43 +08:00
<input type="phone" class="form-control" value="" id="phone_alter" name="address" placeholder="">
2016-12-08 10:10:37 +08:00
</div>
</div>
<!-- ./form-group -->
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">邮箱</label>
<div class="col-sm-6 col-md-push-2">
2016-12-28 13:34:43 +08:00
<input type="email" class="form-control" value="" id="email_alter" name="mail" placeholder="">
2016-12-08 10:10:37 +08:00
</div>
</div>
<!-- ./form-group -->
</form>
</div>
<!-- /.box-body -->
<div class="box-footer">
2016-12-28 13:34:43 +08:00
<button onclick="alter_basic()" class="btn btn-primary pull-right">提交修改</button>
2016-12-08 10:10:37 +08:00
</div>
<!-- /.box-footer -->
</div>
</div>
<!-- /.widget-user -->
</div>
<!-- ./col -->
<div class="col-lg-8 col-lg-offset-2">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">密码修改</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<form role="form">
<div class="box-body">
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">输入新密码</label>
<div class="col-sm-6 col-md-push-2">
2016-12-28 13:34:43 +08:00
<input type="password" class="form-control" value="" id="pwd1" name="address" placeholder="">
2016-12-08 10:10:37 +08:00
</div>
</div>
<!-- ./form-group -->
<div class="form-group row has-feedback">
<label for="inputPassword3" class="col-sm-2 col-md-push-2 control-label">再次输入新密码</label>
<div class="col-sm-6 col-md-push-2">
2016-12-28 13:34:43 +08:00
<input type="password" class="form-control" value="" id="pwd2" name="mail" placeholder="">
2016-12-08 10:10:37 +08:00
</div>
</div>
<!-- ./form-group -->
</div>
<!-- /.box-body -->
<div class="box-footer">
2016-12-28 13:34:43 +08:00
<button onclick="alter_pwd()" class="btn btn-primary pull-right">提交修改</button>
2016-12-08 10:10:37 +08:00
</div>
</form>
</div>
</div>
<!-- ./col -->
</div>
<!-- ./row -->
</section>
<!-- content header -->
</div>
<!-- content-wrapper -->
</div>
<!-- ./wrapper -->
<center><strong>Copyright &copy; 2016 <a href="#">Ambition Inc.</a>.</strong> All rights reserved.</center>
<!-- jQuery 2.1.4 -->
<script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="../bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/app.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- date select and query -->
<!-- Custom Scripts -->
<script src="include/main.js"></script>
2016-12-28 13:34:43 +08:00
<script>
//alert("111");
$(document).ready(function(){
$.ajax({
type: "get",
dataType: "json",
url:"/session.json",
statusCode: {
200: function(data) {// 请求成功
$("#name_alter").val(data.name)
$("#email_alter").val(data.email);
$("#phone_alter").val(data.phone);
},
401:function(){// 未授权
alert("未登录!");
window.location.href="pages/login.html";
}
}
});
});
function alter_basic(){
var name=$("#name_alter").val();
var email=$("#email_alter").val();
var phone=$("#phone_alter").val();
if( name.length>0 && email.length>0 && phone.length>0 ){
$.ajax({
type: "patch",
dataType: "json",
url:"/user/current.json",
data:{
"user[name]":name,
"user[email]":email,
"user[phone]":phone
},
statusCode: {
200: function(data) {// 请求成功
alert("更新成功!");
// alter
parent.LoginUserInfo.name=name;
parent.LoginUserInfo.email=email;
parent.LoginUserInfo.phone=phone;
window.location.reload();
2016-12-28 13:34:43 +08:00
},
401:function(){// 未授权
alert("未登录!");
window.location.href="pages/login.html";
},
422:function(){
alert("输入不符合要求,请重新输入!");
}
}
});
}else{
alert("请输入完整!");
}
}
function alter_pwd(){
var pwd1=$("#pwd1").val();
var pwd2=$("#pwd2").val();
if( pwd1.length>0 && pwd2.length>0 && pwd1==pwd2 ){
$.ajax({
type: "patch",
dataType: "json",
url:"/user/current.json",
data:{
"user[password]":pwd1,
"user[password_confirmation]":pwd2
},
statusCode: {
200: function(data) {// 请求成功
alert("更新成功!");
window.location.reload();
},
401:function(){// 未授权
alert("未登录!");
window.location.href="pages/login.html";
},
422:function(){
alert("输入不符合要求,请重新输入!");
}
}
});
}else{
alert("请输入完整!");
}
}
</script>
2016-12-08 10:10:37 +08:00
</body>
</html>