findpaypass.vue 2.0 KB

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