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.

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