giveAwhirl.vue
7.51 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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<template>
<!-- 试一试 -->
<view class="giveAwhirl">
<!-- 画布盒子 -->
<view class="canvasBox">
<!-- 后退 -->
<view class="retreat" @click="retreat">
<u-icon color="white" size="45" name="arrow-left"></u-icon>
</view>
<!-- 卡片 -->
<view class="canvasBoxCard">
<uni-transition :mode-class="['fade','zoom-in']" :show="!TorF" :duration="1000">
<!-- 结果物品 -->
<view class="resultGoods" v-if="!TorF">
<!-- 恭喜 -->
<view class="congratulation">
<image class="congratulationImg" :src="require('@/static/congratulation.png')" mode=""></image>
</view>
<!-- 物品信息 -->
<view class="goodsMsg">
<!-- 商品图片 -->
<view class="goods">
<img class="goodsImg" :src="isGoods[0].productPic" alt="">
</view>
<!-- 参数 -->
<view class="parameter">
<!-- 标签 -->
<view class="label">
SSR至尊款
</view>
<!-- 价格-->
<view class="parameterPrice" v-if="isGoods[0]">
<p class="parameterName">{{isGoods[0].productName}}</p>
<p class="parameterReference">参考价¥ {{isGoods[0].productPrice}}</p>
</view>
</view>
</view>
</view>
</uni-transition>
<!-- 惊喜盒子 -->
<uni-transition :mode-class="['fade','zoom-in']" :show="TorF" :duration="1000">
<view @tap="$u.throttle(openBox, 2000)" :class="classLiftR" v-if="TorF">
<image class="surprisedBoxImg" :src="require('@/static/surprised.png')" mode=""></image>
</view>
</uni-transition>
</view>
<!-- 按钮试一试or来真的 -->
<uni-transition :mode-class="['fade','zoom-in']" :show="!TorF" :duration="1000">
<view class="btnTry" v-if="!TorF" @click="retreat">
来真的试一试
</view>
</uni-transition>
<uni-transition :mode-class="['fade','zoom-in']" :show="TorF" :duration="1000">
<view class="btnReally" v-if="TorF">
请点击魔盒
</view>
</uni-transition>
</view>
</view>
</template>
<script>
export default {
data() {
return {
// 盒子显示与隐藏
TorF:true,
// 上下 左右动画样式
classLiftR:"surprisedBox"
};
},
methods: {
// 返回购买页
retreat() {
this.$Router.back(1)
},
// 打开盒子
openBox(){
this.classLiftR="clileftR"
setTimeout(()=>{
this.TorF=!this.TorF
},1000)
}
},
//商品
computed: {
isGoods() {
return this.$store.state.pay.commoditys
}
}
}
</script>
<style lang="scss" scoped>
* {
margin: 0;
padding: 0;
}
// 上下抖动动画
@keyframes upDown{
0% {
transform: translateY(0);
}
25%{
transform: translateY(-20rpx);
}
50% {
transform: translateY(0);
}
75%{
transform: translateY(-20rpx);
}
100%{
transform: translateY(0rpx);
}
}
// 上下抖动动画
@keyframes leftR{
0% {
transform: rotateZ(0);
}
25%{
transform: rotateZ(15deg);
}
50% {
transform: rotateZ(-15deg);
}
75%{
transform: rotateZ(15deg);
}
100%{
transform: rotateZ(-15deg);
}
}
.clileftR{
width: 384rpx;
height: 353rpx;
animation: leftR 0.4s infinite;
transform: rotateZ(0deg);
.surprisedBoxImg{
width: 384rpx;
height: 353rpx;
}
}
.giveAwhirl {
width: 100vw;
height: 100vh;
background-image: url("~@/static/showbgd.png");
background-repeat: no-repeat;
background-size: cover;
display: flex;
justify-content: center;
//画布盒子
.canvasBox {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
position: relative;
flex-direction: column;
// 后退
.retreat {
padding: 15rpx;
background-color: rgba(0, 0, 0, 0.7);
position: absolute;
display: flex;
align-items: center;
justify-content: center;
top: var(--status-bar-height);
left: 50rpx;
}
// 卡片
.canvasBoxCard{
width: 680rpx;
height: 900rpx;
background-image: url("~@/static/kapian.png");
background-repeat: no-repeat;
background-size: contain;
margin-top: 250rpx;
border-radius: 30rpx;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 40rpx;
// 开出结果
.resultGoods{
width: 500rpx;
height: 650rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
// 恭喜
.congratulation{
width: 450rpx;
height: 70rpx;
.congratulationImg{
width: 450rpx;
height: 70rpx;
}
}
// 物品信息
.goodsMsg{
width: 450rpx;
height: 550rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
// 商品图片
.goods{
width: 450rpx;
height: 350rpx;
display: flex;
align-items: center;
justify-content: center;
.goodsImg{
width: 200rpx;
height: 300rpx;
background-color: seagreen;
}
}
// 参数
.parameter{
width: 500rpx;
height: 200rpx;
display: flex;
justify-content: flex-start;
flex-direction: column;
// 标签
.label{
width: 160rpx;
height: 50rpx;
background: linear-gradient(55deg, #03EBF1 0%, #C3FDFF 34%, #F8C6E7 69%, #FFFEE1 100%);
border-radius: 10rpx;
text-align: center;
line-height: 50rpx;
font-weight: 700;
}
.parameterPrice{
margin-top: 20rpx;
width: 370rpx;
height: 130rpx;
border: 1px solid black;
border-radius: 30rpx;
background-image: url("@/static/rightB.png");
background-position: right bottom;
background-color: white;
background-repeat: no-repeat;
background-size: 90rpx 80rpx;
padding: 10rpx 13rpx;
.parameterName{
font-size: 16px;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.parameterReference{
width: 220rpx;
height: 40rpx;
border-radius: 40rpx;
font-size: 14px;
color: white;
background-color: #1F64E8;
margin-top: 12rpx;
line-height: 40rpx;
font-weight: 600;
text-align: center;
padding: 8rpx 8rpx;
white-space: nowrap;
}
}
}
}
}
// 惊喜盒子
.surprisedBox{
width: 384rpx;
height: 353rpx;
animation: upDown 3s infinite;
transform: translateY(0);
.surprisedBoxImg{
width: 384rpx;
height: 353rpx;
}
}
}
// 按钮 来真的
.btnTry{
width: 420rpx;
height: 100rpx;
background: linear-gradient(129deg, #ffcdb0 15%, #F72934 100%);
line-height: 100rpx;
text-align: center;
font-size: 20px;
color: white;
font-weight: 700;
text-shadow: 0px 0px 10px rgba(127,1,1,0.5000);
}
// 按钮 试一试
.btnReally{
width: 420rpx;
height: 100rpx;
background: linear-gradient(129deg, #ffcdb0 15%, #F72934 100%);
line-height: 100rpx;
text-align: center;
font-size: 20px;
color: white;
font-weight: 700;
text-shadow: 0px 0px 10px rgba(127,1,1,0.5000);
}
}
}
</style>