login.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="t-login">
  3. <!-- 页面装饰图片 -->
  4. <image class="img-a" src="/static/2.png"></image>
  5. <image class="img-b" src="/static/3.png"></image>
  6. <!-- 标题 -->
  7. <view class="t-b">{{ title }}</view>
  8. <form class="cl">
  9. <view class="t-a">
  10. <image class="text-center cuIcon cuIcon-people"></image>
  11. <view class="line"></view>
  12. <input type="text" placeholder="请输入账号" v-model="loginName" />
  13. </view>
  14. <view class="t-a">
  15. <image :class="[!showPassword ? 'text-center cuIcon cuIcon-unlock' : 'text-center cuIcon cuIcon-lock']"
  16. class="text-center cuIcon cuIcon-lock" @tap="showPwd()"></image>
  17. <!-- <image src="/static/pwd.png"></image> -->
  18. <view class="line"></view>
  19. <input type="text" :password="showPassword" :focus="buttonFocused" placeholder="请输入密码" v-model="password" @confirm="startLogin()" />
  20. </view>
  21. <button @tap="startLogin()">登 录</button>
  22. </form>
  23. </view>
  24. </template>
  25. <script>
  26. import request from '@/common/libs/request.js';
  27. export default {
  28. data() {
  29. return {
  30. title: "都能运",
  31. supplierArray: [{
  32. itemName: "",
  33. id: -99
  34. }],
  35. supplierIndex: 0,
  36. showPassword: true,
  37. loginName: "",
  38. password: "",
  39. buttonFocused: false
  40. }
  41. },
  42. methods: {
  43. bindPickerChange: function(e) {
  44. this.supplierIndex = e.detail.value
  45. console.log(this.supplierArray[this.supplierIndex].id);
  46. },
  47. showPwd: function() {
  48. this.showPassword = !this.showPassword;
  49. },
  50. startLogin: function() {
  51. var user = {
  52. loginName: this.loginName,
  53. password: this.password
  54. };
  55. var userData = {
  56. "user": JSON.stringify(user),
  57. "supplierId":1
  58. }
  59. request.httpPost("/dnyDriver/login", userData, false).then(res => {
  60. console.log(res);
  61. if (res.httpCode == 200) {
  62. uni.setStorageSync("erpToken", res.data.accessToken);
  63. uni.reLaunch({
  64. url: '/pages/index/tabbar',
  65. })
  66. } else {
  67. uni.showToast({
  68. title: res.msg,
  69. icon: "error"
  70. })
  71. }
  72. })
  73. }
  74. }
  75. }
  76. </script>
  77. <style>
  78. .img-a {
  79. position: absolute;
  80. width: 100%;
  81. top: -150rpx;
  82. right: 0;
  83. }
  84. .img-b {
  85. position: absolute;
  86. width: 50%;
  87. bottom: 0;
  88. left: -50rpx;
  89. /* margin-bottom: -200rpx; */
  90. }
  91. .t-login {
  92. width: 650rpx;
  93. margin: 0 auto;
  94. font-size: 28rpx;
  95. color: #000;
  96. }
  97. .t-login button {
  98. font-size: 28rpx;
  99. background: #5677fc;
  100. color: #fff;
  101. height: 90rpx;
  102. line-height: 90rpx;
  103. border-radius: 50rpx;
  104. box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
  105. }
  106. .t-login picker {
  107. padding: 0 20rpx 0 120rpx;
  108. height: 90rpx;
  109. line-height: 90rpx;
  110. margin-bottom: 50rpx;
  111. background: #FFCC00;
  112. border: 1px solid #e9e9e9;
  113. font-size: 28rpx;
  114. border-radius: 50rpx;
  115. box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
  116. }
  117. .t-login input {
  118. padding: 0 20rpx 0 120rpx;
  119. height: 90rpx;
  120. line-height: 90rpx;
  121. margin-bottom: 50rpx;
  122. background: #f8f7fc;
  123. border: 1px solid #e9e9e9;
  124. font-size: 28rpx;
  125. border-radius: 50rpx;
  126. }
  127. .t-login .t-a {
  128. position: relative;
  129. }
  130. .t-login .t-a image {
  131. width: 40rpx;
  132. height: 40rpx;
  133. position: absolute;
  134. left: 40rpx;
  135. top: 28rpx;
  136. /* border-right: 2rpx solid #dedede; */
  137. margin-right: 20rpx;
  138. }
  139. .t-login .t-a .line {
  140. width: 2rpx;
  141. height: 40rpx;
  142. background-color: #dedede;
  143. position: absolute;
  144. top: 28rpx;
  145. left: 98rpx;
  146. }
  147. .t-login .t-b {
  148. text-align: left;
  149. font-size: 46rpx;
  150. color: #000;
  151. padding: 250rpx 0 30rpx 0;
  152. font-weight: bold;
  153. }
  154. .t-login .t-b2 {
  155. text-align: left;
  156. font-size: 32rpx;
  157. color: #aaaaaa;
  158. padding: 0rpx 0 120rpx 0;
  159. }
  160. .t-login .t-c {
  161. position: absolute;
  162. right: 22rpx;
  163. top: 22rpx;
  164. background: #5677fc;
  165. color: #fff;
  166. font-size: 24rpx;
  167. border-radius: 50rpx;
  168. height: 50rpx;
  169. line-height: 50rpx;
  170. padding: 0 25rpx;
  171. }
  172. .t-login .t-d {
  173. text-align: center;
  174. color: #999;
  175. margin: 80rpx 0;
  176. }
  177. .t-login .t-e {
  178. text-align: center;
  179. width: 250rpx;
  180. margin: 80rpx auto 0;
  181. }
  182. .t-login .t-g {
  183. float: left;
  184. width: 50%;
  185. }
  186. .t-login .t-e image {
  187. width: 50rpx;
  188. height: 50rpx;
  189. }
  190. .t-login .t-f {
  191. text-align: center;
  192. margin: 200rpx 0 0 0;
  193. color: #666;
  194. }
  195. .t-login .t-f text {
  196. margin-left: 20rpx;
  197. color: #aaaaaa;
  198. font-size: 27rpx;
  199. }
  200. .t-login .uni-input-placeholder {
  201. color: #000;
  202. }
  203. .cl {
  204. zoom: 1;
  205. }
  206. .cl:after {
  207. clear: both;
  208. display: block;
  209. visibility: hidden;
  210. height: 0;
  211. content: '\20';
  212. }
  213. </style>