login.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. if (res.httpCode == 200) {
  61. uni.setStorageSync("erpToken", res.data.accessToken);
  62. uni.reLaunch({
  63. url: '/pages/index/tabbar',
  64. })
  65. } else {
  66. uni.showToast({
  67. title: res.msg,
  68. icon: "error"
  69. })
  70. }
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style>
  77. .img-a {
  78. position: absolute;
  79. width: 100%;
  80. top: -150rpx;
  81. right: 0;
  82. }
  83. .img-b {
  84. position: absolute;
  85. width: 50%;
  86. bottom: 0;
  87. left: -50rpx;
  88. /* margin-bottom: -200rpx; */
  89. }
  90. .t-login {
  91. width: 650rpx;
  92. margin: 0 auto;
  93. font-size: 28rpx;
  94. color: #000;
  95. }
  96. .t-login button {
  97. font-size: 28rpx;
  98. background: #5677fc;
  99. color: #fff;
  100. height: 90rpx;
  101. line-height: 90rpx;
  102. border-radius: 50rpx;
  103. box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
  104. }
  105. .t-login picker {
  106. padding: 0 20rpx 0 120rpx;
  107. height: 90rpx;
  108. line-height: 90rpx;
  109. margin-bottom: 50rpx;
  110. background: #FFCC00;
  111. border: 1px solid #e9e9e9;
  112. font-size: 28rpx;
  113. border-radius: 50rpx;
  114. box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
  115. }
  116. .t-login input {
  117. padding: 0 20rpx 0 120rpx;
  118. height: 90rpx;
  119. line-height: 90rpx;
  120. margin-bottom: 50rpx;
  121. background: #f8f7fc;
  122. border: 1px solid #e9e9e9;
  123. font-size: 28rpx;
  124. border-radius: 50rpx;
  125. }
  126. .t-login .t-a {
  127. position: relative;
  128. }
  129. .t-login .t-a image {
  130. width: 40rpx;
  131. height: 40rpx;
  132. position: absolute;
  133. left: 40rpx;
  134. top: 28rpx;
  135. /* border-right: 2rpx solid #dedede; */
  136. margin-right: 20rpx;
  137. }
  138. .t-login .t-a .line {
  139. width: 2rpx;
  140. height: 40rpx;
  141. background-color: #dedede;
  142. position: absolute;
  143. top: 28rpx;
  144. left: 98rpx;
  145. }
  146. .t-login .t-b {
  147. text-align: left;
  148. font-size: 46rpx;
  149. color: #000;
  150. padding: 250rpx 0 30rpx 0;
  151. font-weight: bold;
  152. }
  153. .t-login .t-b2 {
  154. text-align: left;
  155. font-size: 32rpx;
  156. color: #aaaaaa;
  157. padding: 0rpx 0 120rpx 0;
  158. }
  159. .t-login .t-c {
  160. position: absolute;
  161. right: 22rpx;
  162. top: 22rpx;
  163. background: #5677fc;
  164. color: #fff;
  165. font-size: 24rpx;
  166. border-radius: 50rpx;
  167. height: 50rpx;
  168. line-height: 50rpx;
  169. padding: 0 25rpx;
  170. }
  171. .t-login .t-d {
  172. text-align: center;
  173. color: #999;
  174. margin: 80rpx 0;
  175. }
  176. .t-login .t-e {
  177. text-align: center;
  178. width: 250rpx;
  179. margin: 80rpx auto 0;
  180. }
  181. .t-login .t-g {
  182. float: left;
  183. width: 50%;
  184. }
  185. .t-login .t-e image {
  186. width: 50rpx;
  187. height: 50rpx;
  188. }
  189. .t-login .t-f {
  190. text-align: center;
  191. margin: 200rpx 0 0 0;
  192. color: #666;
  193. }
  194. .t-login .t-f text {
  195. margin-left: 20rpx;
  196. color: #aaaaaa;
  197. font-size: 27rpx;
  198. }
  199. .t-login .uni-input-placeholder {
  200. color: #000;
  201. }
  202. .cl {
  203. zoom: 1;
  204. }
  205. .cl:after {
  206. clear: both;
  207. display: block;
  208. visibility: hidden;
  209. height: 0;
  210. content: '\20';
  211. }
  212. </style>