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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<template>
<div class="container">
<div class="title">
<span>大转盘抽奖</span>
</div>
<div class="active">
<template v-for="(item, index) in activeList">
<div
v-if="index < wheelActive_limit"
class="list"
:key="item.id"
@click="toDetail(item.id, item.activityType)"
>
<div class="left">
<img :src="item.logo" alt="logo" style="width:100%;height:100%;" />
</div>
<div class="right">
<h3>{{ item.activityName }}</h3>
<p>{{ item.des }}</p>
</div>
</div>
</template>
<span
class="more"
v-if="activeList.length && !activeList_finished"
@click="handleWheelActiveMore"
>
查看更多
<span class="icon">></span>
</span>
</div>
<div v-if="couponList.length > 0" class="fg">送券活动</div>
<div class="active">
<div
class="list"
v-for="item in couponList"
:key="item.id"
@click="toDetail(item.id, item.activityType)"
>
<div class="left"></div>
<div class="right">
<h3>{{ item.activityName }}</h3>
<p>{{ item.des }}</p>
</div>
</div>
</div>
</div>
</template>
<script>
import * as API_Active from "@/api/active";
export default {
data() {
return {
wheelActive_limit: 3,
activeList_finished: false,
activeList: [
{
id: 1,
activityType: "coupon",
activityName: "砍价",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
},
{
id: 2,
activityType: "wheel",
activityName: "集赞",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
}
],
couponList: [
{
id: 1,
activityType: "coupon",
activityName: "砍价",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
},
{
id: 2,
activityType: "wheel",
activityName: "集赞",
des: "由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状。"
}
],
params: {
pageNo: 1,
pageSize: 10
}
};
},
mounted() {
this.getActiveList(this.params);
},
methods: {
handleWheelActiveMore() {
this.wheelActive_limit += 3;
if (this.wheelActive_limit === this.activeList.length - 3) {
this.activeList_finished = true;
return;
}
},
// 获取 活动列表
getActiveList(params) {
API_Active.getActiveList(params).then(res => {
console.log("获取到数据");
this.activeList = res.data.list;
});
},
// 跳转到 活动详情
toDetail(active_id, type) {
this.$router.push({
path: "/activeDetail",
query: {
id: active_id,
active_type: type
}
});
}
}
};
</script>
<style scoped>
.more {
float: right;
margin-bottom: 5px;
font-size: 12px;
}
.container {
height: auto;
background-color: rgba(248, 248, 248, 1);
min-height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
.title {
height: 44px;
background: rgba(248, 248, 248, 1);
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 16px;
font-size: 12px;
color: rgba(45, 71, 106, 1);
}
.fg {
padding: 0 16px;
font-size: 12px;
color: rgba(45, 71, 106, 1);
height: 44px;
line-height: 44px;
}
.icon {
font-weight: 800;
}
.active {
background-color: #fff;
padding: 12px 12px 0 12px;
box-shadow: 0px 2px 4px 0px rgba(221, 221, 221, 1);
}
.list {
height: 94px;
width: 100%;
background-color: #fff;
display: flex;
justify-content: space-between;
border-bottom: 1px solid rgba(238, 238, 238, 1);
margin-bottom: 14px;
}
.list3 {
border-bottom: none;
margin-bottom: 0;
}
.left,
.right {
height: 80px;
}
.left {
width: 80px;
background: rgba(248, 248, 248, 1);
}
.right {
width: 76%;
padding-left: 10px;
background-color: #fff;
}
h3 {
font-size: 14px;
font-weight: bold;
color: rgba(45, 71, 106, 1);
}
p {
margin-top: 10px;
font-size: 12px;
color: rgba(45, 71, 106, 0.8);
}
</style>