|
| 1 | +<template> |
| 2 | + <Header /> |
| 3 | + <div id="app"> |
| 4 | + <main> |
| 5 | + <AsideDashboard pageName="estagios" /> |
| 6 | + <div class="content"> |
| 7 | + <div class="back-button"> |
| 8 | + <router-link to="/vagas"> |
| 9 | + <img src="../../assets/icons/angulo.png" alt="Voltar" /> |
| 10 | + Voltar |
| 11 | + </router-link> |
| 12 | + </div> |
| 13 | + |
| 14 | + <div class="vaga"> |
| 15 | + <div class="vaga-header"> |
| 16 | + <h3 v-text="vaga.titulo"></h3> |
| 17 | + <p class="status" v-text="situacao[vaga.status]"></p> |
| 18 | + </div> |
| 19 | + |
| 20 | + <div class="main-information"> |
| 21 | + <div class="enterprise"> |
| 22 | + <img |
| 23 | + :src="vaga.empresa.logo" |
| 24 | + :alt="vaga.empresa.name" |
| 25 | + /> |
| 26 | + <div class="info-enterprise"> |
| 27 | + <strong>Empresa:</strong> |
| 28 | + <router-link |
| 29 | + :to="'/empresa/' + vaga.empresa.cnpj" |
| 30 | + >{{ vaga.empresa.name }}</router-link |
| 31 | + > |
| 32 | + </div> |
| 33 | + </div> |
| 34 | + <div class="remuneracao"> |
| 35 | + <strong>Remuneração:</strong> |
| 36 | + <span v-text="vaga.remuneracao"></span> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + |
| 40 | + <section class="vaga-info"> |
| 41 | + <h2>Requisitos</h2> |
| 42 | + <ul class="requisitos"> |
| 43 | + <li |
| 44 | + v-for="(requisito, index) in parsedRequisitos" |
| 45 | + :key="index" |
| 46 | + > |
| 47 | + <p v-text="requisito"></p> |
| 48 | + </li> |
| 49 | + </ul> |
| 50 | + |
| 51 | + <div class="vaga-details"> |
| 52 | + <p> |
| 53 | + <strong>Carga Horária:</strong> |
| 54 | + <span v-text="vaga.cargaHoraria"></span> |
| 55 | + </p> |
| 56 | + <p> |
| 57 | + <strong>Entrada:</strong> |
| 58 | + <span v-text="vaga.entrada"></span> |
| 59 | + </p> |
| 60 | + <p> |
| 61 | + <strong>Saída:</strong> |
| 62 | + <span v-text="vaga.saida"></span> |
| 63 | + </p> |
| 64 | + </div> |
| 65 | + |
| 66 | + <section class="descricao"> |
| 67 | + <h2>Descrição</h2> |
| 68 | + <p v-text="vaga.descricao"></p> |
| 69 | + </section> |
| 70 | + |
| 71 | + <h2>Benefícios</h2> |
| 72 | + <ul class="beneficios"> |
| 73 | + <li |
| 74 | + v-for="(beneficio, index) in parsedBeneficios" |
| 75 | + :key="index" |
| 76 | + > |
| 77 | + <p v-text="beneficio"></p> |
| 78 | + </li> |
| 79 | + </ul> |
| 80 | + </section> |
| 81 | + </div> |
| 82 | + </div> |
| 83 | + </main> |
| 84 | + </div> |
| 85 | + <Footer /> |
| 86 | +</template> |
| 87 | + |
| 88 | +<script> |
| 89 | +import Header from "../../components/aluno/Header.vue"; |
| 90 | +import Footer from "../../components/Footer.vue"; |
| 91 | +import AsideDashboard from "../../components/aluno/AsideDashboard.vue"; |
| 92 | +import router from "../../router/index.js"; |
| 93 | +import Cookies from "js-cookie"; |
| 94 | +import { getVaga } from "../../services/api/shared"; |
| 95 | +import { getMeAluno } from "../../services/api/aluno"; |
| 96 | +
|
| 97 | +export default { |
| 98 | + name: "Vaga", |
| 99 | + components: { |
| 100 | + Header, |
| 101 | + AsideDashboard, |
| 102 | + Footer, |
| 103 | + }, |
| 104 | + data() { |
| 105 | + return { |
| 106 | + vaga: { |
| 107 | + requisitos: "[]", |
| 108 | + beneficios: "[]", |
| 109 | + }, |
| 110 | + aluno: { |
| 111 | + email: "", |
| 112 | + token: "", |
| 113 | + }, |
| 114 | + situacao: { |
| 115 | + DISPONIVEL: "Vaga disponível", |
| 116 | + INDISPONIVEL: "Vaga indisponível", |
| 117 | + }, |
| 118 | + }; |
| 119 | + }, |
| 120 | + computed: { |
| 121 | + parsedRequisitos() { |
| 122 | + return JSON.parse(this.vaga.requisitos); |
| 123 | + }, |
| 124 | + parsedBeneficios() { |
| 125 | + return JSON.parse(this.vaga.beneficios); |
| 126 | + }, |
| 127 | + }, |
| 128 | + methods: { |
| 129 | + async getVaga() { |
| 130 | + try { |
| 131 | + const response = await getVaga({ id: this.$route.params.id }); |
| 132 | + if (response.status >= 200 && response.status < 300) { |
| 133 | + this.vaga = response.data.vaga; |
| 134 | + } else { |
| 135 | + console.error( |
| 136 | + "Erro ao recuperar os dados da vaga:", |
| 137 | + response.message, |
| 138 | + ); |
| 139 | + } |
| 140 | + } catch (error) { |
| 141 | + console.error( |
| 142 | + "Erro ao recuperar os dados da vaga:", |
| 143 | + error.message, |
| 144 | + ); |
| 145 | + } |
| 146 | + }, |
| 147 | + async testAluno() { |
| 148 | + this.aluno.token = Cookies.get("token"); |
| 149 | +
|
| 150 | + if (this.aluno.token) { |
| 151 | + const responseMail = await getMeAluno(this.aluno.token); |
| 152 | + if (responseMail.status >= 200 && responseMail.status < 300) { |
| 153 | + this.aluno.email = responseMail.data.email; |
| 154 | + } else { |
| 155 | + console.log("Erro ao buscar aluno"); |
| 156 | + } |
| 157 | + } else { |
| 158 | + console.log("Token de aluno não encontrado"); |
| 159 | + } |
| 160 | + }, |
| 161 | + }, |
| 162 | + async created() { |
| 163 | + await this.testAluno(); |
| 164 | + await this.getVaga(); |
| 165 | + }, |
| 166 | +}; |
| 167 | +</script> |
| 168 | + |
| 169 | +<style lang="scss" scoped> |
| 170 | +@import "../../scss/pages/shared/_vaga.scss"; |
| 171 | +</style> |
0 commit comments