forked from VitorCarvalho67/Boot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTableprofessor.vue
122 lines (111 loc) · 4.17 KB
/
Tableprofessor.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
<Header />
<div id="app">
<main>
<AsideDashboard pageName='home' />
<div class="content">
<div class="path">
<p>Dashboard</p>
<img :src="anguloIcon" alt="">
<p>Tabelas</p>
<img :src="anguloIcon" alt="">
<p>Professores</p>
</div>
<div class="table">
<div class="table-header">
<div class="table-row table-row1">
<div class="table-cell">Professores Registrados</div>
</div>
</div>
<div class="table-body">
<div class="table-row" v-for="professor in professores" :key="professor.id">
<div class="table-cell">
<!-- <p v-text="professor.id"></p> -->
<p v-text="'Nome: ' + professor.name"></p>
<p v-text="'Email: ' + professor.email"></p>
<!-- <p v-text="professor.password"></p>
<p v-text="professor.recoveryPass"></p> -->
<p v-text="'Título principal: ' + professor.tituloPrincipal"></p>
<p v-text="professor.imagem"></p>
<p v-text="professor.banner"></p>
<p v-text="'Conta validada: ' + professor.validated"></p>
<!-- <p v-text="professor.tentativasRestantes"></p> -->
<p v-text="'Registro: ' + formatarData(professor.createdAt)"></p>
<!-- <p v-text="professor.updatedAt"></p> -->
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</template>
<script>
import Header from '../../components/Header.vue';
import AsideDashboard from '../../components/admin/AsideDashboard.vue';
import anguloIcon from '../../assets/icons/angulo.png';
import { mixinAdmin } from '../../util/authMixins.js';
import { getFullProfessores } from '../../services/api/admin.js';
export default {
name: 'TableProfessores',
components: {
Header,
AsideDashboard,
},
data() {
return {
anguloIcon,
professores: []
}
},
methods: {
async fetchProfessores() {
const data = await getFullProfessores(this.admin.token);
this.professores = data.data;
console.log(data)
},
formatarData(data) {
const dataAtual = new Date();
const dataMensagem = new Date(data);
if (dataMensagem.toDateString() === dataAtual.toDateString()) {
return dataMensagem.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
} else {
const diff = Math.floor((dataAtual - dataMensagem) / (1000 * 60 * 60 * 24));
if (diff === 1) {
return `Ontem, ${dataMensagem.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;
} else if (diff <= 7) {
return `${dataMensagem.toLocaleDateString('pt-BR', { weekday: 'long' })}, ${dataMensagem.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`;
} else {
return dataMensagem.toLocaleString();
}
}
}
},
mixins: [mixinAdmin],
async created() {
this.getToken();
await this.fetchProfessores();
}
}
</script>
<style lang="scss" scoped>
@import "../../scss/pages/admin/_tableProfessor.scss";
#app {
display: flex;
flex-direction: column;
min-height: calc(100vh - 80px);
main {
display: flex;
overflow: hidden;
.content {
flex: 1;
padding: 20px;
overflow-y: auto;
height: 100%;
@media (max-width: 1000px) {
width: calc(100% - 100px);
}
}
}
}
</style>