From 736d3b9616064c16cec8d3bb5d923dfe1032d298 Mon Sep 17 00:00:00 2001 From: tcubic <123456> Date: Thu, 4 Aug 2022 17:50:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8E=A5=E5=8F=A3=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/page/Home/Home.vue | 146 +++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 58 deletions(-) diff --git a/src/page/Home/Home.vue b/src/page/Home/Home.vue index 7e6630c..9c37eb8 100644 --- a/src/page/Home/Home.vue +++ b/src/page/Home/Home.vue @@ -43,100 +43,99 @@ const showIndex = ref(false); // 活动参与人数 const getActivityNum = () => { - service + return service .post(process.env.VUE_APP_API + "/cms-activity/cms88/user/count/") - .then((res) => { - console.log(res.data.data); - store.commit({ - type: "updateParticipantNum", - participantNum: res.data.data, - }); - }); + // .then((res) => { + // console.log(res.data.data); + // store.commit({ + // type: "updateParticipantNum", + // participantNum: res.data.data, + // }); + // }); }; // 是否在活动期间生日 const getBrithday = () => { - service + return service .post( process.env.VUE_APP_API + "/cms-activity/cms88/user/isin/birthday", {} ) - .then((res) => { - console.log("生日是否处于当月:", res.data.data); - // store.state.userAccount.isBirthMon = 1 - store.commit({ - type: "updateBirthMoon", - isBirthMon: res.data.data, - // isBirthMon: 1, - }); - }); + // .then((res) => { + // console.log("生日是否处于当月:", res.data.data); + // // store.state.userAccount.isBirthMon = 1 + // store.commit({ + // type: "updateBirthMoon", + // isBirthMon: res.data.data, + // // isBirthMon: 1, + // }); + // }); }; // 查询是否添加了企微: isInActivityDate 0否 1是 const getIsAddService = () => { let isInActivityDate = 1; - service + return service .post( process.env.VUE_APP_API + "/cms-activity/cms88/qywx/isadded/" + isInActivityDate, {} ) - .then((res) => { - console.log("是否添加了企微", res.data); - // store.state.userAccount.isBirthMon = res.data.data - store.commit({ - type: "updateIsAddCustomer", - // isBirthMon:res.data.data, - isAddCustomer: res.data.data, - }); - }); + // .then((res) => { + // console.log("是否添加了企微", res.data); + // // store.state.userAccount.isBirthMon = res.data.data + // store.commit({ + // type: "updateIsAddCustomer", + // // isBirthMon:res.data.data, + // isAddCustomer: res.data.data, + // }); + // }); }; // 红包记录 const getMyPrizeRecored = () => { - service + return service .post(process.env.VUE_APP_API + "/cms-activity/cms88/prize/list", {}) - .then((res) => { - console.log("红包记录:", res.data); + // .then((res) => { + // console.log("红包记录:", res.data); - store.commit({ - type: "updatePrizeList", - prizeList: res.data.data, - }); - }); + // store.commit({ + // type: "updatePrizeList", + // prizeList: res.data.data, + // }); + // }); }; // 查询员工企业-微信二维码 const gerCardId = (carid) => { - service + return service .get(process.env.VUE_APP_API + "/cms-activity/cms88/card/qrcode/" + carid) - .then((res) => { - console.log("企微二维码:", res.data.data); - store.commit({ - type: "updateeEqcodeImg", - eqcodeImg: res.data.data, - }); - }); + // .then((res) => { + // console.log("企微二维码:", res.data.data); + // store.commit({ + // type: "updateeEqcodeImg", + // eqcodeImg: res.data.data, + // }); + // }); }; // 获取绑定的资金账号 const getInfo = () => { - service - .post(process.env.VUE_APP_API + "/cms-activity/cms88/nkh/info", {}) - .then((res) => { - console.log("资金账号:", res.data); - }); + // return new Promise((resolve, reject) => { + + // }); + + return service + .post(process.env.VUE_APP_API + "/cms-activity/cms88/nkh/info", {}) + // .then((res) => { + // console.log("资金账号:", res.data); + // }); }; -// 页面未挂载 -onBeforeMount(() => { - // gerCardId(store.state.userAccount.cardId); - // getInfo(); - // getMyPrizeRecored(); - // getBrithday(); - // getActivityNum(); - // getIsAddService(); + +// 接口数据处理 +const apiAll = ()=>{ // 页面挂载前请求接口 Promise.all([ gerCardId(store.state.userAccount.cardId), @@ -146,7 +145,32 @@ onBeforeMount(() => { getActivityNum(), getIsAddService(), ]).then((result) => { - console.log("接口都请求完成",result); + // console.log("接口都请求完成", result); + console.log("1.获取企业微信二维码:",result[0].data); + console.log("2.获取资金账号:",result[1].data); + console.log("3.获取红包记录:",result[2].data); + console.log("4.获取生日状态:",result[3].data); + console.log("5.获取活动人数:",result[4].data); + console.log("5.获取添加企业微信状态:",result[5].data); + + // 更细二维码 + store.commit({ type: "updateeEqcodeImg", eqcodeImg: result[0].data.data,}); + // 更新资金账号记录 + + // 更新红包记录 + store.commit({ type: "updatePrizeList", prizeList: result[2].data.data,}); + + // 更新生日状态 + store.commit({type: "updateBirthMoon",isBirthMon: result[3].data.data,}); + + // 更新活动人数 + store.commit({type: "updateParticipantNum",participantNum: result[4].data.data,}); + + // 更新添加企微状态 + store.commit({type: "updateIsAddCustomer",isAddCustomer: result[5].data.data,}); + + + // 预加载图片资源 pageImgsArrLoad(imgList).then(() => { console.log("load done"); @@ -154,6 +178,11 @@ onBeforeMount(() => { gsap.from(".homePage", { duration: 0.1, autoAlpha: 0, y: 100 }); }); }); +} + +// 页面未挂载 +onBeforeMount(() => { + // apiAll() console.log("link:", window.location.href); console.log("用户活动信息:", store.state.userAccount); @@ -224,6 +253,7 @@ const getOpenId = (code) => { // store.commit({ type: "updateCardId", cardId: h5plugin.getQueryString('cardId') }); // store.commit({ type: "updateNkh", cardId: h5plugin.getQueryString('nkh') }); // console.log("用户活动信息:", store.state.userAccount); + apiAll() } }); };