金诚优选前端代码
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.

130 lines
2.8 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="旧手机号验证" :showIcon="true"></lf-nav>
  4. <view class="content">
  5. <view class="list">
  6. <view class="lf-flex">
  7. <view class="lf-font-28 lf-color-black" style="width: 140rpx;">旧手机号</view>
  8. <input class="input" placeholder="请输入手机号" v-model="phone" maxlength="11" />
  9. </view>
  10. <view class="clear" v-if="phone.length" @click="phone = ''">
  11. <text class="lf-iconfont icon--"></text>
  12. </view>
  13. </view>
  14. <view class="list">
  15. <view class="lf-flex">
  16. <view class="lf-font-28 lf-color-black" style="width: 140rpx;">验证码</view>
  17. <input class="input input-code" placeholder="请输入验证码" maxlength="8" v-model="code" />
  18. </view>
  19. <view class="code" :class="{'active-bg': is_code}" @click="getCode">
  20. <text>{{ is_code ? num +'秒后重新获取' : '获取验证码' }}</text>
  21. </view>
  22. </view>
  23. </view>
  24. <button class="next-btn" hover-class="lf-opacity" @click="next">下一步</button>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data(){
  30. return {
  31. phone: '',
  32. code: '',
  33. is_code: false,
  34. timer: null,
  35. num: 10
  36. }
  37. },
  38. onLoad(){
  39. },
  40. onUnload(){
  41. if(this.timer){
  42. clearInterval(this.timer);
  43. this.timer = null;
  44. }
  45. },
  46. methods: {
  47. getCode(){
  48. if(this.is_code) return;
  49. this.is_code = true;
  50. if(this.timer){
  51. clearInterval(this.timer);
  52. this.timer = null;
  53. }
  54. console.log("测试重复点击", Math.random())
  55. // TODO 在此发送网络请求
  56. this.timer = setInterval(() => {
  57. this.num--;
  58. if(this.num <= 0){
  59. clearInterval(this.timer);
  60. this.timer = null;
  61. this.num = 10;
  62. this.is_code = false;
  63. }
  64. }, 1000);
  65. },
  66. next(){
  67. // this.$url('/pages/user/my/setPassword', {type: 'redirect'});
  68. this.$url('/pages/user/my/setPassword');
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped="scoped">
  74. .content{
  75. padding: 0 32rpx;
  76. }
  77. .next-btn{
  78. width: 550rpx;
  79. height: 100rpx;
  80. background: #15716E;
  81. border-radius: 50rpx;
  82. position: fixed;
  83. bottom: 10vh;
  84. left: calc(50% - 275rpx);
  85. line-height: 100rpx;
  86. color: #FFFFFF;
  87. }
  88. .list{
  89. height: 106rpx;
  90. width: 100%;
  91. border-bottom: 1rpx solid #e5e5e5;
  92. display: flex;
  93. justify-content: space-between;
  94. align-items: center;
  95. &:nth-child(2n){
  96. margin-top: 30rpx;
  97. }
  98. .input{
  99. width: 380rpx;
  100. height: 80rpx;
  101. font-size: 32rpx;
  102. margin-left: 50rpx;
  103. }
  104. .input-code{
  105. width: 290rpx;
  106. }
  107. .clear{
  108. padding: 20rpx;
  109. }
  110. .code{
  111. min-width: 180rpx;
  112. max-width: 220rpx;
  113. height: 64rpx;
  114. padding: 0 4rpx;
  115. font-size: 24rpx;
  116. color: #15716E;
  117. display: flex;
  118. justify-content: center;
  119. align-items: center;
  120. border-radius: 32rpx;
  121. border: 2rpx solid #15716E;
  122. }
  123. .active-bg{
  124. background: #efefef;
  125. }
  126. }
  127. </style>