login.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. this.$refs.uToast.show({
  68. type: 'error',
  69. message: failres.errmsg,
  70. })
  71. uni.hideLoading()
  72. }).then(res => {
  73. console.log(res)
  74. if (res.errno == 200) {
  75. uni.hideLoading()
  76. uni.setStorageSync('userInfo', this.userInfo)
  77. this.$store.commit('login', this.userInfo)
  78. // that.$api.setUserInfo(that.userInfo)
  79. uni.switchTab({
  80. url: '/pages/index/index'
  81. })
  82. }
  83. })
  84. }
  85. }
  86. }
  87. </script>
  88. <style>
  89. .content {
  90. display: flex;
  91. flex-direction: column;
  92. justify-content: center;
  93. }
  94. .header {
  95. width: 161rpx;
  96. height: 161rpx;
  97. background: rgba(63, 205, 235, 1);
  98. box-shadow: 0rpx 12rpx 13rpx 0rpx rgba(63, 205, 235, 0.47);
  99. border-radius: 50%;
  100. margin-top: 30rpx;
  101. margin-left: auto;
  102. margin-right: auto;
  103. }
  104. .header image {
  105. width: 161rpx;
  106. height: 161rpx;
  107. border-radius: 50%;
  108. }
  109. .list {
  110. display: flex;
  111. flex-direction: column;
  112. padding-top: 50rpx;
  113. padding-left: 70rpx;
  114. padding-right: 70rpx;
  115. }
  116. .list-call {
  117. display: flex;
  118. flex-direction: row;
  119. justify-content: space-between;
  120. align-items: center;
  121. height: 100rpx;
  122. color: #333333;
  123. border-bottom: 0.5px solid #e2e2e2;
  124. }
  125. .list-call .img {
  126. width: 40rpx;
  127. height: 40rpx;
  128. }
  129. .list-call .sl-input {
  130. flex: 1;
  131. text-align: left;
  132. font-size: 32rpx;
  133. margin-left: 16rpx;
  134. }
  135. .button-login {
  136. color: #FFFFFF;
  137. font-size: 34rpx;
  138. width: 470rpx;
  139. height: 100rpx;
  140. background: linear-gradient(-90deg, rgba(63, 205, 235, 1), rgba(188, 226, 158, 1));
  141. box-shadow: 0rpx 0rpx 13rpx 0rpx rgba(164, 217, 228, 0.2);
  142. border-radius: 50rpx;
  143. line-height: 100rpx;
  144. text-align: center;
  145. margin-left: auto;
  146. margin-right: auto;
  147. margin-top: 100rpx;
  148. }
  149. .button-hover {
  150. background: linear-gradient(-90deg, rgba(63, 205, 235, 0.8), rgba(188, 226, 158, 0.8));
  151. }
  152. .agreenment {
  153. display: flex;
  154. flex-direction: row;
  155. justify-content: center;
  156. align-items: center;
  157. font-size: 30rpx;
  158. margin-top: 80rpx;
  159. color: #FFA800;
  160. text-align: center;
  161. height: 40rpx;
  162. line-height: 40rpx;
  163. }
  164. .agreenment text {
  165. font-size: 24rpx;
  166. margin-left: 15rpx;
  167. margin-right: 15rpx;
  168. }
  169. </style>