You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhaozong1/pages/prize/index.vue

557 lines
102 KiB

8 months ago
<template>
<view class="conbox">
<view class="container">
<!-- 背景 -->
7 months ago
<image src="https://admin.njqicheng.cn/static/images/prizeBg.png" class="cont" mode=""></image>
8 months ago
<view>
7 months ago
<image src="https://admin.njqicheng.cn/static/images/prizeTitle.png" class="caidai" mode="widthFix"></image>
8 months ago
<view class="main">
<view class="canvas-container">
8 months ago
<image src="/static/images/shadow.png" mode="heightFix" class="shadow"></image>
8 months ago
<view :animation="animationData" class="canvas-content" id="zhuanpano" style="">
<!-- <image src="/static/images/prizeCir.png" class="pan" mode="widthFix"></image> -->
<!-- <view class="canvas-line">
<view class="canvas-litem" v-for="(item,index) in list" :key="index"
:style="{transform:'rotate('+(index * width + width / 2)+'deg)'}"></view>
</view> -->
<view class="canvas-list">
<view class="canvas-item" :style="{transform: 'rotate('+(index * width)+'deg)', zIndex:index, }" v-for="(iteml,index) in list" :key="index">
<view class="canvas-item-text" :style="'transform:rotate('+(index )+')'">
<text class="b" style="font-size: 28rpx;color: #C30B29;">{{iteml.type==2?'谢谢惠顾':iteml.type==3?'再抽一次':iteml.type==1?iteml.value+'钻石':''}}</text>
<!-- <text class="iconfont " :class="iteml.icon"></text> -->
</view>
</view>
</view>
</view>
8 months ago
<view @click="playReward" class="canvas-btn" v-bind:class="btnDisabled">
7 months ago
<image src="https://admin.njqicheng.cn/static/images/start.png" mode="widthFix"></image>
8 months ago
<text>开始<br/>抽奖</text>
</view>
</view>
</view>
8 months ago
<u-notice-bar :text="noticeList" direction="column" bgColor="#FF6600" color="#fff" fontSize="15"></u-notice-bar>
8 months ago
<view class="textInfo">
8 months ago
<u-parse :content="ruleText"></u-parse>
<!-- 活动最终解释权归平台所有活动最终解释权归平台所有活动最终解释权归平台所有活动最终解释权归平台所有活动最终解释权归平台所有 -->
8 months ago
</view>
<!-- 规则 -->
<!-- <view class="guize" style="margin-top: 100upx;">
<view class="title">
规则说明
</view>
<view class="g_item">
1.用户每天登录即送1次抽奖机会分享好友则多赠1次机会
</view>
<view class="g_item">
2.用户点击大转盘抽奖按钮有积分和现金两种方式可参与抽奖没抽一次消耗1次抽奖机会
</view>
<view class="g_item">
3.用户获得的奖品可在我的道具里查看
</view>
</view> -->
</view>
</view>
<u-popup :show="show" :round="15" mode="center" @close="close">
<view class="descContent">
<view class="closeTag">
<view class="title">
{{title}}
</view>
<view class="subTitle">
{{subTitle}}
</view>
<view class="status">
8 months ago
<!-- <image :src="image" mode="widthFix"></image> -->
7 months ago
<image src="https://admin.njqicheng.cn/static/images/2.png" v-if="type==1" mode="widthFix"></image>
<image src="https://admin.njqicheng.cn/static/images/3.png" v-if="type==2" mode="widthFix"></image>
<image src="https://admin.njqicheng.cn/static/images/1.png" v-if="type==3" mode="widthFix"></image>
8 months ago
8 months ago
</view>
<view class="btnGroup">
8 months ago
<view class="cancelBtn" @click="close">
8 months ago
取消
</view>
8 months ago
<view class="confirmBtn" v-if="type!=2" @click="prizeAgain">
8 months ago
继续抽
</view>
</view>
</view>
<view class="closeText" @click="close">×</view>
</view>
</u-popup>
</view>
</template>
<script>
import { getPrizeData,setPrizeApi } from '@/api/user.js';
export default {
data() {
return {
show:false,
list: [
],
width: 0,
animationData: {},
btnDisabled: '',
title:'',
subTitle:'',
8 months ago
type:1,
noticeList:[
'中奖公告183****8566中了20钻石',
'中奖公告152****2322中了20钻石',
'中奖公告181****5656中了20钻石',
'中奖公告152****8181中了20钻石',
'中奖公告136****2314中了20钻石',
'中奖公告196****5467中了20钻石',
'中奖公告132****7714中了20钻石',
'中奖公告132****7716中了20钻石',
'中奖公告185****4587中了20钻石',
'中奖公告182****6548中了20钻石',
'中奖公告183****5670中了20钻石',
'中奖公告161****0034中了20钻石',
],
ruleText:''
8 months ago
}
},
onLoad: function() {
this.getPrizeDataHandle()
},
methods: {
close() {
this.show = false
},
getPrizeDataHandle(){
getPrizeData().then(res=>{
8 months ago
this.list = res.data.list;
8 months ago
// 获取奖品列表
8 months ago
this.width = 360 / this.list.length;
this.ruleText = res.data.rule.the_lottery_rule2
8 months ago
})
},
animation(index, duration)
{
//中奖index
var list = this.list;
// var awardIndex = 1 || Math.round(Math.random() * (awardsNum.length - 1)); //随机数
var runNum = 4; //旋转8周
// 旋转角度
this.runDeg = this.runDeg || 0;
this.runDeg = this.runDeg + (360 - this.runDeg % 360) + (360 * runNum - index * (360 / list.length)) +1
//创建动画
var animationRun = uni.createAnimation({
duration: duration,
timingFunction: 'ease'
})
animationRun.rotate(this.runDeg).step();
this.animationData = animationRun.export();
this.btnDisabled = 'disabled';
},
8 months ago
prizeAgain(){
this.show=false;
setTimeout(()=>{
this.playReward()
},500)
},
8 months ago
//发起抽奖
playReward(){
8 months ago
8 months ago
setPrizeApi().then(res=>{
8 months ago
let index, duration = 3000
this.list.forEach((item,i)=>{
if(item.id==res.data.item.id){
console.log("yy",i)
index=i
}
})
8 months ago
this.animation(index, duration)
setTimeout(() => {
this.type=res.data.item.type
// 1钻石 2谢谢惠顾 3 再抽一次
if(res.data.item.type==1){
this.title="恭喜你,抽中";
this.subTitle = res.data.item.value+"钻石"
7 months ago
this.image = "https://admin.njqicheng.cn/static/images/2.png"
8 months ago
}else if(res.data.item.type==2){
this.title="很遗憾,没有抽中";
this.subTitle = "谢谢惠顾"
7 months ago
this.image = "https://admin.njqicheng.cn/static/images/3.png"
8 months ago
}else if(res.data.item.type==3){
this.title="恭喜你,抽中";
this.subTitle = "再抽一次"
7 months ago
this.image = "https://admin.njqicheng.cn/static/images/1.png"
8 months ago
}
this.show = true;
8 months ago
this.btnDisabled = '';
// document.getElementById('zhuanpano').style=''
8 months ago
}, duration + 1000)
}).catch(err=>{
uni.showToast({
title: err,
icon: 'none'
})
})
},
}
}
</script>
<style scoped lang="scss">
.conbox {
width: 750upx;
height: 100vh;
overflow-x: hidden;
overflow-y: scroll;
position: relative;
}
.container,
image.cont {
width: 750upx;
min-height: 100vh;
height: auto;
position: relative;
}
image.cont {
height: 100%;
position: absolute;
z-index: 0;
}
image.caidai {
position: absolute;
top: 40rpx;
left: 10%;
// width: 750upx;
// height: 1024upx;
width:80%;
height:auto;
}
.main{
position: relative;
padding-top: 35%;
.pan{
position: absolute;
width:100%;
height:auto;
}
}
/* 转盘 */
.canvas-container {
margin: 0 auto;
position: relative;
width: 600upx;
height: 600upx;
background-size: cover;
border-radius: 50%;
8 months ago
.shadow{
position: absolute;
height: 56rpx;
width: auto;
bottom: -26rpx;
left: 50%;
transform: translateX(-50%);
z-index: 1;
}
8 months ago
}
.canvas-content {
position: absolute;
left: 0;
top: 0;
z-index: 1;
display: block;
width: 600rpx;
height: 600rpx !important;
border-radius: inherit;
background-size: contain;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjkAAAI/CAYAAACVsshwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAHYYAAB2GAV2iE4EAAP+lSURBVHhe7J0JgBxHdff/1T3n3rtare5bsmRJli1btmXLtnzb2GCDbSDcN4SEhOtLQhIImJCEQC74vgRIIBByEHA4wun7BF/4wPcpWdZ9r649Z6bre6+61lqtdna65+yZfT+7NV01PbPdPd1V/3716j0IgiAIgiAIgiAIgiAIgiAIgiAIQu1Q9lUQBAH6SST0HvQghx6l3S446NRKd8FzOqB0G23STq1GK7RuhnLS0GiiT6WprgkeLQ7StE2KGhZXa5WgdUcpJPm7x6I1hujFo7Uh+jy9YpC+j+sGzaIwAK0OQ3l98FQflQ9R/UGqOwTHO6C02q8V9sPL9cLFbjWVlpUYpm0EQRAMInIEYRLA4gU7MFu7sTnwvDlwnTmkMmZSAzBN00Liooc2m0ZNQgeJkrpsF0g00aHoA7S6i45gNx3ELqqgdbUdOW8LHGeLymW3YAa2ihgShMmBiBxBaAD0p+Ho8zAHyl2soBdBq4V0dy+kTn4edf1Ur6bRze7YzSc1JIbYesRCaIvSeJmqNkLpjRpqA3TuRXUhNpPQo1MnCEK9IyJHE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o06SqhtX6BHj2+rOCxo/IEYREFobaIyBEih3crpsFx2WrzQRI31XHXZF+cpd8AFpCmKpX91BPed1LVUw3ULWztyJDI5IWn6nedSuduCRAjNZbZBfS/AOx9ABh4EGYWV
/* background-clip: padding-box; */
/* background-color: #ffcb3f; */
}
.canvas-list {
position: absolute;
left: 0;
top: 0;
width: inherit;
height: inherit;
z-index: 9999;
}
.canvas-item {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
color: #e4370e;
/* text-shadow: 0 1upx 1upx rgba(255, 255, 255, 0.6); */
}
.canvas-item-text {
position: relative;
padding-top: 100rpx;
margin: 0 auto;
text-align: center;
-webkit-transform-origin: 50% 156px;
transform-origin: 50% 300rpx;
display: flex;
flex-direction: column;
align-items: center;
color: #FB778B;
}
// .icon-awrad {
// font-size: 50upx !important;
// }
/* 分隔线 */
.canvas-line {
position: absolute;
left: 0;
top: 0;
width: inherit;
height: inherit;
z-index: 99;
}
.canvas-litem {
position: absolute;
left: 300upx;
top: 0;
width: 3upx;
height: 300upx;
background-color: rgba(228, 55, 14, 0.4);
overflow: hidden;
-webkit-transform-origin: 50% 300upx;
transform-origin: 50% 300upx;
}
/**
* 抽奖按钮
*/
.canvas-btn {
position: absolute;
left: 50%;
top: 50%;
z-index: 400;
width: 225rpx;
height: 253rpx;
border-radius: 50%;
transform: translate(-50%,-50%);
image{
width:100%;
height:auto;
}
text{
text-align: center;
position: absolute;
left: 50%;
top: 55%;
transform: translate(-50%,-50%);
display: block;
line-height: 60rpx;
font-size: 40rpx;
color: #FFFFFF;
}
}
// .canvas-btn::after {
// position: absolute;
// display: block;
// content: ' ';
// left: 12upx;
// top: -44upx;
// width: 0;
// height: 0;
// overflow: hidden;
// border-width: 30upx;
// border-style: solid;
// border-color: transparent;
// border-bottom-color: #e44025;
// }
// .canvas-btn.disabled {
// pointer-events: none;
// background: #b07a7b;
// color: #ccc;
// }
// .canvas-btn.disabled::after {
// border-bottom-color: #b07a7b;
// }
// 弹窗
::v-deep .u-popup__content{
background-color: transparent !important;
width:60%;
overflow: hidden;
text-align: center;
.closeTag{
background: linear-gradient(52deg, #FEEADF, #FEFBEA, #FFFCEE, #FFEBED);
padding:59rpx 38rpx 47rpx 38rpx;
border-radius: 15px;
.title{
font-family: Alibaba PuHuiTi;
font-weight: 400;
font-size: 36rpx;
color: #B7523E;
}
.subTitle{
font-family: Alibaba PuHuiTi;
font-weight: 400;
font-size: 60rpx;
color: #B7523E;
margin-top:34rpx;
}
.status{
margin-top:51rpx;
image{
width:179rpx;
height:auto;
}
}
.btnGroup{
margin-top:60rpx;
display: flex;
.cancelBtn{
8 months ago
flex:1;
8 months ago
background: rgba(255,255,255,0);
border-radius: 40px;
border: 1px solid #CCCCCC;
8 months ago
padding:25rpx 0rpx;
text-align: center;
8 months ago
font-family: Alibaba PuHuiTi;
font-weight: 400;
font-size: 30rpx;
color: #666666;
}
.confirmBtn{
8 months ago
flex:1;
8 months ago
background: linear-gradient(52deg, #FF3640, #FE7553);
border-radius: 40px;
8 months ago
padding:25rpx 0rpx;
text-align: center;
8 months ago
font-family: Alibaba PuHuiTi;
font-weight: 400;
font-size: 30rpx;
color: #FFFFFF;
margin-left: 23rpx;
}
}
}
.closeText{
width: 57rpx;
height: 57rpx;
border-radius: 50%;
border: 1px solid #FFFFFF;
font-size: 21px;
text-align: center;
line-height: 50rpx;
margin: 36rpx auto;
color: #fff;
}
}
// 规则
.textInfo{
font-family: Alibaba PuHuiTi;
font-weight: 400;
font-size: 26rpx;
color: #FFF8F8;
width:80%;
margin:60rpx auto;
position: relative;
line-height: 50rpx;
z-index: 9;
}
.guize {
width: 502upx;
min-height: 300upx;
display: flex;
flex-direction: column;
position: relative;
z-index: 3;
background-image: linear-gradient(-180deg, #F48549 0%, #F2642E 100%);
border: 18upx solid #E4431A;
border-radius: 16px;
margin: 0 auto;
margin-top: -104upx;
padding: 48upx;
/* box-sizing: border-box; */
color: #fff;
}
.guize .title {
text-align: center;
margin-bottom: 28upx;
}
.guize .g_item {
font-family: PingFang-SC-Medium;
font-size: 24upx;
color: #FFFFFF;
letter-spacing: 0.5px;
text-align: justify;
line-height: 20px;
}
.myrewards .title {
font-family: PingFang-SC-Bold;
font-size: 16px;
color: #E4431A;
letter-spacing: 0.57px;
display: flex;
padding-top: 36upx;
justify-content: center;
}
8 months ago
::v-deep .u-notice-bar{
position: relative;
z-index: 2;
margin: 0 24rpx;
padding: 30rpx !important;
margin-top: 78rpx;
}
8 months ago
</style>