login.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view>
  3. <!-- <view class="head"></view>
  4. -->
  5. <view class="img">
  6. <image src="../../static/登录/bg@2x.png" class="image"></image>
  7. <view class="white">
  8. <view class="title">
  9. <text class="title1">中央空调管理系统</text>
  10. <text class="title2">MANAGEMENT SYSTEM</text>
  11. </view>
  12. <view class="form">
  13. <form @submit="formSubmit">
  14. <view class="uni-form-item">
  15. <view class="titleA">用户名</view>
  16. <view class="input">
  17. <input placeholder="请输入用户名" v-model="formData.account" style="margin-left: 30rpx;" />
  18. </view>
  19. </view>
  20. <view class="uni-form-item">
  21. <view class="titleA">密码</view>
  22. <view class="input">
  23. <input password type="text" placeholder="请输入密码" style="margin-left: 30rpx;" />
  24. <!-- <input placeholder="请输入密码" v-model="formData.password" style="margin-left: 30rpx;" />
  25. <view class="icon">
  26. <uni-icons type="eye" size="26" @click="isC" v-show="block"></uni-icons>
  27. <uni-icons type="eye-slash" size="26" @click="isC" v-show="toggle"></uni-icons>
  28. </view> -->
  29. </view>
  30. </view>
  31. <view class="uni-form-item">
  32. <view class="titleA">验证码</view>
  33. <view class="AAA">
  34. <view class="input1">
  35. <input placeholder="请输入验证码" v-model="formData.verifyCode"
  36. style="margin-left: 30rpx;" />
  37. </view>
  38. <view class="code" @tap="handleRefreshVerifyCode">
  39. <img class="verify-img" :src="verifyCodeUrl" style="cursor: pointer">
  40. </view>
  41. </view>
  42. </view>
  43. <view class="login">
  44. <button class="loginBut" form-type="submit">登录</button>
  45. </view>
  46. <view class="forget">忘记密码</view>
  47. </form>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. verifyCodeUrl: 'http://127.0.0.1:9999/auth/verifyCode',
  58. isCollapse: false,
  59. toggle: false, //第二个图标默认隐藏
  60. block: true, //默认显示第一个图标
  61. formData: {
  62. account: '',
  63. password: '',
  64. verifyCode: '',
  65. }
  66. }
  67. },
  68. onLoad() {
  69. },
  70. methods: {
  71. handleRefreshVerifyCode() {
  72. this.verifyCodeUrl = 'http://127.0.0.1:9999/auth/verifyCode' + "?t=" + new Date()
  73. .getTime();
  74. },
  75. isC() {
  76. this.isCollapse = !this.isCollapse;
  77. this.toggle = !this.toggle;
  78. this.block = !this.block;
  79. },
  80. formSubmit(e) {
  81. console.log('form发生了submit事件')
  82. uni.request('http://127.0.0.1:9999/auth/login', {
  83. account: this.formData.account,
  84. password: this.formData.password,
  85. verifyCode: this.formData.verifyCode
  86. },
  87. 'POST').then(function(res) {
  88. console.log(res);
  89. })
  90. }
  91. },
  92. }
  93. </script>
  94. <style>
  95. .AAA {
  96. display: flex;
  97. flex-direction: row;
  98. }
  99. .icon {
  100. margin-left: 200rpx;
  101. }
  102. .form {
  103. margin-top: 80rpx;
  104. }
  105. .titleA {
  106. font-size: 30rpx;
  107. margin-bottom: 20rpx;
  108. margin-left: 32rpx;
  109. margin-top: 24rpx;
  110. }
  111. .input {
  112. background-color: white;
  113. width: 654rpx;
  114. margin-left: 24rpx;
  115. height: 98rpx;
  116. border-radius: 10rpx;
  117. border: 4rpx solid #F7F8F9;
  118. display: flex;
  119. align-items: center;
  120. }
  121. .verify-img {
  122. margin-left: 20rpx;
  123. width: 320rpx;
  124. height: 100rpx;
  125. border-radius: 10rpx;
  126. }
  127. .input1 {
  128. background-color: white;
  129. width: 320rpx;
  130. margin-left: 24rpx;
  131. height: 98rpx;
  132. border-radius: 10rpx;
  133. border: 4rpx solid #F7F8F9;
  134. display: flex;
  135. align-items: center;
  136. }
  137. .title1 {
  138. font-size: 44rpx;
  139. font-weight: 550;
  140. }
  141. .title2 {
  142. font-size: 26rpx;
  143. color: #AAAAAA;
  144. margin-top: 10rpx;
  145. }
  146. .title {
  147. margin-top: 60rpx;
  148. margin-left: 30rpx;
  149. display: flex;
  150. flex-direction: column;
  151. }
  152. .img {
  153. width: 750rpx;
  154. height: 1520rpx;
  155. z-index: 9;
  156. }
  157. .white {
  158. position: absolute;
  159. bottom: 40rpx;
  160. z-index: 10;
  161. width: 702rpx;
  162. height: 1060rpx;
  163. margin-left: 24rpx;
  164. background-color: #FFFFFF;
  165. opacity: 0.8;
  166. }
  167. .image {
  168. width: 750rpx;
  169. height: 1500rpx;
  170. }
  171. /* .head {
  172. height: 80rpx;
  173. background-color: white;
  174. } */
  175. .loginBut {
  176. margin-top: 60rpx;
  177. background-color: #007AFF;
  178. color: white;
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. width: 654rpx;
  183. height: 98rpx;
  184. }
  185. .forget {
  186. font-size: 30rpx;
  187. color: #007AFF;
  188. display: flex;
  189. align-items: center;
  190. justify-content: center;
  191. margin-top: 30rpx;
  192. }
  193. </style>