You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
4.3 KiB

10 months ago
10 months ago
10 months ago
6 months ago
10 months ago
10 months ago
1 year ago
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta name="renderer" content="webkit">
  6. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  7. <title>管理员登录</title>
  8. <link href="{$cdnpublic}twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
  9. <script src="{$cdnpublic}modernizr/2.8.3/modernizr.min.js"></script>
  10. <script src="{$cdnpublic}jquery/2.1.4/jquery.min.js"></script>
  11. <!--[if lt IE 9]>
  12. <script src="{$cdnpublic}html5shiv/3.7.3/html5shiv.min.js"></script>
  13. <script src="{$cdnpublic}respond.js/1.4.2/respond.min.js"></script>
  14. <![endif]-->
  15. </head>
  16. <body>
  17. <nav class="navbar navbar-fixed-top navbar-default">
  18. <div class="container">
  19. <div class="navbar-header">
  20. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  21. <span class="sr-only">导航按钮</span>
  22. <span class="icon-bar"></span>
  23. <span class="icon-bar"></span>
  24. <span class="icon-bar"></span>
  25. </button>
  26. <a class="navbar-brand" href="./">Cloud</a>
  27. </div><!-- /.navbar-header -->
  28. <div id="navbar" class="collapse navbar-collapse">
  29. <ul class="nav navbar-nav navbar-right">
  30. <li class="active">
  31. <a href="#"><span class="glyphicon glyphicon-user"></span> 登录</a>
  32. </li>
  33. </ul>
  34. </div><!-- /.navbar-collapse -->
  35. </div><!-- /.container -->
  36. </nav><!-- /.navbar -->
  37. <div class="container" style="padding-top:70px;">
  38. <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6 center-block" style="float: none;">
  39. <div class="panel panel-primary">
  40. <div class="panel-heading"><h3 class="panel-title">管理员登录</h3></div>
  41. <div class="panel-body">
  42. <form class="form-horizontal" role="form" onsubmit="return submitlogin()">
  43. <div class="input-group">
  44. <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
  45. <input type="text" name="user" value="" class="form-control input-lg" placeholder="用户名" required="required"/>
  46. </div><br/>
  47. <div class="input-group">
  48. <span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
  49. <input type="password" name="pass" class="form-control input-lg" placeholder="密码" required="required"/>
  50. </div><br/>
  51. <div class="input-group">
  52. <span class="input-group-addon"><span class="glyphicon glyphicon-adjust"></span></span>
  53. <input type="text" class="form-control input-lg" name="code" placeholder="输入验证码" autocomplete="off" required>
  54. <span class="input-group-addon" style="padding: 0">
  55. <img src="/admin/verifycode" height="45" id="verifycode" onclick="this.src='/admin/verifycode?r='+Math.random();" title="点击更换验证码">
  56. </span>
  57. </div><br/>
  58. <div class="form-group">
  59. <div class="col-xs-12"><input type="submit" value="立即登录" class="btn btn-primary btn-block btn-lg"/></div>
  60. </div>
  61. </form>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. <script src="{$cdnpublic}layer/3.5.1/layer.js"></script>
  67. <script>
  68. function submitlogin(){
  69. var user = $("input[name='user']").val();
  70. var pass = $("input[name='pass']").val();
  71. var code = $("input[name='code']").val();
  72. if(user=='' || pass==''){layer.alert('用户名或密码不能为空!');return false;}
  73. var ii = layer.load(2);
  74. $.ajax({
  75. type : 'POST',
  76. url : '{:request()->url()}',
  77. data: {username:user, password:pass, code:code},
  78. dataType : 'json',
  79. success : function(data) {
  80. layer.close(ii);
  81. if(data.code == 0){
  82. layer.msg('登录成功,正在跳转', {icon: 1,shade: 0.01,time: 15000});
  83. window.location.href='/admin';
  84. }else{
  85. if(data.msg.indexOf('验证码')==-1){
  86. $("#verifycode").attr('src', '/admin/verifycode?r='+Math.random())
  87. }
  88. layer.alert(data.msg, {icon: 2});
  89. }
  90. },
  91. error:function(data){
  92. layer.close(ii);
  93. layer.msg('服务器错误');
  94. }
  95. });
  96. return false;
  97. }
  98. </script>
  99. </body>
  100. </html>