抽奖接口已通

This commit is contained in:
tcubic 2022-08-03 18:53:29 +08:00
parent 933bdc7f9e
commit f55f3133cc
5 changed files with 78 additions and 21 deletions

View File

@ -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>

View File

@ -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 {

View File

@ -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;

View File

@ -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>

View File

@ -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, //生日是否处于当月
}, },
}, },