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.

364 lines
14 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div :class="['tw-h-full tw-p-[30px] tw-bg-white md:tw-bg-primary-pale']">
  3. <div
  4. class="xl:tw-grid xl:tw-grid-cols-[auto_414px] xl:tw-gap-[96px] xl:tw-max-w-[1246px] xl:tw-mx-auto xl:tw-px-[60px]">
  5. <div class="tw-hidden xl:tw-block xl:tw-mt-[30px]">
  6. <p class="welcome tw-text-primary-light">{{ $t("Welcome to ShowEasy") }}</p>
  7. <p class="sub tw-text-neutral-400">
  8. {{
  9. $t(
  10. "Your best guide from trip to show and from show to the world."
  11. )
  12. }}
  13. </p>
  14. <img class="mt-11 ml-15" :src="require('@/assets/img/UserLoginMain.png')" />
  15. </div>
  16. <div class="md:tw-w-[414px] md:tw-mx-auto">
  17. <div class="tw-bg-white md:tw-rounded-[24px] md:tw-mt-[30px] md:tw-pt-[60px] md:tw-pb-[150px] md:tw-px-[30px]">
  18. <v-spacer v-if="emailSignUp">
  19. <h1 class="tw-text-[40px] tw-font-bold tw-mb-[20px] md:tw-text-[24px] md:tw-mb-[14px]">{{ $t("Sign Up") }}</h1>
  20. <p class="tw-body-3 tw-text-neutral-400 tw-mb-[16px] md:tw-mb-[12px]">
  21. {{ $t("Welcome to ShowEasy!") }}
  22. </p>
  23. <p class="tw-body-3 tw-mb-[45px] md:tw-mb-[32px]">
  24. {{ $t("Already have an account?") }}
  25. <nuxt-link :to="localePath('/user')" class="primary--text text-decoration-none">{{ $t("Login") }}</nuxt-link>
  26. </p>
  27. <div class="tw-grid tw-grid-cols-1 tw-gap-[10px] md:tw-gap-[12px]">
  28. <!-- <button @click="googleLogin"
  29. class="tw-flex tw-justify-center tw-items-center tw-w-full tw-py-[8px] tw-rounded-[16px] tw-border tw-border-solid tw-text-black tw-border-neutrals-200"><img
  30. width="24px" height="24px" src="~/assets/img/g-normal.png" class="mr-5" />{{ $t("Sign up with Google")
  31. }}</button>
  32. <button @click="facebookLogin"
  33. class="tw-flex tw-justify-center tw-items-center tw-w-full tw-py-[8px] tw-rounded-[16px] tw-border tw-border-solid tw-text-black tw-border-neutrals-200"><img
  34. width="20px" height="20px" src="~/assets/img/f_logo_RGB-Blue_72.png" class="mr-5" />
  35. {{ $t("Sign up with Facebook") }}
  36. </button> -->
  37. <button @click="emailSignUp = !emailSignUp"
  38. class="tw-flex tw-justify-center tw-items-center tw-w-full tw-py-[8px] tw-rounded-[16px] tw-border tw-border-solid tw-text-black tw-border-neutrals-200">
  39. <unicon name="envelope" width="20px" height="20px"
  40. class="tw-flex tw-justify-center tw-items-center tw-mr-[20px]">
  41. </unicon>{{ $t("Sign up with Email") }}
  42. </button>
  43. </div>
  44. </v-spacer>
  45. <v-spacer v-if="!emailSignUp">
  46. <p class="title">{{ $t("Sign up with Email") }}</p>
  47. <p class="neutrals--text text--darken-3 text-size-14">
  48. {{ $t("Welcome to ShowEasy!") }}
  49. </p>
  50. <v-form v-model="valid">
  51. <v-text-field v-model="userData.FirstName" background-color="neutrals darken-1"
  52. :label="this.$t('First Name') + '*'" placeholder="" filled rounded dense single-line :rules="[rules.require]">
  53. </v-text-field>
  54. <v-text-field v-model="userData.LastName" background-color="neutrals darken-1"
  55. :label="this.$t('Last Name') + '*'" placeholder="" filled rounded dense single-line :rules="[rules.require]">
  56. </v-text-field>
  57. <v-text-field v-model="userData.Email" background-color="neutrals darken-1" :label="this.$t('Email') + '*'"
  58. filled rounded dense single-line :rules="[rules.email, rules.require]" validate-on-blur></v-text-field>
  59. <v-text-field v-model="userData.Password" background-color="neutrals darken-1"
  60. :label="this.$t('Password') + '*'" :type="showPass ? 'text' : 'password'" placeholder="" filled rounded dense
  61. single-line :rules="[rules.checkPassword, rules.require]" :hint="
  62. this.$t(
  63. 'userProfile.passwordsHint'
  64. )
  65. " persistent-hint :append-icon="showPass ? 'mdi-eye' : 'mdi-eye-off'" @click:append="showPass = !showPass"
  66. validate-on-blur></v-text-field>
  67. <v-text-field v-model="confirmPasswordText" background-color="neutrals darken-1"
  68. :label="this.$t('Confirm Password') + '*'" :type="showConfirmPass ? 'text' : 'password'" placeholder="" filled
  69. rounded dense single-line :rules="[rules.checkConfirmPassword, rules.require]"
  70. :append-icon="showConfirmPass ? 'mdi-eye' : 'mdi-eye-off'" @click:append="showConfirmPass = !showConfirmPass"
  71. validate-on-blur></v-text-field>
  72. </v-form>
  73. <v-checkbox v-model="userData.Subscribe" class="mt-n2 ml-1"><template v-slot:label><span
  74. class="neutrals--text text--darken-4 text-size-14">{{
  75. $t("Subscribe to ShowEasy\’s newsletter")
  76. }}</span></template></v-checkbox>
  77. <div class="md:tw-flex md:tw-justify-center md:tw-items-center"> <button @click="userRegister"
  78. :disabled="!validFormat"
  79. :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']">
  80. {{ $t("Sign Up") }}
  81. </button></div>
  82. <v-dialog v-model="dialog" :width="$vuetify.breakpoint.smAndUp ? 423 : 294"
  83. @click:outside="$router.push(localePath('/user'))">
  84. <v-card class="pa-7" :height="$vuetify.breakpoint.smAndUp ? 249 : 290">
  85. <v-spacer class="d-flex align-center text-size-20 neutrals--text text--darken-5">
  86. {{ $t("Verify your email") }}
  87. <v-spacer></v-spacer>
  88. <v-btn @click="$router.push(localePath('/user'))" icon>
  89. <v-icon> mdi-close </v-icon>
  90. </v-btn>
  91. </v-spacer>
  92. <v-spacer class="text-size-16 my-7 neutrals--text text--darken-4">{{ $t("We've sent a verification email to")
  93. }}<br />
  94. <span class="primary--text">{{ userData.Email }}</span>{{
  95. $t(". Please click the link within to activate your account.")
  96. }}
  97. </v-spacer>
  98. <v-btn @click="resendVerifyEmail" class="primary no-text-transform" width="153px" rounded
  99. :disabled="countdown > 0">
  100. {{ $t("Resend") }}
  101. <span v-if="countdown > 0">
  102. {{ `(${this.countdown})` }}
  103. </span>
  104. </v-btn>
  105. </v-card>
  106. </v-dialog>
  107. <v-dialog v-model="errorDialog" :width="$vuetify.breakpoint.smAndUp ? 423 : 294">
  108. <v-card class="pa-7 border-radius-16" :max-height="$vuetify.breakpoint.smAndUp ? 249 : 290">
  109. <v-spacer class="d-flex align-center text-size-20 neutrals--text text--darken-5">
  110. {{ $t("Error") }}
  111. <v-spacer></v-spacer>
  112. <v-btn @click="errorDialog = !errorDialog" icon>
  113. <v-icon> mdi-close </v-icon>
  114. </v-btn>
  115. </v-spacer>
  116. <v-spacer class="text-size-16 my-7 neutrals--text text--darken-4">
  117. {{ $t("Same email has been created already.") }}
  118. </v-spacer>
  119. <v-spacer class="d-flex justify-center">
  120. <v-btn class="border-radius-16" color="primary" @click="errorDialog = !errorDialog">{{ $t("ok") }}</v-btn>
  121. </v-spacer>
  122. </v-card>
  123. </v-dialog>
  124. <p align="center" class="neutrals--text text--darken-3 text-size-14 mt-7">
  125. {{ $t("By signing up,") }}<br />
  126. {{ $t("you agree to the") }}
  127. <nuxt-link :to="localePath('/termsandconditions')" target="_blank" class="text-decoration-none">
  128. {{ $t("Terms & Conditions") }}</nuxt-link>
  129. {{ $t("and") }}
  130. <nuxt-link :to="localePath('/privacypolicy')" target="_blank" class="text-decoration-none">
  131. {{ $t("Privacy Policy") }}</nuxt-link>
  132. </p>
  133. <p align="center" class="neutrals--text text--darken-5 text-size-14">
  134. {{ $t("Already have an account?") }}
  135. <nuxt-link :to="localePath('/user')" class="primary--text text-decoration-none">{{ $t("Login") }}</nuxt-link>
  136. </p>
  137. </v-spacer>
  138. <loading :isLoading="isPageLoading"></loading>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </template>
  144. <script>
  145. import loading from "@/components/newComponent/loading/loading.vue";
  146. export default {
  147. name: "SignUp",
  148. layout: "login",
  149. auth: false,
  150. components: {
  151. loading,
  152. },
  153. data() {
  154. return {
  155. valid: false,
  156. showPass: false,
  157. showConfirmPass: false,
  158. emailSignUp: true,
  159. Subscribe: true,
  160. dialog: false,
  161. errorDialog: false,
  162. btnText: "Sign up",
  163. confirmPasswordText: "",
  164. countdown: 60,
  165. isPageLoading: false,
  166. rules: {
  167. require: (value) => !!value || this.$t("Required."),
  168. email: (v) =>
  169. /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/.test(
  170. v
  171. ) || this.$t("Invalid email"),
  172. checkPassword: (v) =>
  173. (/(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])/.test(v) &&
  174. v.length >= 8 &&
  175. v.length <= 20) ||
  176. this.$t(
  177. "Passwords must be 8-20 characters with at least 1 number, 1 lower case letter and 1 upper case letter"
  178. ),
  179. checkConfirmPassword: (v) =>
  180. this.confirmPasswordText === this.userData.Password ||
  181. this.$t("Your password and confirmation password do not match"),
  182. },
  183. userData: {
  184. FirstName: "",
  185. LastName: "",
  186. Account: "",
  187. Password: "",
  188. Email: "",
  189. Subscribe: true,
  190. },
  191. signUp: false,
  192. };
  193. },
  194. watch: {
  195. signUp: {
  196. handler: function () {
  197. if (this.signUp == true) {
  198. this.$auth.$storage.removeUniversal("userPassword");
  199. this.$auth.$storage.removeUniversal("userAccount");
  200. }
  201. },
  202. },
  203. },
  204. methods: {
  205. userRegister() {
  206. const postUserData = { ...this.userData };
  207. this.isPageLoading = true;
  208. this.$axios
  209. .post(
  210. `/trending/api/Signup/SignupWithEmail`, postUserData
  211. )
  212. .then((response) => {
  213. //console.log(JSON.stringify(response));
  214. if(response.data.STATUSCODE == "400"){
  215. this.errorDialog = true;
  216. this.isPageLoading = false;
  217. }
  218. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  219. let data = response.data.DATA.rel
  220. if(data){
  221. this.signUp = true;
  222. this.timer = setInterval(() => {
  223. if (this.countdown > 0) {
  224. this.countdown--;
  225. }
  226. if (this.countdown === 0) {
  227. clearInterval(this.timer);
  228. }
  229. }, 1000);
  230. this.isPageLoading = false;
  231. this.dialog = !this.dialog;
  232. }
  233. }
  234. })
  235. .catch((err) => {
  236. console.log(err);
  237. });
  238. },
  239. resendVerifyEmail() {
  240. this.countdown = 60;
  241. this.$axios
  242. .post(
  243. `/trending/api/Signup/ReSendVerifyMail?Email=${this.userData.Email}`
  244. )
  245. .then((res) => {
  246. //console.log(JSON.stringify(res));
  247. clearInterval(this.timer);
  248. this.timer = setInterval(() => {
  249. if (this.countdown > 0) {
  250. this.countdown--;
  251. }
  252. if (this.countdown === 0) {
  253. clearInterval(this.timer);
  254. }
  255. }, 1000);
  256. })
  257. .catch((err) => {
  258. console.log(err);
  259. });
  260. },
  261. async facebookLogin() {
  262. try {
  263. await this.$auth.loginWith("facebook");
  264. } catch (err) {
  265. console.log(err);
  266. }
  267. },
  268. async googleLogin() {
  269. try {
  270. await this.$auth.loginWith("google");
  271. } catch (err) {
  272. console.log(err);
  273. }
  274. },
  275. },
  276. computed: {
  277. validFormat() {
  278. if (this.valid && this.userData.Password === this.confirmPasswordText) {
  279. return true;
  280. } else {
  281. return false;
  282. }
  283. },
  284. },
  285. beforeUnmount() {
  286. clearInterval(this.timer);
  287. },
  288. };
  289. </script>
  290. <style lang="scss" scoped>
  291. #app {
  292. overflow-y: hidden;
  293. }
  294. .welcome {
  295. color: #f5cda8;
  296. font-family: Damion;
  297. font-size: 48px;
  298. margin-bottom: 0px;
  299. font-weight: 400;
  300. line-height: 66px;
  301. letter-spacing: 0.02em;
  302. }
  303. .sub {
  304. color: #9c9c9c;
  305. font-style: italic;
  306. font-weight: 400;
  307. font-size: 22px;
  308. line-height: 29px;
  309. letter-spacing: 0.02em;
  310. }
  311. :deep(.v-text-field.v-text-field--enclosed .v-text-field__details) {
  312. padding: 0;
  313. margin: 0;
  314. }
  315. :deep(.v-messages__message) {
  316. font-size: 14px;
  317. }
  318. $border-style: 1px solid #e5e5e5;
  319. .title {
  320. font-weight: 700;
  321. font-size: 26px;
  322. line-height: 34px;
  323. letter-spacing: 0.02em;
  324. color: #232323;
  325. }
  326. :deep(.v-text-field.v-text-field--enclosed .v-text-field__details) {
  327. margin-bottom: 0;
  328. padding: 0;
  329. .v-messages {
  330. color: #9c9c9c;
  331. display: none;
  332. }
  333. .v-messages.error--text {
  334. display: block;
  335. margin-top: 4px;
  336. margin-bottom: 16px;
  337. }
  338. }
  339. .btn-border {
  340. border: $border-style;
  341. }
  342. </style>