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

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