index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="register absolute">
  3. <view class="shading">
  4. <view class="pictrue acea-row row-center-wrapper">
  5. </view>
  6. </view>
  7. <view class="whiteBg">
  8. <view class="title">找回密码</view>
  9. <view class="list">
  10. <view class="item">
  11. <view class="acea-row row-middle">
  12. <image src="/static/images/phone_1.png"></image>
  13. <input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account" class="input"/>
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="align-left acea-row row-middle">
  18. <image src="/static/images/code_2.png"></image>
  19. <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" placeholder-class="placeholder"/>
  20. <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="handleVerify">
  21. {{ text }}
  22. </button>
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="acea-row row-middle">
  27. <image src="/static/images/code_1.png"></image>
  28. <input type="password" placeholder="填写您的登录密码" v-model="password" placeholder-class="placeholder" class="input"/>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="logon" @click="registerReset">确认</view>
  33. <navigator url="/pages/users/login/index" class="tip">
  34. <text class="font-color">立即登录</text>
  35. </navigator>
  36. </view>
  37. <view class="bottom"></view>
  38. <Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
  39. </view>
  40. </template>
  41. <script>
  42. // +----------------------------------------------------------------------
  43. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  44. // +----------------------------------------------------------------------
  45. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  46. // +----------------------------------------------------------------------
  47. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  48. // +----------------------------------------------------------------------
  49. // | Author: CRMEB Team <admin@crmeb.com>
  50. // +----------------------------------------------------------------------
  51. import sendVerifyCode from "@/mixins/SendVerifyCode";
  52. import { registerVerify, registerReset } from "@/api/user";
  53. import Verify from '@/components/verify/verify.vue';
  54. export default {
  55. components: {
  56. Verify
  57. },
  58. data() {
  59. return {
  60. account: "",
  61. password: "",
  62. captcha: ""
  63. };
  64. },
  65. mixins: [sendVerifyCode],
  66. methods: {
  67. registerReset() {
  68. let that = this;
  69. if (!that.account) return that.$util.Tips({
  70. title: '请填写手机号码'
  71. });
  72. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  73. title: '请输入正确的手机号码'
  74. });
  75. if (!that.captcha) return that.$util.Tips({
  76. title: '请填写验证码'
  77. });
  78. if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
  79. title: '请输入正确的验证码'
  80. });
  81. if (!that.password) return that.$util.Tips({
  82. title: '请填写密码'
  83. });
  84. if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/i.test(that.password)) return that.$util.Tips({
  85. title: '您输入的密码过于简单'
  86. });
  87. registerReset({
  88. account: that.account,
  89. captcha: that.captcha,
  90. password: that.password
  91. })
  92. .then(res => {
  93. that.$util.Tips({
  94. title: res.msg,
  95. success: () => {
  96. uni.navigateTo({
  97. url: '/pages/login/index'
  98. });
  99. }
  100. });
  101. })
  102. .catch(res => {
  103. that.$util.Tips({
  104. title: res.msg
  105. });
  106. });
  107. },
  108. async code(data) {
  109. let that = this;
  110. if (!that.account) return that.$util.Tips({
  111. title: '请填写手机号码'
  112. });
  113. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  114. title: '请输入正确的手机号码'
  115. });
  116. registerVerify({
  117. phone: that.account,
  118. captchaType: 'blockPuzzle',
  119. captchaVerification: data.captchaVerification
  120. })
  121. .then(res => {
  122. that.$util.Tips({
  123. title: res.msg
  124. });
  125. that.sendCode();
  126. })
  127. .catch(res => {
  128. that.$util.Tips({
  129. title: res
  130. });
  131. });
  132. },
  133. success(data) {
  134. this.$refs.verify.hide();
  135. this.code(data);
  136. },
  137. handleVerify() {
  138. this.$refs.verify.show();
  139. }
  140. }
  141. };
  142. </script>
  143. <style>
  144. </style>