findpaypass.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="page-wrap">
  3. <u-navbar
  4. title="忘记密码"
  5. :placeholder="true"
  6. :autoBack="true"
  7. :safeAreaInsetTop="true"
  8. >
  9. </u-navbar>
  10. <view class="title">手机验证身份</view>
  11. <view class="phone">
  12. <text v-if="leftTime>0">验证码已发送</text>
  13. <text v-else>手机号:</text>
  14. {{vuex_member_info.mobile|hidePhoneNumber}}</view>
  15. <u-code-input
  16. v-model="value"
  17. mode="line"
  18. :maxlength="4"
  19. @finish="finish">
  20. </u-code-input>
  21. <u-button class="button" type="primary" :disabled="leftTime>0" @click="sendSMS" :text="btnStatus"></u-button>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. value:'',
  29. leftTime: 0, // 剩余时间
  30. btnStatus: '发送验证码', // 按钮状态
  31. params:{
  32. }
  33. }
  34. },
  35. onShow() {
  36. },
  37. onLoad() {
  38. },
  39. methods: {
  40. sendSMS() {
  41. // console.log('发送短信验证码到:', 手机号码);
  42. this.$u.api.getCode({mobile:this.vuex_member_info.mobile}).then(res=>{
  43. this.leftTime = 60;
  44. this.btnStatus = `${this.leftTime}秒后重试`;
  45. const timer = setInterval(() => {
  46. this.leftTime--;
  47. this.btnStatus = `${this.leftTime}秒后重试`;
  48. if (this.leftTime <= 0) {
  49. clearInterval(timer);
  50. this.btnStatus = '重新发送验证码';
  51. }
  52. }, 1000);
  53. console.log('res',res.data);
  54. }).catch(err=>{
  55. console.log('getCode',err);
  56. });
  57. },
  58. finish(){
  59. console.log('value',this.value);
  60. uni.$u.route('/center/setPaypass', {
  61. fromPage: 'forget',
  62. code:this.value
  63. });
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .page-wrap{
  70. text-align: center;
  71. .title{
  72. font-size: 32rpx;
  73. font-weight: 600;
  74. color: #333333;
  75. line-height: 45rpx;
  76. margin: 40rpx auto 30rpx;
  77. }
  78. .phone{
  79. font-size: 26rpx;
  80. font-weight: 400;
  81. color: #999999;
  82. line-height: 37rpx;
  83. margin-bottom: 130rpx;
  84. }
  85. }
  86. /deep/ .u-code-input__item{
  87. flex-grow: 1;
  88. }
  89. /deep/ .u-button{
  90. margin-top: 80rpx;
  91. width: 80%!important;
  92. }
  93. </style>