account.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <extend name="Public:base" />
  2. <block name="head_script">
  3. <link href="__CSS__/member.css" rel="stylesheet" type="text/css">
  4. <link href="__PUBLIC__/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
  5. </block>
  6. <block name="content">
  7. <div>
  8. <div class="container">
  9. <div class="row">
  10. <div id="content" class="col-sm-9">
  11. <div class="page-title">
  12. <h1>修改联系资料</h1>
  13. </div>
  14. <div class="alert alert-success hidden" role="alert">
  15. <button type="button" class="close"><span aria-hidden="true">&times;</span></button>
  16. <div id="success">修改成功</div>
  17. </div>
  18. <fieldset>
  19. <div class="form-group required clearfix">
  20. <label class="col-sm-2 control-label" for="input-password">电子邮箱</label>
  21. <div class="col-sm-10">
  22. <input id="email" class="form-control" type="text" name="email" value="{$account.email|default=''}" />
  23. </div>
  24. </div>
  25. <div class="form-group clearfix">
  26. <label class="col-sm-2 control-label" for="input-password-1">手机号码</label>
  27. <div class="col-sm-10">
  28. <input id="tel" class="form-control" type="text" name="tel" value="{$account.telephone|default=''}" />
  29. </div>
  30. </div>
  31. </fieldset>
  32. <div class="buttons clearfix">
  33. <div class="left" style="margin-left:15px;">
  34. <button class="button continue " type="submit">提交</button>
  35. </div>
  36. </div>
  37. </div>
  38. <include file="User/side" />
  39. </div>
  40. </div>
  41. </div>
  42. </block>
  43. <block name="foot_script">
  44. <script type="text/javascript">
  45. $('.button').click(function(){
  46. $.ajax({
  47. url: '{$action}',
  48. type: 'post',
  49. data: $('input[type=\'text\']'),
  50. dataType: 'json',
  51. beforeSend: function() {
  52. $('#submit').attr('disabled', true);
  53. $('#submit').after('<span class="wait">&nbsp;<img src="__IMG__/loading.gif" alt="" /></span>');
  54. },
  55. complete: function() {
  56. $('#submit').attr('disabled', false);
  57. $('.wait').remove();
  58. },
  59. success: function(json) {
  60. $('.warning, .error').remove();
  61. if (json['redirect']) {
  62. $('.alert-success').removeClass('hidden');
  63. setTimeout(function(){
  64. location = json['redirect']
  65. },2000);
  66. } else if (json['error']) {
  67. if (json['error']['email']) {
  68. $("input[name='email']").after('<span class="error">' + json['error']['email'] + '</span>');
  69. }
  70. if (json['error']['tel']) {
  71. $("input[name='tel']").after('<span class="error">' + json['error']['tel'] + '</span>');
  72. }
  73. }
  74. },
  75. error: function(xhr, ajaxOptions, thrownError) {
  76. alert('修改失败');
  77. }
  78. });
  79. });
  80. $('.close').click(function(){
  81. $(this).parent().addClass('hidden');
  82. });
  83. </script>
  84. </block>