code.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <script lang='ts' setup>
  2. import type { FormInstance, FormRules } from 'element-plus'
  3. import useLogin from '../../useLogin'
  4. const { loginForm, finishCode, errorCodeTxt, seconds, showCode, getMailCode, backStep } = useLogin()
  5. const ruleFormRef = ref<FormInstance>()
  6. const rules = ref<FormRules>({
  7. captcha: [
  8. { required: true, message: 'Please enter a valid email.', trigger: 'blur' },
  9. ],
  10. })
  11. </script>
  12. <template>
  13. <div>
  14. <div class="custom-title-font text-24px fw-800 text-#333 mb-10px flex items-center">
  15. <img src="@/assets/images/login_back_arrow.png" alt="" class="w-16px h-16px mr-4px cursor-pointer" @click="backStep">
  16. Finish Signing In
  17. </div>
  18. <div class="text-14px text-#1A1A1A lh-22px mb-20px">
  19. Once you enter the code we sent to <span class="text-#1A1A1A fw-700">{{ loginForm.email }}</span>, you’ll be signed in.
  20. </div>
  21. <div v-if="showCode" class="my-10px text-14px text-#9B6CFF underline cursor-pointer fw-bold" :class="seconds && '!text-#999'" @click="getMailCode">
  22. Get a Code
  23. </div>
  24. <el-form ref="ruleFormRef" :rules="rules" :model="loginForm" @submit.prevent>
  25. <el-form-item label="" prop="captcha" class="!mb-24px">
  26. <el-input v-model.trim="loginForm.captcha" type="number" :maxlength="6" :class="!!errorCodeTxt && 'error-txt'" class="!h-46px login-input !text-14px" placeholder="Enter email" />
  27. <div v-if="errorCodeTxt" class="text-red mt-10px">
  28. {{ errorCodeTxt }}
  29. </div>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button class="!w-full !h-50px !text-16px !fw-500 !b-rd-10px !bg-#9B6CFF !text-#fff" @click="finishCode(ruleFormRef)">
  33. Continue
  34. </el-button>
  35. </el-form-item>
  36. </el-form>
  37. <div class="mt-20px text-14px text-#767676">
  38. <div v-if="!seconds && !showCode" class="mb-8px">
  39. Didn't get the code? <span class="text-#9B6CFF cursor-pointer underline " :class="seconds && '!text-#999'" @click="getMailCode">Resend code</span>⁠.
  40. </div>
  41. <div v-if="seconds && !showCode">
  42. Didn't get the code? Resend in {{ seconds }} seconds.
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <style lang='less' scoped>
  48. ::v-deep(.login-input) {
  49. &.error-txt{
  50. .el-input__wrapper{
  51. border: 1px solid red!important;
  52. }
  53. }
  54. .el-input__wrapper{
  55. border-radius: 10px;
  56. }
  57. }
  58. </style>