Publicity.vue
1.95 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
<template>
<div class="c-Publicity">
<el-carousel
height="50px"
:autoplay="true"
indicator-position="none"
arrow="never"
:interval="3000"
>
<el-carousel-item v-for="item in message" :key="item.key">
<div class="item" :class="{ actiname: item.key === 0 }">
<span v-if="item.title" class="title"> {{ item.title }}</span>
<span v-if="item.value" class="value">
{{ item.value }}
</span>
</div>
</el-carousel-item>
</el-carousel>
</div>
</template>
<script>
import { conversionCategoryName } from '@/helper/index';
export default {
name: 'Publicity',
computed: {
config() {
return this.$store.state.config;
},
result() {
return this.$store.state.result;
},
list() {
return this.$store.state.list;
},
message() {
const { result, config, list } = this;
const fields = Object.keys(config);
let message = [{ key: 0, title: config.name }];
fields.forEach((item, index) => {
let label = conversionCategoryName(item);
if (result[item] && config[item] > 0) {
message.push({
key: index + 1,
title: `${label}抽奖结果:`,
value: `${
result[item].length > 0
? list
.filter(v => result[item].indexOf(v.key) > -1)
.map(v => v.name)
.join('、')
: '暂未抽取'
}`
});
}
});
return message;
}
}
};
</script>
<style lang="scss">
.c-Publicity {
height: 100%;
// width: 1000px;
margin: 0 auto;
position: relative;
overflow: hidden;
.item {
text-align: center;
color: #fff;
font-size: 16px;
.title {
color: #f1d192;
}
.value {
margin-left: 10px;
}
&.actiname {
.title {
color: #fff;
font-size: 20px;
}
}
}
}
</style>