selectCard.vue
2.99 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
<template>
<div class="help-main">
<el-drawer class="help-drawer" size="1080px" title="更换卡背景" :visible.sync="drawer" :before-close="handleClose">
<div class="market-container">
<div class="help-drawer-h4">预览</div>
<div class="drawer-overview">
<img :src="require(`@/assets/img/home/card${selectIndex}.png`)" alt="" />
</div>
<div class="help-drawer-h4">名片模板</div>
<div class="drawer-card">
<div @click="selectIndex = item" v-for="item in 4" :key="item" :class="{ 'card-item': true, 'card-checked': selectIndex == item }">
<img :src="require(`@/assets/img/home/card${item}.png`)" alt="" />
<i class="el-icon-success" v-if="selectIndex == item"></i>
</div>
</div>
</div>
<div class="drawer-btn">
<el-button @click="drawer = false" size="small">
取消
</el-button>
<el-button type="primary" @click="handleSaveConfig" size="small">提交</el-button>
</div>
</el-drawer>
</div>
</template>
<script>
export default {
name: 'marketConfig',
data() {
return {
selectIndex: 1,
drawer: false
}
},
methods: {
init(idx) {
this.selectIndex = idx
this.drawer = true
},
handleSaveConfig() {
this.drawer = false
this.$emit('cardConfigChecked', this.selectIndex)
}
}
}
</script>
<style lang="scss" scoped>
.help-drawer {
/deep/ .el-drawer__header {
border-bottom: 1px solid #e6e6e6;
padding: 18px 20px;
margin-bottom: 20px;
font-size: 20px;
}
.market-container {
padding: 20px;
height: calc(100vh - 164px);
overflow: auto;
.help-drawer-h4 {
font-size: 14px;
color: #666666;
line-height: 20px;
font-weight: 500;
margin-bottom: 10px;
}
.drawer-overview {
height: 304px;
width: auto;
margin-bottom: 20px;
img {
width: auto;
height: 100%;
}
}
.drawer-card {
display: flex;
.card-item {
cursor: pointer;
width: 224px;
height: 224px;
background: #ffffff;
border-radius: 8px;
border: 1px solid #e5e5e5;
margin-right: 24px;
padding: 16px;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
img {
width: 100%;
height: auto;
}
&.card-checked {
box-shadow: 0px 6px 12px 0px rgba(0, 0, 0, 0.1);
border: 1px solid #5850ff;
position: relative;
i {
position: absolute;
top: 6px;
right: 6px;
color: #5850ff;
font-size: 16px;
}
}
&:last-child {
margin-right: 0px;
}
}
}
}
.drawer-btn {
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 20px;
height: 64px;
border-top: 1px solid #e6e6e6;
}
}
</style>