index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div class="register absolute" :style="viewColor">
  3. <div class="whiteBg" :style="{ 'background-image': `url(${domain}/static/images/logo_bgl.png)`}">
  4. <view class="login_title">
  5. <view class="title_h">找回密码</view>
  6. </view>
  7. <div class="list">
  8. <div class="item">
  9. <input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account" autocomplete="off" />
  10. <input type="text" style="height: 0;opacity: 0">
  11. </div>
  12. <div class="item">
  13. <input type="password" placeholder="填写您的新密码" placeholder-class="placeholder" v-model="password" autocomplete="off" />
  14. </div>
  15. <div class="item">
  16. <input type="password" placeholder="再次输入新密码" placeholder-class="placeholder" v-model="confirm_pwd" autocomplete="off" />
  17. </div>
  18. <div class="item">
  19. <input type="text" placeholder="填写验证码" placeholder-class="placeholder" class="codeIput" v-model="captcha" autocomplete="off" />
  20. <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="handleVerify">
  21. {{ text }}
  22. </button>
  23. </div>
  24. </div>
  25. <div class="logon" @click="registerReset">确认</div>
  26. <div class="tip">
  27. <text @click="back">立即登录</text>
  28. </div>
  29. </div>
  30. <div class="bottom"></div>
  31. <Verify @success="success" :captchaType="'blockPuzzle'" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
  32. </div>
  33. </template>
  34. <script>
  35. // +----------------------------------------------------------------------
  36. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  37. // +----------------------------------------------------------------------
  38. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  39. // +----------------------------------------------------------------------
  40. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  41. // +----------------------------------------------------------------------
  42. // | Author: CRMEB Team <admin@crmeb.com>
  43. // +----------------------------------------------------------------------
  44. const app = getApp();
  45. import { mapGetters} from "vuex";
  46. import sendVerifyCode from "@/mixins/SendVerifyCode";
  47. import {
  48. registerVerify,
  49. registerForget,
  50. getCaptcha
  51. } from "@/api/user";
  52. import { configMap } from '@/utils';
  53. import { HTTP_REQUEST_URL } from '@/config/app';
  54. import Verify from '@/components/verify/verify.vue';
  55. export default {
  56. name: "RetrievePassword",
  57. components: {
  58. Verify
  59. },
  60. mixins: [sendVerifyCode],
  61. data: function() {
  62. return {
  63. account: "",
  64. password: "",
  65. confirm_pwd: "",
  66. captcha: "",
  67. codeKey: "",
  68. codeUrl: "",
  69. codeVal: "",
  70. isShowCode: false,
  71. domain: HTTP_REQUEST_URL,
  72. };
  73. },
  74. computed: configMap(['login_logo'], mapGetters(['viewColor'])),
  75. onReady() {
  76. },
  77. mounted: function() {
  78. },
  79. methods: {
  80. back() {
  81. uni.navigateBack();
  82. },
  83. again() {
  84. this.codeUrl = VUE_APP_API_URL + "/captcha?" + this.keyCode + Date.parse(new Date());
  85. },
  86. async code(data) {
  87. let that = this;
  88. if (!that.account) return that.$util.Tips({
  89. title: '请填写手机号码'
  90. });
  91. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  92. title: '请输入正确的手机号码'
  93. });
  94. await registerVerify({
  95. phone: that.account,
  96. type: 'change_pwd',
  97. captchaType: 'blockPuzzle',
  98. captchaVerification: data.captchaVerification
  99. })
  100. .then(res => {
  101. that.$util.Tips({
  102. title: res.message
  103. });
  104. that.sendCode();
  105. }).catch(res => {
  106. that.$util.Tips({
  107. title: res
  108. });
  109. });
  110. },
  111. getcaptcha() {
  112. let that = this
  113. getCaptcha().then(data => {
  114. that.codeUrl = data.data.captcha; //图片路径
  115. that.codeVal = data.data.code; //图片验证码
  116. that.codeKey = data.data.key //图片验证码key
  117. })
  118. that.isShowCode = true;
  119. },
  120. async registerReset() {
  121. var that = this;
  122. if (!that.account) return that.$util.Tips({
  123. title: '请填写手机号码'
  124. });
  125. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  126. title: '请输入正确的手机号码'
  127. });
  128. if (that.password == '123456') return that.$util.Tips({
  129. title: '您输入的密码过于简单'
  130. });
  131. if (that.password != that.confirm_pwd) return that.$util.Tips({
  132. title: '两次密码不一致'
  133. });
  134. if (!that.captcha) return that.$util.Tips({
  135. title: '请填写验证码'
  136. });
  137. registerForget({
  138. phone: that.account,
  139. sms_code: that.captcha,
  140. pwd: that.password,
  141. confirm_pwd: that.confirm_pwd
  142. })
  143. .then(res => {
  144. that.$util.Tips({
  145. title: res.message
  146. }, {
  147. tab: 3
  148. })
  149. })
  150. .catch(res => {
  151. that.$util.Tips({
  152. title: res
  153. })
  154. });
  155. },
  156. success(data) {
  157. this.$refs.verify.hide();
  158. this.code(data);
  159. },
  160. handleVerify() {
  161. this.$refs.verify.show();
  162. }
  163. }
  164. };
  165. </script>
  166. <style lang="scss" scoped>
  167. .register{
  168. background: #ffffff;
  169. height: 100vh;
  170. }
  171. .register .list .item .code {
  172. color: var(--view-theme);
  173. }
  174. .whiteBg .logon {
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. width: 100%;
  179. height: 86rpx;
  180. margin-top: 48rpx;
  181. background-color:var(--view-theme);
  182. border-radius: 120rpx;
  183. color: #FFFFFF;
  184. font-size: 30rpx;
  185. }
  186. .whiteBg{
  187. background-repeat: no-repeat;
  188. background-size: 100% auto;
  189. }
  190. </style>