Login.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <div class="login_page fillcontain">
  3. <div style="height:50px;" role="navigation">
  4. <nav class="navbar navbar-static-top">
  5. <div class="navbar-header">
  6. <img src="../assets/image/log2.png" class="img-responsive">
  7. </div>
  8. </nav>
  9. </div>
  10. <transition name="el-fade-in">
  11. <section class="form_contianer" v-show="showLogin">
  12. <el-form :model="loginForm" :rules="rules" ref="loginForm" @keyup.enter.native="submitForm('loginForm')">
  13. <h2>用户登录</h2>
  14. <div class="row">
  15. <div class="col-sm-6">
  16. <div class="logimg">
  17. <img src="../assets/image/xsqq.png">
  18. </div>
  19. </div>
  20. <div class="col-sm-6">
  21. <el-form-item prop="username">
  22. <el-input v-model="loginForm.username" placeholder="用户名" suffix-icon="el-icon-user"></el-input>
  23. </el-form-item>
  24. <el-form-item prop="password">
  25. <el-input type="password" placeholder="密码" v-model="loginForm.password" suffix-icon="el-icon-lock"></el-input>
  26. </el-form-item>
  27. <el-form-item>
  28. <el-button type="primary" v-loading.fullscreen.lock="fullscreenLoading" @click="submitForm('loginForm')" class="submit_btn">登录</el-button>
  29. </el-form-item>
  30. <div>账号/密码: admin/123456</div>
  31. </div>
  32. </div>
  33. </el-form>
  34. </section>
  35. </transition>
  36. <div align="center" class="bottomtxt">
  37. <div class="txt" align="center">
  38. <a href='https://www.ruisitech.com' target="_blank">睿思BI</a> - <a href='https://www.ruisitech.com/productent.html' target="_blank">企业版</a> - <a href='https://www.ruisitech.com/product.html' target="_blank">标准版</a> - <a href='https://www.ruisitech.com/opensource.html' target="_blank">开源版</a> - <a href='https://www.ruisitech.com/yun.html' target="_blank">睿思云</a> - <a href='http://www.ruisibi.cn/book.htm' target="_blank">使用手册</a> - <a href='https://www.ruisitech.com/suggest.html' target="_blank">问题反馈</a> </div>
  39. ©成都睿思商智科技有限公司 2020 版权所有
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. import {baseUrl} from '@/common/biConfig'
  45. import $ from 'jquery'
  46. export default {
  47. data(){
  48. return {
  49. loginForm: {
  50. username: '',
  51. password: '',
  52. },
  53. fullscreenLoading: false,
  54. rules: {
  55. username: [
  56. { required: true, message: '请输入用户名', trigger: 'blur' },
  57. ],
  58. password: [
  59. { required: true, message: '请输入密码', trigger: 'blur' }
  60. ],
  61. },
  62. showLogin: true
  63. }
  64. },
  65. mounted(){
  66. },
  67. computed: {
  68. },
  69. methods: {
  70. submitForm: function(formName) {
  71. let ts = this;
  72. this.$refs[formName].validate(async (valid) => {
  73. if (valid) {
  74. ts.fullscreenLoading = true;
  75. $.ajax({
  76. type:"POST",
  77. data:{userName:this.loginForm.username, password:this.loginForm.password},
  78. dataType:"JSON",
  79. url:baseUrl+"doLogin.action",
  80. xhrFields: {withCredentials: true},
  81. crossDomain: true,
  82. success:function(resp){
  83. ts.fullscreenLoading = false;
  84. if (resp.result == 1) {
  85. ts.$router.push('Welcome')
  86. }else{
  87. ts.$notify.error({
  88. title: '登录错误',
  89. message: resp.msg,
  90. offset: 50
  91. });
  92. }
  93. },
  94. error:function(){
  95. ts.fullscreenLoading = false;
  96. ts.$notify.error({
  97. title: '网络错误',
  98. offset: 50
  99. });
  100. }
  101. });
  102. } else {
  103. return false;
  104. }
  105. });
  106. },
  107. fadeIn:function(){
  108. this.showLogin = !this.showLogin;
  109. }
  110. },
  111. watch: {
  112. }
  113. }
  114. </script>
  115. <style lang="less" scoped>
  116. @import '../style/mixin';
  117. .login_page{
  118. background-color: #f0f3f4;
  119. background:url("../assets/image/login_bg.jpg") 100% center
  120. }
  121. .form_contianer{
  122. max-width: 600px;
  123. padding: 20px;
  124. top: 40%;
  125. margin: 0 auto;
  126. position: relative;
  127. transform: translateY(-55%);
  128. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  129. border-radius: .5rem;
  130. background-color: #fff;
  131. text-align: center;
  132. .submit_btn{
  133. width: 100%;
  134. font-size: 16px;
  135. }
  136. h2 {
  137. font-size: 24px;
  138. padding: 0 20px 20px 20px;
  139. font-weight: normal;
  140. }
  141. }
  142. .tip{
  143. font-size: 12px;
  144. color: red;
  145. }
  146. .logimg {
  147. padding:20px 10px 20px 0px;
  148. }
  149. @media (max-width: 600px) {
  150. .form_contianer {
  151. max-width: 400px;
  152. }
  153. .logimg {
  154. padding:5px 0px 20px 0px;
  155. }
  156. }
  157. @media (max-width: 500px) {
  158. .form_contianer {
  159. max-width: 300px;
  160. }
  161. .logimg {
  162. padding:5px 0px 20px 0px;
  163. }
  164. }
  165. .navbar-static-top {
  166. background-color: #034d8f;
  167. }
  168. .bottomtxt{
  169. bottom:0px;
  170. width: 100%;
  171. position: absolute;
  172. .txt {
  173. color:#fff;
  174. }
  175. a {
  176. color:#fff;
  177. }
  178. }
  179. </style>