otherPhoneLogin.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="other-box">
  3. <en-nav @navHeight="setNavHeight" :right-show="true" right-text="密码登录" @rightClick="goToPass"></en-nav>
  4. <view class="login-box" :style="{'height':'calc(100vh - '+navHeight+'px)'}">
  5. <view class="login-top">
  6. <view class="login-title">
  7. <text class="title-item sys-color-black sys-weight-600">验证登录</text>
  8. </view>
  9. <view class="login-from">
  10. <view class="from-text">
  11. <input type="tel" class="from-input sys-color-gray-3" v-model="phone" placeholder="请输入手机号"></input>
  12. </view>
  13. <view class="from-code">
  14. <view class="from-text">
  15. <input type="tel" class="from-input sys-color-gray-3" v-model="code" placeholder="请输入手机号"></input>
  16. </view>
  17. <view class="code-text">
  18. <text class="sys-color-gray-3" v-if="time<=0" @click="senCode">获取验证码</text>
  19. <text class="sys-color-gray-3" v-else>{{time}} s</text>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="login-but sys-color-white sys-background-black" :class="{'login-but-no':!isLogin}">登录</view>
  24. <view class="local-txt sys-color-gray-9">若长时间未收到验证码,请使用以下方式快速登录</view>
  25. </view>
  26. </view>
  27. <view class="login-bottom">
  28. <other-login></other-login>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import EnNav from "@/components/en-utils/en-nav/en-nav";
  34. import tools from "@/service/tools";
  35. import OtherLogin from "@/pages/login/model/otherLogin";
  36. export default {
  37. name:'otherPhoneLogin',
  38. components: {OtherLogin, EnNav},
  39. data() {
  40. return {
  41. navHeight:40,
  42. isLogin:false,
  43. phone:'',
  44. code:'',
  45. time:0
  46. }
  47. },
  48. watch:{
  49. 'phone':function (){
  50. this.verifyIsLogin()
  51. },
  52. 'code':function (){
  53. this.verifyIsLogin()
  54. },
  55. },
  56. methods: {
  57. setNavHeight(navHeight){
  58. this.navHeight=navHeight
  59. },
  60. verifyIsLogin(){
  61. this.isLogin = this.phone.length === 11 && this.code !== '';
  62. },
  63. senCode(){
  64. if(this.phone.length !== 11){
  65. tools.error('请输入手机号码')
  66. return false
  67. }
  68. this.time=60
  69. let timeServe=setInterval(()=>{
  70. --this.time
  71. if(this.time<=0){
  72. clearInterval(timeServe)
  73. }
  74. },1000)
  75. },
  76. goToPass(){
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped lang="scss">
  82. .other-box{
  83. padding: 82rpx 80rpx 0 80rpx;
  84. box-sizing: border-box;
  85. position: relative;
  86. .login-top{
  87. .login-title{
  88. padding-bottom: 60rpx;
  89. .title-item{
  90. font-size: 48rpx;
  91. }
  92. }
  93. .login-from{
  94. .from-text{
  95. width: 100%;
  96. padding-bottom: 40rpx;
  97. border-bottom: 1rpx solid #E0E0E0;
  98. .from-input{
  99. font-size: 32rpx;
  100. height: 44rpx;
  101. line-height: 44rpx;
  102. }
  103. .from-input::placeholder{
  104. color: #999999;
  105. }
  106. }
  107. .from-code{
  108. margin-top: 60rpx;
  109. display: flex;
  110. justify-content: space-between;
  111. .from-text{
  112. width: 344rpx;
  113. }
  114. .code-text{
  115. width: 180rpx;
  116. height: 44rpx;
  117. line-height: 44rpx;
  118. text-align: center;
  119. text{
  120. font-size: 32rpx;
  121. }
  122. }
  123. }
  124. }
  125. .login-but{
  126. margin-top: 120rpx;
  127. border-radius: 200rpx;
  128. height: 88rpx;
  129. line-height: 88rpx;
  130. text-align: center;
  131. transition: .5s ease;
  132. }
  133. .login-but-no{
  134. opacity: 0.1;
  135. transition: .5s ease;
  136. }
  137. .local-txt{
  138. padding-top: 32rpx;
  139. font-size: 24rpx;
  140. text-align: center;
  141. }
  142. }
  143. .login-bottom{
  144. padding-bottom: calc(186rpx + env(safe-area-inset-bottom));
  145. position: absolute;
  146. bottom: 0;
  147. left: 80rpx;
  148. width:calc(100vw - 160rpx);
  149. }
  150. }
  151. </style>