测试
This commit is contained in:
parent
0a8c3a14d3
commit
20c23c8f47
@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="homePage">
|
<div class="homePage">
|
||||||
|
|
||||||
<!-- 首页 -->
|
<!-- 首页 -->
|
||||||
<Index @indexPage="indexPage" v-if="showIndex" />
|
<Index @indexPage="indexPage" v-if="showIndex" />
|
||||||
|
|
||||||
@ -46,99 +45,102 @@ const showIndex = ref(false);
|
|||||||
|
|
||||||
// 活动参与人数
|
// 活动参与人数
|
||||||
const getActivityNum = () => {
|
const getActivityNum = () => {
|
||||||
return service
|
return service.post(
|
||||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/user/count/")
|
process.env.VUE_APP_API + "/cms-activity/cms88/user/count/"
|
||||||
// .then((res) => {
|
);
|
||||||
// console.log(res.data.data);
|
// .then((res) => {
|
||||||
// store.commit({
|
// console.log(res.data.data);
|
||||||
// type: "updateParticipantNum",
|
// store.commit({
|
||||||
// participantNum: res.data.data,
|
// type: "updateParticipantNum",
|
||||||
// });
|
// participantNum: res.data.data,
|
||||||
// });
|
// });
|
||||||
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 是否在活动期间生日
|
// 是否在活动期间生日
|
||||||
const getBrithday = () => {
|
const getBrithday = () => {
|
||||||
return service
|
return service.post(
|
||||||
.post(
|
process.env.VUE_APP_API + "/cms-activity/cms88/user/isin/birthday",
|
||||||
process.env.VUE_APP_API + "/cms-activity/cms88/user/isin/birthday",
|
{}
|
||||||
{}
|
);
|
||||||
)
|
// .then((res) => {
|
||||||
// .then((res) => {
|
// console.log("生日是否处于当月:", res.data.data);
|
||||||
// console.log("生日是否处于当月:", res.data.data);
|
// // store.state.userAccount.isBirthMon = 1
|
||||||
// // store.state.userAccount.isBirthMon = 1
|
// store.commit({
|
||||||
// store.commit({
|
// type: "updateBirthMoon",
|
||||||
// type: "updateBirthMoon",
|
// isBirthMon: res.data.data,
|
||||||
// isBirthMon: res.data.data,
|
// // isBirthMon: 1,
|
||||||
// // isBirthMon: 1,
|
// });
|
||||||
// });
|
// });
|
||||||
// });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 查询是否添加了企微: isInActivityDate 0活动前是否存在 1活动期间是否存在
|
// 查询是否添加了企微: isInActivityDate 0活动前是否存在 1活动期间是否存在
|
||||||
const getIsAddService = (id) => {
|
const getIsAddService = (id) => {
|
||||||
let isInActivityDate = id;
|
let isInActivityDate = id;
|
||||||
return service
|
return service.post(
|
||||||
.post(
|
process.env.VUE_APP_API +
|
||||||
process.env.VUE_APP_API +
|
"/cms-activity/cms88/qywx/isadded/" +
|
||||||
"/cms-activity/cms88/qywx/isadded/" +
|
isInActivityDate,
|
||||||
isInActivityDate,
|
{}
|
||||||
{}
|
);
|
||||||
)
|
// .then((res) => {
|
||||||
// .then((res) => {
|
// console.log("是否添加了企微", res.data);
|
||||||
// console.log("是否添加了企微", res.data);
|
// // store.state.userAccount.isBirthMon = res.data.data
|
||||||
// // store.state.userAccount.isBirthMon = res.data.data
|
// store.commit({
|
||||||
// store.commit({
|
// type: "updateIsAddCustomer",
|
||||||
// type: "updateIsAddCustomer",
|
// // isBirthMon:res.data.data,
|
||||||
// // isBirthMon:res.data.data,
|
// isAddCustomer: res.data.data,
|
||||||
// isAddCustomer: res.data.data,
|
// });
|
||||||
// });
|
// });
|
||||||
// });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 红包记录
|
// 红包记录
|
||||||
const getMyPrizeRecored = () => {
|
const getMyPrizeRecored = () => {
|
||||||
return service
|
return service.post(
|
||||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/prize/list", {})
|
process.env.VUE_APP_API + "/cms-activity/cms88/prize/list",
|
||||||
// .then((res) => {
|
{}
|
||||||
// console.log("红包记录:", res.data);
|
);
|
||||||
|
// .then((res) => {
|
||||||
|
// console.log("红包记录:", res.data);
|
||||||
|
|
||||||
// store.commit({
|
// store.commit({
|
||||||
// type: "updatePrizeList",
|
// type: "updatePrizeList",
|
||||||
// prizeList: res.data.data,
|
// prizeList: res.data.data,
|
||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 查询员工企业-微信二维码
|
// 查询员工企业-微信二维码
|
||||||
const gerCardId = (carid) => {
|
const gerCardId = (carid) => {
|
||||||
return service
|
return service.get(
|
||||||
.get(process.env.VUE_APP_API + "/cms-activity/cms88/card/qrcode/" + carid)
|
process.env.VUE_APP_API + "/cms-activity/cms88/card/qrcode/" + carid
|
||||||
// .then((res) => {
|
);
|
||||||
// console.log("企微二维码:", res.data.data);
|
// .then((res) => {
|
||||||
// store.commit({
|
// console.log("企微二维码:", res.data.data);
|
||||||
// type: "updateeEqcodeImg",
|
// store.commit({
|
||||||
// eqcodeImg: res.data.data,
|
// type: "updateeEqcodeImg",
|
||||||
// });
|
// eqcodeImg: res.data.data,
|
||||||
// });
|
// });
|
||||||
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取绑定的资金账号
|
// 获取绑定的资金账号
|
||||||
const getInfo = () => {
|
const getInfo = () => {
|
||||||
// return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
// });
|
// });
|
||||||
|
|
||||||
return service
|
return service.post(
|
||||||
.post(process.env.VUE_APP_API + "/cms-activity/cms88/nkh/info", {})
|
process.env.VUE_APP_API + "/cms-activity/cms88/nkh/info",
|
||||||
// .then((res) => {
|
{}
|
||||||
// console.log("资金账号:", res.data);
|
);
|
||||||
// });
|
// .then((res) => {
|
||||||
|
// console.log("资金账号:", res.data);
|
||||||
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 接口数据处理
|
// 接口数据处理
|
||||||
const apiAll = ()=>{
|
const apiAll = () => {
|
||||||
// 页面挂载前请求接口
|
// 页面挂载前请求接口
|
||||||
Promise.all([
|
Promise.all([
|
||||||
gerCardId(store.state.userAccount.cardId),
|
gerCardId(store.state.userAccount.cardId),
|
||||||
@ -150,35 +152,42 @@ const apiAll = ()=>{
|
|||||||
getIsAddService(1),
|
getIsAddService(1),
|
||||||
]).then((result) => {
|
]).then((result) => {
|
||||||
// console.log("接口都请求完成", result);
|
// console.log("接口都请求完成", result);
|
||||||
console.log("1.获取企业微信二维码:",result[0].data);
|
console.log("1.获取企业微信二维码:", result[0].data);
|
||||||
console.log("2.获取资金账号:",result[1].data);
|
console.log("2.获取资金账号:", result[1].data);
|
||||||
console.log("3.获取红包记录:",result[2].data);
|
console.log("3.获取红包记录:", result[2].data);
|
||||||
console.log("4.获取生日状态:",result[3].data);
|
console.log("4.获取生日状态:", result[3].data);
|
||||||
console.log("5.获取活动人数:",result[4].data);
|
console.log("5.获取活动人数:", result[4].data);
|
||||||
console.log("6.获取添加企业微信状态【活动前是否存在】:",result[5].data);
|
console.log("6.获取添加企业微信状态【活动前是否存在】:", result[5].data);
|
||||||
console.log("7.获取添加企业微信状态【活动期间是否添加】:",result[6].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(() => {
|
pageImgsArrLoad(imgList).then(() => {
|
||||||
@ -187,14 +196,12 @@ const apiAll = ()=>{
|
|||||||
gsap.from(".homePage", { duration: 0.1, autoAlpha: 0, y: 100 });
|
gsap.from(".homePage", { duration: 0.1, autoAlpha: 0, y: 100 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// 页面未挂载
|
// 页面未挂载
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
|
if (!h5plugin.isWX()) {
|
||||||
if(!h5plugin.isWX()){
|
apiAll();
|
||||||
apiAll()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("link:", window.location.href);
|
console.log("link:", window.location.href);
|
||||||
@ -216,9 +223,8 @@ onBeforeMount(() => {
|
|||||||
|
|
||||||
// 页面挂载
|
// 页面挂载
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fontAdpat()
|
fontAdpat();
|
||||||
// stopBack()
|
stopBack()
|
||||||
goBackEvent()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 来自首页的事件
|
// 来自首页的事件
|
||||||
@ -231,12 +237,9 @@ const getCode = () => {
|
|||||||
let redirect_uri = window.location.href;
|
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,
|
||||||
service
|
service
|
||||||
.post(
|
.post(process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize", {
|
||||||
process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize",
|
redirect_uri: redirect_uri,
|
||||||
{
|
})
|
||||||
redirect_uri: redirect_uri,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let code = res.data.data;
|
let code = res.data.data;
|
||||||
console.log("get code结果3", res);
|
console.log("get code结果3", res);
|
||||||
@ -264,7 +267,7 @@ const getOpenId = (code) => {
|
|||||||
console.log("后端返回的openid:", res.data);
|
console.log("后端返回的openid:", res.data);
|
||||||
// 更新openid
|
// 更新openid
|
||||||
store.commit({ type: "updateXGLOpenid", openid: res.data.data });
|
store.commit({ type: "updateXGLOpenid", openid: res.data.data });
|
||||||
apiAll()
|
apiAll();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -292,54 +295,50 @@ const pageImgsArrLoad = (imgs) => {
|
|||||||
return Promise.all(promiseArr);
|
return Promise.all(promiseArr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 字体适配
|
// 字体适配
|
||||||
const fontAdpat = ()=>{
|
const fontAdpat = () => {
|
||||||
if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
|
if (
|
||||||
handleFontSize();
|
typeof WeixinJSBridge == "object" &&
|
||||||
} else {
|
typeof WeixinJSBridge.invoke == "function"
|
||||||
if (document.addEventListener) {
|
) {
|
||||||
document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
|
handleFontSize();
|
||||||
} else if (document.attachEvent) {
|
} else {
|
||||||
document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
|
if (document.addEventListener) {
|
||||||
}
|
document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
|
||||||
}
|
} else if (document.attachEvent) {
|
||||||
function handleFontSize() {
|
document.attachEvent("onWeixinJSBridgeReady", 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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user