Commit 69829d54 authored by spc's avatar spc

Merge branch 'feihesanqi_20251014' of http://gitlab.dui88.com/fh/20250528_FHQ1...

Merge branch 'feihesanqi_20251014' of http://gitlab.dui88.com/fh/20250528_FHQ1 into feihesanqi_20251014
parents 57d04ade 72ac94e8
...@@ -49,7 +49,7 @@ import { onMounted, ref, computed } from 'vue'; ...@@ -49,7 +49,7 @@ import { onMounted, ref, computed } from 'vue';
import { onShareAppMessage, onShow } from '@dcloudio/uni-app'; import { onShareAppMessage, onShow } from '@dcloudio/uni-app';
import sharepoplogin from '@/components/integralArea/sharepoplogin.vue'; import sharepoplogin from '@/components/integralArea/sharepoplogin.vue';
import sharenpopnologin from '@/components/integralArea/sharenpopnologin.vue'; import sharenpopnologin from '@/components/integralArea/sharenpopnologin.vue';
import { jump, JumpType } from '../../utils'; import { jump, JumpType, showLoading, hideLoading } from '../../utils';
import { useGlobalStore } from '@/stores/global'; import { useGlobalStore } from '@/stores/global';
import { useUserStore } from '@/stores/user'; import { useUserStore } from '@/stores/user';
import { useIntegralStore } from '@/stores/integral'; import { useIntegralStore } from '@/stores/integral';
...@@ -107,7 +107,28 @@ const initInviteParams = () => { ...@@ -107,7 +107,28 @@ const initInviteParams = () => {
}; };
onMounted(async() => { onMounted(async() => {
// 调用邀请活动首页接口
// 先进行自动登录获取基础信息,登录成功后执行页面初始化
try {
console.log('开始执行 normalAutoLogin...')
await userStore.normalAutoLogin(initPage)
console.log('normalAutoLogin 完成')
} catch (error) {
console.error('normalAutoLogin 失败:', error)
// 即使登录失败也执行页面初始化
await initPage()
}
// 先隐藏朋友圈分享
uni.hideShareMenu({
menus: ['shareTimeline']
});
});
const initPage = async () => {
// 调用邀请活动首页接口
const integralStore = useIntegralStore(); const integralStore = useIntegralStore();
//获取邀请码和奖励 //获取邀请码和奖励
const res = await integralStore.getOriginInviteHome(); const res = await integralStore.getOriginInviteHome();
...@@ -127,10 +148,20 @@ onMounted(async() => { ...@@ -127,10 +148,20 @@ onMounted(async() => {
prizeName.value = unclaimedPrize?.prizeName; prizeName.value = unclaimedPrize?.prizeName;
prizeImage.value = res.data?.prizeImageUrl; prizeImage.value = res.data?.prizeImageUrl;
} }
if(isLogin.value) {
// 获取邀请码参数
const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
// 如果有邀请码,调用助力接口
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid);
}
}
} }
}else{ }else{
console.log('未获取授权,接口不通视为新用户'); console.log('获取邀请活动首页接口失败');
isLogin.value = false; isLogin.value = false;
// uni.showToast({title: '网络问题,请稍后再试', icon: 'none'}); // uni.showToast({title: '网络问题,请稍后再试', icon: 'none'});
} }
...@@ -138,62 +169,55 @@ onMounted(async() => { ...@@ -138,62 +169,55 @@ onMounted(async() => {
console.log('onMounted--sharepage:', isLogin.value); console.log('onMounted--sharepage:', isLogin.value);
// 页面加载时显示分享未登录弹窗 // 页面加载时显示分享未登录弹窗
// showShareNPopNoLogin.value = true; // showShareNPopNoLogin.value = true;
if(isLogin.value) { }
// 获取邀请码参数
const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
// 如果有邀请码,调用助力接口
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid);
}
}
});
// Phone authorization // Phone authorization
const onGetPhoneNumber = async (e) => { const onGetPhoneNumber = async (e) => {
console.log('onGetPhoneNumber', e.detail) console.log('onGetPhoneNumber', e.detail)
showLoading('授权中...') showLoading('授权中...')
const pages = getCurrentPages(); const pages = getCurrentPages();
const currentPage = pages[pages.length - 1]; const currentPage = pages[pages.length - 1];
const options = currentPage.options; const options = currentPage.options;
const incomingCode = options.inviteCode; const incomingCode = options.inviteCode;
if (e.detail.errMsg === 'getPhoneNumber:ok') { if (e.detail.errMsg === 'getPhoneNumber:ok') {
try { try {
// console.warn('onGetPhoneNumber', e.detail) // console.warn('onGetPhoneNumber', e.detail)
// 隐藏授权弹窗 // 隐藏授权弹窗
userStore.phoneCallback(e.detail, null, null, async () => {
hideLoading() console.log('onGetPhoneNumber-phoneCallback-sharepage:', userStore.phoneCallback);
// 重新获取用户信息(登录后)getphonenumber userStore.phoneCallback(e.detail, null, null, async () => {
await Promise.all([ hideLoading()
userStore.loadUserInfo(), // 重新获取用户信息(登录后)getphonenumber
userStore.loadMemberInfo(), await Promise.all([
]) userStore.loadUserInfo(),
console.warn('授权后重新获取用户信息') userStore.loadMemberInfo(),
])
// 获取邀请码参数 console.warn('授权后重新获取用户信息')
const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
// 获取邀请码参数
// 如果有邀请码,调用助力接口 const { inviteCode: ivtCode, unionId: uid } = initInviteParams();
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid); // 如果有邀请码,调用助力接口
if (ivtCode && isLogin.value) {
callAssistInvite(ivtCode, uid);
}
}, {
wxLoginBusinessDTO: {
activityUserInvite915Code: incomingCode
}
})
} catch (error) {
hideLoading()
console.error('授权后处理失败:', error)
uni.showToast({title: '授权失败', icon: 'none'});
} }
} else {
}, { hideLoading()
wxLoginBusinessDTO: { uni.showToast({title: '授权失败', icon: 'none'});
activityUserInvite915Code: incomingCode }
}
})
} catch (error) {
hideLoading()
console.error('授权后处理失败:', error)
uni.showToast({title: '授权失败', icon: 'none'});
}
} else {
hideLoading()
uni.showToast({title: '授权失败', icon: 'none'});
}
}; };
// 调用助力接口 // 调用助力接口
......
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