抽奖接口已通
This commit is contained in:
parent
933bdc7f9e
commit
f55f3133cc
@ -40,6 +40,10 @@ import {
|
|||||||
} from "vue";
|
} from "vue";
|
||||||
import gsap from "gsap";
|
import gsap from "gsap";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import service from "@/api/httpServe";
|
||||||
|
import qs from "qs";
|
||||||
|
|
||||||
|
|
||||||
import { Toast } from "vant";
|
import { Toast } from "vant";
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
|
|
||||||
@ -73,16 +77,16 @@ const hide = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 立即领取红包
|
// 立即领取红包
|
||||||
const getMoney = ()=>{
|
const getMoney = ()=>{
|
||||||
|
redpacket()
|
||||||
|
|
||||||
gsap.to('.draw_container',{duration:0.3,scale:0,autoAlpha:0,onComplete:()=>{
|
gsap.to('.draw_container',{duration:0.3,scale:0,autoAlpha:0,onComplete:()=>{
|
||||||
drawStatus.value = false
|
drawStatus.value = false
|
||||||
isgetMoney.value = true
|
isgetMoney.value = true
|
||||||
|
gsap.form('.add_container',{duration:0.5,scale:0,autoAlpha:0,})
|
||||||
gsap.form('.add_container',{duration:0.3,scale:0,autoAlpha:0,})
|
|
||||||
|
|
||||||
|
|
||||||
}})
|
}})
|
||||||
|
|
||||||
@ -90,6 +94,22 @@ const getMoney = ()=>{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 领取接口
|
||||||
|
const redpacket = (prizeId) => {
|
||||||
|
let redpacketId = 84;
|
||||||
|
service
|
||||||
|
.post(
|
||||||
|
process.env.VUE_APP_API +
|
||||||
|
"/cms-activity/cms88/redpacket/receive/" +
|
||||||
|
redpacketId,
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
console.log("领取红包结果", res);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="indexPage">
|
<div class="indexPage">
|
||||||
<div class="indexCon">
|
<div class="indexCon">
|
||||||
<div class="logo"></div>
|
<div class="logo" @click="deleteData"></div>
|
||||||
<div class="title_main"></div>
|
<div class="title_main"></div>
|
||||||
<div class="cloud_left_1"></div>
|
<div class="cloud_left_1"></div>
|
||||||
<div class="cloud_right_1"></div>
|
<div class="cloud_right_1"></div>
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<div class="cloud_right_3"></div>
|
<div class="cloud_right_3"></div>
|
||||||
<div class="icon_right_1"></div>
|
<div class="icon_right_1"></div>
|
||||||
<div class="select_box"></div>
|
<div class="select_box"></div>
|
||||||
<div class="draw_btn" @click="drawBtn"></div>
|
<div class="draw_btn" :class="isDraw ? 'is_draw' : ''" @click="drawBtn"></div>
|
||||||
<div class="rule_btn" @click="showRluesBtn"></div>
|
<div class="rule_btn" @click="showRluesBtn"></div>
|
||||||
<div class="prize_btn" @click="showMyPrizePop"></div>
|
<div class="prize_btn" @click="showMyPrizePop"></div>
|
||||||
<div class="rule_btn_text"></div>
|
<div class="rule_btn_text"></div>
|
||||||
@ -169,7 +169,9 @@ const activityList = reactive([
|
|||||||
|
|
||||||
// 页面挂载前
|
// 页面挂载前
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
// 获取企微二维码
|
if( store.state.userAccount.isHasPrize.length != 0 ){
|
||||||
|
isDraw.value = true
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 入场动画
|
// 入场动画
|
||||||
@ -233,9 +235,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
// 抽奖按钮
|
// 抽奖按钮
|
||||||
const drawBtn = () => {
|
const drawBtn = () => {
|
||||||
console.log("抽奖:");
|
|
||||||
|
|
||||||
console.log(LuckyWheelCon.value);
|
|
||||||
|
|
||||||
if (!isDraw.value) {
|
if (!isDraw.value) {
|
||||||
// LuckyWheelCon.value.showDrawAni(3, true)
|
// LuckyWheelCon.value.showDrawAni(3, true)
|
||||||
@ -266,10 +266,13 @@ const hideRulesPop = () => {
|
|||||||
const showMyPrizePop = () => {
|
const showMyPrizePop = () => {
|
||||||
showMyPrize.value = true;
|
showMyPrize.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 关闭我的奖品中心弹窗
|
||||||
const myPrizePop = () => {
|
const myPrizePop = () => {
|
||||||
showMyPrize.value = false;
|
showMyPrize.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 关闭抽奖弹窗
|
||||||
const drawConFn = ()=>{
|
const drawConFn = ()=>{
|
||||||
showDrawCon.value = false
|
showDrawCon.value = false
|
||||||
}
|
}
|
||||||
@ -312,7 +315,6 @@ const getInfo = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 我的红包记录
|
// 我的红包记录
|
||||||
|
|
||||||
const getMyPrizeRecored = () => {
|
const getMyPrizeRecored = () => {
|
||||||
service
|
service
|
||||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/prize/list", {})
|
.post(process.env.VUE_APP_API + "/cms-activity/cms88/prize/list", {})
|
||||||
@ -342,37 +344,42 @@ const getluckyBag = (id) => {
|
|||||||
drawType.value = id;
|
drawType.value = id;
|
||||||
service
|
service
|
||||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/redpacket/draw", {
|
.post(process.env.VUE_APP_API + "/cms-activity/cms88/redpacket/draw", {
|
||||||
xglOpenId: store.state.userAccount.xglOpenid,
|
xglOpenId: store.state.userAccount.xglOpenId,
|
||||||
redpacketType: type,
|
redpacketType: type,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("抽取红包结果:", res);
|
console.log("抽取红包结果:", res);
|
||||||
|
|
||||||
|
let prizeNum = res.data.data.amount
|
||||||
|
|
||||||
// 判断抽奖类型drawType = 1时转动大转盘
|
// 判断抽奖类型drawType = 1时转动大转盘
|
||||||
if (drawType.value == 1) {
|
if (drawType.value == 1) {
|
||||||
// 判断抽奖结果状态
|
// 判断抽奖结果状态
|
||||||
if (res.data.code == 0) {
|
if (res.data.code == 0) {
|
||||||
// 大转盘正常抽奖
|
// 大转盘正常抽奖
|
||||||
if (res.data.data == 0) {
|
if (prizeNum == 0) {
|
||||||
// 谢谢参与
|
// 谢谢参与
|
||||||
|
console.log("抽中1:");
|
||||||
LuckyWheelCon.value.showDrawAni(5, true);
|
LuckyWheelCon.value.showDrawAni(5, true);
|
||||||
}
|
}
|
||||||
if (res.data.data == 1.88) {
|
if (prizeNum == 1.08) {
|
||||||
// 1.88元
|
// 1.88元
|
||||||
LuckyWheelCon.value.showDrawAni(1, true);
|
LuckyWheelCon.value.showDrawAni(1, true);
|
||||||
}
|
}
|
||||||
if (res.data.data == 2.68) {
|
if (prizeNum == 2.68) {
|
||||||
// 2.68元
|
// 2.68元
|
||||||
LuckyWheelCon.value.showDrawAni(2, true);
|
LuckyWheelCon.value.showDrawAni(2, true);
|
||||||
}
|
}
|
||||||
if (res.data.data == 6.66) {
|
if (prizeNum == 6.66) {
|
||||||
// 6.66元
|
// 6.66元
|
||||||
LuckyWheelCon.value.showDrawAni(3, true);
|
LuckyWheelCon.value.showDrawAni(3, true);
|
||||||
}
|
}
|
||||||
if (res.data.data == 8.88) {
|
if (prizeNum == 8.88) {
|
||||||
// 6.66元
|
// 6.66元
|
||||||
LuckyWheelCon.value.showDrawAni(4, true);
|
LuckyWheelCon.value.showDrawAni(4, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (res.data.data == 0) {
|
if (res.data.data == 0) {
|
||||||
// 谢谢参与
|
// 谢谢参与
|
||||||
@ -411,6 +418,28 @@ const getBrithday = () => {
|
|||||||
console.log(res);
|
console.log(res);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const deleteNum = ref(0)
|
||||||
|
// 清数据接口
|
||||||
|
const deleteData = (type) => {
|
||||||
|
deleteNum.value++
|
||||||
|
if(deleteNum.value == 3){
|
||||||
|
let type = 0;
|
||||||
|
service
|
||||||
|
.post(
|
||||||
|
process.env.VUE_APP_API +
|
||||||
|
"/cms-activity/cms88/redpacket/delete/" + type, {}
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
console.log("数据已清空", res);
|
||||||
|
deleteNum.value = 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -424,6 +453,7 @@ const getBrithday = () => {
|
|||||||
right: 0;
|
right: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
background: #ffd195;
|
||||||
|
|
||||||
.indexCon {
|
.indexCon {
|
||||||
// @include pos(100%, 1090px, 0, 0);
|
// @include pos(100%, 1090px, 0, 0);
|
||||||
@ -438,7 +468,7 @@ const getBrithday = () => {
|
|||||||
.logo {
|
.logo {
|
||||||
@include pos(241px, 36px, 31px, 41px);
|
@include pos(241px, 36px, 31px, 41px);
|
||||||
@include bg_pos("../assets/img/logo.png");
|
@include bg_pos("../assets/img/logo.png");
|
||||||
pointer-events: none;
|
// pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice {
|
.notice {
|
||||||
@ -598,6 +628,12 @@ const getBrithday = () => {
|
|||||||
.draw_btn {
|
.draw_btn {
|
||||||
@include pos(216px, 252px, 273px, 810px);
|
@include pos(216px, 252px, 273px, 810px);
|
||||||
@include bg_pos("../assets/img/draw_btn.png");
|
@include bg_pos("../assets/img/draw_btn.png");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.is_draw{
|
||||||
|
-webkit-filter: grayscale(100%);
|
||||||
|
filter: grayscale(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.rule_btn {
|
.rule_btn {
|
||||||
|
|||||||
@ -71,7 +71,7 @@ const hidePop = () => {
|
|||||||
.service_box {
|
.service_box {
|
||||||
@include box(573px, 688px);
|
@include box(573px, 688px);
|
||||||
@include bg_pos('../assets/img/pop/service_box.png');
|
@include bg_pos('../assets/img/pop/service_box.png');
|
||||||
pointer-events: none;
|
// pointer-events: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -260,6 +260,7 @@ const pageImgsArrLoad = imgs => {
|
|||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -276,6 +277,6 @@ div {
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
background: rgb(255, 255, 255);
|
background: #ffd195;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -7,7 +7,7 @@ export default createStore({
|
|||||||
// 数据源
|
// 数据源
|
||||||
state: {
|
state: {
|
||||||
userAccount: {
|
userAccount: {
|
||||||
xglOpenid: '', //用户openid
|
xglOpenId: 'o9B_fvjtyh2KELQYc2t9A3MEh7JQ', //用户openid
|
||||||
token: h5plugin.getQueryString('token'), //用户token
|
token: h5plugin.getQueryString('token'), //用户token
|
||||||
cardId: h5plugin.getQueryString('cardId'), //carid
|
cardId: h5plugin.getQueryString('cardId'), //carid
|
||||||
nkh: h5plugin.getQueryString('nkh'), //牛卡号
|
nkh: h5plugin.getQueryString('nkh'), //牛卡号
|
||||||
@ -18,7 +18,7 @@ export default createStore({
|
|||||||
participantNum: 0, //活动参与人数
|
participantNum: 0, //活动参与人数
|
||||||
prizeResult: 0, //中奖金额
|
prizeResult: 0, //中奖金额
|
||||||
eqcodeImg: '', //二维码
|
eqcodeImg: '', //二维码
|
||||||
isBirthMon: 0, //生日是否处于当月
|
isBirthMon: 1, //生日是否处于当月
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user