login.jsp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: 熊竹
  4. Date: 2017/3/9
  5. Time: 11:39
  6. To change this template use File | Settings | File Templates.
  7. --%>
  8. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  9. <html>
  10. <head>
  11. <jsp:include page="head.jsp"/>
  12. <title>享居屋房源管理系统</title>
  13. <style lang="scss" scoped>
  14. #login-page {
  15. width: 100vw;
  16. height: 100vh;
  17. display: flex;
  18. justify-content: center;
  19. align-items: center;
  20. background: #efeeee;
  21. }
  22. #login-page .login-form {
  23. display: flex;
  24. flex-direction: column;
  25. align-items: center;
  26. width: 500px;
  27. height: 445px;
  28. border-radius: 10px;
  29. background: white;
  30. border: 1px #eaeaea solid;
  31. box-shadow: 0px 0px 25px #cac6c6;
  32. }
  33. #login-page .login-form .title {
  34. color: #20a0ff;
  35. font-weight: bold;
  36. font-size: 40px;
  37. text-align: center;
  38. line-height: 2.2;
  39. font-family: sans-serif;
  40. }
  41. #login-page .login-form .input-group {
  42. margin-top: 30px;
  43. width: 80%;
  44. }
  45. #login-page .login-form .input-group button {
  46. width: 100%;
  47. }
  48. </style>
  49. </head>
  50. <body>
  51. <div id="app">
  52. <div id="login-page" @keyup.enter="login">
  53. <div class="login-form">
  54. <div class="input-group">
  55. <div class="title">享居屋房源管理系统 </div>
  56. <el-input
  57. :autofocus="true"
  58. placeholder="请输入用户名"
  59. icon="time"
  60. v-model="username">
  61. </el-input>
  62. </div>
  63. <div class="input-group">
  64. <el-input
  65. placeholder="请输入密码"
  66. type="password"
  67. icon="time"
  68. v-model="password">
  69. </el-input>
  70. </div>
  71. <div class="input-group">
  72. <el-input
  73. style="width: 280px;"
  74. placeholder="请输入验证码"
  75. icon="time"
  76. v-model="code">
  77. </el-input>
  78. <img style="width: 80px; float: right;" src="../auth/image" ref="img" @click="refresh">
  79. </div>
  80. <div class="input-group">
  81. <label>记住我?</label>
  82. <el-switch
  83. v-model="rememberMe"
  84. on-text=""
  85. off-text="">
  86. </el-switch>
  87. </div>
  88. <div class="input-group">
  89. <el-button @click.native="login" type="primary" :loading="isBtnLoading">{{btnText}}</el-button>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </body>
  95. <script>
  96. new Vue({
  97. el : '#app',
  98. data : function () {
  99. return {
  100. username : '',
  101. password : '',
  102. code : '',
  103. rememberMe : false,
  104. isBtnLoading: false
  105. };
  106. },
  107. computed: {
  108. btnText: function () {
  109. if (this.isBtnLoading) return '登录中...';
  110. return '登录';
  111. }
  112. },
  113. methods : {
  114. login : function () {
  115. window.location.href = 'index';
  116. this.isBtnLoading = true;
  117. $.post({
  118. url : '../adminInfo/login',
  119. data: {
  120. userName: this.username,
  121. password: this.password,
  122. code : this.code,
  123. }
  124. }).then(function (res) {
  125. this.isBtnLoading = false;
  126. if (res.success) {
  127. window.location.href = 'index';
  128. } else {
  129. this.$message.error(res.error);
  130. }
  131. }.bind(this));
  132. },
  133. refresh: function () {
  134. this.$refs.img.src = '../auth/image' + '?' + Math.random();
  135. }
  136. }
  137. })
  138. </script>
  139. </html>