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
b0765cac
Commit
b0765cac
authored
Oct 22, 2025
by
lg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 修复授权后执行动作
parent
07261625
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
47 deletions
+66
-47
ClickArea.vue
activities/1015/components/ClickArea.vue
+21
-5
InviteTask.vue
activities/1015/components/InviteTask.vue
+37
-39
home.vue
activities/1015/home.vue
+6
-1
index.js
utils/index.js
+2
-2
No files found.
activities/1015/components/ClickArea.vue
View file @
b0765cac
<
script
setup
lang=
"ts"
>
import
{
computed
,
inject
}
from
'vue'
import
{
computed
,
inject
,
watch
,
ref
}
from
'vue'
import
{
jump
}
from
'@/utils'
import
{
MdConfig
}
from
"../types"
;
import
{
useMD
}
from
"../use-md"
;
...
...
@@ -18,6 +18,8 @@ const props = defineProps<{
const
pageName
=
inject
(
'pageName'
,
''
)
const
needRevoke
=
ref
(
false
)
const
style
=
computed
(()
=>
{
const
area
=
props
.
properties
.
area
return
{
...
...
@@ -35,22 +37,36 @@ const emit = defineEmits<{
(
e
:
'getphonenumber'
,
e
:
any
):
void
}
>
()
function
onClick
(
e
)
{
emit
(
'click'
,
e
)
function
onClick
(
e
,
revoke
=
false
)
{
if
(
!
revoke
)
{
emit
(
'click'
,
e
)
logClick
()
}
if
((
!
props
.
properties
.
needLogin
||
props
.
isLogin
)
&&
props
.
properties
.
link
)
{
jump
(
props
.
properties
.
link
)
}
logClick
()
}
function
onGetPhoneNumber
(
e
)
{
needRevoke
.
value
=
true
emit
(
'getphonenumber'
,
e
)
}
watch
(()
=>
props
.
isLogin
,
async
(
newVal
)
=>
{
if
(
newVal
&&
needRevoke
.
value
)
{
needRevoke
.
value
=
false
onClick
(
null
,
true
)
}
})
</
script
>
<
template
>
<button
class=
"click-area"
:class=
"
{'debug-mode': debugMode}" :style="style"
:open-type="openType ?? (properties.needLogin
&&
!isLogin ? 'getPhoneNumber' : undefined)"
@click="onClick"
@getphonenumber="
(e) => emit('getphonenumber', e)
"
@getphonenumber="
onGetPhoneNumber
"
/>
</
template
>
...
...
activities/1015/components/InviteTask.vue
View file @
b0765cac
...
...
@@ -13,7 +13,7 @@ const gotPrizeModalRef = ref<InstanceType<typeof GotPrizeModal>>()
const
updateShareData
=
inject
(
'updateShareData'
)
const
onGetPhoneNumber
=
inject
(
'onGetPhoneNumber'
)
const
{
proxy
}
=
getCurrentInstance
()
const
{
proxy
}
=
getCurrentInstance
()
const
$baseUrl
=
proxy
.
$baseUrl
const
props
=
defineProps
<
{
...
...
@@ -48,46 +48,44 @@ async function updateInvitationInfo() {
}
async
function
tryAssist
()
{
if
(
invitationInfo
)
{
const
pages
=
getCurrentPages
();
const
currentPage
=
pages
[
pages
.
length
-
1
];
const
options
=
currentPage
.
options
;
const
invitationCode
=
options
.
invitationCode
;
if
(
invitationCode
&&
!
isAssist
.
value
&&
props
.
isLogin
)
{
console
.
log
(
'处理助力邀请码:'
,
invitationCode
)
try
{
const
unionId
=
uni
.
getStorageSync
(
'unionId'
);
const
res
=
await
invitationAssist
(
invitationCode
,
unionId
);
if
(
res
&&
res
.
success
)
{
uni
.
showToast
({
title
:
'助力成功'
,
icon
:
'none'
,
duration
:
2000
});
isAssist
.
value
=
true
;
// 助力成功后重新获取数据
await
updateInvitationInfo
();
return
Promise
.
resolve
();
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
,
duration
:
2000
});
return
Promise
.
reject
();
}
}
catch
(
error
)
{
console
.
error
(
'助力请求失败:'
,
error
)
const
pages
=
getCurrentPages
();
const
currentPage
=
pages
[
pages
.
length
-
1
];
const
options
=
currentPage
.
options
;
const
invitationCode
=
options
.
invitationCode
;
if
(
invitationCode
&&
!
isAssist
.
value
&&
props
.
isLogin
)
{
console
.
log
(
'处理助力邀请码:'
,
invitationCode
)
try
{
const
unionId
=
uni
.
getStorageSync
(
'unionId'
);
const
res
=
await
invitationAssist
(
invitationCode
,
unionId
);
if
(
res
&&
res
.
success
)
{
uni
.
showToast
({
title
:
'助力成功'
,
icon
:
'none'
,
duration
:
2000
});
isAssist
.
value
=
true
;
// 助力成功后重新获取数据
await
updateInvitationInfo
();
return
Promise
.
resolve
();
}
else
{
uni
.
showToast
({
title
:
error
.
message
,
title
:
res
.
message
,
icon
:
'none'
,
duration
:
2000
});
return
Promise
.
reject
();
}
}
catch
(
error
)
{
console
.
error
(
'助力请求失败:'
,
error
)
uni
.
showToast
({
title
:
error
.
message
,
icon
:
'none'
,
duration
:
2000
});
return
Promise
.
reject
();
}
}
}
...
...
@@ -114,12 +112,12 @@ async function initComponent() {
watch
(()
=>
props
.
isLogin
,
async
(
newVal
)
=>
{
if
(
newVal
)
{
initComponent
()
initComponent
()
.
catch
(
console
.
log
)
}
})
onMounted
(
async
()
=>
{
initComponent
()
initComponent
()
.
catch
(
console
.
log
)
})
</
script
>
...
...
@@ -154,14 +152,14 @@ onMounted(async () => {
background-color: rgba(255, 0, 0, 0.3);
}
.avatars{
.avatars
{
position: absolute;
left: 24rpx;
top: 108rpx;
display: flex;
gap: 25rpx;
.avatar{
.avatar
{
width: 63rpx;
height: 63rpx;
}
...
...
activities/1015/home.vue
View file @
b0765cac
...
...
@@ -38,6 +38,7 @@ import {useUserStore} from '@/stores/user';
import
ClickArea
from
"./components/ClickArea.vue"
;
import
ImageSwiper
from
"./components/ImageSwiper.vue"
;
import
InviteTask
from
"./components/InviteTask.vue"
;
import
{
hideLoading
,
showLoading
}
from
"@/utils"
;
const
DEBUG_MODE
=
false
...
...
@@ -187,6 +188,7 @@ onMounted(async () => {
// 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;
...
...
@@ -197,11 +199,12 @@ const onGetPhoneNumber = async (e) => {
// console.warn('onGetPhoneNumber', e.detail)
// 隐藏授权弹窗
userStore.phoneCallback(e.detail, null, null, async () => {
// 重新获取用户信息(登录后)
// 重新获取用户信息(登录后)
getphonenumber
await Promise.all([
userStore.loadUserInfo(),
userStore.loadMemberInfo(),
])
hideLoading()
console.warn('授权后重新获取用户信息')
}, {
wxLoginBusinessDTO: {
...
...
@@ -209,10 +212,12 @@ const onGetPhoneNumber = async (e) => {
}
})
} catch (error) {
hideLoading()
console.error('授权后处理失败:', error)
uni.showToast({title: '授权失败', icon: 'none'});
}
} else {
hideLoading()
uni.showToast({title: '授权失败', icon: 'none'});
}
};
...
...
utils/index.js
View file @
b0765cac
...
...
@@ -138,10 +138,10 @@ export function throttleTap(fn, delay = 1000) {
let
loadingCount
=
0
;
let
loadingTimer
=
null
;
export
function
showLoading
()
{
export
function
showLoading
(
title
=
"加载中"
)
{
if
(
loadingCount
==
0
)
{
uni
.
showLoading
({
title
:
"加载中"
,
title
,
mask
:
true
,
});
...
...
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