password.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="content">
  3. <view class="box">
  4. <view class="box-top">
  5. <view class="shu" style="">
  6. </view>
  7. <view class="pass-title">
  8. 支付密码
  9. </view>
  10. </view>
  11. <view class="box-bottom">
  12. <view class="ipt">
  13. <view class="text">
  14. 新密码
  15. </view> <input type="password" class="input" value="" placeholder="请输入新的支付密码" />
  16. </view>
  17. <view class="ipt">
  18. <view class="text">
  19. 重复密码
  20. </view><input type="password" class="input" value="" placeholder="请重复输入支付密码" />
  21. </view>
  22. <view class="ipt">
  23. <view class="text">
  24. 验证码
  25. </view> <input type="number" class="input" value="" placeholder="请输入验证码"/>
  26. <view class="yzm" @click="getDjs()" v-if="!isDjs">
  27. 验证码
  28. </view>
  29. <view class="yzm" v-else>
  30. {{countDown}}
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <button class="button" @click="navTo('/pages/money/success')">确认</button>
  36. <!-- <image style="z-index: 99;" src="../../static/game/game13.png" mode=""></image>
  37. <image style="z-index: 99;" src="../../static/game/reb01.png" mode=""></image> -->
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. verify
  43. } from '@/api/login.js';
  44. import {
  45. mapState
  46. } from 'vuex';
  47. import {
  48. registerReset
  49. } from '@/api/set.js';
  50. export default {
  51. data() {
  52. return {
  53. time: '', //保存倒计时对象
  54. countDown: 0, //倒计时
  55. account: '', //手机号
  56. captcha: '', //验证码
  57. password: '', //新密码
  58. loding: false, //是否载入中
  59. isDjs:false,//是否在倒计时
  60. };
  61. },
  62. computed: {
  63. ...mapState(['userInfo'])
  64. },
  65. onLoad() {
  66. if (this.userInfo.phone == null) {
  67. this.account = '';
  68. } else {
  69. this.account = this.userInfo.phone;
  70. this.show = false;
  71. }
  72. },
  73. watch: {
  74. // 监听倒计时
  75. countDown(i) {
  76. if (i == 0) {
  77. clearInterval(this.time);
  78. }
  79. }
  80. },
  81. methods: {
  82. getDjs(){
  83. this.isDjs = true
  84. this.countDown= 10
  85. let time = setInterval(e=>{
  86. this.countDown--
  87. console.log(this.countDown);
  88. if(this.countDown==0){
  89. clearInterval(time)
  90. console.log('倒计时结束');
  91. console.log(this.countDown,'打印');
  92. }
  93. },1000)
  94. },
  95. //发送验证码
  96. verification() {
  97. let obj = this;
  98. if (this.account == '') {
  99. this.$api.msg('请输入电话号码');
  100. return;
  101. }
  102. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.account)) {
  103. this.$api.msg('请输入正确的手机号');
  104. return;
  105. }
  106. // 判断是否在倒计时
  107. if (obj.countDown > 0) {
  108. return false;
  109. } else {
  110. obj.countDown = 60;
  111. obj.time = setInterval(() => {
  112. obj.countDown--;
  113. }, 1000);
  114. //调用验证码接口
  115. verify({
  116. phone: obj.account,
  117. type: ''
  118. })
  119. .then(({
  120. data
  121. }) => {})
  122. .catch(err => {
  123. console.log(err);
  124. });
  125. }
  126. },
  127. confirm(e) {
  128. this.loding = true;
  129. registerReset({
  130. account: this.account,
  131. captcha: this.captcha,
  132. password: this.password,
  133. })
  134. .then(({
  135. data
  136. }) => {
  137. this.loding = false;
  138. this.$api.msg('修改成功');
  139. })
  140. .catch(err => {
  141. this.loding = false;
  142. console.log(err);
  143. });
  144. },
  145. navTo(url){
  146. uni.navigateTo({
  147. url
  148. })
  149. }
  150. }
  151. };
  152. </script>
  153. <style lang="scss">
  154. page,
  155. .content {
  156. width: 750rpx;
  157. height: 100%;
  158. background: #111111;
  159. .box {
  160. background: #222222;
  161. .box-top {
  162. height: 100rpx;
  163. display: flex;
  164. align-items: center;
  165. .shu {
  166. width: 2rpx;
  167. height: 30rpx;
  168. background: #A581FF;
  169. display: inline-block;
  170. margin: 0 20rpx 0 30rpx;
  171. line-height: 100rpx;
  172. }
  173. .pass-title {
  174. line-height: 100rpx;
  175. display: inline-block;
  176. font-size: 30rpx;
  177. font-weight: 500;
  178. color: #FFFFFF;
  179. }
  180. }
  181. .box-bottom {
  182. .ipt{
  183. border-top:2rpx solid #F3F3F3;
  184. padding: 0 30rpx;
  185. display: flex;
  186. align-items: center;
  187. // justify-content: space-between;
  188. .text{
  189. width: 150rpx;
  190. font-size: 26rpx;
  191. font-weight: 500;
  192. color: #FFFFFF;
  193. line-height: 80rpx;
  194. }
  195. .input{
  196. }
  197. .yzm{
  198. margin-left: 140rpx;
  199. font-size: 26rpx;
  200. font-weight: 500;
  201. color: #A581FF;
  202. line-height: 100rpx;
  203. }
  204. }
  205. }
  206. }
  207. .button {
  208. margin-top: 60rpx;
  209. width: 690rpx;
  210. height: 80rpx;
  211. background: $bgBaseBg;
  212. border-radius: 40rpx;
  213. font-size: 30rpx;
  214. font-weight: bold;
  215. color: #FFFFFF;
  216. line-height: 80rpx;
  217. }
  218. }
  219. </style>