测试
This commit is contained in:
parent
0a8c3a14d3
commit
20c23c8f47
@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div class="homePage">
|
||||
|
||||
<!-- 首页 -->
|
||||
<Index @indexPage="indexPage" v-if="showIndex" />
|
||||
|
||||
@ -46,81 +45,83 @@ const showIndex = ref(false);
|
||||
|
||||
// 活动参与人数
|
||||
const getActivityNum = () => {
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
};
|
||||
|
||||
// 是否在活动期间生日
|
||||
const getBrithday = () => {
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
};
|
||||
|
||||
// 查询是否添加了企微: isInActivityDate 0活动前是否存在 1活动期间是否存在
|
||||
const getIsAddService = (id) => {
|
||||
let isInActivityDate = id;
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
};
|
||||
|
||||
// 红包记录
|
||||
const getMyPrizeRecored = () => {
|
||||
return service
|
||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/prize/list", {})
|
||||
// .then((res) => {
|
||||
// console.log("红包记录:", res.data);
|
||||
return service.post(
|
||||
process.env.VUE_APP_API + "/cms-activity/cms88/prize/list",
|
||||
{}
|
||||
);
|
||||
// .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) => {
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
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,
|
||||
// });
|
||||
// });
|
||||
};
|
||||
|
||||
// 获取绑定的资金账号
|
||||
@ -129,16 +130,17 @@ const getInfo = () => {
|
||||
|
||||
// });
|
||||
|
||||
return service
|
||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/nkh/info", {})
|
||||
// .then((res) => {
|
||||
// console.log("资金账号:", res.data);
|
||||
// });
|
||||
return service.post(
|
||||
process.env.VUE_APP_API + "/cms-activity/cms88/nkh/info",
|
||||
{}
|
||||
);
|
||||
// .then((res) => {
|
||||
// console.log("资金账号:", res.data);
|
||||
// });
|
||||
};
|
||||
|
||||
|
||||
// 接口数据处理
|
||||
const apiAll = ()=>{
|
||||
const apiAll = () => {
|
||||
// 页面挂载前请求接口
|
||||
Promise.all([
|
||||
gerCardId(store.state.userAccount.cardId),
|
||||
@ -150,35 +152,42 @@ const apiAll = ()=>{
|
||||
getIsAddService(1),
|
||||
]).then((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("6.获取添加企业微信状态【活动前是否存在】:",result[5].data);
|
||||
console.log("7.获取添加企业微信状态【活动期间是否添加】:",result[6].data);
|
||||
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("6.获取添加企业微信状态【活动前是否存在】:", result[5].data);
|
||||
console.log("7.获取添加企业微信状态【活动期间是否添加】:", result[6].data);
|
||||
|
||||
// 更细二维码
|
||||
store.commit({ type: "updateeEqcodeImg", eqcodeImg: result[0].data.data,});
|
||||
store.commit({ type: "updateeEqcodeImg", eqcodeImg: result[0].data.data });
|
||||
// 更新资金账号记录
|
||||
store.commit({ type: "updateeNkh", nkh: result[1].data.data,});
|
||||
store.commit({ type: "updateeNkh", nkh: result[1].data.data });
|
||||
|
||||
// 更新红包记录
|
||||
store.commit({ type: "updatePrizeList", prizeList: result[2].data.data,});
|
||||
store.commit({ type: "updatePrizeList", prizeList: result[2].data.data });
|
||||
|
||||
// 更新生日状态
|
||||
store.commit({type: "updateBirthMoon",isBirthMon: result[3].data.data,});
|
||||
store.commit({ type: "updateBirthMoon", isBirthMon: result[3].data.data });
|
||||
|
||||
// 更新活动人数
|
||||
store.commit({type: "updateParticipantNum",participantNum: result[4].data.data,});
|
||||
store.commit({
|
||||
type: "updateParticipantNum",
|
||||
participantNum: result[4].data.data,
|
||||
});
|
||||
|
||||
// 更新添加企微状态:活动前是否存在
|
||||
store.commit({type: "updateisAddCustomerBefore",isAddCustomerBefore: result[5].data.data,});
|
||||
store.commit({
|
||||
type: "updateisAddCustomerBefore",
|
||||
isAddCustomerBefore: result[5].data.data,
|
||||
});
|
||||
|
||||
// 更新添加企微状态:活动期间
|
||||
store.commit({type: "updateIsAddCustomer",isAddCustomer: result[6].data.data,});
|
||||
|
||||
|
||||
store.commit({
|
||||
type: "updateIsAddCustomer",
|
||||
isAddCustomer: result[6].data.data,
|
||||
});
|
||||
|
||||
// 预加载图片资源
|
||||
pageImgsArrLoad(imgList).then(() => {
|
||||
@ -187,14 +196,12 @@ const apiAll = ()=>{
|
||||
gsap.from(".homePage", { duration: 0.1, autoAlpha: 0, y: 100 });
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 页面未挂载
|
||||
onBeforeMount(() => {
|
||||
|
||||
if(!h5plugin.isWX()){
|
||||
apiAll()
|
||||
|
||||
if (!h5plugin.isWX()) {
|
||||
apiAll();
|
||||
}
|
||||
|
||||
console.log("link:", window.location.href);
|
||||
@ -216,9 +223,8 @@ onBeforeMount(() => {
|
||||
|
||||
// 页面挂载
|
||||
onMounted(() => {
|
||||
fontAdpat()
|
||||
// stopBack()
|
||||
goBackEvent()
|
||||
fontAdpat();
|
||||
stopBack()
|
||||
});
|
||||
|
||||
// 来自首页的事件
|
||||
@ -231,12 +237,9 @@ const getCode = () => {
|
||||
let redirect_uri = window.location.href;
|
||||
// service.post(process.env.VUE_APP_API + '/cms-activity/cms88/zsApi/xfhdAuthorize?redirect_uri='+redirect_uri,
|
||||
service
|
||||
.post(
|
||||
process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize",
|
||||
{
|
||||
redirect_uri: redirect_uri,
|
||||
}
|
||||
)
|
||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize", {
|
||||
redirect_uri: redirect_uri,
|
||||
})
|
||||
.then((res) => {
|
||||
let code = res.data.data;
|
||||
console.log("get code结果3", res);
|
||||
@ -264,7 +267,7 @@ const getOpenId = (code) => {
|
||||
console.log("后端返回的openid:", res.data);
|
||||
// 更新openid
|
||||
store.commit({ type: "updateXGLOpenid", openid: res.data.data });
|
||||
apiAll()
|
||||
apiAll();
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -292,54 +295,50 @@ const pageImgsArrLoad = (imgs) => {
|
||||
return Promise.all(promiseArr);
|
||||
};
|
||||
|
||||
|
||||
// 字体适配
|
||||
const fontAdpat = ()=>{
|
||||
if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
|
||||
handleFontSize();
|
||||
} else {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
|
||||
}
|
||||
}
|
||||
function handleFontSize() {
|
||||
// 设置网页字体为默认大小
|
||||
WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
|
||||
// 重写设置网页字体大小的事件
|
||||
WeixinJSBridge.on('menu:setfont', function() {
|
||||
WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize' : 0 });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 禁止返回
|
||||
const stopBack = ()=>{
|
||||
history.pushState(null, null, document.URL);
|
||||
|
||||
window.addEventListener('popstate', function () {
|
||||
|
||||
history.pushState(null, null, document.URL);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 监听后退事件
|
||||
const goBackEvent = ()=>{
|
||||
if (window.history && window.history.pushState) {
|
||||
window.onpopstate = function() {
|
||||
//后退按钮触发事件
|
||||
console.log("后退");
|
||||
window.history.go(-1)
|
||||
const fontAdpat = () => {
|
||||
if (
|
||||
typeof WeixinJSBridge == "object" &&
|
||||
typeof WeixinJSBridge.invoke == "function"
|
||||
) {
|
||||
handleFontSize();
|
||||
} else {
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
|
||||
} else if (document.attachEvent) {
|
||||
document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
|
||||
}
|
||||
}
|
||||
function handleFontSize() {
|
||||
// 设置网页字体为默认大小
|
||||
WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 });
|
||||
// 重写设置网页字体大小的事件
|
||||
WeixinJSBridge.on("menu:setfont", function () {
|
||||
WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
// 禁止返回
|
||||
const stopBack = () => {
|
||||
history.pushState(null, null, document.URL);
|
||||
|
||||
window.addEventListener("popstate", function () {
|
||||
// history.pushState(null, null, document.URL);
|
||||
history.back(-1)
|
||||
});
|
||||
};
|
||||
|
||||
// 监听后退事件
|
||||
const goBackEvent = () => {
|
||||
if (window.history && window.history.pushState) {
|
||||
window.onpopstate = function () {
|
||||
//后退按钮触发事件
|
||||
console.log("后退");
|
||||
window.history.go(-1);
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user