From e391123b4ecbaa6cdf3d920a835d80b67ee9593f Mon Sep 17 00:00:00 2001 From: tcubic <123456> Date: Fri, 5 Aug 2022 22:56:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B4=BB=E5=8A=A8=E5=89=8D?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=B7=BB=E5=8A=A0=E4=BC=81=E5=BE=AE=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Index.vue | 62 ++++++++++++++++++++++++---------------- src/page/Home/Home.vue | 19 +++++++----- src/store/index.js | 15 ++++++++-- 3 files changed, 62 insertions(+), 34 deletions(-) diff --git a/src/components/Index.vue b/src/components/Index.vue index bdae2d8..b966323 100644 --- a/src/components/Index.vue +++ b/src/components/Index.vue @@ -170,7 +170,6 @@ const serviceLuckyMsg = reactive({ const hideServiceLuckyPop = () => { gsap.to(".serviceLuckyPop", { duration: 0.5, autoAlpha: 0 }); - }; // 点击领取企微红包 @@ -360,11 +359,16 @@ onMounted(() => { addPoint(); // 如果添加了企微,直接调抽奖结果,中奖了就弹窗,未中奖的话不弹窗 - if ( - store.state.userAccount.isAddCustomer == 1 && - !isGetedServiceLucky.value - ) { - getluckyBag2(2); + + // 您已添加过专属服务人员,请参与其他活动 + + if (store.state.userAccount.isAddCustomerBefore == 0) { + if ( + store.state.userAccount.isAddCustomer == 1 && + !isGetedServiceLucky.value + ) { + getluckyBag2(2); + } } if (!isDraw.value) { @@ -401,7 +405,13 @@ const activityBtn = (item) => { console.log(item.id); if (item.id == 1) { - showServicePop.value = true; + + if(store.state.userAccount.isAddCustomerBefore == 1){ + Toast("您已添加过专属服务人员,请参与其他活动") + }else{ + showServicePop.value = true; + } + } if (item.id == 2) { @@ -513,9 +523,9 @@ const getMyPrizeRecored = () => { }); }; -// 查询是否添加了企微: isInActivityDate 0否 1是 -const getIsAddService = () => { - let isInActivityDate = 0; +// 查询是否添加了企微: isInActivityDate 0活动前是否存在 1活动期间是否存在 +const getIsAddService = (id) => { + let isInActivityDate = id; service .post( process.env.VUE_APP_API + @@ -601,7 +611,7 @@ const getluckyBag2 = (id) => { duration: 0.5, autoAlpha: 0, y: 50, - delay:0.5 + delay: 0.5, }); } else { console.log("企微不中奖"); @@ -659,20 +669,22 @@ const addPoint = () => { 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; - }); + if (process.env.NODE_ENV == "test") { + 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; + }); + } } }; diff --git a/src/page/Home/Home.vue b/src/page/Home/Home.vue index c3201f8..2332818 100644 --- a/src/page/Home/Home.vue +++ b/src/page/Home/Home.vue @@ -75,9 +75,9 @@ const getBrithday = () => { // }); }; -// 查询是否添加了企微: isInActivityDate 0否 1是 -const getIsAddService = () => { - let isInActivityDate = 1; +// 查询是否添加了企微: isInActivityDate 0活动前是否存在 1活动期间是否存在 +const getIsAddService = (id) => { + let isInActivityDate = id; return service .post( process.env.VUE_APP_API + @@ -146,7 +146,8 @@ const apiAll = ()=>{ getMyPrizeRecored(), getBrithday(), getActivityNum(), - getIsAddService(), + getIsAddService(0), + getIsAddService(1), ]).then((result) => { // console.log("接口都请求完成", result); console.log("1.获取企业微信二维码:",result[0].data); @@ -154,7 +155,8 @@ const apiAll = ()=>{ console.log("3.获取红包记录:",result[2].data); console.log("4.获取生日状态:",result[3].data); console.log("5.获取活动人数:",result[4].data); - console.log("5.获取添加企业微信状态:",result[5].data); + console.log("6.获取添加企业微信状态【活动前是否存在】:",result[5].data); + console.log("7.获取添加企业微信状态【活动期间是否添加】:",result[6].data); // 更细二维码 store.commit({ type: "updateeEqcodeImg", eqcodeImg: result[0].data.data,}); @@ -170,8 +172,11 @@ const apiAll = ()=>{ // 更新活动人数 store.commit({type: "updateParticipantNum",participantNum: result[4].data.data,}); - // 更新添加企微状态 - store.commit({type: "updateIsAddCustomer",isAddCustomer: result[5].data.data,}); + // 更新添加企微状态:活动前是否存在 + store.commit({type: "updateisAddCustomerBefore",isAddCustomerBefore: result[5].data.data,}); + + // 更新添加企微状态:活动期间 + store.commit({type: "updateIsAddCustomer",isAddCustomer: result[6].data.data,}); diff --git a/src/store/index.js b/src/store/index.js index 450181a..d5a4355 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -13,7 +13,8 @@ export default createStore({ nkh: '', //牛卡号 isDraw: false, //是否抽过奖 isHasAccount: false, //是否存在牛卡号 - isAddCustomer: 0, //是否添加过服务人员 + isAddCustomer: 0, //活动期间内是否添加过服务人员 + isAddCustomerBefore:0, //活动前是否存在服务人员 isHasPrize: [], //是否存在奖品 participantNum: 0, //活动参与人数 prizeResult: 0, //中奖金额 @@ -43,27 +44,37 @@ export default createStore({ state.userAccount.nkh = val.nkh }, + // 更新cardId updateCardId(state,val){ state.userAccount.cardId = val.cardId }, + // 更新二维码 updateeEqcodeImg(state,val){ state.userAccount.eqcodeImg = val.eqcodeImg }, + // 更新活动参与人数 updateParticipantNum(state,val){ state.userAccount.participantNum = val.participantNum }, + // 更新生日是否处于当月状态 updateBirthMoon(state,val){ state.userAccount.isBirthMon = val.isBirthMon }, + // 更新活动期间内是否添加过企微状态 updateIsAddCustomer(state,val){ state.userAccount.isAddCustomer = val.isAddCustomer }, - // 更新奖品 + // 更新活动前是否存在企微状态 + updateisAddCustomerBefore(state,val){ + state.userAccount.isAddCustomerBefore = val.isAddCustomerBefore + }, + + // 更新奖品列表 updatePrizeList(state,val){ state.userAccount.prizeList = val.prizeList }