Commit f856c46e authored by 王炽's avatar 王炽

666666

parent a29a091c
......@@ -185,11 +185,14 @@ onMounted(async () => {
//获取邀请码和奖励
const res = await integralStore.getOriginInviteHome();
if(res.success && res.data?.unclaimedPrize) {
// const unionId = uni.getStorageSync('unionId');
const unclaimedPrize = res.data?.unclaimedPrize;
if(res.success && unclaimedPrize) {
globalStore.isShowInvitePrizePanel = true;
globalStore.inviteCount = res.data?.invitedCount;
globalStore.prizeName = res.data?.invitationImageUrl;//????
globalStore.prizeImage = res.data?.invitationImageUrl;
globalStore.prizeName = unclaimedPrize?.prizeName;
globalStore.prizeImage = res.data?.prizeImageUrl;
}
console.log('邀请活动首页数据:', res);
});
......
......@@ -34,7 +34,6 @@
justify-content: center;
box-shadow: 0 4rpx 20rpx rgba(211, 164, 88, 0.3);
transition: transform 0.2s ease;
z-index: 2;
&:active {
transform: translateX(-50%) scale(0.95);
......@@ -46,6 +45,16 @@
font-weight: bold;
}
}
.sharepage_login_button {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.2;
background-color: #000;
}
}
}
......@@ -8,7 +8,14 @@
<view class="claim_button" @click="handleClaim">
<text class="claim_text">一键领取</text>
</view>
<button class="sharepage_login_button"
v-if="!isLogin"
open-type="getPhoneNumber"
@getphonenumber="onGetPhoneNumber"
:debug-mode="debugMode"
/>
</view>
<!-- 分享登录弹窗 -->
<!-- <sharepoplogin
......@@ -43,14 +50,14 @@ const showSharePopLogin = ref(false);
const showShareNPopNoLogin = ref(true);
const handlePageClick = () => {
console.log('handlePageClick');
if(!isLogin.value) {
needReinit.value = true;
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
}
// console.log('handlePageClick');
// if(!isLogin.value) {
// needReinit.value = true;
// jump({
// type: JumpType.INNER,
// url: "/pages/activity/register",
// })
// }
};
// 获取store实例
......@@ -60,37 +67,97 @@ const integralStore = useIntegralStore();
const isLogin = computed(()=>{
//return false
console.log('isLogin--sharepage:', userStore.isLogin);
return userStore.isLogin;
})
const isnew = ref(false);
const inviteCode = ref('');
const unionId = ref('oQ9KswkD0qMVwPHQGslkHaJ0QxnE' || '');
onMounted(() => {
// 页面加载时显示分享未登录弹窗
// showShareNPopNoLogin.value = true;
const unionId = ref('');
const showPhone = ref(false);
// 获取邀请码参数
// 获取邀请码和unionId
const initInviteParams = () => {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const options = currentPage.options || {};
const inviteCode1 = options.inviteCode || '';
inviteCode.value = inviteCode1;
unionId.value = uni.getStorageSync('unionId');
console.log('unionIdsharepage:', unionId.value);
return { inviteCode: inviteCode1, unionId: unionId.value };
};
onMounted(() => {
// 页面加载时显示分享未登录弹窗
// showShareNPopNoLogin.value = true;
if(isLogin.value) {
// 获取邀请码参数
const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
// 如果有邀请码,调用助力接口
if (inviteCode.value && isLogin.value) {
callAssistInvite(inviteCode1,unionId.value);
// 如果有邀请码,调用助力接口
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid);
}
}
});
// Phone authorization
const onGetPhoneNumber = async (e) => {
console.log('onGetPhoneNumber', e.detail)
showLoading('授权中...')
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const options = currentPage.options;
const incomingCode = options.inviteCode;
if (e.detail.errMsg === 'getPhoneNumber:ok') {
try {
// console.warn('onGetPhoneNumber', e.detail)
// 隐藏授权弹窗
userStore.phoneCallback(e.detail, null, null, async () => {
hideLoading()
// 重新获取用户信息(登录后)getphonenumber
await Promise.all([
userStore.loadUserInfo(),
userStore.loadMemberInfo(),
])
console.warn('授权后重新获取用户信息')
// 获取邀请码参数
const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
// 如果有邀请码,调用助力接口
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid);
}
}, {
wxLoginBusinessDTO: {
activityUserInvite915Code: incomingCode
}
})
} catch (error) {
hideLoading()
console.error('授权后处理失败:', error)
uni.showToast({title: '授权失败', icon: 'none'});
}
} else {
hideLoading()
uni.showToast({title: '授权失败', icon: 'none'});
}
};
// 调用助力接口
const callAssistInvite = async (ivtCode,unionId) => {
try {
// 获取用户unionId
const wxUnionId = userStore.unionId || '';
const res = await integralStore.assistInvite(ivtCode, unionId);
console.log('助力接口返回:', res);
......@@ -101,18 +168,20 @@ const callAssistInvite = async (ivtCode,unionId) => {
onShow(() => {
if(isLogin.value) {
if(isnew.value) {
globalStore.invateUseType = 'new';
//新用户注册登录后调用助力接口
gotoIntegral();
// 如果有邀请码,调用助力接口
if (inviteCode.value) {
callAssistInvite(ivtCode, unionId.value);
}
isnew.value = false;
}
// if(integralStore.assistInviteData.success && integralStore.assistInviteData.data.newUser) {
// globalStore.invateUseType = 'new';
// //新用户注册登录后调用助力接口
// gotoIntegral();
// // 如果有邀请码,调用助力接口
// if (inviteCode.value) {
// callAssistInvite(ivtCode, unionId.value);
// }
// isnew.value = false;
// }
}
});
......@@ -139,23 +208,18 @@ onShow(() => {
// 一键领取按钮点击事件
const handleClaim = () => {
if(!isLogin.value) {
needReinit.value = true;
jump({
type: JumpType.INNER,
url: "/pages/activity/register",
})
isnew.value = true;
}else{
// 设置邀请用户类型
if(isnew.value) {
globalStore.invateUseType = 'new';
} else {
globalStore.invateUseType = 'old';
}
showPhone.value = true;
return;
}
gotoIntegral();
// 设置邀请用户类型
if(integralStore.assistInviteData?.data?.newUser) {
globalStore.invateUseType = 'new';
} else {
globalStore.invateUseType = 'old';
}
gotoIntegral();
};
const gotoIntegral = () => {
......
......@@ -2909,7 +2909,7 @@ onShareAppMessage(() => {
return {
title: '积分分享',
path: '/pages/invate/sharepage' + '?inviteCode=' + integralStore.originInviteHome?.data?.invitationCode,
imageUrl: 'https://course.feihe.com/momclub-picture/integral/1023/invate_star_character1023.png'
imageUrl: integralStore.originInviteHome?.data?.invitationImageUrl || 'https://course.feihe.com/momclub-picture/integral/1023/invate_star_character1023.png'
};
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment