接口初始调通
This commit is contained in:
parent
d419800cdc
commit
6cc6503270
@ -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) {
|
||||||
// 在发送请求之前做些什么
|
// 在发送请求之前做些什么
|
||||||
|
|||||||
@ -16,20 +16,13 @@
|
|||||||
<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 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>
|
||||||
<div class="icon_right_2"></div>
|
<div class="icon_right_2"></div>
|
||||||
<div class="icon_right_3"></div>
|
<div class="icon_right_3"></div>
|
||||||
@ -155,7 +148,14 @@ const activityList = reactive([
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// 页面挂载前
|
// 页面挂载前
|
||||||
onBeforeMount(() => {});
|
onBeforeMount(() => {
|
||||||
|
// 获取企微二维码
|
||||||
|
gerCardId(94207)
|
||||||
|
getInfo()
|
||||||
|
getMyPrizeRecored()
|
||||||
|
getBrithday()
|
||||||
|
getActivityNum()
|
||||||
|
});
|
||||||
|
|
||||||
// 页面挂载后
|
// 页面挂载后
|
||||||
onMounted(() => {});
|
onMounted(() => {});
|
||||||
@ -183,22 +183,11 @@ 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);
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 活动点击
|
// 活动点击
|
||||||
@ -239,6 +228,80 @@ 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>
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
@ -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')) {
|
||||||
|
// 存在code的话去换取openid
|
||||||
|
authCode.value = h5plugin.getQueryString('code')
|
||||||
|
getOpenId(authCode.value)
|
||||||
|
} else {
|
||||||
|
getCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if (h5plugin.getQueryString('code')) {
|
|
||||||
// // 存在code的话去换取openid
|
|
||||||
// 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(() => {
|
||||||
|
|
||||||
|
|||||||
@ -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: '' //二维码
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -40,6 +41,14 @@ export default createStore({
|
|||||||
updateNkh(state,val){
|
updateNkh(state,val){
|
||||||
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
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
// 改变方法:异步
|
// 改变方法:异步
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user