certificate.vue
3.9 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<template>
<div class="body">
<nav-bar class="navbar">
<div slot="left" class="certificateback" @click="goBack">
<img src="../../assets/img/back.png" alt="">
</div>
<div slot="center" class="userinfotitle">
我的证书
</div>
<div slot="right" class="certificateresult"></div>
</nav-bar>
<div style="width: 100%;">
<div class="certificate display-flex-between" >
<router-link :to="{path:'/certificateDetail',query:{id:item.id}}" v-for="(item,index) in certificate" :key="index" class="certificate_item">
<img v-if="item.is_valid==0" src="../../assets/img/over.png" alt="" class="overtimes">
<div class="itempic">
<van-image
width="100%"
height="100%"
fit="cover"
:src="item.image_text"
/>
</div>
<div class="name">{{item.cert.name}}</div>
<div class="time">有限期:{{item.end_time}}</div>
</router-link>
<router-link to="/uploadcertificate" style="color: #000;" class="certificate_uploadimg" >
<img src="../../assets/img/unload.png" alt="" class="upimg">
<div class="uploadtext" >上传证书</div>
</router-link>
</div>
</div>
</div>
</template>
<script>
export default {
data () {
return {
certificate: [],
page: 1,
pagenum: 10
}
},
mounted () {
this.getlist()
},
methods: {
goBack () {
this.$router.go(-1)
},
async getlist () {
const params = {
page: this.page,
page_num: this.pagenum
}
const res = await this.api.certificate(params)
if (res.code === 1) {
const result = res.data.list.data
result.forEach((item) => {
item.end_time = item.end_time.split(' ')[0]
})
this.certificate = result
} else {
this.$toast(res.msg)
}
}
}
}
</script>
<style lang="scss">
.body{
height: 100vh;
overflow: hidden;
background-color: #f7f8fa;
}
.navbar{
background: #fff;
}
.certificateback,.certificateresult{
width: 1rem;
font-size: 0.48rem;
}
.certificateback img{
width: 0.48rem;
height: 0.48rem;
}
.certificate{
flex-wrap: wrap;
padding: 0 0.32rem;
box-sizing: border-box;
margin-top: 1rem;
}
.certificate_item{
position: relative;
width: 3.2rem;
height: 4.52rem;
border-radius: 0.16rem;
opacity: 1;
background: rgba(255,255,255,1);
padding: 0.32rem;
box-sizing: border-box;
margin-bottom: 0.32rem;
}
.certificate_item .itempic{
width: 100%;
height: 2.56rem;
}
.name{
font-size: 0.28rem;
font-weight: 500;
font-family: "PingFang SC";
text-align: center;
line-height: 0.52rem;
margin-top: 0.1rem;
color: black;
}
.time{
font-size: 0.24rem;
font-weight: 400;
font-family: "PingFang SC";
text-align: center;
line-height: 0.4rem;
color: rgba(150,151,153,1);
margin-top: 0.1rem;
}
.uploadtext{
font-size: 0.28rem;
font-weight: 500;
font-family: "PingFang SC";
text-align: center;
line-height: 0.52rem;
position: absolute;
bottom: 1rem;
left: 50%;
transform: translate(-50%,0);
}
.certificate_uploadimg{
width: 50%;
position: relative;
}
.certificate_uploadimg .upimg{
width: 100%;
height: 4.52rem;
}
.overtimes{
width:1rem;
height: 1rem;
position: absolute;
right: 0.24rem;
top: 0.24rem;
z-index: 8;
}
</style>