forgot.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="container">
  3. <div class="title">
  4. Forget the password
  5. <div></div>
  6. <span @click="handleSure()" class="iconfont icon-shanchu1"></span>
  7. </div>
  8. <template v-if="!emailSent">
  9. <n-form ref="formRef" label-placement="left" label-align="left" :model="form" :rules="rules" size="large" require-mark-placement="left">
  10. <n-form-item :label="'Email address:'" path="email">
  11. <n-input v-model:value="form.email" placeholder="Please enter your email address" />
  12. </n-form-item>
  13. </n-form>
  14. <n-button class="login-btn" attr-type="button" type="info" color="#18A058" :disabled="submitLoading" @click="handleSend">
  15. {{ submitLoading ? t('common.login.sending') : t('common.login.clickToSend') }}
  16. </n-button>
  17. </template>
  18. <template v-else>
  19. <p style="text-align: center">
  20. <n-icon size="30" color="#00C849" :component="MdCheckmarkCircle" />
  21. </p>
  22. <p class="tip">
  23. {{t('common.login.emailSendSuccess')}}
  24. </p>
  25. <n-button class="login-btn" attr-type="button" type="info" color="#18A058" @click="handleSure">
  26. Confirm
  27. </n-button>
  28. </template>
  29. </div>
  30. </template>
  31. <script lang="ts" setup>
  32. import { useI18n } from "#imports";
  33. import { createDiscreteApi } from "naive-ui";
  34. import { MdCheckmarkCircle } from "@vicons/ionicons4";
  35. import { ref, reactive } from "vue";
  36. const { t, locale, setLocale } = useI18n();
  37. const emit = defineEmits(["closeSginDialog"]);
  38. const message = createDiscreteApi(["message"]);
  39. const formRef = ref();
  40. const submitLoading = ref(false);
  41. const form = reactive<object>({
  42. email: "",
  43. });
  44. const rules: FormRules = {
  45. email: [
  46. {
  47. required: true,
  48. message: "Please enter your email address.",
  49. trigger: ["input", "blur"],
  50. },
  51. {
  52. required: true,
  53. validator: (rule: FormItemRule, value: string): boolean => {
  54. return value && isEmail(value);
  55. },
  56. message: "Please enter a properly formatted email address",
  57. trigger: ["blur"],
  58. },
  59. ],
  60. };
  61. const emailSent = ref<boolean>(false);
  62. const handleSend = () => {
  63. formRef.value?.validate(async (errors: any) => {
  64. if (!errors) {
  65. submitLoading.value = true;
  66. const { code } = await email_Api(form);
  67. if (code === 200) {
  68. message.message.success("send successfully");
  69. emailSent.value = true;
  70. }
  71. submitLoading.value = false;
  72. }
  73. });
  74. };
  75. const handleSure = () => {
  76. emit("closeSginDialog", "success");
  77. };
  78. </script>
  79. <style lang="scss" scoped>
  80. @import "~/assets/css/tool.scss";
  81. .container {
  82. padding: 30px 58px 80px;
  83. background: #ffffff;
  84. border-radius: 20px;
  85. position: relative;
  86. .title {
  87. font-size: 38px;
  88. font-family: Arial, Arial-Bold;
  89. font-weight: 700;
  90. text-align: center;
  91. color: #1a1a1a;
  92. > div {
  93. width: 71px;
  94. height: 6px;
  95. background: linear-gradient(90deg, #719d59 2%, #479f82 98%);
  96. border-radius: 3px;
  97. margin: auto;
  98. }
  99. > span {
  100. position: absolute;
  101. right: 20px;
  102. top: 15px;
  103. cursor: pointer;
  104. }
  105. }
  106. .login-btn {
  107. width: 100%;
  108. height: 58px;
  109. background: linear-gradient(90deg, #60ab91, #84a86c);
  110. border-radius: 8px;
  111. font-size: 18px;
  112. margin-top: 10px;
  113. :deep(.n-button__content) {
  114. display: block;
  115. }
  116. }
  117. .tip {
  118. font-size: 16px;
  119. line-height: 32px;
  120. }
  121. }
  122. .n-form {
  123. margin-top: 30px;
  124. }
  125. :deep(.n-form-item-blank) {
  126. border-bottom: 1px solid #e6e6e6;
  127. }
  128. :deep(.n-form-item-label) {
  129. color: #666666;
  130. font-size: var(--size-14);
  131. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  132. line-height: var(--size-20);
  133. padding: 10px 10px 10px 0;
  134. border-bottom: 1px solid #e6e6e6;
  135. }
  136. :deep(.n-form-item-label__text) {
  137. height: 30px;
  138. }
  139. :deep(.n-input-wrapper) {
  140. font-size: var(--size-14);
  141. font-family: Microsoft YaHei, Microsoft YaHei-Regular;
  142. line-height: var(--size-20);
  143. padding: 0px 0 10px;
  144. }
  145. :deep(.n-form-item-blank--error .n-input) {
  146. --n-border-error: var(--size-1) solid transparent !important;
  147. --n-border-focus-error: var(--size-1) solid transparent !important;
  148. --n-border-hover-error: var(--size-1) solid transparent !important;
  149. --n-box-shadow-focus-error: var(--size-1) solid transparent !important;
  150. }
  151. :deep(input::-ms-reveal) {
  152. display: none;
  153. }
  154. @include responseTo("phone") {
  155. .container {
  156. padding: 10px 20px 30px;
  157. .title {
  158. font-size: 20px;
  159. > div {
  160. width: 30px;
  161. height: 4px;
  162. border-radius: 3px;
  163. }
  164. }
  165. .n-form {
  166. margin-top: 15px;
  167. .icon {
  168. height: 26px;
  169. padding-right: 10px;
  170. margin-right: 10px;
  171. border-right: 1px solid #cccccc;
  172. }
  173. .icon1 {
  174. height: 26px;
  175. padding-right: 14px;
  176. margin-right: 10px;
  177. border-right: 1px solid #cccccc;
  178. }
  179. .icon2 {
  180. height: 26px;
  181. padding-right: 13px;
  182. margin-right: 10px;
  183. border-right: 1px solid #cccccc;
  184. }
  185. }
  186. .login-btn {
  187. height: 45px;
  188. margin-top: 0;
  189. }
  190. }
  191. }
  192. </style>