transaction.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view class="container">
  3. <view class="row ">
  4. <text class="tit">{{$t('set.a3')}}</text>
  5. <input class="input" disabled v-model="account" type="text" :placeholder="$t('reg.a3')"
  6. placeholder-class="placeholder" />
  7. </view>
  8. <view class="row ">
  9. <text class="tit">{{$t('reg.a8')}}</text>
  10. <input class="input" v-model="password" type="password" :placeholder="$t('reg.a9')"
  11. placeholder-class="placeholder" />
  12. </view>
  13. <view class="row ">
  14. <text class="tit">{{$t('reg.b0')}}</text>
  15. <input class="input" v-model="repeat" type="password" :placeholder="$t('reg.b1')"
  16. placeholder-class="placeholder" />
  17. </view>
  18. <view class="row">
  19. <text class="tit">{{$t('reg.a6')}}</text>
  20. <input class="input" v-model="captcha" type="text" :placeholder="$t('reg.a7')" placeholder-class="placeholder" />
  21. <view class="code" @click="verification">{{ countDown == 0 ? $t('reg.c6') : countDown }}</view>
  22. </view>
  23. <button class="add-btn" :class="{'bg-gray':loding}"
  24. @click="loding?'':confirm()">{{$t('common.submit')}}</button>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. verify
  30. } from '@/api/login.js';
  31. import {
  32. mapState
  33. } from 'vuex';
  34. import {
  35. Reset
  36. } from '@/api/set.js';
  37. // import detectEthereumProvider from '@metamask/detect-provider'
  38. export default {
  39. data() {
  40. return {
  41. time: '', //保存倒计时对象
  42. countDown: 0, //倒计时
  43. account: '', //手机号
  44. captcha: '', //验证码
  45. password: '', //密码
  46. repeat: '', //确认密码
  47. loding: false, //是否载入中
  48. };
  49. },
  50. computed: {
  51. ...mapState("user", ['userInfo'])
  52. },
  53. onLoad() {
  54. if (this.userInfo.phone == null) {
  55. this.account = '';
  56. } else {
  57. this.account = this.userInfo.phone;
  58. this.show = false;
  59. }
  60. console.log(this.userInfo,'this.userInfo');
  61. uni.setNavigationBarTitle({
  62. title: this.$t("tab.b3"),
  63. });
  64. },
  65. watch: {
  66. // 监听倒计时
  67. countDown(i) {
  68. if (i == 0) {
  69. clearInterval(this.time);
  70. }
  71. }
  72. },
  73. methods: {
  74. //发送验证码
  75. verification() {
  76. let obj = this;
  77. if (this.account == '') {
  78. this.$api.msg(obj.$t("safe.b5"));
  79. return;
  80. }
  81. // if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.account)) {
  82. // this.$api.msg(obj.$t("safe.b8"));
  83. // return;
  84. // }
  85. // 判断是否在倒计时
  86. if (obj.countDown > 0) {
  87. return false;
  88. } else {
  89. obj.countDown = 60;
  90. obj.time = setInterval(() => {
  91. obj.countDown--;
  92. }, 1000);
  93. //调用验证码接口
  94. verify({
  95. phone: obj.account,
  96. type: ''
  97. })
  98. .then(({
  99. data
  100. }) => {})
  101. .catch(err => {
  102. console.log(err);
  103. });
  104. }
  105. },
  106. async confirm(e) {
  107. const obj = this;
  108. this.loding = true;
  109. Reset({
  110. // account: this.account,
  111. captcha: this.captcha,
  112. password: this.password,
  113. })
  114. .then(({
  115. data
  116. }) => {
  117. this.loding = false;
  118. this.$api.msg("修改成功");
  119. })
  120. .catch(err => {
  121. this.loding = false;
  122. console.log(err);
  123. });
  124. }
  125. }
  126. };
  127. </script>
  128. <style lang="scss">
  129. page {
  130. background: #051137;
  131. }
  132. .row {
  133. display: flex;
  134. align-items: center;
  135. position: relative;
  136. padding: 20rpx;
  137. background: #1F2A4A;
  138. margin: 0 30rpx 30rpx 30rpx;
  139. border-radius: 10rpx;
  140. color: #FFF;
  141. .tit {
  142. min-width: 130rpx;
  143. flex-shrink: 0;
  144. font-size: $font-base;
  145. }
  146. .input {
  147. flex: 1;
  148. font-size: $font-base;
  149. color: $font-color-light;
  150. padding-left: 20rpx;
  151. }
  152. .iconlocation {
  153. font-size: 36rpx;
  154. color: $font-color-light;
  155. }
  156. }
  157. .add-btn {
  158. background: linear-gradient(90deg, #0C5AFA, #1356FF);
  159. margin: 30rpx;
  160. color: #FFF;
  161. font-size: 30rpx;
  162. text-align: center;
  163. border-radius: 10rpx;
  164. }
  165. .bg-gray {
  166. background-color: $color-gray;
  167. }
  168. .code {
  169. color: #000s;
  170. font-size: 23rpx;
  171. border-left: 1px solid #eeeeee;
  172. width: 150rpx;
  173. flex-shrink: 0;
  174. text-align: center;
  175. }
  176. </style>