自主产品,供应链食堂系统。将两个端拆开了。
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.

165 lines
3.6 KiB

  1. <template>
  2. <view>
  3. <view class="head">
  4. <view class="nav">
  5. <view>登录</view>
  6. </view>
  7. <image src="../../static/images/login_bg.png"></image>
  8. </view>
  9. <view class="content">
  10. <view>
  11. <!-- 账号 -->
  12. <view class="lf-flex lf-m-b-10">
  13. <u-icon name="account-fill"></u-icon>
  14. <text class="lf-m-l-10 lf-font-28 lf-color-333">登录账号</text>
  15. </view>
  16. <input class="input"
  17. maxlength="11"
  18. v-model="user_key"
  19. :adjust-position="false"
  20. :auto-blur="true"
  21. placeholder="请输入账号"
  22. @focus="inputFocus(190)"
  23. @blur="inputBlur" />
  24. <!-- 密码 -->
  25. <view class="lf-flex lf-m-b-10 lf-m-t-60">
  26. <u-icon name="lock-fill"></u-icon>
  27. <text class="lf-m-l-10 lf-font-28 lf-color-333">登录密码</text>
  28. </view>
  29. <input class="input"
  30. maxlength="11"
  31. v-model="user_pw"
  32. :adjust-position="false"
  33. :auto-blur="true"
  34. placeholder="请输入密码"
  35. :password="true"
  36. @focus="inputFocus(230)"
  37. @blur="inputBlur"
  38. @confirm="login" />
  39. </view>
  40. <view>
  41. <!-- 登录按钮 -->
  42. <button class="button" :class="{'lf-btn-disabled': button_click}" @click="login">登录</button>
  43. </view>
  44. </view>
  45. <view :style="is_focus ? 'height: 540rpx' : 'height: 40rpx'"></view>
  46. </view>
  47. </template>
  48. <script>
  49. let time = null;
  50. export default {
  51. data(){
  52. return {
  53. is_focus: false,
  54. user_key: '',
  55. user_pw: '',
  56. button_click: false
  57. }
  58. },
  59. methods: {
  60. inputFocus(scrollTop){
  61. time = setTimeout(() => {
  62. this.is_focus = true;
  63. }, 0); // 给blur事件留出时间
  64. setTimeout(() => {
  65. uni.pageScrollTo({
  66. scrollTop: scrollTop,
  67. duration: 100
  68. })
  69. }, 200);
  70. },
  71. inputBlur(){
  72. time = setTimeout(() => {
  73. this.is_focus = false;
  74. }, 0); // 给click事件留出时间
  75. },
  76. login(){
  77. if(this.button_click) return;
  78. if(!this.user_key){
  79. this.$msg('账号不能为空');
  80. }else if(!this.user_pw){
  81. this.$msg('密码不能为空');
  82. }else{
  83. this.button_click = true;
  84. this.$http(this.API.API_SUPPLIER_LOGIN, {
  85. username: this.user_key,
  86. password: this.user_pw
  87. }).then(res => {
  88. console.log("login", res);
  89. uni.setStorageSync('supply_token', res.data.token);
  90. this.button_click = false;
  91. this.$url('/pages/index/index', {tyep: 'redirect'});
  92. }).catch(err => this.button_click = false);
  93. }
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped="scoped">
  99. .lf-m-t-60{
  100. margin-top: 60rpx;
  101. }
  102. .head{
  103. height: 750rpx;
  104. width: 750rpx;
  105. background-color: #1833F2;
  106. position: relative;
  107. image{
  108. width: 626.5rpx;
  109. height: 582rpx;
  110. position: absolute;
  111. top: calc(50% - 240rpx);
  112. left: calc(50% - 313rpx);
  113. z-index: 0;
  114. }
  115. .nav{
  116. text-align: center;
  117. padding-top: 70rpx;
  118. padding-bottom: 34rpx;
  119. color: #FFFFFF;
  120. font-size: 32rpx;
  121. font-weight: bold;
  122. }
  123. }
  124. .content{
  125. width: 686rpx;
  126. height: 622rpx;
  127. background: #FFFFFF;
  128. box-shadow: 0rpx 2rpx 10rpx 5rpx rgba(24, 51, 242, 0.1);
  129. border-radius: 20rpx;
  130. margin: 0 auto;
  131. margin-top: -100rpx;
  132. padding: 60rpx 30rpx;
  133. box-sizing: border-box;
  134. display: flex;
  135. flex-direction: column;
  136. justify-content: space-between;
  137. position: relative;
  138. z-index: 2;
  139. .input{
  140. // padding: 20rpx 0;
  141. border-bottom: 1rpx solid #e5e5e5;
  142. font-size: 48rpx;
  143. /* #ifdef MP */
  144. height: 90rpx;
  145. line-height: 90rpx;
  146. /* #endif */
  147. }
  148. .button{
  149. background-color: #1833F2;
  150. color: #FFFFFF;
  151. font-size: 32rpx;
  152. }
  153. }
  154. /deep/.input-placeholder{
  155. color: #999999;
  156. font-size: 28rpx;
  157. }
  158. /deep/.button-hover{
  159. opacity: .5;
  160. animation: all .3s;
  161. }
  162. </style>