金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
3.7 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="商家登录" :showIcon="true" bgColor="#fff"></lf-nav>
  4. <view class="head">
  5. <view class="head-content">
  6. <image class="logo"></image>
  7. <view class="title">欢迎来到金诚优选</view>
  8. </view>
  9. </view>
  10. <view class="content">
  11. <view class="list">
  12. <view class="lf-flex">
  13. <view class="lf-font-28 lf-color-black" style="width: 140rpx;">手机号</view>
  14. <input class="input" placeholder="请输入手机号码" v-model="phone" maxlength="11" />
  15. </view>
  16. <view class="clear" v-if="phone.length" @click="phone = ''">
  17. <text class="lf-iconfont icon-status-error"></text>
  18. </view>
  19. </view>
  20. <view class="list">
  21. <view class="lf-flex">
  22. <view class="lf-font-28 lf-color-black" style="width: 140rpx;">密码</view>
  23. <input class="input" placeholder="请输入密码" v-model="password" />
  24. </view>
  25. <view class="clear" v-if="password.length" @click="password = ''">
  26. <text class="lf-iconfont icon-status-error"></text>
  27. </view>
  28. </view>
  29. </view>
  30. <button class="next-btn" hover-class="lf-opacity" @click="next">登录</button>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data(){
  36. return {
  37. phone: '',
  38. password: ''
  39. }
  40. },
  41. onLoad(){
  42. },
  43. methods: {
  44. next(){
  45. if(!this.phone) return this.$msg('请输入登录手机号');
  46. if(!this.$check(this.phone, 'mobile')) return this.$msg('请输入正确的手机号');
  47. if(!this.password) return this.$msg('请输入密码');
  48. uni.showLoading({
  49. title: '正在登录'
  50. })
  51. this.$http.post({
  52. api: 'api/supplier/login',
  53. data: {
  54. username: this.phone,
  55. password: this.password
  56. }
  57. }).then(res => {
  58. console.log("login", res);
  59. uni.hideLoading();
  60. if(res.data.code != 200){
  61. this.$msg(res.data.data);
  62. }else{
  63. let token = res.data.data.token;
  64. // let expires_in = res.data.data.expires_in || 315360000; // 登录超时时效
  65. // this.$cookieStorage.set('store_token', token, expires_in);
  66. this.$cookieStorage.set('store_token', token);
  67. this.$url('/pages/business/center/center', {type: 'redirect'});
  68. }
  69. }).catch(err => uni.hideLoading())
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .head{
  76. height: 400rpx;
  77. width: 750rpx;
  78. display: flex;
  79. flex-direction: column;
  80. align-items: center;
  81. justify-content: center;
  82. .head-content{
  83. display: flex;
  84. flex-direction: column;
  85. align-items: center;
  86. .logo{
  87. width: 182rpx;
  88. height: 182rpx;
  89. border-radius: 50%;
  90. background-color: #EEEEEE;
  91. }
  92. .title{
  93. font-size: 32rpx;
  94. color: #222222;
  95. font-weight: bold;
  96. font-family: '楷体';
  97. margin-top: 20rpx;
  98. }
  99. }
  100. }
  101. .content{
  102. padding: 0 32rpx;
  103. }
  104. .next-btn{
  105. width: 550rpx;
  106. height: 100rpx;
  107. background: #0D2E9A;
  108. border-radius: 50rpx;
  109. line-height: 100rpx;
  110. color: #FFFFFF;
  111. margin-top: 100rpx;
  112. }
  113. .list{
  114. height: 120rpx;
  115. width: 100%;
  116. border-bottom: 1rpx solid #e5e5e5;
  117. display: flex;
  118. justify-content: space-between;
  119. align-items: center;
  120. .input{
  121. width: 430rpx;
  122. height: 80rpx;
  123. font-size: 28rpx;
  124. }
  125. .input-code{
  126. width: 340rpx;
  127. }
  128. .clear{
  129. padding: 20rpx;
  130. }
  131. .code{
  132. min-width: 180rpx;
  133. max-width: 220rpx;
  134. height: 64rpx;
  135. padding: 0 4rpx;
  136. font-size: 24rpx;
  137. color: #0D2E9A;
  138. display: flex;
  139. justify-content: center;
  140. align-items: center;
  141. border-radius: 32rpx;
  142. border: 2rpx solid #0D2E9A;
  143. }
  144. .active-bg{
  145. background: #efefef;
  146. }
  147. }
  148. .fixed-desc{
  149. position: fixed;
  150. bottom: 50rpx;
  151. left: calc(50% - 343rpx);
  152. width: 686rpx;
  153. padding-bottom: constant(safe-area-inset-bottom);
  154. padding-bottom: env(safe-area-inset-bottom);
  155. font-size: 28rpx;
  156. color: #777777;
  157. &>text:nth-child(2){
  158. color: #FF9D9D;
  159. }
  160. }
  161. </style>