ApplyCard.vue
3.12 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
<template>
<div class="apply-card" :class="{ 'border-bottom': isShowBottomMargin }">
<div class="apply-card--title" v-if="title">{{ title }}</div>
<van-grid
:border="false"
class="apply-card--content"
v-if="applyList && applyList.length"
>
<van-grid-item
class="apply-card--item"
v-for="(item, index) in applyList"
:key="`${item[props.name]}_${index}`"
@click="handleClick(item)"
>
<div
class="item-top--icon"
:style="{ background: item[props.iconColor] || '#409EFF' }"
>
<i
class="apply-icon"
:class="item[props.icon] || 'icon-aside-app-center'"
></i>
</div>
<div class="item-bottom--name">{{ item[props.name] }}</div>
</van-grid-item>
</van-grid>
<div v-else-if="noDataText" class="no-data--text">{{ noDataText }}</div>
</div>
</template>
<script>
export default {
name: 'ApplyCard',
props: {
applyList: {
type: Array,
default: () => [],
},
props: {
type: Object,
default: () => {
return {
name: 'name',
icon: 'icon',
iconColor: 'iconColor',
path: 'path',
}
},
},
title: {
type: String,
default: '',
},
isShowBottomMargin: {
type: Boolean,
default: true,
},
noDataText: {
type: String,
default: '',
},
isProcessCenter: {
type: Boolean,
default: false,
},
},
methods: {
handleClick(item) {
if (this.isProcessCenter) {
if (item[this.props.path]) {
this.$router.push({
path: item[this.props.path],
query: { from: 'worker' },
})
}
} else {
this.$emit('apply-click', item)
}
},
},
}
</script>
<style lang="scss" scoped>
.apply-card {
background: #fff;
&--title {
padding: 16px 0 8px 16px;
font-size: 17px;
color: $base-text-color;
font-weight: bold;
}
&--content {
.apply-card--item {
.item-top--icon {
width: 40px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
border-radius: 8px;
color: #fff;
.apply-icon {
font-size: 24px;
}
}
.item-bottom--name {
height: 34px;
font-size: 13px;
color: $base-text-color;
padding-top: 8px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
::v-deep {
.van-grid-item__content {
padding-top: 12px;
padding-bottom: 12px;
}
}
}
}
.no-data--text {
font-size: 14px;
color: #8c8c8c;
padding-left: 16px;
padding-bottom: 16px;
}
}
.border-bottom {
margin-bottom: 12px;
}
</style>