login.vue 5.9 KB

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