This commit is contained in:
yangtao 2024-04-02 19:42:57 +08:00
parent 31ff194388
commit 458f7cd79c
10 changed files with 499 additions and 8 deletions

View File

@ -792,4 +792,44 @@ export function queryBankCard(data) {
*/ */
export function queryCNAPS(data) { export function queryCNAPS(data) {
return request.post('intention/interbank', data, {noAuth: true}) return request.post('intention/interbank', data, {noAuth: true})
} }
/**
* 获取弹窗广告
* @param object data
*
*/
export function getHomePop() {
return request.get('home_pop', {}, {noAuth: true})
}
/**
* 获取幸运抽奖次数
* @param object data
*
*/
export function getWhellNumber() {
return request.get('wheel/info', {}, {noAuth: true})
}
/**
* 获取幸运抽奖配置
* @param object data
*
*/
export function getWhellConfig() {
return request.get('wheel/config', {}, {noAuth: true})
}
/**
* 获取幸运抽奖中奖记录
* @param object data
*
*/
export function getWhellList() {
return request.get('wheel/lst', {}, {noAuth: true})
}
/**
* 幸运抽奖开始抽奖
* @param object data
*
*/
export function getWhellAction() {
return request.get('wheel/create', {}, {noAuth: true})
}

View File

@ -219,12 +219,9 @@ export function throttle(fn, delay) {
var delay = delay || 200; var delay = delay || 200;
return function(...args) { return function(...args) {
lastArgs = args; lastArgs = args;
console.log('没进来');
if(!timer){ if(!timer){
console.log('进来了');
timer = setTimeout(()=>{ timer = setTimeout(()=>{
timer = null; timer = null;
console.log('节----');
fn.apply(this, lastArgs); fn.apply(this, lastArgs);
}, delay); }, delay);
} }

30
package-lock.json generated
View File

@ -2,5 +2,33 @@
"name": "DS", "name": "DS",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": {} "packages": {
"": {
"dependencies": {
"@lucky-canvas/uni": "^0.0.13",
"uni-luck-draw": "^1.3.9"
}
},
"node_modules/@lucky-canvas/uni": {
"version": "0.0.13",
"resolved": "https://registry.npmjs.org/@lucky-canvas/uni/-/uni-0.0.13.tgz",
"integrity": "sha512-rtudKkWgGY+Uj+1xvZJqbQ/NMGGvge/os0cypj12EO6RK8ZX0NKVR97SxEsFG7mn96cDn96tCg12MwmYQHkB9g==",
"dependencies": {
"lucky-canvas": "~1.7.19"
}
},
"node_modules/lucky-canvas": {
"version": "1.7.27",
"resolved": "https://registry.npmjs.org/lucky-canvas/-/lucky-canvas-1.7.27.tgz",
"integrity": "sha512-Ftz6qD+863bI7xijBmZg3dw3cNEc7odPr70EZQcGA14y3TgTAzH65HPosOCd6kKUlMwhntBaHMx3onoj9MtJRQ=="
},
"node_modules/uni-luck-draw": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/uni-luck-draw/-/uni-luck-draw-1.3.9.tgz",
"integrity": "sha512-n0uUHeHL91lUpeoTYE1b6dWyYCdFfN64wGd0v/x8qyacUVbKGGP+QzdcxniVBmFM8Ycgixvxro0cMY6Hag/mQg==",
"dependencies": {
"lucky-canvas": "^1.5.3"
}
}
}
} }

View File

@ -1 +1,6 @@
{} {
"dependencies": {
"@lucky-canvas/uni": "^0.0.13",
"uni-luck-draw": "^1.3.9"
}
}

View File

