index.vue 17 KB

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