|
@@ -1,7 +1,6 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="index-box">
|
3
|
|
- <popup :show="showPopup" @cancel="cancelFrom" />
|
4
|
|
- <!-- <SaveShare :show="sSaveSharehowPopup" @cancel="cancelFrom" /> -->
|
|
3
|
+ <popup :show="showPopup" @cancel="cancelFrom" :current-month="currentMonth" />
|
5
|
4
|
<div>
|
6
|
5
|
<div>
|
7
|
6
|
<img class="topImage" src="../assets/hareTop.png" alt />
|
|
@@ -9,13 +8,13 @@
|
9
|
8
|
</div>
|
10
|
9
|
<div class="outer6-wrapper">
|
11
|
10
|
<div class="outer6 flex-col">
|
12
|
|
- <div v-for="item in indexJPG" :key="item" class="section-item">
|
13
|
|
- <div @click="baga">
|
14
|
|
- <img class="section-item-image" src="../assets/coverIndex.jpg" />
|
15
|
|
- <!-- <img
|
|
11
|
+ <div v-for="month in list" :key="month.id" class="section-item">
|
|
12
|
+ <div @click="handleMonthClick(month)">
|
|
13
|
+ <!-- <img class="section-item-image" src="../assets/coverIndex.jpg" /> -->
|
|
14
|
+ <img
|
16
|
15
|
:class="`section-item-image ${!showPopup?'backImag':''}` "
|
17
|
16
|
src="../assets/popupImg/backImag.jpg"
|
18
|
|
- />-->
|
|
17
|
+ />
|
19
|
18
|
</div>
|
20
|
19
|
</div>
|
21
|
20
|
</div>
|
|
@@ -25,6 +24,109 @@
|
25
|
24
|
|
26
|
25
|
<script>
|
27
|
26
|
import { useModel } from '@/store'
|
|
27
|
+import { drawLottery, getPrizeList } from '@/services/person'
|
|
28
|
+import { rand, shuffle } from '@/utils/math'
|
|
29
|
+import { hideLoading } from '@/utils'
|
|
30
|
+
|
|
31
|
+// 月份信息
|
|
32
|
+const monthList = [
|
|
33
|
+ {
|
|
34
|
+ id: 1,
|
|
35
|
+ posterImg: '',
|
|
36
|
+ popImg: '',
|
|
37
|
+ shareImg: '',
|
|
38
|
+ screenImg: '',
|
|
39
|
+ calendarImg: ''
|
|
40
|
+ },
|
|
41
|
+ {
|
|
42
|
+ id: 2,
|
|
43
|
+ posterImg: '',
|
|
44
|
+ popImg: '',
|
|
45
|
+ shareImg: '',
|
|
46
|
+ screenImg: '',
|
|
47
|
+ calendarImg: ''
|
|
48
|
+ },
|
|
49
|
+ {
|
|
50
|
+ id: 3,
|
|
51
|
+ posterImg: '',
|
|
52
|
+ popImg: '',
|
|
53
|
+ shareImg: '',
|
|
54
|
+ screenImg: '',
|
|
55
|
+ calendarImg: ''
|
|
56
|
+ },
|
|
57
|
+ {
|
|
58
|
+ id: 4,
|
|
59
|
+ posterImg: '',
|
|
60
|
+ popImg: '',
|
|
61
|
+ shareImg: '',
|
|
62
|
+ screenImg: '',
|
|
63
|
+ calendarImg: ''
|
|
64
|
+ },
|
|
65
|
+ {
|
|
66
|
+ id: 5,
|
|
67
|
+ posterImg: '',
|
|
68
|
+ popImg: '',
|
|
69
|
+ shareImg: '',
|
|
70
|
+ screenImg: '',
|
|
71
|
+ calendarImg: ''
|
|
72
|
+ },
|
|
73
|
+ {
|
|
74
|
+ id: 6,
|
|
75
|
+ posterImg: '',
|
|
76
|
+ popImg: '',
|
|
77
|
+ shareImg: '',
|
|
78
|
+ screenImg: '',
|
|
79
|
+ calendarImg: ''
|
|
80
|
+ },
|
|
81
|
+ {
|
|
82
|
+ id: 7,
|
|
83
|
+ posterImg: '',
|
|
84
|
+ popImg: '',
|
|
85
|
+ shareImg: '',
|
|
86
|
+ screenImg: '',
|
|
87
|
+ calendarImg: ''
|
|
88
|
+ },
|
|
89
|
+ {
|
|
90
|
+ id: 8,
|
|
91
|
+ posterImg: '',
|
|
92
|
+ popImg: '',
|
|
93
|
+ shareImg: '',
|
|
94
|
+ screenImg: '',
|
|
95
|
+ calendarImg: ''
|
|
96
|
+ },
|
|
97
|
+ {
|
|
98
|
+ id: 9,
|
|
99
|
+ posterImg: '',
|
|
100
|
+ popImg: '',
|
|
101
|
+ shareImg: '',
|
|
102
|
+ screenImg: '',
|
|
103
|
+ calendarImg: ''
|
|
104
|
+ },
|
|
105
|
+ {
|
|
106
|
+ id: 10,
|
|
107
|
+ posterImg: '',
|
|
108
|
+ popImg: '',
|
|
109
|
+ shareImg: '',
|
|
110
|
+ screenImg: '',
|
|
111
|
+ calendarImg: ''
|
|
112
|
+ },
|
|
113
|
+ {
|
|
114
|
+ id: 11,
|
|
115
|
+ posterImg: '',
|
|
116
|
+ popImg: '',
|
|
117
|
+ shareImg: '',
|
|
118
|
+ screenImg: '',
|
|
119
|
+ calendarImg: ''
|
|
120
|
+ },
|
|
121
|
+ {
|
|
122
|
+ id: 12,
|
|
123
|
+ posterImg: '',
|
|
124
|
+ popImg: '',
|
|
125
|
+ shareImg: '',
|
|
126
|
+ screenImg: '',
|
|
127
|
+ calendarImg: ''
|
|
128
|
+ }
|
|
129
|
+]
|
28
|
130
|
|
29
|
131
|
export default {
|
30
|
132
|
name: 'Honghe',
|
|
@@ -34,9 +136,12 @@ export default {
|
34
|
136
|
},
|
35
|
137
|
data() {
|
36
|
138
|
return {
|
37
|
|
- indexJPG: new Array(12).fill(null),
|
|
139
|
+ list: shuffle(monthList),
|
|
140
|
+ currentMonth: null,
|
38
|
141
|
showPopup: false,
|
39
|
|
- sSaveSharehowPopup: false
|
|
142
|
+ prizeList: [],
|
|
143
|
+ clickNum: 0,
|
|
144
|
+ bingoClickNum: rand(0, 12)
|
40
|
145
|
}
|
41
|
146
|
},
|
42
|
147
|
computed: {
|
|
@@ -49,22 +154,56 @@ export default {
|
49
|
154
|
}
|
50
|
155
|
}
|
51
|
156
|
},
|
52
|
|
- watch: {
|
53
|
|
- person: {
|
54
|
|
- handler(val) {
|
55
|
|
- console.log('-----watch---person----', val)
|
56
|
|
- },
|
57
|
|
- immediate: true
|
58
|
|
- }
|
|
157
|
+ created() {
|
|
158
|
+ this.getPrizes()
|
59
|
159
|
},
|
60
|
160
|
methods: {
|
61
|
161
|
//关闭
|
62
|
162
|
cancelFrom() {
|
63
|
163
|
this.showPopup = false
|
64
|
164
|
},
|
65
|
|
- baga(e) {
|
66
|
|
- console.log(e)
|
67
|
|
- this.showPopup = true
|
|
165
|
+ handleMonthClick(month) {
|
|
166
|
+ this.currentMonth = month
|
|
167
|
+
|
|
168
|
+ // 如果点击可以抽奖
|
|
169
|
+ if (this.clickNum === this.bingoClickNum) {
|
|
170
|
+ if (!this.person.personId) {
|
|
171
|
+ // 报错, 提示刷新页面
|
|
172
|
+ } else {
|
|
173
|
+ // 如果还没有参与
|
|
174
|
+ if (!this.person.isJoined) {
|
|
175
|
+ this.drawLots()
|
|
176
|
+ } else {
|
|
177
|
+ this.showPopup = true
|
|
178
|
+ }
|
|
179
|
+ }
|
|
180
|
+ } else {
|
|
181
|
+ this.showPopup = true
|
|
182
|
+ }
|
|
183
|
+
|
|
184
|
+ if (this.clickNum < this.bingoClickNum) {
|
|
185
|
+ this.clickNum += 1
|
|
186
|
+ }
|
|
187
|
+ },
|
|
188
|
+ // 抽奖
|
|
189
|
+ drawLots() {
|
|
190
|
+ drawLottery(this.person).then((res) => {
|
|
191
|
+ // 更新人员信息
|
|
192
|
+ this.person = res
|
|
193
|
+
|
|
194
|
+ // 其他动作
|
|
195
|
+ })
|
|
196
|
+ },
|
|
197
|
+ // 获取奖品列表
|
|
198
|
+ getPrizes() {
|
|
199
|
+ getPrizeList().then((list) => {
|
|
200
|
+ this.prizeList = list
|
|
201
|
+
|
|
202
|
+ const t = setTimeout(() => {
|
|
203
|
+ hideLoading()
|
|
204
|
+ clearTimeout(t)
|
|
205
|
+ }, 1000)
|
|
206
|
+ })
|
68
|
207
|
}
|
69
|
208
|
}
|
70
|
209
|
}
|