login.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="content">
  3. <view class="header">
  4. <image src="../../static/shilu-login/logo.png"></image>
  5. </view>
  6. <view class="list">
  7. <view class="list-call">
  8. <image class="img" src="/static/shilu-login/1.png"></image>
  9. <input class="sl-input" v-model="userInfo.username" maxlength="11" placeholder="输入用户名" />
  10. </view>
  11. <view class="list-call">
  12. <image class="img" src="/static/shilu-login/2.png"></image>
  13. <input class="sl-input" v-model="userInfo.password" type="text" maxlength="32" placeholder="输入密码"
  14. password="true" />
  15. </view>
  16. </view>
  17. <view class="button-login" hover-class="button-hover" @tap="bindLogin()">
  18. <text>登录</text>
  19. </view>
  20. <!-- <view class="agreenment">
  21. <navigator url="forget" open-type="navigate">忘记密码</navigator>
  22. <text>|</text>
  23. <navigator url="reg" open-type="navigate">注册账户</navigator>
  24. </view> -->
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. userInfo: {
  32. username: '',
  33. password: '',
  34. verifyCode: 666666
  35. }
  36. };
  37. },
  38. methods: {
  39. bindLogin() {
  40. // if (this.phone.length) {
  41. // uni.showToast({
  42. // icon: 'none',
  43. // title: '用户名不正确'
  44. // });
  45. // return;
  46. // }
  47. // if (this.password.length < 6) {
  48. // uni.showToast({
  49. // icon: 'none',
  50. // title: '密码不正确'
  51. // });
  52. // return;
  53. // }
  54. // {
  55. // sunMemberInfo: JSON.stringify({
  56. // name: that.userInfo.nickname,
  57. // phone: val.phoneNumber,
  58. // sex: '1'
  59. // })
  60. // }
  61. uni.showLoading({
  62. mask: true,
  63. title: "加载中"
  64. })
  65. this.$request.baseRequest('admin', 'login', this.userInfo, failres => {
  66. console.log('res+++++', failres.errmsg)
  67. uni.showToast({
  68. mask: true,
  69. title: failres.errmsg
  70. })
  71. uni.hideLoading()
  72. }).then(res => {
  73. if (res.errno == 200) {
  74. uni.hideLoading()
  75. uni.setStorageSync('userInfo', this.userInfo)
  76. this.$store.commit('login', this.userInfo)
  77. // that.$api.setUserInfo(that.userInfo)
  78. uni.switchTab({
  79. url: '/pages/index/index'
  80. })
  81. }
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style>
  88. .content {
  89. display: flex;
  90. flex-direction: column;
  91. justify-content: center;
  92. }
  93. .header {
  94. width: 161rpx;
  95. height: 161rpx;
  96. background: rgba(63, 205, 235, 1);
  97. box-shadow: 0rpx 12rpx 13rpx 0rpx rgba(63, 205, 235, 0.47);
  98. border-radius: 50%;
  99. margin-top: 30rpx;
  100. margin-left: auto;
  101. margin-right: auto;
  102. }
  103. .header image {
  104. width: 161rpx;
  105. height: 161rpx;
  106. border-radius: 50%;
  107. }
  108. .list {
  109. display: flex;
  110. flex-direction: column;
  111. padding-top: 50rpx;
  112. padding-left: 70rpx;
  113. padding-right: 70rpx;
  114. }
  115. .list-call {
  116. display: flex;
  117. flex-direction: row;
  118. justify-content: space-between;
  119. align-items: center;
  120. height: 100rpx;
  121. color: #333333;
  122. border-bottom: 0.5px solid #e2e2e2;
  123. }
  124. .list-call .img {
  125. width: 40rpx;
  126. height: 40rpx;
  127. }
  128. .list-call .sl-input {
  129. flex: 1;
  130. text-align: left;
  131. font-size: 32rpx;
  132. margin-left: 16rpx;
  133. }
  134. .button-login {
  135. color: #FFFFFF;
  136. font-size: 34rpx;
  137. width: 470rpx;
  138. height: 100rpx;
  139. background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
  140. box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(164, 217, 228, 0.2);
  141. border-radius: 50rpx;
  142. line-height: 100rpx;
  143. text-align: center;
  144. margin-left: auto;
  145. margin-right: auto;
  146. margin-top: 100rpx;
  147. }
  148. .button-hover {
  149. background: linear-gradient(-90deg, rgba(63, 205, 235, 0.8), rgba(188, 226, 158, 0.8));
  150. }
  151. .agreenment {
  152. display: flex;
  153. flex-direction: row;
  154. justify-content: center;
  155. align-items: center;
  156. font-size: 30rpx;
  157. margin-top: 80rpx;
  158. color: #FFA800;
  159. text-align: center;
  160. height: 40rpx;
  161. line-height: 40rpx;
  162. }
  163. .agreenment text {
  164. font-size: 24rpx;
  165. margin-left: 15rpx;
  166. margin-right: 15rpx;
  167. }
  168. </style>