forgetPass.vue 3.5 KB

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