Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
frontend
GeekLearnMathWeapp
Commits
3c86091c
Commit
3c86091c
authored
Apr 05, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp
parents
61efbd65
e7445d0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
20 deletions
+25
-20
index.tsx
src/pages/group/index.tsx
+2
-5
main.tsx
src/pages/main/main.tsx
+23
-15
No files found.
src/pages/group/index.tsx
View file @
3c86091c
import
{
View
,
Image
,
Input
}
from
'@tarojs/components'
import
{
useDidShow
,
getCurrentInstance
,
getTabBar
,
getMenuButtonBoundingClientRect
,
showModal
,
useShareAppMessage
}
from
'@tarojs/taro'
import
{
useMemo
,
useState
,
useEffect
}
from
'react'
import
{
useMemo
,
useState
}
from
'react'
import
Modal
from
'@/components/Modal'
import
Button
from
'@/components/Button'
...
...
@@ -35,6 +35,7 @@ const Group = () => {
useDidShow
(()
=>
{
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
tabbar
?.
setSelected
(
1
)
fetchTribeInfo
()
})
useShareAppMessage
(()
=>
{
...
...
@@ -45,10 +46,6 @@ const Group = () => {
}
})
useEffect(() => {
fetchTribeInfo()
}, [fetchTribeInfo])
const { run, loading: spining } = useRequest(createTribe, {
immediate: false,
onSuccess: () => {
...
...
src/pages/main/main.tsx
View file @
3c86091c
...
...
@@ -6,7 +6,7 @@ import {
}
from
'@tarojs/taro'
import
{
useState
,
useMemo
,
useCallback
}
from
'react'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
joinTribe
}
from
'@/api/group'
import
{
getTribeInfo
,
joinTribe
}
from
'@/api/group'
import
{
useRequest
}
from
'@/hooks'
import
type
{
TabbarRef
}
from
'../../custom-tab-bar/index'
...
...
@@ -28,13 +28,6 @@ const MainPage = () => {
const
router
=
useRouter
<
{
groupId
:
string
,
inviteId
:
string
}
>
()
const
{
groupId
,
inviteId
}
=
router
.
params
const
{
run
}
=
useRequest
(
joinTribe
,
{
immediate
:
false
,
onSuccess
:
()
=>
{
showToast
()
}
})
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
height
=
getSystemInfoSync
().
windowHeight
pageScrollTo
({
...
...
@@ -65,14 +58,29 @@ const MainPage = () => {
})
})
const
joinTribeByCode
=
useCallback
(()
=>
{
if
(
groupId
&&
inviteId
&&
+
inviteId
!==
userInfo
.
userId
)
{
showModal
({
title
:
'加入部落'
,
success
:
(
res
)
=>
{
res
.
confirm
&&
run
({
groupId
:
+
groupId
})
// 加入部落
const
{
run
}
=
useRequest
(
joinTribe
,
{
immediate
:
false
,
onSuccess
:
()
=>
{
showToast
({
title
:
'加入成功'
})
}
})
const
joinTribeByCode
=
useCallback
(
async
()
=>
{
if
(
groupId
&&
inviteId
&&
+
inviteId
!==
userInfo
.
userId
)
{
// 邀请人是不是自己
try
{
const
res
=
await
getTribeInfo
()
if
(
!
res
.
data
.
id
)
{
// 是否已经加入部落
showModal
({
title
:
'加入部落'
,
success
:
({
confirm
})
=>
{
confirm
&&
run
({
groupId
:
+
groupId
})
}
})
}
})
}
finally
{
console
.
log
(
'-finally-'
)
}
}
},
[
groupId
,
inviteId
])
...
...
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