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

<template>
<modal name="VerifyCode" :clickToClose="false">
<div class="tw-text-base-primary">
<div class="modal-header tw-flex tw-w-full tw-justify-between tw-mb-[30px]">
<div class="tw-font-bold tw-text-[20px]">{{ $t("Verify your email") }}</div>
<button class="close tw-transition tw-btn-md" @click="$modal.hide('VerifyCode')"></button>
</div>
<div class="tw-mb-[30px]">
<div class="modal-content tw-text-[18px] tw-text-hint">
我們已寄送認證碼至您的電子信箱<span class="tw-text-primary-1 tw-text-[18px]">{{ account }}</span>
</div>
<div>
請至電子信箱確認後在下方輸入驗證碼來啟動您的帳戶
</div>
</div>
<div class="tw-mb-[40px]">
<div>
<input @keyup.enter="checkVerifyCode" 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]']" />
</div>
<div :class="['md:tw-flex', validation ? 'md:tw-justify-between' : 'md:tw-justify-end']">
<div :class="['tw-text-[14px] tw-text-error-default', validation ? 'tw-block tw-mb-[10px]' : 'tw-hidden']">
認證碼錯誤
</div>
<button @click="ResendMail" class="tw-grid tw-grid-cols-[18px_100px] tw-gap-[10px]">
<img src="~/assets/svg/Icon.svg"/>
<div class="tw-text-[14px] tw-text-complementary-1 tw-w-fit">
重新寄送認證碼
</div>
</button>
</div>
</div>
<div class="tw-grid tw-grid-cols-2 tw-gap-[10px]">
<button @click="cancel" class="tw-rounded-[8px] tw-text-primary-1 tw-text-[18px] tw-px-[12px] tw-py-[12px] md:tw-rounded-[16px]">
取消
</button>
<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']">
確認
</button>
</div>
</div>
</modal>
</template>
<script>
export default {
name: "VerifyCode",
data() {
return {
user_VerifyCode: "",
checkCode: false,
errorCode: false,
validation: false,
};
},
props: {
error: {
type: Boolean,
},
account: {
type: String,
}
},
watch: {
error: {
immediate: true,
handler: function () {
if(this.error){
this.validation = this.error;
}
},
},
user_VerifyCode: {
handler: function () {
if(this.user_VerifyCode == ""){
this.validation = true;
}else if(this.user_VerifyCode.length > "6"){
this.validation = true;
}else{
this.validation = false;
}
}
}
},
methods: {
checkVerifyCode(){
this.checkCode = true;
this.$emit('user-verifyCode', this.user_VerifyCode);
},
ResendMail(){
this.$emit('resend-mail');
},
cancel() {
this.$modal.hide('VerifyCode');
this.user_VerifyCode = "";
this.validation = false;
}
}
};
</script>
<style lang="scss" scoped>
.close {
position: absolute;
right: 25px;
top: 25px;
background-image: url("~/assets/svg/close.svg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 14px;
height: 14px;
@media (min-width: 1366px) {
position: relative;
right: initial;
top: initial;
}
}
:deep() {
.v--modal {
background-color: #fefefe !important;
text-align: left;
border-radius: 16px;
box-shadow: 0 20px 60px -2px rgb(27 33 58 / 40%);
padding: 20px;
max-width: 100%;
top: 0 !important;
left: 0 !important;
right: 0 !important;
margin: 0 auto;
height: auto !important;
vertical-align: middle;
@media (min-width: 768px) {
max-width: 360px;
}
}
.v--modal-overlay {
position: fixed;
box-sizing: border-box;
left: 0;
top: 0;
width: 100%;
height: auto;
background: rgba(0, 0, 0, 0.2);
z-index: 999;
opacity: 1;
}
.v--modal-top-right {
display: block;
position: fixed;
right: 0;
top: 0;
}
.v--modal-background-click {
display: flex;
justify-content: center;
align-items: center;
}
.v--modal-box {
margin-left: 60px;
margin-right: 60px;
@media (min-width: 768px) {
margin-left: 161px;
margin-right: 161px;
max-width: 360px;
}
}
}
</style>