code.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <script lang='ts' setup>
  2. import type { FormInstance, FormRules } from 'element-plus'
  3. import useLogin from '../../useLoginAndDownload'
  4. const { loginForm, finishCode, errorCodeTxt, seconds, getMailCode, backStep } = useLogin()
  5. const ruleFormRef = ref<FormInstance>()
  6. const rules = ref<FormRules>({
  7. code: [
  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.mail }}</span>, you’ll be signed in.
  20. </div>
  21. <div class="my-10px text-14px text-#9B6CFF underline cursor-pointer fw-bold" @click="getMailCode">
  22. Get a Code
  23. </div>
  24. <el-form ref="ruleFormRef" :rules="rules" :model="loginForm">
  25. <el-form-item label="" prop="code" class="!mb-24px">
  26. <el-input v-model.trim="loginForm.code" :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 class="mb-8px">
  39. Didn't get the code? <span class="text-#9B6CFF cursor-pointer hover:underline" @click="getMailCode">Resend code</span>⁠.
  40. </div>
  41. <div> Didn't get the code? Resend in {{ seconds }} seconds.</div>
  42. </div>
  43. </div>
  44. </template>
  45. <style lang='less' scoped>
  46. ::v-deep(.login-input) {
  47. &.error-txt{
  48. .el-input__wrapper{
  49. border: 1px solid red!important;
  50. }
  51. }
  52. .el-input__wrapper{
  53. border-radius: 10px;
  54. }
  55. }
  56. </style>