adminlogin.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /* @var $this \yii\web\View */
  3. /* @var $content string */
  4. use yii\helpers\Html;
  5. use yii\helpers\Url;
  6. use yii\web\YiiAsset;
  7. YiiAsset::register($this);
  8. ?>
  9. <?php $this->beginPage() ?>
  10. <!DOCTYPE html>
  11. <html>
  12. <head>
  13. <meta charset="utf-8">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge">
  15. <?= Html::csrfMetaTags() ?>
  16. <title>管理登录</title>
  17. <link href="<?= STATIC_URL ?>/ui/css/bootstrap.min.css" rel="stylesheet">
  18. <link href="<?= STATIC_URL ?>/ui/font-awesome/css/font-awesome.css" rel="stylesheet">
  19. <link href="<?= STATIC_URL ?>/ui/css/animate.css" rel="stylesheet">
  20. <link href="<?= STATIC_URL ?>/ui/css/style.css" rel="stylesheet">
  21. <link href="<?= STATIC_URL ?>/ui/css/plugins/toastr/toastr.min.css" rel="stylesheet">
  22. </head>
  23. <body class="gray-bg">
  24. <?php $this->beginBody() ?>
  25. <div class="loginColumns animated fadeInDown">
  26. <div class="row">
  27. <div class="col-md-2"></div>
  28. <div class="col-md-8">
  29. <h1 class="text-center">ADMIN LOGIN</h1>
  30. <hr/>
  31. </div>
  32. <div class="col-md-2"></div>
  33. </div>
  34. <div class="row">
  35. <div class="col-md-2"></div>
  36. <div class="col-md-8">
  37. <div class="ibox-content">
  38. <form id="form" class="m-t" role="form">
  39. <div class="form-group">
  40. <input type="text" id="username" name="username" class="form-control" placeholder="账户" required="">
  41. </div>
  42. <div class="form-group">
  43. <input type="password" id="password" name="password" class="form-control" placeholder="密码" required="">
  44. </div>
  45. <button id="login" type="button" class="btn btn-primary block full-width m-b">登录</button>
  46. <!--
  47. <a href="#">
  48. <small>忘记密码?</small>
  49. </a>
  50. -->
  51. </form>
  52. </div>
  53. <hr/>
  54. </div>
  55. <div class="col-md-2"></div>
  56. </div>
  57. <div class="row">
  58. <div class="col-md-2"></div>
  59. <div class="col-md-4"></div>
  60. <div class="col-md-4 text-right">
  61. <small>© 2017</small>
  62. </div>
  63. <div class="col-md-2"></div>
  64. </div>
  65. </div>
  66. <?php $this->endBody() ?>
  67. <script src="<?= STATIC_URL ?>/ui/js/jquery.1.9.1.min.js"></script>
  68. <script src="<?= STATIC_URL ?>/ui/js/bootstrap.min.js"></script>
  69. <script src="<?= STATIC_URL ?>/ui/js/plugins/toastr/toastr.min.js"></script>
  70. <script type="text/javascript">
  71. $("#login").on("click",function(){
  72. $.ajax({
  73. type: "POST",
  74. url: "/account/adminlogin-post",
  75. data: $('#form').serialize(),
  76. dataType: "json",
  77. beforeSend: function() {},
  78. success: function(data) {
  79. if(data.isSuccess){
  80. var url="/admin/dashboard";
  81. window.location.href=url;
  82. }else{
  83. toastr.error("用户名或密码错误", "提示");
  84. }
  85. },
  86. complete: function(XMLHttpRequest, textStatus) {},
  87. error: function() {}
  88. });
  89. });
  90. </script>
  91. </body>
  92. </html>
  93. <?php $this->endPage() ?>