Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
72ac94e8
Commit
72ac94e8
authored
Oct 27, 2025
by
王炽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
666666
parent
e21afea3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
56 deletions
+80
-56
sharepage.vue
pages/invate/sharepage.vue
+80
-56
No files found.
pages/invate/sharepage.vue
View file @
72ac94e8
...
...
@@ -49,7 +49,7 @@ import { onMounted, ref, computed } from 'vue';
import
{
onShareAppMessage
,
onShow
}
from
'@dcloudio/uni-app'
;
import
sharepoplogin
from
'@/components/integralArea/sharepoplogin.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
{
useUserStore
}
from
'@/stores/user'
;
import
{
useIntegralStore
}
from
'@/stores/integral'
;
...
...
@@ -107,7 +107,28 @@ const initInviteParams = () => {
};
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
res
=
await
integralStore
.
getOriginInviteHome
();
...
...
@@ -127,10 +148,20 @@ onMounted(async() => {
prizeName
.
value
=
unclaimedPrize
?.
prizeName
;
prizeImage
.
value
=
res
.
data
?.
prizeImageUrl
;
}
if
(
isLogin
.
value
)
{
// 获取邀请码参数
const
{
inviteCode
:
ivtCode
,
unionId
:
uid
}
=
initInviteParams
();
// 如果有邀请码,调用助力接口
if
(
ivtCode
&&
isLogin
.
value
)
{
callAssistInvite
(
ivtCode
,
uid
);
}
}
}
}
else
{
console
.
log
(
'
未获取授权,接口不通视为新用户
'
);
console
.
log
(
'
获取邀请活动首页接口失败
'
);
isLogin
.
value
=
false
;
// uni.showToast({title: '网络问题,请稍后再试', icon: 'none'});
}
...
...
@@ -138,62 +169,55 @@ onMounted(async() => {
console
.
log
(
'onMounted--sharepage:'
,
isLogin
.
value
);
// 页面加载时显示分享未登录弹窗
// showShareNPopNoLogin.value = true;
if
(
isLogin
.
value
)
{
// 获取邀请码参数
const
{
inviteCode
:
ivtCode
,
unionId
:
uid
}
=
initInviteParams
();
// 如果有邀请码,调用助力接口
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
);
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)
// 隐藏授权弹窗
console
.
log
(
'onGetPhoneNumber-phoneCallback-sharepage:'
,
userStore
.
phoneCallback
);
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'
});
}
},
{
wxLoginBusinessDTO
:
{
activityUserInvite915Code
:
incomingCode
}
})
}
catch
(
error
)
{
hideLoading
()
console
.
error
(
'授权后处理失败:'
,
error
)
uni
.
showToast
({
title
:
'授权失败'
,
icon
:
'none'
});
}
}
else
{
hideLoading
()
uni
.
showToast
({
title
:
'授权失败'
,
icon
:
'none'
});
}
}
else
{
hideLoading
()
uni
.
showToast
({
title
:
'授权失败'
,
icon
:
'none'
});
}
};
// 调用助力接口
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment