From dcece301ae6ce589f91adc28c572926a21565c50 Mon Sep 17 00:00:00 2001 From: Janie <109517022+Janie06@users.noreply.github.com> Date: Wed, 15 Feb 2023 18:21:28 +0800 Subject: [PATCH] =?UTF-8?q?[WHAT]=20=E7=99=BB=E5=85=A5=E3=80=81=E5=BF=98?= =?UTF-8?q?=E8=A8=98=E5=AF=86=E7=A2=BC=E5=A2=9E=E5=8A=A0=E9=98=B2=E5=91=86?= =?UTF-8?q?Modal=20[WHY]=20=E9=96=8B=E7=99=BC=20ShowEasy=20=E5=89=8D?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 判斷會員狀態若為未認證、已註銷、輸入錯誤跳出防呆視窗 --- FrontEnd/pages/user/forgot.vue | 123 +++++++++++++++++++++++++++++---- FrontEnd/pages/user/index.vue | 123 ++++++++++++++++++++++----------- 2 files changed, 192 insertions(+), 54 deletions(-) diff --git a/FrontEnd/pages/user/forgot.vue b/FrontEnd/pages/user/forgot.vue index 72c4795..9f9120b 100644 --- a/FrontEnd/pages/user/forgot.vue +++ b/FrontEnd/pages/user/forgot.vue @@ -13,6 +13,9 @@ ) }}

