forgetpassword.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view class="register container">
  3. <!-- 返回按钮 -->
  4. <view class="zindex999" @click="back">
  5. <image src="@/static/index/details/arrow_back.png" mode="widthFix"
  6. style="width: 48rpx;margin-left: 20rpx;margin-top: 50rpx;"></image>
  7. </view>
  8. <!-- 返回按钮 -->
  9. <view class="title">
  10. <!-- <view class="">
  11. 登录
  12. </view> -->
  13. <view class="login_view">
  14. <view class="">
  15. 重置密码
  16. </view>
  17. <view class="">
  18. <!-- 开启你的数字藏品之旅 -->
  19. </view>
  20. <!-- <image src="@/static/login/logo.png" mode=""></image> -->
  21. </view>
  22. <view class="text">
  23. <image src="@/static/logo.png" mode="widthFix" style="width: 120rpx;"></image>
  24. </view>
  25. </view>
  26. <view class="login_content">
  27. <view class="input_item">
  28. <view class="">
  29. <input type="number" v-model="tel" placeholder="输入手机号">
  30. </view>
  31. </view>
  32. <view class="input_item">
  33. <view class="">
  34. <input type="text" v-model="codeImgVal" placeholder="输入图形验证">
  35. </view>
  36. <view class="sendcode" @click="getVerify()" style="border: 0;">
  37. <image :src="codeImgData.image" mode="widthFix" style="width: 150rpx;"></image>
  38. </view>
  39. </view>
  40. <view class="input_item">
  41. <view class="">
  42. <input type="number" v-model="code" placeholder="输入验证码">
  43. </view>
  44. <view class="sendcode" @click="sendCode()" v-if="count<=0">
  45. 发送验证码
  46. </view>
  47. <view class="sendcode" v-else>
  48. {{count}}秒后重新发送
  49. </view>
  50. </view>
  51. <view class="input_item">
  52. <!-- <view class="label">
  53. 设置新密码
  54. </view> -->
  55. <view class="">
  56. <input type="password" v-model="pwd" placeholder="设置新密码">
  57. </view>
  58. </view>
  59. <view class="input_item">
  60. <!-- <view class="label">
  61. 确认密码
  62. </view> -->
  63. <view class="">
  64. <input type="password" v-model="repwd" placeholder="确认新密码">
  65. </view>
  66. </view>
  67. </view>
  68. <view class="login_btn bcggreen colorBlack" @click="forget">
  69. 确认
  70. </view>
  71. <view class="gologin">
  72. 想起密码,<text style="color: #0C9D5B;" @click="rdt('/pages/login/login')">去登录</text>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. export default {
  78. components: {
  79. },
  80. data() {
  81. return {
  82. count: 0,
  83. tel: "",
  84. pwd: "",
  85. repwd: "",
  86. code: "",
  87. time: "",
  88. codeImgData: {},
  89. codeImgVal: '',
  90. }
  91. },
  92. onLoad() {
  93. this.getVerify()
  94. },
  95. onHide() {
  96. clearInterval(this.time)
  97. },
  98. methods: {
  99. getVerify() {
  100. this.api.graphVer().then(res => {
  101. this.codeImgData = res.data
  102. })
  103. },
  104. // 滑块验证
  105. // 发送验证码
  106. sendCode() {
  107. if (!this.codeImgVal) {
  108. this.$api.pop("请输入图形验证")
  109. return;
  110. }
  111. this.api.smsCode(this.tel, this.codeImgVal, this.codeImgData.uniqid).then(res => {
  112. console.log(res)
  113. if (res.code == 1) {
  114. if (res.data.time < 115) {
  115. this.$api.pop(res.data.time + 's后重试')
  116. } else {
  117. this.$api.pop(res.info)
  118. this.count = 60
  119. setInterval(() => {
  120. if (this.count <= 0) {
  121. this.count = 0
  122. return
  123. }
  124. --this.count
  125. }, 1000)
  126. }
  127. }
  128. })
  129. },
  130. forget() {
  131. if (!this.tel) {
  132. this.$api.pop("请输入手机号")
  133. return
  134. }
  135. if (!this.code) {
  136. this.$api.pop("请输入验证码")
  137. return
  138. }
  139. if (!this.pwd) {
  140. this.$api.pop("请输入密码")
  141. return
  142. }
  143. if (!this.repwd) {
  144. this.$api.pop("请再次输入密码")
  145. return
  146. }
  147. if (this.pwd != this.repwd) {
  148. this.$api.pop("两次输入密码不一致")
  149. return
  150. }
  151. this.api.forget(this.tel, this.code, this.pwd, this.repwd).then(res => {
  152. if (res.code == 1) {
  153. this.$api.pop("修改成功")
  154. setTimeout(() => {
  155. this.$api.rdt("/pages/login/index")
  156. }, 1500)
  157. }
  158. })
  159. }
  160. }
  161. }
  162. </script>
  163. <style scoped>
  164. .register {
  165. box-sizing: border-box;
  166. /* padding-top: 72rpx; */
  167. }
  168. .title {
  169. width: 600rpx;
  170. font-size: 46rpx;
  171. display: flex;
  172. align-items: center;
  173. justify-content: space-between;
  174. margin: 80rpx auto 0 auto;
  175. }
  176. /deep/ .uni-input-wrapper {
  177. color: #fff;
  178. }
  179. .login_view {
  180. font-size: 68rpx;
  181. }
  182. .login_content {
  183. margin-top: 70rpx;
  184. margin-left: 100rpx;
  185. }
  186. .text {
  187. width: 120rpx;
  188. }
  189. .input_item {
  190. display: flex;
  191. border-bottom: 1px solid #333333;
  192. width: 558rpx;
  193. height: 70rpx;
  194. font-size: 32rpx;
  195. margin-top: 60rpx;
  196. line-height: 70rpx;
  197. color: #999999;
  198. justify-content: space-between;
  199. }
  200. input {
  201. height: 70rpx;
  202. line-height: 70rpx;
  203. }
  204. .sendcode {
  205. font-size: 28rpx;
  206. color: #fff;
  207. border-bottom: 1px solid #fff;
  208. height: 55rpx;
  209. }
  210. .login_btn {
  211. width: 558rpx;
  212. height: 96rpx;
  213. color: #000;
  214. background: linear-gradient(to bottom, #69FF60, #0C9D5B);
  215. font-size: 32rpx;
  216. line-height: 100rpx;
  217. margin: 0 auto;
  218. margin-top: 88rpx;
  219. text-align: center;
  220. border-radius: 138rpx;
  221. }
  222. .gologin {
  223. font-size: 28rpx;
  224. margin: 22rpx auto;
  225. text-align: center;
  226. }
  227. </style>