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.

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