+
+ {{ $t('The Email entered is incorrect') }} +
+ + + +
+ {{ $t("Verify your email") }} +
+ + mdi-close + +
+ +
+ {{ $t("Oops! Seems like you haven't verified your email,please click the button below to resend a verification email.")}} +
+
+ + +
+
+ + + +
+ {{ $t("Reactivate your account") }} +
+ + mdi-close + +
+ +
+ {{ $t("Welcome back!")}} +
+
+ {{ $t("Looks like your account has been deactivated.")}} +
+ {{ $t("Would you like to reactivate this account?")}} +
+
+ + +
+
@@ -128,7 +190,7 @@ export default { resetValid: false, disableBtn: false, resetSuccess: false, - countdown: 60, + countdown: 0, Email: "", userConfirmPass: "", userData: { @@ -155,6 +217,9 @@ export default { v === this.userData.Password || this.$t("Your password and confirmation password do not match"), }, + dialog: false, + deleteDialog: false, + wrongMessageActive: false, }; }, created(){ @@ -178,25 +243,31 @@ export default { .then((response) => { //console.log(JSON.stringify(response)); if(response.data.STATUSCODE == "404"){ - //console.log("此帳號未認證或已註銷"); this.resendValid = false; + if(response.data.MSG == "0"){ + this.dialog = true; + }else if(response.data.MSG == "2"){ + this.deleteDialog = true; + }else{ + this.wrongMessageActive = true; + + } } if(response && response.data && response.data.DATA && response.data.DATA.rel){ let data = response.data.DATA.rel if(data){ this.result = data; - this.disableBtn = !this.disableBtn; - this.timeout = setInterval(() => { - if (this.countdown > 0) { - this.countdown--; - } - if (this.countdown === 0) { - this.disableBtn = !this.disableBtn; - this.countdown = 60; - clearInterval(this.timeout); - } - }, 1000); + // this.timeout = setInterval(() => { + // if (this.countdown > 0) { + // this.countdown--; + // } + // if (this.countdown === 0) { + // this.disableBtn = !this.disableBtn; + // this.countdown = 60; + // clearInterval(this.timeout); + // } + // }, 1000); } } }) @@ -236,6 +307,32 @@ export default { }); } }, + resendVerifyEmail() { + this.countdown = 60; + this.$axios + .post( + `/trending/api/Signup/ReSendVerifyMail?Email=${this.Email}` + ) + .then((response) => { + //console.log(JSON.stringify(response)) + if(response && response.data){ + + clearInterval(this.timer); + this.timer = setInterval(() => { + if (this.countdown > 0) { + this.countdown--; + } + if (this.countdown === 0) { + clearInterval(this.timer); + } + }, 1000); + } + }) + .catch((error) => { + console.log(error); + }); + + }, }, beforeUnmount() { clearInterval(this.timeout); diff --git a/FrontEnd/pages/user/index.vue b/FrontEnd/pages/user/index.vue index 21466e2..cb8e572 100644 --- a/FrontEnd/pages/user/index.vue +++ b/FrontEnd/pages/user/index.vue @@ -67,47 +67,65 @@ :class="['tw-block tw-w-full tw-py-[10px] tw-rounded-[16px] tw-border tw-border-solid tw-body-3 tw-font-normal tw-transition-all tw-duration-200 tw-ease-in-out',valid?'tw-text-white tw-bg-primary-default tw-border-primary-default':'tw-text-base-disable tw-bg-neutral-100 tw-border-neutral-100']">{{ $t("Login") }} - - - - {{ $t('Verify your email') }} - - mdi-close + + +
+ {{ $t("Verify your email") }} +
+ + mdi-close
- - {{ $t("We've sent a verification email to")}} -
- - {{ userData.Password }} - . {{ $t("Please click the link within to activate your account.") }} + +
+ {{ $t("Oops! Seems like you haven't verified your email,please click the button below to resend a verification email.")}} +
- + +
- - - {{ $t('Verify your email') }} +
+ + + +
+ {{ $t("Reactivate your account") }} +
+ + mdi-close +
- - {{ $t("We've sent a verification email to") - }} -
- - {{ userData.Password }} - . {{ $t("Please click the link within to activate your account.") }} + +
+ {{ $t("Welcome back!")}} +
+
+ {{ $t("Looks like your account has been deactivated.")}} +
+ {{ $t("Would you like to reactivate this account?")}} +
- + {{ $t("Reactivate my account") }} + +
-
+ @@ -126,7 +144,7 @@ verifyEmailSent: false, valid: false, remember: false, - countdown: 60, + countdown: 0, userData: { Account: '', Password: '', @@ -137,6 +155,8 @@ // checkPassword: v => (/(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])/.test(v) && v.length >= 8 && v.length <= 20) || '請輸入密碼', checkPassword: v => v.length >= 1 || '請輸入密碼', }, + deleteDialog: false, + dialog: false, } }, watch: { @@ -186,6 +206,14 @@ } }else if(response.data.STATUSCODE==500){ that.$auth.redirect('login'); + }else if(response.data.STATUSCODE==401){ + if(response.data.MSG == "0"){ + this.dialog = true; + }else if(response.data.MSG == "2"){ + this.deleteDialog = true; + }else if(response.data.MSG == "帳號或密碼不正確"){ + this.wrongMessageActive = true; + } }else{ // that.resendDialog = !that.resendDialog; that.wrongMessageActive = true; @@ -198,18 +226,31 @@ } }, resendVerifyEmail() { - this.countdown = 60 - // this.$axios.get(`/member/users/resend/${this.userData.email}?lang=${this.$i18n.locale}`) - // .then((res) => { - // clearInterval(this.timer) - // this.verifyEmailSent = true - // this.timer = setInterval(() => { - // if (this.countdown > 0) { this.countdown-- } - // if (this.countdown === 0) { clearInterval(this.timer) } - // }, 1000) - // }) - // .catch((err) => { console.log(err); }) - }, + this.countdown = 60; + this.$axios + .post( + `/trending/api/Signup/ReSendVerifyMail?Email=${this.userData.Account}` + ) + .then((response) => { + //console.log(JSON.stringify(response)) + if(response && response.data){ + + clearInterval(this.timer); + this.timer = setInterval(() => { + if (this.countdown > 0) { + this.countdown--; + } + if (this.countdown === 0) { + clearInterval(this.timer); + } + }, 1000); + } + }) + .catch((error) => { + console.log(error); + }); + + }, updateValid(){ if(this.userData.Account !=='' && this.userData.Password !==''){ this.valid = true;