login.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view>
  3. <view class="login-view" style="">
  4. <image src="/static/images/logo/logo.png" class="logo" mode="widthFix"></image>
  5. <view class="t-login">
  6. <form class="cl">
  7. <view class="t-a">
  8. <text class="txt">账户名</text>
  9. <input type="text" name="phone" placeholder="请输入您的账户名" maxlength="20" v-model.trim="phone" />
  10. </view>
  11. <view class="t-a">
  12. <text class="txt">密码</text>
  13. <input type="password" name="code" maxlength="18" placeholder="请输入您的密码" v-model.trim="pwd" />
  14. </view>
  15. <view style="display: flex;justify-content: space-between;">
  16. <u-checkbox-group v-model="checkedList" @change="change">
  17. <u-checkbox activeColor="#fd5003" :customStyle="{marginBottom: '8px'}" label="记住密码"
  18. name="记住密码">
  19. </u-checkbox>
  20. </u-checkbox-group>
  21. <view style="color: #FD5003;" @click="forgotPassword">忘记密码</view>
  22. </view>
  23. <u-button type="primary" class="custom-style" color="linear-gradient(0deg, #FD5003 0%, #FBA680 100%)" :ripple="true" @click="login">登 录
  24. </u-button>
  25. </form>
  26. </view>
  27. </view>
  28. <view style="position:absolute; bottom:20rpx;font-size: 20rpx;width: 100%;text-align: center;">
  29. <image src="/static/images/login/bottom.png" style="
  30. display: block;
  31. width: 60%;
  32. height: auto;
  33. margin: 0 auto 10rpx;" mode="widthFix"></image>
  34. 青岛途宝软件开发有限公司提供技术支持
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import md5 from '@/utils/md5.js'
  40. export default {
  41. data() {
  42. return {
  43. phone: '', //手机号码
  44. pwd: '', //密码
  45. // phone: '13021669111', //手机号码18669858069
  46. // pwd: '123456', //密码
  47. checked: false,
  48. lifeData: {},
  49. checkedList: []
  50. }
  51. },
  52. onShow() {
  53. //清除本地缓存
  54. // uni.removeStorageSync('lifeData');
  55. this.phone = uni.getStorageSync('username')
  56. this.pwd = uni.getStorageSync('password')
  57. if (uni.getStorageSync('username')) {
  58. this.checked = true
  59. this.checkedList = ['记住密码']
  60. }
  61. },
  62. methods: {
  63. //忘记密码
  64. forgotPassword() {
  65. uni.$u.route('/pages/login/forgotPassword');
  66. },
  67. change(e) {
  68. this.checked = !this.checked
  69. },
  70. //当前登录按钮操作
  71. login() {
  72. // let tenant = '681169'
  73. // let tenant = '922648'
  74. // let tenant = '888390'
  75. // let tenant = '269129'
  76. // let tenant = '673511'
  77. // let tenant = '000000'
  78. // let phone = this.phone
  79. // if (this.phone.slice(0, 6) == '000000') {
  80. // tenant = '000000'
  81. // phone = this.phone.slice(6, this.phone.length)
  82. // }
  83. // if (this.phone.slice(0, 6) == '681169') {
  84. // tenant = '681169'
  85. // phone = this.phone.slice(6, this.phone.length)
  86. // }
  87. uni.showLoading({
  88. title: '加载中',
  89. mask: true
  90. });
  91. this.$u.api.token(
  92. // '096359',
  93. // '000000',
  94. // tenant,
  95. this.phone,
  96. md5(this.pwd)
  97. ).then(data => {
  98. if (this.checked === true) {
  99. uni.setStorageSync('username', this.phone);
  100. uni.setStorageSync('password', this.pwd);
  101. }
  102. uni.hideLoading();
  103. uni.showToast({
  104. icon: 'none',
  105. title: '登录成功',
  106. position: "bottom",
  107. mask: true
  108. })
  109. let _this = this
  110. setTimeout(function() {
  111. _this.$u.func.login(data)
  112. }, 1000);
  113. })
  114. }
  115. }
  116. };
  117. </script>
  118. <style lang="scss" scoped>
  119. .custom-style {
  120. color: #3ab2f7;
  121. margin-top: 140rpx;
  122. box-shadow: 2px 5px 10px 1px rgba(43, 117, 250, 0.3);
  123. }
  124. .txt {
  125. font-size: 32rpx;
  126. font-weight: bold;
  127. color: #333333;
  128. }
  129. .img-a {
  130. width: 100%;
  131. height: 400rpx;
  132. }
  133. .logo {
  134. display: block;
  135. width: 281rpx;
  136. height: auto;
  137. margin: 0 auto 120rpx;
  138. }
  139. .reg {
  140. font-size: 28rpx;
  141. color: #fff;
  142. height: 90rpx;
  143. line-height: 90rpx;
  144. border-radius: 50rpx;
  145. font-weight: bold;
  146. background: #f5f6fa;
  147. color: #000000;
  148. text-align: center;
  149. margin-top: 30rpx;
  150. }
  151. .login-view {
  152. width: 100%;
  153. padding-top: 200rpx;
  154. }
  155. .t-login {
  156. width: 600rpx;
  157. margin: 0 auto;
  158. font-size: 28rpx;
  159. margin-top: 80rpx;
  160. }
  161. .t-login button {
  162. font-size: 28rpx;
  163. background: #2796f2;
  164. color: #fff;
  165. height: 90rpx;
  166. line-height: 90rpx;
  167. border-radius: 50rpx;
  168. font-weight: bold;
  169. }
  170. .t-login input {
  171. height: 90rpx;
  172. line-height: 90rpx;
  173. margin-bottom: 50rpx;
  174. border-bottom: 1px solid #e9e9e9;
  175. font-size: 28rpx;
  176. }
  177. .t-login .t-a {
  178. position: relative;
  179. }
  180. .t-b {
  181. text-align: left;
  182. font-size: 42rpx;
  183. color: #000;
  184. padding: 130rpx 0 0 70rpx;
  185. font-weight: bold;
  186. line-height: 70rpx;
  187. }
  188. .t-login .t-c {
  189. position: absolute;
  190. right: 22rpx;
  191. top: 22rpx;
  192. background: #5677fc;
  193. color: #fff;
  194. font-size: 24rpx;
  195. border-radius: 50rpx;
  196. height: 50rpx;
  197. line-height: 50rpx;
  198. padding: 0 25rpx;
  199. }
  200. .t-login .t-d {
  201. text-align: center;
  202. color: #999;
  203. margin: 80rpx 0;
  204. }
  205. .t-login .t-e {
  206. text-align: center;
  207. width: 250rpx;
  208. margin: 80rpx auto 0;
  209. }
  210. .t-login .t-g {
  211. float: left;
  212. width: 50%;
  213. }
  214. .t-login .t-e image {
  215. width: 50rpx;
  216. height: 50rpx;
  217. }
  218. .t-login .t-f {
  219. text-align: center;
  220. margin: 150rpx 0 0 0;
  221. color: #666;
  222. }
  223. .t-login .t-f text {
  224. margin-left: 20rpx;
  225. color: #aaaaaa;
  226. font-size: 27rpx;
  227. }
  228. .t-login .uni-input-placeholder {
  229. color: #aeaeae;
  230. }
  231. .cl {
  232. zoom: 1;
  233. }
  234. .cl:after {
  235. clear: both;
  236. display: block;
  237. visibility: hidden;
  238. height: 0;
  239. content: '\20';
  240. }
  241. </style>