融合你的代码提交
# Conflicts:
#	src/components/Index.vue
This commit is contained in:
rucky 2022-08-02 17:13:43 +08:00
commit cda4a491da
5 changed files with 137 additions and 52 deletions

View File

@ -13,12 +13,19 @@ const service = axios.create({
baseURL: process.env.VUE_APP_API, baseURL: process.env.VUE_APP_API,
// responseType: 'json', // responseType: 'json',
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', // 'Content-Type': 'application/x-www-form-urlencoded',
'token': store.state.userAccount.token 'Content-Type': 'application/json;charset=UTF-8',
'i-token': store.state.userAccount.token,
},
params: {
}, },
}); });
// 添加请求拦截器 // 添加请求拦截器
service.interceptors.request.use(function (config) { service.interceptors.request.use(function (config) {
// 在发送请求之前做些什么 // 在发送请求之前做些什么

View File

@ -16,21 +16,17 @@
<span class="icon" <span class="icon"
><img src="../assets/img/laba.png" alt="" srcset="" ><img src="../assets/img/laba.png" alt="" srcset=""
/></span> /></span>
<span class="num">活动已有{{ participantNum }}人参与</span> <span class="num"
>活动已有{{
store.state.userAccount.participantNum
}}人参与</span
>
</div> </div>
<div class="cloud_left_2"></div> <div class="cloud_left_2"></div>
<div class="icon_left_2"></div> <div class="icon_left_2"></div>
<div class="cloud_right_2"></div> <div class="cloud_right_2"></div>
<!-- 大转盘 --> <!-- 大转盘 -->
<div class="zhuanpan"> <div class="zhuanpan"></div>
<!-- <div class="liwu">
<div>1.99</div>
<div>2.99</div>
<div>3.99</div>
<div>4.99</div>
<div>5.99</div>
</div> -->
</div>
<div class="icon_right_2"></div> <div class="icon_right_2"></div>
<div class="icon_right_3"></div> <div class="icon_right_3"></div>
<div class="cloud_left_3"></div> <div class="cloud_left_3"></div>
@ -80,7 +76,7 @@
<!-- 添加专属服务人员企微弹窗 --> <!-- 添加专属服务人员企微弹窗 -->
<ServiceList v-if="showServicePop" @ServicePop="hideServicePop" /> <ServiceList v-if="showServicePop" @ServicePop="hideServicePop" />
<LuckyWheel v-if="false" /> <LuckyWheel v-if="true" />
</div> </div>
</template> </template>
@ -159,7 +155,14 @@ const activityList = reactive([
]); ]);
// //
onBeforeMount(() => {}); onBeforeMount(() => {
//
gerCardId(94207);
getInfo();
getMyPrizeRecored();
getBrithday();
getActivityNum();
});
// //
onMounted(() => {}); onMounted(() => {});
@ -187,25 +190,8 @@ const btn = () => {
// //
const drawBtn = () => { 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);
// }
}; };
// //
@ -246,6 +232,94 @@ const getAuthorize = (scopeState) => {
// return `${process.env.VUE_APP_ZS_DOMAIN}/wxauth/official/account/authorize?redirectUrl=${out_href}&scope=${1}"`; // 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}`; 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);
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -3,8 +3,7 @@
<div class="service_container"> <div class="service_container">
<div class="service_box"> <div class="service_box">
<div class="eqcode_box"> <div class="eqcode_box">
<img :src="eqcode" alt=""> <img :src="store.state.userAccount.eqcodeImg" alt="">
</div> </div>
</div> </div>
<div class="service_cls_btn" @click="hidePop"></div> <div class="service_cls_btn" @click="hidePop"></div>

View File

@ -38,34 +38,30 @@ onBeforeMount(() => {
console.log("link",window.location.href); console.log("link",window.location.href);
// //
// if (h5plugin.isWX()) { if (h5plugin.isWX()) {
// console.log('code:', h5plugin.getQueryString('code')); console.log('code:', h5plugin.getQueryString('code'));
if (h5plugin.getQueryString('code')) {
// codeopenid
authCode.value = h5plugin.getQueryString('code')
getOpenId(authCode.value)
} else {
getCode()
}
}
// if (h5plugin.getQueryString('code')) {
// // codeopenid
// authCode.value = h5plugin.getQueryString('code')
// getOpenId(authCode.value)
// } else {
// getCode()
// }
// }
// let token = h5plugin.getQueryString('token') // let token = h5plugin.getQueryString('token')
// openid // openid
store.commit({ type: "updateToken", token: h5plugin.getQueryString('token') }); store.commit({ type: "updateToken", token: h5plugin.getQueryString('token') });
store.commit({ type: "updateCardId", cardId: h5plugin.getQueryString('cardId') }); store.commit({ type: "updateCardId", cardId: h5plugin.getQueryString('cardId') });
store.commit({ type: "updateNkh", cardId: h5plugin.getQueryString('nkh') }); store.commit({ type: "updateNkh", cardId: h5plugin.getQueryString('nkh') });
console.log("用户活动信息:", store.state.userAccount); console.log("用户活动信息:", store.state.userAccount);
}); });
// //
onMounted(() => { onMounted(() => {

View File

@ -6,8 +6,8 @@ export default createStore({
state: { state: {
userAccount: { userAccount: {
xglOpenid: 'openid12138', //用户openid xglOpenid: 'openid12138', //用户openid
token: 'token12138', //用户token token: '13f88993882b4dc0832351566c11a1eb', //用户token
cardId: '', //carid cardId: '94207', //carid
nkh: '', //牛卡号 nkh: '', //牛卡号
isDraw: false, //是否抽过奖 isDraw: false, //是否抽过奖
isHasAccount: false, //是否存在牛卡号 isHasAccount: false, //是否存在牛卡号
@ -15,6 +15,7 @@ export default createStore({
isHasPrize: [], //是否存在奖品 isHasPrize: [], //是否存在奖品
participantNum: 1213821, //活动参与人数 participantNum: 1213821, //活动参与人数
prizeResult: 73.11, //中奖金额 prizeResult: 73.11, //中奖金额
eqcodeImg: '' //二维码
}, },
}, },
@ -41,6 +42,14 @@ export default createStore({
state.userAccount.nkh = val.nkh state.userAccount.nkh = val.nkh
}, },
updateeEqcodeImg(state,val){
state.userAccount.eqcodeImg = val.eqcodeImg
},
updateParticipantNum(state,val){
state.userAccount.participantNum = val.participantNum
},
}, },
// 改变方法:异步 // 改变方法:异步
actions: {}, actions: {},