@ -240,6 +240,12 @@
"navigationBarTitleText": "签到记录" "navigationBarTitleText": "签到记录"
} }
}, },
{
"path": "user_luckyDraw/index",
"style": {
"navigationBarTitleText": "幸运抽奖"
}
},
{ {
"path": "user_money/index", "path": "user_money/index",
"style": { "style": {

View File

@ -245,6 +245,12 @@
<view class='iconfont icon-guanbi3' @click="showCoupon = false"></view> <view class='iconfont icon-guanbi3' @click="showCoupon = false"></view>
</view> </view>
</view> </view>
<view class="coupon_popups" v-if="isADPopup&&popList.length">
<view class="bg"></view>
<view class="con" :style="{ 'background-image': `url(${popList[0].pic})` ,'background-size':'100%'}" @click="toNav(popList[0].url)">
<view class='iconfont icon-guanbi3' @click.stop="isADPopup = false"></view>
</view>
</view>
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<passwordPopup></passwordPopup> <passwordPopup></passwordPopup>
<!-- #endif --> <!-- #endif -->
@ -257,7 +263,7 @@
var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'; var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
let app = getApp(); let app = getApp();
import { getUserInfo } from '@/api/user.js'; import { getUserInfo,getHomePop } from '@/api/user.js';
import { getDiy, getPageDiy, getIndexData, getAppVersion } from '@/api/api.js'; import { getDiy, getPageDiy, getIndexData, getAppVersion } from '@/api/api.js';
import { getNavigation } from '@/api/public.js'; import { getNavigation } from '@/api/public.js';
import { getStorage } from '@/libs/uniApi.js'; import { getStorage } from '@/libs/uniApi.js';
@ -356,6 +362,7 @@ export default {
data() { data() {
return { return {
domain: HTTP_REQUEST_URL, domain: HTTP_REQUEST_URL,
isADPopup:true,
couponTypeMsg:{ couponTypeMsg:{
10: '通用券', 10: '通用券',
11: '品类券', 11: '品类券',
@ -434,7 +441,8 @@ export default {
overflow: false, overflow: false,
diyId: 0, diyId: 0,
preview: false, preview: false,
isSupport: true isSupport: true,
popList:[],
}; };
}, },
/** /**
@ -479,6 +487,7 @@ export default {
} }
}); });
}) })
that.getPopConfig();
that.pageLoad(options); that.pageLoad(options);
}, },
created(options) { created(options) {
@ -530,6 +539,19 @@ export default {
// #endif // #endif
}, },
methods: { methods: {
toNav(url){
this.isADPopup=false;
uni.navigateTo({
url
})
},
getPopConfig(){
getHomePop().then((res)=>{
if(res){
this.popList=res.data.list;
}
})
},
goCopyright(url){ goCopyright(url){
this.$util.JumpPath(url); this.$util.JumpPath(url);
}, },

View File

@ -68,6 +68,13 @@
<view class='earn'>赚积分</view> <view class='earn'>赚积分</view>
</view> </view>
<!--#endif--> <!--#endif-->
<navigator class='item acea-row row-between-wrapper' hover-class='none' url='/pages/users/user_luckyDraw/index'>
<view class='pictrue'>
<image :src='`${domain}/static/images/score.png`'></image>
</view>
<view class='name'>轮盘抽奖可获得积分奖励</view>
<view class='earn'>去抽奖</view>
</navigator>
</view> </view>
</view> </view>
</view> </view>

View File

@ -0,0 +1,386 @@
<template>
<view class="content">
<view class="bg">
<view class="rule">
<text>活动规则</text>
</view>
<view class="top">
</view>
<view class="lucky-draw">
<view class="title">
恭喜你获得 {{wheel}} 次抽奖机会
</view>
<LuckyWheel ref="myLucky" width="600rpx" height="600rpx" :blocks="blocks" :prizes="prizes"
:buttons="buttons" :defaultStyle="defaultStyle" @start="startCallBack" @end="endCallBack" :defaultConfig="defaultConfig" />
</view>
<view class="lucky-draw-info">
<view class="title">
- 抽奖纪录 -
</view>
<view class="list">
<view class="item" v-for="item in list">
<view>{{item.create_time}}</view>
<view>{{item.title}}</view>
</view>
</view>
</view>
</view>
<view class="coupon_popups" v-if="popShow">
<view class="bg2"></view>
<view class="con" >
<view class="content">
<image :src="drawInfo.img" mode=""></image>
<view class="text-black">恭喜您获得</view>
<view class="text-red">{{drawInfo.text}}</view>
<view class="btn" @click="popShow = false">开心收下</view>
</view>
<view class='iconfont icon-guanbi3' @click="popShow = false"></view>
</view>
</view>
</view>
</template>
<script>
import {getWhellNumber,getWhellConfig,getWhellAction,getWhellList} from '@/api/user.js'
import LuckyWheel from 'uni-luck-draw/lucky-wheel'
export default {
components: {
LuckyWheel
},
data() {
return {
wheel:0,
blocks: [{
padding: '4px',
imgs:[{src:'https://plus.hwms.shop/uploads/def/20240402/9bcfea91fd2ebc06cc9eea5de95d624e.png', width: '100%',
height: '100%'}]
},{
padding:'14px',
imgs:[{src:'https://plus.hwms.shop/uploads/def/20240402/db41a1225c12cfb7a0d429fab8397fe5.png', width: '100%',
height: '100%'}]
}],
prizes: [{
fonts: [{
text: '0',
top: '40%'
}],
background: '#faf7d5',
imgs:[{src:'https://plus.hwms.shop/uploads/def/20240402/de991ebf4c190afcc5de692a910949f4.png',width:'25px',height:'25px',top:'10%'}]
},
{
fonts: [{
text: '1',
top: '10%'
}],
background: '#FC3E8F'
},
{
fonts: [{
text: '2',
top: '10%'
}],
background: '#faf7d5'
},
{
fonts: [{
text: '3',
top: '10%'
}],
background: '#FC3E8F'
},
{
fonts: [{
text: '4',
top: '10%'
}],
background: '#faf7d5'
},
{
fonts: [{
text: '5',
top: '10%'
}],
background: '#FC3E8F'
},
],
buttons: [{
radius: '50px',
// background: '#e81c47',
imgs:[{src:'https://plus.hwms.shop/uploads/def/20240402/25da054fc2f6c52349bb193ee4919e6c.png',width: '100%',
top: '-190%'}],
// pointer: true,
},
{
radius: '45px',
background: '#faf7d5'
},
{
radius: '40px',
imgs:[{src:'https://plus.hwms.shop/uploads/def/20240402/1e1ce5f047e6282554200f316b975c06.png',width: '100%',
top: '-100%'}],
// background: linear-gradient( #F8A059 0%, #E22B70 100%)',
// background: '#ec4656',
// pointer: true,
fonts: [{
text: '开始\n抽奖',
top: '-20px',
fontColor:'#fff',
}]
},
],
defaultConfig: {
gutter: '5px',
speed: 60,
stopRange:'0.95'
},
popShow:false,
list:[],
drawInfo:{
img:'',
text:'',
}
}
},
onLoad() {
this.init()
},
methods: {
init(){
getWhellNumber().then((res)=>{
if(res){
this.wheel=res.data.userInfo.wheel;
}
})
getWhellConfig().then((res)=>{
let ary=res.data;
this.prizes.map((e,index)=>{
ary.map((e2,index2)=>{
if(index==index2){
e.fonts[0].text=e2.value.title;
e.fonts[0].top='40%';
e.fonts[0].fontSize='14px';
e.imgs=[];
e.imgs.push({src:e2.value.icon,width:'25px',height:'25px',top:'10%'})
}
})
})
})
getWhellList().then((res)=>{
if(res){
this.list=res.data.list;
}
})
},
//
async startCallBack() {
if(this.wheel>0){
//
this.$refs.myLucky.play()
await getWhellAction().then((res)=>{
if(res){
this.drawInfo.img=res.data.win.value.icon;
this.drawInfo.text=res.data.win.value.title;
// 使
const index = res.data.win.winKey;
setTimeout(() => {
// 0
// stop
this.$refs.myLucky.stop(index)
},5000)
}
})
}
},
//
endCallBack(prize) {
setTimeout(()=>{
this.popShow=true;
},2000)
//
console.log(prize)
}
}
}
</script>
<style lang="less" scoped>
.content {
width: 100%;
height: 100vh;
.coupon_popups{
z-index: 999;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
text-align: center;
.bg2{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,.5);
}
.con{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 680rpx;
height: 900rpx;
background-size: 100% 700rpx;
background-repeat: no-repeat;
.content{
width: 500rpx;
height: 520rpx;
border-radius: 20rpx;
margin: 0 auto;
background-color: white;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
grid-gap: 40rpx;
image{
width: 300rpx;
height: 200rpx;
margin-top: 50rpx;
}
.text-black{
font-size: 32rpx;
font-weight: bold;
}
.text-red{
font-size: 28rpx;
color: #FC3C70;
}
.btn{
color: white;
margin-bottom: 40rpx;
width: 328rpx;
height: 68rpx;
line-height: 68rpx;
padding: 4rpx 0;
border-radius: 60rpx;
background: linear-gradient(136deg, #D753FC 0%, #FC276C 53%, #FC3E8F 100%);
}
}
.text{
width: 600rpx;
margin: 30rpx auto 0;
font-size: 20rpx;
color: #ffffff;
}
.icon-guanbi3{
color: #ffffff;
font-size: 70rpx;
position: absolute;
bottom: 250rpx;
left: 310rpx;
}
}
}
.bg {
width: 100%;
// height: 100vh;
background-image: url('https://plus.hwms.shop/uploads/def/20240402/de991ebf4c190afcc5de692a910949f4.png');
background-size: 100% 100%;
position: relative;
padding-bottom: 40rpx;
.rule {
width: 80rpx;
height: 120rpx;
background-image: url(@/static/images/right-btn.png);
background-size: 100%;
background-repeat: no-repeat;
position: absolute;
right: 0;
top: 320rpx;
// text-align: center;
display: flex;
align-items: center;
justify-content: center;
text {
width: 56rpx;
height: 80rpx;
font-family: PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #DC3424;
line-height: 36rpx;
}
}
.top{
height: 330rpx;
}
.lucky-draw{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.title{
position: relative;
bottom: 20rpx;
width:60%;
height: 50rpx;
font-family: PingFang SC;
font-weight: 400;
font-size: 32rpx;
color: #FFFFFF;
margin: 20rpx 0;
line-height: 54rpx;
text-align: center;
background: url('@/static/images/font-bg.png') no-repeat 100%;
background-position: center;
}
}
.lucky-draw-info{
margin: 80rpx auto;
width: 680rpx;
height: 440rpx;
background-color: white;
display: flex;
flex-direction: column;
border-radius: 32rpx;
.title{
text-align: center;
font-size: 36rpx;
color: #FC3C70;
line-height: 72rpx;
}
.list{
flex: 1;
overflow: scroll;
display: flex;
flex-direction: column;
grid-gap: 20rpx;
.item{
font-size: 32rpx;
font-weight: bold;
padding: 10rpx 20rpx;
width: 100%;
display: flex;
justify-content: space-between;
}
}
}
}
}
</style>

BIN
static/images/font-bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
static/images/right-btn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB