Login.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div class="view">
  3. <!-- <div class="logo">
  4. <img src="../assets/FG-01C.png" alt="" />
  5. </div> -->
  6. <div class="header">
  7. <p>
  8. 你好!
  9. <br />
  10. 欢迎使用扫码系统
  11. </p>
  12. </div>
  13. <b-form @submit.prevent="onSubmit" class="form">
  14. <b-form-group
  15. label="账号"
  16. label-for="input-1"
  17. style="margin-bottom: 1rem"
  18. label-cols="2"
  19. >
  20. <b-form-input
  21. id="input-1"
  22. v-model="form.account"
  23. required
  24. class="inp"
  25. style="
  26. height: 3rem;
  27. font-size: 1.1rem;
  28. font-weight: 500;
  29. letter-spacing: 0.1rem;
  30. background: #f2f2f2;
  31. border-radius: 1.2rem;
  32. border: none;
  33. box-shadow: 0.2rem 0.18rem 0.1rem 0.1rem rgba(0, 0, 0, 0.3);
  34. "
  35. placeholder="请输入账号"
  36. ></b-form-input>
  37. </b-form-group>
  38. <b-form-group
  39. label="密码"
  40. label-for="input-2"
  41. style="margin-bottom: 1rem"
  42. label-cols="2"
  43. >
  44. <b-form-input
  45. id="input-2"
  46. v-model="form.password"
  47. type="password"
  48. autocomplete="off"
  49. class="inp"
  50. style="
  51. height: 3rem;
  52. font-size: 1.1rem;
  53. font-weight: 500;
  54. background: #f2f2f2;
  55. border-radius: 1.2rem;
  56. letter-spacing: 0.1rem;
  57. border: none;
  58. box-shadow: 0.2rem 0.18rem 0.1rem 0.1rem rgba(0, 0, 0, 0.3);
  59. "
  60. required
  61. placeholder="请输入密码"
  62. ></b-form-input>
  63. </b-form-group>
  64. <b-button
  65. type="submit"
  66. variant="primary"
  67. style="
  68. width: 100%;
  69. height: 3rem;
  70. font-size: 1.2rem;
  71. border-radius: 1.2rem;
  72. margin-top: 2rem;
  73. "
  74. >登录</b-button
  75. >
  76. </b-form>
  77. </div>
  78. </template>
  79. <script>
  80. export default {
  81. data () {
  82. return {
  83. form: {
  84. account: '',
  85. password: ''
  86. }
  87. }
  88. },
  89. methods: {
  90. onSubmit () {
  91. const data = {
  92. post: {
  93. name: this.form.account, password: this.form.password, rememberMe: true
  94. },
  95. url: 'http://121.36.142.167:7774/jbl/api/mes/login',
  96. header: ['Content-Type:application/json']
  97. }
  98. this.axios.post('/api/testdwy', data).then(res => {
  99. if (res.code === 200) {
  100. this.$Message.success(res.msg)
  101. localStorage.setItem('token', res.data.token)
  102. localStorage.setItem('userDto', JSON.stringify(res.data.userDto))
  103. this.$router.push('/cms/home')
  104. }
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .view {
  112. height: 100vh;
  113. width: 100vw;
  114. background: #4d8ef7;
  115. padding: 0;
  116. overflow-x: hidden;
  117. }
  118. .form {
  119. box-sizing: border-box;
  120. width: 100%;
  121. height: 100%;
  122. position: absolute;
  123. top: 8.8rem;
  124. padding: 1.7rem 1.5rem;
  125. border-radius: 1.5rem 1.5rem 0 0;
  126. font-size: 18px !important;
  127. font-weight: bold;
  128. background: #fff;
  129. transform: translateX(1px) scaleX(1.01);
  130. }
  131. .logo {
  132. width: 6rem;
  133. height: 6rem;
  134. position: absolute;
  135. top: 20%;
  136. left: 50%;
  137. transform: translate(-50%, -70%);
  138. img {
  139. width: 100%;
  140. height: 100%;
  141. }
  142. }
  143. .header {
  144. color: #fff;
  145. font-weight: bold;
  146. font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
  147. "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
  148. font-size: 1.5rem;
  149. position: relative;
  150. width: 100%;
  151. height: 20%;
  152. top: 3rem;
  153. left: 2rem;
  154. }
  155. .inp:focus {
  156. background: #fff !important;
  157. }
  158. </style>