| | |
| | | |
| | | beforeRouteEnter (to, from, next) { |
| | | next(vm => { |
| | | console.log(from.path, 'beforeRouteEnter'); |
| | | vm.previousPath = from.path; |
| | | }) |
| | | } |
| | |
| | | this.storageRole(Role.USER); |
| | | this.phoneSuccessConfirmVisable = true; |
| | | this.autoRedirect(); |
| | | this.storageUserInfo(this.setRegisterInfo()); |
| | | this.storagePhoneOrEmail(this.setRegisterInfo()); |
| | | }).catch(error => { |
| | | this.checkHttpErrorStatus(error); |
| | | }); |
| | |
| | | loginService.register(registerInfo).then(res => { |
| | | this.storageIdToken(res.id_token); |
| | | this.storageRole(Role.USER); |
| | | this.storageUserInfo(this.setRegisterInfo()); |
| | | this.storagePhoneOrEmail(registerInfo); |
| | | this.autoRedirect(); |
| | | this.registerSuccessConfirmVisable = true; |
| | | }).catch(() => { |
| | |
| | | private redirect() { |
| | | const backToPrevious = ['questionnaire', 'myConsultantList']; |
| | | const find = backToPrevious.findIndex(item => this.previousPath.includes(item)); |
| | | console.log(this.previousPath, find, 'redirect'); |
| | | find > -1 ? this.$router.go(-1) : this.$router.push('/'); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private storagePhoneOrEmail(registerInfo:RegisterInfo):void{ |
| | | const info = {...registerInfo, time: new Date()} |
| | | // storageUserInfo!: (userInfo: RegisterInfo) => void; |
| | | this.storageUserInfo(info); |
| | | // localStorage.setItem('userInfo',JSON.stringify(info)); |
| | | } |
| | | |
| | | private removeOtpTime() { |
| | | otpService.removeOtpTimeToStorage(OtpStorageName.PHONE); |
| | | otpService.removeOtpTimeToStorage(OtpStorageName.EMAIL); |