forgetPassword.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="forgetPassword-page">
  3. <zx-input
  4. v-model="email"
  5. :placeholder="$t('请输入要重置的邮箱账号')"
  6. />
  7. <view :class="['zx-form-btn', email && 'is-submit']" style="margin-top: 48rpx;" @tap="resetHandle">
  8. {{ $t('重置密码') }}
  9. </view>
  10. <NoticeDialog
  11. :title="$t('重置密码邮件已发送')"
  12. :btnText="$t('我知道了')"
  13. :text="noticeText"
  14. v-model="isSendSucceed"
  15. />
  16. </view>
  17. </template>
  18. <script>
  19. import { emailRegex } from '@/common/constant'
  20. import NoticeDialog from '@/component/comPopup/Notice.vue'
  21. import ZxInput from './components/ZxInput.vue'
  22. const http = require('@/common/http.js');
  23. const config = require('@/common/config.js');
  24. const common = require('@/common/common.js');
  25. export default {
  26. components: {
  27. ZxInput,
  28. NoticeDialog
  29. },
  30. data() {
  31. return {
  32. isSendSucceed: false,
  33. email: ''
  34. }
  35. },
  36. computed: {
  37. noticeText({ email }) {
  38. return `我们向 <span style="color: #0A59F7;">${email}</span> 发送了一封密码重置邮件,请您登录邮箱操作处理。`
  39. }
  40. },
  41. methods: {
  42. resetHandle() {
  43. if (!emailRegex.test(this.email)) {
  44. uni.showToast({ title: this.$t('请输入有效的邮箱地址'), icon: 'none' })
  45. return
  46. }
  47. http.postApi(config.API_RESET_PASSWORD, { email: this.email }, res => {
  48. if (res.succeed) {
  49. this.isSendSucceed = true
  50. } else {
  51. }
  52. uni.showToast({ title: res.data.msg, icon: 'none' })
  53. })
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. @import "@/libs/css/layout.scss";
  60. .forgetPassword-page {
  61. width: 100%;
  62. background: #F1F3F4;
  63. min-height: 100vh;
  64. padding: 32rpx;
  65. }
  66. </style>