diff --git a/src/api/httpServe.js b/src/api/httpServe.js index 8414c4d..7c0f7e4 100644 --- a/src/api/httpServe.js +++ b/src/api/httpServe.js @@ -13,12 +13,19 @@ const service = axios.create({ baseURL: process.env.VUE_APP_API, // responseType: 'json', headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - 'token': store.state.userAccount.token + // 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Type': 'application/json;charset=UTF-8', + 'i-token': store.state.userAccount.token, + }, + params: { + + }, }); + + // 添加请求拦截器 service.interceptors.request.use(function (config) { // 在发送请求之前做些什么 diff --git a/src/components/Index.vue b/src/components/Index.vue index 6a3c254..b44bde2 100644 --- a/src/components/Index.vue +++ b/src/components/Index.vue @@ -16,20 +16,13 @@ - 活动已有{{ participantNum }}人参与 + 活动已有{{ store.state.userAccount.participantNum }}人参与
-
@@ -155,7 +148,14 @@ const activityList = reactive([ ]); // 页面挂载前 -onBeforeMount(() => {}); +onBeforeMount(() => { + // 获取企微二维码 + gerCardId(94207) + getInfo() + getMyPrizeRecored() + getBrithday() + getActivityNum() +}); // 页面挂载后 onMounted(() => {}); @@ -183,22 +183,11 @@ const btn = () => { // 抽奖按钮 const drawBtn = () => { - console.log("抽奖22:"); + console.log("抽奖:"); + getluckyBag(1) + + - service.get(process.env.VUE_APP_API + '/cms88/card/qrcode/',cardId=store.state.userAccount.cardId ) - .then((res) => { - - console.log(res); - }) - - // console.log("授权:",getAuthorize(1)); - // if (h5plugin.getQueryString("forceauth")) { - // console.log("yes-forceauth"); - // getAuthorize(0); - // } else { - // console.log("no-forceauth"); - // getAuthorize(1); - // } }; // 活动点击 @@ -239,6 +228,80 @@ const getAuthorize = (scopeState) => { // return `${process.env.VUE_APP_ZS_DOMAIN}/wxauth/official/account/authorize?redirectUrl=${out_href}&scope=${1}"`; window.location.href = `${process.env.VUE_APP_ZS_DOMAIN}/wxauth/official/account/authorize?redirectUrl=${out_href}&scope=${scopeState}`; }; + + +// 查询员工企业微信二维码 +const gerCardId = (carid)=>{ + 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 }); + }); +} + +// 获取绑定的资金账号 +const getInfo = ()=>{ + service + .post(process.env.VUE_APP_API + "/cms-activity/cms88/nkh/info",{}) + .then((res) => { + console.log("资金账号:",res); + }); +} + +// 我的红包记录 +const getMyPrizeRecored = ()=>{ + service + .post(process.env.VUE_APP_API + "/cms-activity/cms88/prize/list",{}) + .then((res) => { + console.log(res); + }); +} + +// 查询是否添加了企微: isInActivityDate 0否 1是 +const getIsAddService = ()=>{ + let isInActivityDate = 0 + service + .post(process.env.VUE_APP_API + "/cms-activity/cms88/qywx/isadded/"+ isInActivityDate) + .then((res) => { + console.log(res); + }); +} + +// 抽取红包 type为红包类型 1为参与红包 2为加企微 +const getluckyBag = (id)=>{ + + let type = id + service + .post(process.env.VUE_APP_API + "/cms-activity/cms88/redpacket/draw/"+ type,{}) + .then((res) => { + console.log(res); + }); +} + +// 活动参与人数 +const getActivityNum = ()=>{ + 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 }); + + }); +} + + +// 是否在活动期间生日 +const getBrithday = ()=>{ + service + .post(process.env.VUE_APP_API + "/cms-activity/cms88/user/isin/birthday",{}) + .then((res) => { + console.log(res); + }); +} + +