index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  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(${heroBackground})` }"
  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 justifyBetween">
  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. {{ settings.hero_title }}
  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. {{ settings.hero_subtitle }}
  21. </p>
  22. <div class="reveal reveal-delay-2 flex flex-col sm:flex-row gap-4">
  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. </div>
  37. <div class="reveal reveal-delay-3 flex flex-row lg:flex-col gap-6 lg:gap-8 shrink-0">
  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);">{{ settings.stat1_value }}</span>
  41. <span class="text-white/80 text-sm">{{ settings.stat1_label }}</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);">{{ settings.stat2_value }}</span>
  46. <span class="text-white/80 text-sm">{{ settings.stat2_label }}</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);">{{ settings.stat3_value }}</span>
  51. <span class="text-white/80 text-sm">{{ settings.stat3_label }}</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.id"
  69. :class="`reveal reveal-delay-${index + 1}`"
  70. class="benefit-card"
  71. >
  72. <div class="benefit-icon-wrap">
  73. <i :class="`mdi ${benefit.icon} text-violet-normal`" style="font-size: 1.5rem;" />
  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 heroBgFallback from '~/assets/images/imagem_fundo.png'
  213. useHead({ title: 'Serprati' })
  214. definePageMeta({ layout: 'default' })
  215. const { settings, benefits } = useCompanyData()
  216. const heroBackground = computed(() => settings.value.hero_background_url ?? heroBgFallback)
  217. const scrollTo = (id: string) => {
  218. document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' })
  219. }
  220. const form = reactive({
  221. nomeCompleto: '',
  222. cpf: '',
  223. email: '',
  224. telefone: '',
  225. cargo: '',
  226. setor: '',
  227. })
  228. const formatCPF = (value: string): string => {
  229. return value
  230. .replace(/\D/g, '')
  231. .replace(/(\d{3})(\d)/, '$1.$2')
  232. .replace(/(\d{3})(\d)/, '$1.$2')
  233. .replace(/(\d{3})(\d{1,2})$/, '$1-$2')
  234. .slice(0, 14)
  235. }
  236. const validateCPF = (cpf: string): boolean => {
  237. const d = cpf.replace(/\D/g, '')
  238. if (d.length !== 11 || /^(\d)\1{10}$/.test(d)) return false
  239. const calc = (n: number): number => {
  240. let sum = 0
  241. for (let i = 0; i < n; i++) sum += parseInt(d.charAt(i)) * (n + 1 - i)
  242. const rem = sum % 11
  243. return rem < 2 ? 0 : 11 - rem
  244. }
  245. return calc(9) === parseInt(d.charAt(9)) && calc(10) === parseInt(d.charAt(10))
  246. }
  247. const validateEmail = (email: string): boolean =>
  248. /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
  249. const formatPhone = (value: string): string =>
  250. value
  251. .replace(/\D/g, '')
  252. .replace(/^(\d{2})(\d)/, '($1) $2')
  253. .replace(/(\d{5})(\d{1,4})$/, '$1-$2')
  254. .slice(0, 15)
  255. const errors = reactive({ cpf: '', email: '', telefone: '' })
  256. const handleCPF = (e: Event) => {
  257. form.cpf = formatCPF((e.target as HTMLInputElement).value)
  258. if (errors.cpf) errors.cpf = ''
  259. }
  260. const handlePhone = (e: Event) => {
  261. form.telefone = formatPhone((e.target as HTMLInputElement).value)
  262. if (errors.telefone) errors.telefone = ''
  263. }
  264. const onCPFBlur = () => {
  265. errors.cpf = form.cpf && !validateCPF(form.cpf) ? 'CPF inválido' : ''
  266. }
  267. const onEmailBlur = () => {
  268. errors.email = form.email && !validateEmail(form.email) ? 'E-mail inválido' : ''
  269. }
  270. const onPhoneBlur = () => {
  271. errors.telefone = form.telefone && form.telefone.replace(/\D/g, '').length < 10 ? 'Telefone inválido' : ''
  272. }
  273. watch(() => form.email, () => { if (errors.email) errors.email = '' })
  274. const { registerLandingUser } = useRegisterApi()
  275. const isLoading = ref(false)
  276. const showSuccess = ref(false)
  277. const showError = ref(false)
  278. const errorMessage = ref('')
  279. const resetForm = () => {
  280. Object.assign(form, { nomeCompleto: '', cpf: '', email: '', telefone: '', cargo: '', setor: '' })
  281. Object.assign(errors, { cpf: '', email: '', telefone: '' })
  282. }
  283. const handleSubmit = async () => {
  284. errors.cpf = form.cpf && !validateCPF(form.cpf) ? 'CPF inválido' : ''
  285. errors.email = form.email && !validateEmail(form.email) ? 'E-mail inválido' : ''
  286. errors.telefone = form.telefone && form.telefone.replace(/\D/g, '').length < 10 ? 'Telefone inválido' : ''
  287. if (errors.cpf || errors.email || errors.telefone) return
  288. isLoading.value = true
  289. showError.value = false
  290. try {
  291. await registerLandingUser({
  292. name: form.nomeCompleto,
  293. cpf: form.cpf,
  294. email: form.email,
  295. phone: form.telefone,
  296. position_label: form.cargo,
  297. sector_label: form.setor,
  298. })
  299. showSuccess.value = true
  300. setTimeout(() => { showSuccess.value = false }, 4000)
  301. resetForm()
  302. } catch (err: unknown) {
  303. const error = err as { data?: { errors?: Record<string, string[]>; message?: string } }
  304. const firstError = error?.data?.errors
  305. ? Object.values(error.data.errors)[0]?.[0]
  306. : error?.data?.message
  307. errorMessage.value = firstError || 'Erro ao enviar solicitação. Tente novamente.'
  308. showError.value = true
  309. setTimeout(() => { showError.value = false }, 5000)
  310. } finally {
  311. isLoading.value = false
  312. }
  313. }
  314. onMounted(() => {
  315. const observer = new IntersectionObserver(
  316. (entries) => {
  317. entries.forEach((entry) => {
  318. if (entry.isIntersecting) {
  319. entry.target.classList.add('is-visible')
  320. observer.unobserve(entry.target)
  321. }
  322. })
  323. },
  324. { threshold: 0.1, rootMargin: '0px 0px -40px 0px' }
  325. )
  326. document.querySelectorAll('.reveal').forEach((el) => observer.observe(el))
  327. })
  328. </script>
  329. <style scoped>
  330. @media (max-width: 1023px) {
  331. #quem-somos {
  332. background-position: 8% 65%;
  333. }
  334. }
  335. .btn-primary {
  336. background: linear-gradient(90deg, #4d1658 0%, #8b30a5 100%);
  337. color: #ffffff;
  338. font-family: "Nunito", sans-serif;
  339. font-weight: 800;
  340. font-size: 0.875rem;
  341. letter-spacing: 1px;
  342. padding: 0.75rem 1.75rem;
  343. border-radius: 0.5rem;
  344. transition: opacity 0.2s;
  345. cursor: pointer;
  346. white-space: nowrap;
  347. }
  348. .btn-primary:hover {
  349. opacity: 0.88;
  350. }
  351. .btn-outline {
  352. background-color: rgba(102, 29, 117, 0.18);
  353. color: #ffffff;
  354. font-family: "Nunito", sans-serif;
  355. font-weight: 700;
  356. font-size: 0.875rem;
  357. letter-spacing: 1px;
  358. padding: 0.75rem 1.75rem;
  359. border-radius: 0.5rem;
  360. border: 2px solid #a855c8;
  361. transition: background-color 0.2s, border-color 0.2s;
  362. cursor: pointer;
  363. white-space: nowrap;
  364. }
  365. .btn-outline:hover {
  366. background-color: rgba(102, 29, 117, 0.32);
  367. border-color: #ffffff;
  368. }
  369. .benefit-card {
  370. background-color: #ffffff;
  371. border-radius: 1rem;
  372. padding: 1.75rem;
  373. box-shadow: 0 2px 12px rgba(102, 29, 117, 0.07);
  374. transition: box-shadow 0.2s, transform 0.2s;
  375. }
  376. .benefit-card:hover {
  377. box-shadow: 0 6px 24px rgba(102, 29, 117, 0.13);
  378. transform: translateY(-2px);
  379. }
  380. .benefit-icon-wrap {
  381. display: inline-flex;
  382. align-items: center;
  383. justify-content: center;
  384. width: 48px;
  385. height: 48px;
  386. background-color: #f0e8f1;
  387. border-radius: 0.75rem;
  388. }
  389. .tab-active {
  390. background-color: #661d75;
  391. color: #ffffff;
  392. font-family: "Nunito", sans-serif;
  393. font-weight: 600;
  394. font-size: 0.75rem;
  395. letter-spacing: 1.25px;
  396. padding: 0.625rem 1.5rem;
  397. border-radius: 0.5rem 0.5rem 0 0;
  398. cursor: default;
  399. }
  400. .field-group {
  401. display: flex;
  402. flex-direction: column;
  403. gap: 0.375rem;
  404. }
  405. .field-label {
  406. font-family: "Nunito", sans-serif;
  407. font-size: 0.8125rem;
  408. font-weight: 600;
  409. color: #505050;
  410. }
  411. .field-input-wrap {
  412. display: flex;
  413. align-items: center;
  414. gap: 0.5rem;
  415. border: 1.5px solid #C0C0C0;
  416. border-radius: 0.5rem;
  417. padding: 0.5rem 0.75rem;
  418. background-color: #fefefe;
  419. transition: border-color 0.2s;
  420. }
  421. .field-input-wrap:focus-within {
  422. border-color: #661d75;
  423. }
  424. .field-input-wrap.field-error {
  425. border-color: #dc2626;
  426. }
  427. .field-icon {
  428. font-size: 1.125rem;
  429. color: #b6b6b6;
  430. flex-shrink: 0;
  431. }
  432. .field-input {
  433. flex: 1;
  434. border: none;
  435. outline: none;
  436. background: transparent;
  437. font-family: "Nunito", sans-serif;
  438. font-size: 0.875rem;
  439. color: #161616;
  440. }
  441. .field-input::placeholder {
  442. color: #b6b6b6;
  443. }
  444. .btn-submit {
  445. background-color: #661d75;
  446. color: #ffffff;
  447. font-family: "Nunito", sans-serif;
  448. font-weight: 600;
  449. font-size: 0.875rem;
  450. letter-spacing: 1.25px;
  451. padding: 0.875rem 3rem;
  452. border-radius: 0.5rem;
  453. transition: background-color 0.2s;
  454. cursor: pointer;
  455. }
  456. .btn-submit:hover {
  457. background-color: #5c1a69;
  458. }
  459. .toast-enter-active,
  460. .toast-leave-active {
  461. transition: opacity 0.4s ease, transform 0.4s ease;
  462. }
  463. .toast-enter-from,
  464. .toast-leave-to {
  465. opacity: 0;
  466. transform: translateY(12px);
  467. }
  468. .justifyBetween {
  469. display: flex;
  470. flex-direction: column;
  471. justify-content: space-between;
  472. }
  473. </style>