You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
4.6 KiB

  1. <template>
  2. <modal name="VerifyCode" :clickToClose="false">
  3. <div class="tw-text-base-primary">
  4. <div class="modal-header tw-flex tw-w-full tw-justify-between tw-mb-[30px]">
  5. <div class="tw-font-bold tw-text-[20px]">{{ $t("Verify your email") }}</div>
  6. <button class="close tw-transition tw-btn-md" @click="$modal.hide('VerifyCode')"></button>
  7. </div>
  8. <div class="tw-mb-[30px]">
  9. <div class="modal-content tw-text-[18px] tw-text-hint">
  10. 我們已寄送認證碼至您的電子信箱<span class="tw-text-primary-1 tw-text-[18px]">{{ account }}</span>
  11. </div>
  12. <div>
  13. 請至電子信箱確認後在下方輸入驗證碼來啟動您的帳戶
  14. </div>
  15. </div>
  16. <div class="tw-mb-[40px]">
  17. <div>
  18. <input type="text" v-model="user_VerifyCode" placeholder="請輸入認證碼" :class="['tw-w-full tw-text-[18px] tw-p-[10px] tw-border tw-border-solid tw-mb-[10px] tw-rounded-[8px] md:tw-max-w-[360px]', validation ? 'tw-border-error-default' : 'tw-border-[ef5a5a]']" />
  19. </div>
  20. <div :class="['md:tw-flex', validation ? 'md:tw-justify-between' : 'md:tw-justify-end']">
  21. <div :class="['tw-text-[14px] tw-text-error-default', validation ? 'tw-block tw-mb-[10px]' : 'tw-hidden']">
  22. 認證碼錯誤
  23. </div>
  24. <button @click="ResendMail" class="tw-grid tw-grid-cols-[18px_100px] tw-gap-[10px]">
  25. <img src="~/assets/svg/Icon.svg"/>
  26. <div class="tw-text-[14px] tw-text-complementary-1 tw-w-fit">
  27. 重新寄送認證碼
  28. </div>
  29. </button>
  30. </div>
  31. </div>
  32. <div class="tw-grid tw-grid-cols-2 tw-gap-[10px]">
  33. <button @click="cancel" class="tw-rounded-[8px] tw-text-primary-1 tw-text-[18px] tw-px-[12px] tw-py-[12px] md:tw-rounded-[16px]">
  34. 取消
  35. </button>
  36. <button @click="checkVerifyCode" :class="['tw-rounded-[8px] tw-text-[18px] tw-px-[12px] tw-py-[12px] md:tw-rounded-[16px]', validation ? 'tw-text-base-disable tw-bg-neutral-100 tw-border-neutral-100' : 'tw-text-white tw-bg-primary-default tw-border-primary-default']">
  37. 確認
  38. </button>
  39. </div>
  40. </div>
  41. </modal>
  42. </template>
  43. <script>
  44. export default {
  45. name: "VerifyCode",
  46. data() {
  47. return {
  48. user_VerifyCode: "",
  49. checkCode: false,
  50. errorCode: false,
  51. validation: false,
  52. };
  53. },
  54. props: {
  55. error: {
  56. type: Boolean,
  57. },
  58. account: {
  59. type: String,
  60. }
  61. },
  62. watch: {
  63. error: {
  64. immediate: true,
  65. handler: function () {
  66. if(this.error){
  67. this.validation = this.error;
  68. }
  69. },
  70. },
  71. user_VerifyCode: {
  72. handler: function () {
  73. if(this.user_VerifyCode == ""){
  74. this.validation = true;
  75. }else if(this.user_VerifyCode.length > "6"){
  76. this.validation = true;
  77. }else{
  78. this.validation = false;
  79. }
  80. }
  81. }
  82. },
  83. methods: {
  84. checkVerifyCode(){
  85. this.checkCode = true;
  86. this.$emit('user-verifyCode', this.user_VerifyCode);
  87. },
  88. ResendMail(){
  89. this.$emit('resend-mail');
  90. },
  91. cancel() {
  92. this.$modal.hide('VerifyCode');
  93. this.user_VerifyCode = "";
  94. this.validation = false;
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .close {
  101. position: absolute;
  102. right: 25px;
  103. top: 25px;
  104. background-image: url("~/assets/svg/close.svg");
  105. background-position: center;
  106. background-repeat: no-repeat;
  107. background-size: cover;
  108. width: 14px;
  109. height: 14px;
  110. @media (min-width: 1366px) {
  111. position: relative;
  112. right: initial;
  113. top: initial;
  114. }
  115. }
  116. :deep() {
  117. .v--modal {
  118. background-color: #fefefe !important;
  119. text-align: left;
  120. border-radius: 16px;
  121. box-shadow: 0 20px 60px -2px rgb(27 33 58 / 40%);
  122. padding: 20px;
  123. max-width: 100%;
  124. top: 0 !important;
  125. left: 0 !important;
  126. right: 0 !important;
  127. margin: 0 auto;
  128. height: auto !important;
  129. vertical-align: middle;
  130. @media (min-width: 768px) {
  131. max-width: 360px;
  132. }
  133. }
  134. .v--modal-overlay {
  135. position: fixed;
  136. box-sizing: border-box;
  137. left: 0;
  138. top: 0;
  139. width: 100%;
  140. height: auto;
  141. background: rgba(0, 0, 0, 0.2);
  142. z-index: 999;
  143. opacity: 1;
  144. }
  145. .v--modal-top-right {
  146. display: block;
  147. position: fixed;
  148. right: 0;
  149. top: 0;
  150. }
  151. .v--modal-background-click {
  152. display: flex;
  153. justify-content: center;
  154. align-items: center;
  155. }
  156. .v--modal-box {
  157. margin-left: 60px;
  158. margin-right: 60px;
  159. @media (min-width: 768px) {
  160. margin-left: 161px;
  161. margin-right: 161px;
  162. max-width: 360px;
  163. }
  164. }
  165. }
  166. </style>