9
9
Configure seu perfil e veja suas informações
10
10
</h2 >
11
11
12
+ <div id =" getCurriculo" >
13
+ <button @click =" GetCurriculoFile" v-if =" linkstatus == 0" >Gerar Currículo</button >
14
+ <p v-if =" linkstatus == 1" >Gerando currículo</p >
15
+ <p v-if =" linkstatus == 2" >Currículo gerado</p >
16
+ <a v-if =" linkstatus == 2" >
17
+ <button @click =" downloadFile" >Baixar</button >
18
+ </a >
19
+ </div >
20
+
12
21
<h3 >Envio de boletim</h3 >
13
22
14
23
<div class =" inputUpload" >
@@ -69,7 +78,7 @@ import Header from "../../components/aluno/Header.vue";
69
78
import AsideDashboard from " ../../components/aluno/AsideDashboard.vue" ;
70
79
import Footer from " ../../components/Footer.vue" ;
71
80
72
- import { getCurriculo , sendBoletim } from " ../../services/api/aluno" ;
81
+ import { getCurriculo , getCurriculoFile , sendBoletim } from " ../../services/api/aluno" ;
73
82
import { getImage } from " ../../services/api/shared" ;
74
83
75
84
import imgVerificar from " ../../assets/icons/verificar.png" ;
@@ -96,9 +105,11 @@ export default {
96
105
curriculoEdit: " " ,
97
106
imgUrl: " ../../assets/img/defaultImage.png" ,
98
107
bannerUrl: " ../../assets/img/defaultBanner.png" ,
108
+ link_curriculo: " "
99
109
},
100
110
file: " " ,
101
111
fileSelected: false ,
112
+ linkstatus: 0
102
113
};
103
114
},
104
115
methods: {
@@ -201,6 +212,46 @@ export default {
201
212
this .file = this .$refs .boletimInput .files [0 ];
202
213
};
203
214
},
215
+ async GetCurriculoFile (){
216
+ this .linkstatus = 1 ;
217
+ const response = await getCurriculoFile (this .aluno .token );
218
+
219
+ if (response .status >= 200 && response .status < 300 ) {
220
+ console .log (response);
221
+ this .aluno .link_curriculo = response .data .url ;
222
+
223
+ this .linkstatus = 2 ;
224
+ } else {
225
+ alert (
226
+ " Ops.. Algo deu errado ao gerar currículo. 😕\n " +
227
+ response .message ,
228
+ );
229
+ }
230
+ },
231
+ async downloadFile () {
232
+ try {
233
+ const response = await fetch (this .aluno .link_curriculo );
234
+
235
+ if (! response .ok ) {
236
+ throw new Error (' Falha no download do arquivo.' );
237
+ }
238
+
239
+ const blob = await response .blob ();
240
+
241
+ const blobUrl = window .URL .createObjectURL (blob);
242
+
243
+ const link = document .createElement (' a' );
244
+ link .href = blobUrl;
245
+ link .setAttribute (' download' , ' Curriculo.pdf' );
246
+ document .body .appendChild (link);
247
+ link .click ();
248
+
249
+ window .URL .revokeObjectURL (blobUrl);
250
+ document .body .removeChild (link);
251
+ } catch (error) {
252
+ console .error (' Erro ao baixar o arquivo:' , error);
253
+ }
254
+ }
204
255
},
205
256
mixins: [mixinAluno],
206
257
async created () {
0 commit comments