forgetPass.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="name">手机号码:</view>
  5. <view class="item">
  6. <input type="text" class="input" placeholder="请输入手机号码" v-model="mobile" maxlength="11" />
  7. </view>
  8. <view class="name">验证码:</view>
  9. <view class="item">
  10. <input type="text" class="input" placeholder="请输入验证码" v-model="code" maxlength="6" />
  11. <view class="btn">获取验证码</view>
  12. </view>
  13. <view class="name">设置新密码:</view>
  14. <view class="item">
  15. <input type="text" class="input" placeholder="请输入新登录密码" v-model="password1" maxlength="32" />
  16. </view>
  17. <view class="name">确认新密码:</view>
  18. <view class="item">
  19. <input type="text" class="input" placeholder="请再次输入新登录密码" v-model="password2" maxlength="32" />
  20. </view>
  21. <view class="blankHeight"></view>
  22. </view>
  23. <view class="btn_submit">提交修改</view>
  24. <!-- 提示框 -->
  25. <DialogBox ref="DialogBox"></DialogBox>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. components: {},
  31. data() {
  32. return {
  33. title: '',
  34. sel: 1,
  35. mobile: '',
  36. password1: '',
  37. password2: '',
  38. code: '',
  39. captchaTime: 0,
  40. }
  41. },
  42. onLoad() {
  43. setTimeout(function() {
  44. uni.setNavigationBarColor({
  45. frontColor: '#ffffff',
  46. backgroundColor: '#00000000',
  47. animation: {
  48. duration: 400,
  49. timingFunc: 'easeIn'
  50. }
  51. })
  52. }, 200);
  53. },
  54. onShow() {
  55. // this.loadData();
  56. },
  57. methods: {
  58. onBack() {},
  59. getCodeTime() {
  60. this.captchaTime = 60;
  61. let timer = setInterval(() => {
  62. this.captchaTime--;
  63. // console.log(this.captchaTime)
  64. if (this.captchaTime < 1) {
  65. clearInterval(timer);
  66. this.captchaTime = 0
  67. }
  68. }, 1000)
  69. },
  70. getCode() {
  71. if (this.mobile.length != 11) {
  72. uni.showToast({
  73. title: '请输入新手机号',
  74. icon: 'none'
  75. });
  76. return;
  77. }
  78. if (this.captchaTime > 0) {
  79. uni.showToast({
  80. title: '不能重复获取',
  81. icon: 'none'
  82. });
  83. return;
  84. }
  85. this.captchaTime = 60;
  86. uni.request({
  87. url: this.$apiHost + '/Web/getcode', //仅为示例,并非真实接口地址。
  88. data: {
  89. skey: this.skey,
  90. mobile: this.mobile,
  91. },
  92. header: {
  93. 'content-type': 'application/json' //自定义请求头信息
  94. },
  95. success: (res) => {
  96. console.log("----", res.data)
  97. uni.showToast({
  98. title: res.data.str,
  99. icon: 'none'
  100. })
  101. if (res.data.success == 'yes') {
  102. this.getCodeTime();
  103. } else {
  104. this.captchaTime = 0;
  105. }
  106. }
  107. });
  108. },
  109. submitData() {
  110. if (this.mobile == "") {
  111. uni.showToast({
  112. title: "请输入手机号码",
  113. icon: 'none'
  114. });
  115. return;
  116. }
  117. if (this.password1 == "" || this.password1 != this.password2) {
  118. uni.showToast({
  119. title: "请输入密码并确保两次密码一致",
  120. icon: 'none'
  121. });
  122. return;
  123. }
  124. if (this.code == "") {
  125. uni.showToast({
  126. title: "请输入验证码",
  127. icon: 'none'
  128. });
  129. return;
  130. }
  131. uni.request({
  132. url: this.$apiHost + '/Member/editPass',
  133. data: {
  134. uuid: getApp().globalData.uuid,
  135. mobile1: this.mobile1,
  136. mobile2: this.mobile2,
  137. code: this.code,
  138. },
  139. header: {
  140. 'content-type': 'application/json'
  141. },
  142. success: (res) => {
  143. console.log("----", res.data);
  144. uni.showToast({
  145. title: res.data.str,
  146. icon: 'none'
  147. });
  148. if (res.data.success == "yes") {
  149. }
  150. }
  151. });
  152. },
  153. }
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. @import 'normal.scss';
  158. </style>