index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <template>
  2. <div>
  3. <section
  4. id="quem-somos"
  5. class="relative min-h-screen flex flex-col bg-cover lg:bg-left"
  6. :style="{ backgroundImage: `url(${heroBg})` }"
  7. >
  8. <div class="absolute inset-0 bg-violet-normal/45"/>
  9. <div class="relative z-10 flex-1 flex items-center">
  10. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 w-full pt-8 pb-20 lg:py-18">
  11. <div class="flex flex-col lg:flex-row gap-4 lg:gap-12">
  12. <div class="max-w-2xl">
  13. <h1
  14. class="reveal text-h2 text-white font-black mb-10"
  15. style="font-size: clamp(2rem, 5vw, 3.75rem); font-weight: 900;"
  16. >
  17. Serprati é fazer parte de algo maior
  18. </h1>
  19. <p class="reveal reveal-delay-1 text-white/90 mb-6 leading-relaxed" style="font-size: clamp(1rem, 1.5vw, 1.125rem); font-weight: 600;">
  20. Benefícios exclusivos, parceiros de qualidade e uma comunidade
  21. que cuida de você e sua família.
  22. </p>
  23. <div class="reveal reveal-delay-2 flex flex-col sm:flex-row gap-4">
  24. <button
  25. class="btn-primary"
  26. @click="scrollTo('associe-se')"
  27. >
  28. ASSOCIE-SE AGORA
  29. </button>
  30. <button
  31. class="btn-outline"
  32. @click="scrollTo('beneficios')"
  33. >
  34. CONHEÇA OS BENEFÍCIOS
  35. </button>
  36. </div>
  37. </div>
  38. <div class="reveal reveal-delay-3 flex flex-row lg:flex-col gap-6 lg:gap-8 shrink-0">
  39. <div class="flex flex-col items-start gap-1">
  40. <span class="material-icons text-white/90 text-3xl lg:text-4xl">group</span>
  41. <span class="text-white font-bold" style="font-size: clamp(1.25rem, 2.5vw, 1.75rem);">1.000+</span>
  42. <span class="text-white/80 text-sm">Associados</span>
  43. </div>
  44. <div class="flex flex-col items-start gap-1">
  45. <span class="material-icons text-white/90 text-3xl lg:text-4xl">handshake</span>
  46. <span class="text-white font-bold" style="font-size: clamp(1.25rem, 2.5vw, 1.75rem);">50+</span>
  47. <span class="text-white/80 text-sm">Parceiros</span>
  48. </div>
  49. <div class="flex flex-col items-start gap-1">
  50. <span class="material-icons text-white/90 text-3xl lg:text-4xl">favorite_border</span>
  51. <span class="text-white font-bold" style="font-size: clamp(1.25rem, 2.5vw, 1.75rem);">30+</span>
  52. <span class="text-white/80 text-sm">Anos de História</span>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </section>
  59. <section id="beneficios" class="bg-neutral-light py-16 lg:py-24">
  60. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
  61. <div class="reveal text-center mb-12 lg:mb-16">
  62. <h2 class="text-h4 text-text" style="font-size: clamp(1.5rem, 3vw, 2.125rem);">
  63. Benefícios para você
  64. </h2>
  65. </div>
  66. <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
  67. <div
  68. v-for="(benefit, index) in benefits"
  69. :key="benefit.title"
  70. :class="`reveal reveal-delay-${index + 1}`"
  71. class="benefit-card"
  72. >
  73. <div class="benefit-icon-wrap">
  74. <span class="material-icons text-violet-normal text-2xl">{{ benefit.icon }}</span>
  75. </div>
  76. <h3 class="text-subtitle-1 font-semibold text-text mt-4 mb-2">
  77. {{ benefit.title }}
  78. </h3>
  79. <p class="text-body-2 text-text-2 leading-relaxed">
  80. {{ benefit.description }}
  81. </p>
  82. </div>
  83. </div>
  84. </div>
  85. </section>
  86. <section id="associe-se" class="bg-violet-light py-16 lg:py-24">
  87. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
  88. <div class="reveal text-center mb-10 lg:mb-12">
  89. <h2 class="text-h4 text-text" style="font-size: clamp(1.5rem, 3vw, 2.125rem);">
  90. Associe-se
  91. </h2>
  92. </div>
  93. <div class="reveal reveal-delay-1 max-w-3xl mx-auto">
  94. <div class="mb-0">
  95. <button class="tab-active">
  96. NOVA ASSOCIAÇÃO
  97. </button>
  98. </div>
  99. <div class="bg-white rounded-b-2xl rounded-tr-2xl shadow-md p-6 lg:p-10">
  100. <form novalidate @submit.prevent="handleSubmit" >
  101. <div class="grid grid-cols-1 sm:grid-cols-2 gap-5 mb-6">
  102. <div class="field-group">
  103. <label class="field-label">Nome Completo</label>
  104. <div class="field-input-wrap">
  105. <span class="material-icons field-icon">person</span>
  106. <input
  107. v-model="form.nomeCompleto"
  108. type="text"
  109. placeholder="Seu Nome"
  110. class="field-input"
  111. >
  112. </div>
  113. </div>
  114. <div class="field-group">
  115. <label class="field-label">CPF</label>
  116. <div :class="['field-input-wrap', { 'field-error': errors.cpf }]">
  117. <span class="material-icons field-icon">badge</span>
  118. <input
  119. :value="form.cpf"
  120. type="text"
  121. placeholder="000.000.000-00"
  122. maxlength="14"
  123. class="field-input"
  124. @input="handleCPF"
  125. @blur="onCPFBlur"
  126. >
  127. </div>
  128. </div>
  129. <div class="field-group">
  130. <label class="field-label">E-mail</label>
  131. <div :class="['field-input-wrap', { 'field-error': errors.email }]">
  132. <span class="material-icons field-icon">email</span>
  133. <input
  134. v-model="form.email"
  135. type="email"
  136. placeholder="nome@conta.com"
  137. class="field-input"
  138. @blur="onEmailBlur"
  139. >
  140. </div>
  141. </div>
  142. <div class="field-group">
  143. <label class="field-label">Telefone</label>
  144. <div :class="['field-input-wrap', { 'field-error': errors.telefone }]">
  145. <span class="material-icons field-icon">phone</span>
  146. <input
  147. :value="form.telefone"
  148. type="tel"
  149. placeholder="(00) 00000-0000"
  150. maxlength="15"
  151. class="field-input"
  152. @input="handlePhone"
  153. @blur="onPhoneBlur"
  154. >
  155. </div>
  156. </div>
  157. <div class="field-group">
  158. <label class="field-label">Cargo</label>
  159. <div class="field-input-wrap">
  160. <span class="material-icons field-icon">work</span>
  161. <input
  162. v-model="form.cargo"
  163. type="text"
  164. placeholder="Assistente Financeiro"
  165. class="field-input"
  166. >
  167. </div>
  168. </div>
  169. <div class="field-group">
  170. <label class="field-label">Setor</label>
  171. <div class="field-input-wrap">
  172. <span class="material-icons field-icon">business</span>
  173. <input
  174. v-model="form.setor"
  175. type="text"
  176. placeholder="Financeiro"
  177. class="field-input"
  178. >
  179. </div>
  180. </div>
  181. </div>
  182. <div class="flex justify-center">
  183. <button type="submit" class="btn-submit" :disabled="isLoading" :style="isLoading ? 'opacity: 0.7; cursor: not-allowed;' : ''">
  184. {{ isLoading ? 'ENVIANDO...' : 'ENVIAR SOLICITAÇÃO' }}
  185. </button>
  186. </div>
  187. </form>
  188. </div>
  189. </div>
  190. </div>
  191. </section>
  192. <Transition name="toast">
  193. <div
  194. v-if="showSuccess"
  195. class="fixed bottom-6 right-6 z-50 bg-violet-normal text-white px-5 py-4 rounded-xl shadow-xl flex items-center gap-3"
  196. >
  197. <span class="material-icons text-xl">check_circle</span>
  198. <span class="text-sm font-medium">Solicitação enviada com sucesso!</span>
  199. </div>
  200. </Transition>
  201. <Transition name="toast">
  202. <div
  203. v-if="showError"
  204. class="fixed bottom-6 right-6 z-50 bg-red-600 text-white px-5 py-4 rounded-xl shadow-xl flex items-center gap-3"
  205. >
  206. <span class="material-icons text-xl">error_outline</span>
  207. <span class="text-sm font-medium">{{ errorMessage }}</span>
  208. </div>
  209. </Transition>
  210. </div>
  211. </template>
  212. <script setup lang="ts">
  213. import heroBg from '~/assets/images/imagem_fundo.png'
  214. useHead({ title: 'Serprati' })
  215. definePageMeta({ layout: 'default' })
  216. const scrollTo = (id: string) => {
  217. document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' })
  218. }
  219. const benefits = [
  220. {
  221. icon: 'local_offer',
  222. title: 'Descontos Exclusivos',
  223. description: 'Até 50% de desconto em parceiros selecionados.',
  224. },
  225. {
  226. icon: 'health_and_safety',
  227. title: 'Convênios Médicos',
  228. description: 'Planos de saúde com condições especiais.',
  229. },
  230. {
  231. icon: 'store',
  232. title: 'Loja do Associado',
  233. description: 'Produtos com preços diferenciados.',
  234. },
  235. {
  236. icon: 'badge',
  237. title: 'Carteirinha Digital',
  238. description: 'Acesso rápido aos benefícios pelo celular.',
  239. },
  240. {
  241. icon: 'notifications',
  242. title: 'Notificações',
  243. description: 'Fique por dentro das novidades e promoções.',
  244. },
  245. {
  246. icon: 'family_restroom',
  247. title: 'Dependentes',
  248. description: 'Inclua sua família nos benefícios.',
  249. },
  250. ]
  251. const form = reactive({
  252. nomeCompleto: '',
  253. cpf: '',
  254. email: '',
  255. telefone: '',
  256. cargo: '',
  257. setor: '',
  258. })
  259. const formatCPF = (value: string): string => {
  260. return value
  261. .replace(/\D/g, '')
  262. .replace(/(\d{3})(\d)/, '$1.$2')
  263. .replace(/(\d{3})(\d)/, '$1.$2')
  264. .replace(/(\d{3})(\d{1,2})$/, '$1-$2')
  265. .slice(0, 14)
  266. }
  267. const validateCPF = (cpf: string): boolean => {
  268. const d = cpf.replace(/\D/g, '')
  269. if (d.length !== 11 || /^(\d)\1{10}$/.test(d)) return false
  270. const calc = (n: number): number => {
  271. let sum = 0
  272. for (let i = 0; i < n; i++) sum += parseInt(d.charAt(i)) * (n + 1 - i)
  273. const rem = sum % 11
  274. return rem < 2 ? 0 : 11 - rem
  275. }
  276. return calc(9) === parseInt(d.charAt(9)) && calc(10) === parseInt(d.charAt(10))
  277. }
  278. const validateEmail = (email: string): boolean =>
  279. /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
  280. const formatPhone = (value: string): string =>
  281. value
  282. .replace(/\D/g, '')
  283. .replace(/^(\d{2})(\d)/, '($1) $2')
  284. .replace(/(\d{5})(\d{1,4})$/, '$1-$2')
  285. .slice(0, 15)
  286. const errors = reactive({ cpf: '', email: '', telefone: '' })
  287. const handleCPF = (e: Event) => {
  288. form.cpf = formatCPF((e.target as HTMLInputElement).value)
  289. if (errors.cpf) errors.cpf = ''
  290. }
  291. const handlePhone = (e: Event) => {
  292. form.telefone = formatPhone((e.target as HTMLInputElement).value)
  293. if (errors.telefone) errors.telefone = ''
  294. }
  295. const onCPFBlur = () => {
  296. errors.cpf = form.cpf && !validateCPF(form.cpf) ? 'CPF inválido' : ''
  297. }
  298. const onEmailBlur = () => {
  299. errors.email = form.email && !validateEmail(form.email) ? 'E-mail inválido' : ''
  300. }
  301. const onPhoneBlur = () => {
  302. errors.telefone = form.telefone && form.telefone.replace(/\D/g, '').length < 10 ? 'Telefone inválido' : ''
  303. }
  304. watch(() => form.email, () => { if (errors.email) errors.email = '' })
  305. const { registerLandingUser } = useRegisterApi()
  306. const isLoading = ref(false)
  307. const showSuccess = ref(false)
  308. const showError = ref(false)
  309. const errorMessage = ref('')
  310. const resetForm = () => {
  311. Object.assign(form, { nomeCompleto: '', cpf: '', email: '', telefone: '', cargo: '', setor: '' })
  312. Object.assign(errors, { cpf: '', email: '', telefone: '' })
  313. }
  314. const handleSubmit = async () => {
  315. errors.cpf = form.cpf && !validateCPF(form.cpf) ? 'CPF inválido' : ''
  316. errors.email = form.email && !validateEmail(form.email) ? 'E-mail inválido' : ''
  317. errors.telefone = form.telefone && form.telefone.replace(/\D/g, '').length < 10 ? 'Telefone inválido' : ''
  318. if (errors.cpf || errors.email || errors.telefone) return
  319. isLoading.value = true
  320. showError.value = false
  321. try {
  322. await registerLandingUser({
  323. name: form.nomeCompleto,
  324. cpf: form.cpf,
  325. email: form.email,
  326. phone: form.telefone,
  327. position_label: form.cargo,
  328. sector_label: form.setor,
  329. })
  330. showSuccess.value = true
  331. setTimeout(() => { showSuccess.value = false }, 4000)
  332. resetForm()
  333. } catch (err: unknown) {
  334. const error = err as { data?: { errors?: Record<string, string[]>; message?: string } }
  335. const firstError = error?.data?.errors
  336. ? Object.values(error.data.errors)[0]?.[0]
  337. : error?.data?.message
  338. errorMessage.value = firstError || 'Erro ao enviar solicitação. Tente novamente.'
  339. showError.value = true
  340. setTimeout(() => { showError.value = false }, 5000)
  341. } finally {
  342. isLoading.value = false
  343. }
  344. }
  345. onMounted(() => {
  346. const observer = new IntersectionObserver(
  347. (entries) => {
  348. entries.forEach((entry) => {
  349. if (entry.isIntersecting) {
  350. entry.target.classList.add('is-visible')
  351. observer.unobserve(entry.target)
  352. }
  353. })
  354. },
  355. { threshold: 0.1, rootMargin: '0px 0px -40px 0px' }
  356. )
  357. document.querySelectorAll('.reveal').forEach((el) => observer.observe(el))
  358. })
  359. </script>
  360. <style scoped>
  361. @media (max-width: 1023px) {
  362. #quem-somos {
  363. background-position: 8% 65%;
  364. }
  365. }
  366. .btn-primary {
  367. background: linear-gradient(90deg, #4d1658 0%, #8b30a5 100%);
  368. color: #ffffff;
  369. font-family: "Nunito", sans-serif;
  370. font-weight: 800;
  371. font-size: 0.875rem;
  372. letter-spacing: 1px;
  373. padding: 0.75rem 1.75rem;
  374. border-radius: 0.5rem;
  375. transition: opacity 0.2s;
  376. cursor: pointer;
  377. white-space: nowrap;
  378. }
  379. .btn-primary:hover {
  380. opacity: 0.88;
  381. }
  382. .btn-outline {
  383. background-color: rgba(102, 29, 117, 0.18);
  384. color: #ffffff;
  385. font-family: "Nunito", sans-serif;
  386. font-weight: 700;
  387. font-size: 0.875rem;
  388. letter-spacing: 1px;
  389. padding: 0.75rem 1.75rem;
  390. border-radius: 0.5rem;
  391. border: 2px solid #a855c8;
  392. transition: background-color 0.2s, border-color 0.2s;
  393. cursor: pointer;
  394. white-space: nowrap;
  395. }
  396. .btn-outline:hover {
  397. background-color: rgba(102, 29, 117, 0.32);
  398. border-color: #ffffff;
  399. }
  400. .benefit-card {
  401. background-color: #ffffff;
  402. border-radius: 1rem;
  403. padding: 1.75rem;
  404. box-shadow: 0 2px 12px rgba(102, 29, 117, 0.07);
  405. transition: box-shadow 0.2s, transform 0.2s;
  406. }
  407. .benefit-card:hover {
  408. box-shadow: 0 6px 24px rgba(102, 29, 117, 0.13);
  409. transform: translateY(-2px);
  410. }
  411. .benefit-icon-wrap {
  412. display: inline-flex;
  413. align-items: center;
  414. justify-content: center;
  415. width: 48px;
  416. height: 48px;
  417. background-color: #f0e8f1;
  418. border-radius: 0.75rem;
  419. }
  420. .tab-active {
  421. background-color: #661d75;
  422. color: #ffffff;
  423. font-family: "Nunito", sans-serif;
  424. font-weight: 600;
  425. font-size: 0.75rem;
  426. letter-spacing: 1.25px;
  427. padding: 0.625rem 1.5rem;
  428. border-radius: 0.5rem 0.5rem 0 0;
  429. cursor: default;
  430. }
  431. .field-group {
  432. display: flex;
  433. flex-direction: column;
  434. gap: 0.375rem;
  435. }
  436. .field-label {
  437. font-family: "Nunito", sans-serif;
  438. font-size: 0.8125rem;
  439. font-weight: 600;
  440. color: #505050;
  441. }
  442. .field-input-wrap {
  443. display: flex;
  444. align-items: center;
  445. gap: 0.5rem;
  446. border: 1.5px solid #C0C0C0;
  447. border-radius: 0.5rem;
  448. padding: 0.5rem 0.75rem;
  449. background-color: #fefefe;
  450. transition: border-color 0.2s;
  451. }
  452. .field-input-wrap:focus-within {
  453. border-color: #661d75;
  454. }
  455. .field-input-wrap.field-error {
  456. border-color: #dc2626;
  457. }
  458. .field-icon {
  459. font-size: 1.125rem;
  460. color: #b6b6b6;
  461. flex-shrink: 0;
  462. }
  463. .field-input {
  464. flex: 1;
  465. border: none;
  466. outline: none;
  467. background: transparent;
  468. font-family: "Nunito", sans-serif;
  469. font-size: 0.875rem;
  470. color: #161616;
  471. }
  472. .field-input::placeholder {
  473. color: #b6b6b6;
  474. }
  475. .btn-submit {
  476. background-color: #661d75;
  477. color: #ffffff;
  478. font-family: "Nunito", sans-serif;
  479. font-weight: 600;
  480. font-size: 0.875rem;
  481. letter-spacing: 1.25px;
  482. padding: 0.875rem 3rem;
  483. border-radius: 0.5rem;
  484. transition: background-color 0.2s;
  485. cursor: pointer;
  486. }
  487. .btn-submit:hover {
  488. background-color: #5c1a69;
  489. }
  490. .toast-enter-active,
  491. .toast-leave-active {
  492. transition: opacity 0.4s ease, transform 0.4s ease;
  493. }
  494. .toast-enter-from,
  495. .toast-leave-to {
  496. opacity: 0;
  497. transform: translateY(12px);
  498. }
  499. </style>