Skip to content

Commit dec2910

Browse files
Merge pull request VitorCarvalho67#30 from Daniel-Alvarenga/main
FIx Image Update
2 parents 8a02921 + d46d947 commit dec2910

File tree

3 files changed

+67
-13
lines changed

3 files changed

+67
-13
lines changed

client/src/scss/pages/aluno/_profile.scss

+41-9
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,10 @@ main {
102102
}
103103

104104
.infoProfile {
105+
@include flex(row, flex-start, center);
105106
z-index: 2;
106107
position: relative;
107-
108-
.editButtons {
109-
@include flex-center;
110-
z-index: 2;
111-
position: absolute;
112-
top: 100px;
113-
right: auto;
114-
}
115-
@include flex(row, flex-start, center);
108+
116109
> img {
117110
@include flex-center;
118111
position: absolute;
@@ -124,6 +117,45 @@ main {
124117
background-color: $terciary-color-dark;
125118
}
126119

120+
.inputUpload {
121+
@include flex(row, center, center);
122+
position: absolute;
123+
height: 250px;
124+
width: 250px;
125+
background-color: rgba(0, 0, 0, 0.664);
126+
127+
position: absolute;
128+
bottom: 0;
129+
height: 250px;
130+
width: 250px;
131+
object-fit: cover;
132+
border-radius: 50%;
133+
134+
input {
135+
z-index: 2;
136+
width: 100%;
137+
height: 100%;
138+
background-color: rgba(0, 0, 0, 0.664);
139+
opacity: 0;
140+
}
141+
142+
img{
143+
z-index: 1;
144+
position: absolute;
145+
height: 40px;
146+
width: 40px;
147+
filter: invert(100%);
148+
}
149+
}
150+
151+
.editButtons {
152+
@include flex-center;
153+
z-index: 2;
154+
position: absolute;
155+
top: 100px;
156+
right: auto;
157+
}
158+
127159
.info {
128160
@include flex(column, center, flex-start);
129161
margin-left: 250px;

client/src/scss/pages/shared/_pesquisa.scss

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272
}
7373

7474
.resultado {
75-
@include flex(column, flex-end, start);
75+
@include flex(column, center, end);
76+
text-align: right;
77+
width: 80%;
7678
color: $secondary-color-orange;
7779
margin-right: 10px;
7880
margin-bottom: 10px;

client/src/views/aluno/Profile.vue

+23-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
<input type="file" ref="bannerInput" @change="previewBannerImage">
1717
<img src="../../assets/icons/envio.png" alt="">
1818
</div>
19-
<button v-show="modeBanner === 'edit'" @click="updateBannerImage" type="button">
19+
<button v-show="modeBanner === 'edit' && $refs.bannerInput.value != []"
20+
@click="updateBannerImage" type="button">
2021
<img :src="imgVerificar">Salvar
2122
</button>
2223
<button v-show="modeBanner === 'edit'" @click="cancelBanner" type="button">
@@ -27,12 +28,16 @@
2728
<div class="infoProfile">
2829
<img v-if="aluno.imageUrl == 'default'" src="../../assets/icons/artwork.png" :alt="aluno.nome">
2930
<img v-else :src="aluno.imageUrl" :alt="aluno.nome">
31+
<div class="inputUpload" v-show="modeImage === 'edit'">
32+
<input type="file" ref="profileInput" v-show="modeImage === 'edit'" @change="previewProfileImage">
33+
<img src="../../assets/icons/envio.png" alt="">
34+
</div>
3035
<div class="editButtons">
3136
<button v-show="modeImage === 'view'" @click="editModeImage" type="button">
3237
<img :src="imgLapis" alt="">Editar
3338
</button>
34-
<input type="file" ref="profileInput" v-show="modeImage === 'edit'">
35-
<button v-show="modeImage === 'edit'" @click="updateProfileImage" type="button">
39+
<button v-show="modeImage === 'edit' && $refs.profileInput.value != []"
40+
@click="updateProfileImage" type="button">
3641
<img :src="imgVerificar">Salvar
3742
</button>
3843
<button v-show="modeImage === 'edit'" @click="cancelImage" type="button">
@@ -169,9 +174,13 @@ export default {
169174
this.editMode();
170175
},
171176
async cancelImage() {
177+
await this.getCurriculoAluno();
178+
this.$refs.profileInput.value = [];
172179
this.editModeImage();
173180
},
174181
async cancelBanner() {
182+
await this.getCurriculoAluno();
183+
this.$refs.bannerInput.value = [];
175184
this.editModeBanner();
176185
},
177186
calcularIdade(nascimento) {
@@ -229,6 +238,7 @@ export default {
229238
});
230239
231240
if (responseBanner.status >= 200 && responseBanner.status < 300) {
241+
console.log("Pegando o banner do aluno");
232242
this.aluno.bannerUrl = responseBanner.data.url;
233243
} else {
234244
console.log("Ops.. Algo deu errado ao recuperar a imagem de capa do perfil. 😕\n" + responseBanner.message);
@@ -273,6 +283,16 @@ export default {
273283
await this.getCurriculoAluno();
274284
this.editModeBanner();
275285
},
286+
previewProfileImage(event){
287+
const file = event.target.files[0];
288+
if (!file) return;
289+
290+
const reader = new FileReader();
291+
reader.onload = e => {
292+
this.aluno.imageUrl = e.target.result;
293+
};
294+
reader.readAsDataURL(file);
295+
},
276296
previewBannerImage(event) {
277297
const file = event.target.files[0];
278298
if (!file) return;

0 commit comments

Comments
 (0)