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
f52b7c02
Commit
f52b7c02
authored
Apr 05, 2023
by
m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
f94ac1bb
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
56 additions
and
15 deletions
+56
-15
group.ts
src/api/group.ts
+4
-3
index.module.scss
src/components/Button/index.module.scss
+2
-0
creator.module.scss
src/pages/group/components/creator.module.scss
+8
-0
creator.tsx
src/pages/group/components/creator.tsx
+1
-1
header.tsx
src/pages/group/components/header.tsx
+5
-5
index.tsx
src/pages/group/index.tsx
+3
-2
main.tsx
src/pages/main/main.tsx
+29
-3
index.tsx
src/pages/prepare/index.tsx
+3
-1
render.tsx
src/pages/prepare/render.tsx
+1
-0
No files found.
src/api/group.ts
View file @
f52b7c02
...
@@ -35,11 +35,12 @@ export const postTribePoint = ({ type }: Pick<PointType, 'type'>) => {
...
@@ -35,11 +35,12 @@ export const postTribePoint = ({ type }: Pick<PointType, 'type'>) => {
}
}
// 加入部落
// 加入部落
export
const
joinTribe
=
()
=>
{
export
const
joinTribe
=
(
{
groupId
}:
{
groupId
:
number
}
)
=>
{
return
requestAfterSilentLogin
<
{},
{
userId
?:
number
}
>
((
userInfo
)
=>
({
return
requestAfterSilentLogin
<
{},
{
userId
?:
number
,
groupId
:
number
}
>
((
userInfo
)
=>
({
url
:
'/service-idea/group/joinTribe'
,
url
:
'/service-idea/group/joinTribe'
,
method
:
'POST'
,
method
:
'POST'
,
data
:
{
data
:
{
groupId
,
userId
:
userInfo
?.
userId
,
userId
:
userInfo
?.
userId
,
}
}
}))
}))
...
@@ -86,7 +87,7 @@ export const getTribeInfo = () => {
...
@@ -86,7 +87,7 @@ export const getTribeInfo = () => {
url
:
'/service-idea/group/tribeInfo'
,
url
:
'/service-idea/group/tribeInfo'
,
method
:
'POST'
,
method
:
'POST'
,
data
:
{
data
:
{
memberId
:
103
??
userInfo
?.
userId
,
memberId
:
userInfo
?.
userId
,
}
}
}))
}))
}
}
src/components/Button/index.module.scss
View file @
f52b7c02
...
@@ -13,12 +13,14 @@
...
@@ -13,12 +13,14 @@
color
:
#FFFFFF
;
color
:
#FFFFFF
;
&
.default
{
&
.default
{
flex
:
1
;
border
:
4rpx
solid
rgba
(
70
,
81
,
100
,
0
.3
);
border
:
4rpx
solid
rgba
(
70
,
81
,
100
,
0
.3
);
border-radius
:
36px
;
border-radius
:
36px
;
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
color
:
rgba
(
70
,
81
,
100
,
0
.5
);
}
}
&
.primary
{
&
.primary
{
flex
:
1
;
border-radius
:
36px
;
border-radius
:
36px
;
background-color
:
#1786F7
;
background-color
:
#1786F7
;
}
}
...
...
src/pages/group/components/creator.module.scss
View file @
f52b7c02
...
@@ -82,6 +82,14 @@
...
@@ -82,6 +82,14 @@
left
:
32px
;
left
:
32px
;
right
:
32px
;
right
:
32px
;
.btn_image
{
background-image
:
url('https://cdn.jkwljy.com/pk-math/gMAFXFRRH3frGsM2wCpyLUCdiNT/343x56')
;
}
.btn_hover_image
{
background-image
:
url('https://cdn.jkwljy.com/pk-math/3UiwFgrVHVQEcaPdxdf1XinBb64o/343x56')
;
}
&
_icon
{
&
_icon
{
width
:
32
PX
;
width
:
32
PX
;
height
:
32
PX
;
height
:
32
PX
;
...
...
src/pages/group/components/creator.tsx
View file @
f52b7c02
...
@@ -58,7 +58,7 @@ const Creator = ({ onClick }: { onClick: () => void }) => {
...
@@ -58,7 +58,7 @@ const Creator = ({ onClick }: { onClick: () => void }) => {
</
View
>
</
View
>
<
View
className=
{
styles
.
action
}
>
<
View
className=
{
styles
.
action
}
>
<
Button
type=
"custom"
size=
"large"
onClick=
{
onClick
}
>
<
Button
image=
{
styles
.
btn_image
}
hoverImage=
{
styles
.
btn_hover_image
}
size=
"large"
onClick=
{
onClick
}
>
立即创建你的部落
立即创建你的部落
<
Image
className=
{
styles
.
action_icon
}
src=
{
require
(
'@/pages/main/assets/score.png'
)
}
/>
<
Image
className=
{
styles
.
action_icon
}
src=
{
require
(
'@/pages/main/assets/score.png'
)
}
/>
+20
+20
...
...
src/pages/group/components/header.tsx
View file @
f52b7c02
...
@@ -21,9 +21,9 @@ const renderCreator = () => (
...
@@ -21,9 +21,9 @@ const renderCreator = () => (
</
View
>
</
View
>
)
)
const
CroupHeader
=
({
isCreator
}:
{
isCreator
:
boolean
})
=>
{
const
CroupHeader
=
({
groupNo
}:
{
groupNo
:
string
})
=>
{
const
{
data
,
run
:
refresh
}
=
useRequest
(
queryTribePoint
,
{
const
{
data
,
run
:
refresh
}
=
useRequest
(
queryTribePoint
,
{
immediate
:
!
isCreator
immediate
:
!
!
groupNo
})
})
const
{
run
}
=
useRequest
(
postTribePoint
,
{
const
{
run
}
=
useRequest
(
postTribePoint
,
{
...
@@ -60,7 +60,7 @@ const CroupHeader = ({ isCreator }: { isCreator: boolean }) => {
...
@@ -60,7 +60,7 @@ const CroupHeader = ({ isCreator }: { isCreator: boolean }) => {
const
renderMembers
=
()
=>
(
const
renderMembers
=
()
=>
(
<
View
className=
{
styles
.
members
}
>
<
View
className=
{
styles
.
members
}
>
<
View
className=
{
styles
.
members_title
}
>
<
View
className=
{
styles
.
members_title
}
>
<
Text
className=
{
styles
.
members_text
}
>
阳光学习帮
</
Text
>
<
Text
className=
{
styles
.
members_text
}
>
{
groupNo
}
部落
</
Text
>
</
View
>
</
View
>
<
View
className=
{
styles
.
members_content
}
>
<
View
className=
{
styles
.
members_content
}
>
{
data
?.
map
(
renderItem
)
}
{
data
?.
map
(
renderItem
)
}
...
@@ -69,8 +69,8 @@ const CroupHeader = ({ isCreator }: { isCreator: boolean }) => {
...
@@ -69,8 +69,8 @@ const CroupHeader = ({ isCreator }: { isCreator: boolean }) => {
)
)
return
(
return
(
<
View
className=
{
isCreator
?
styles
.
creator_banner
:
styles
.
members_banner
}
>
<
View
className=
{
!
groupNo
?
styles
.
creator_banner
:
styles
.
members_banner
}
>
{
isCreator
?
renderCreator
()
:
renderMembers
()
}
{
!
groupNo
?
renderCreator
()
:
renderMembers
()
}
</
View
>
</
View
>
)
)
}
}
...
...
src/pages/group/index.tsx
View file @
f52b7c02
...
@@ -24,6 +24,7 @@ const Group = () => {
...
@@ -24,6 +24,7 @@ const Group = () => {
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
groupNo
,
setGroupNo
]
=
useState
<
string
>
(
''
)
const
[
groupNo
,
setGroupNo
]
=
useState
<
string
>
(
''
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
{
tribeInfo
,
loading
}
=
useStoreState
(
state
=>
state
.
groupModel
)
const
{
tribeInfo
,
loading
}
=
useStoreState
(
state
=>
state
.
groupModel
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
...
@@ -39,7 +40,7 @@ const Group = () => {
...
@@ -39,7 +40,7 @@ const Group = () => {
useShareAppMessage
(()
=>
{
useShareAppMessage
(()
=>
{
return
{
return
{
title
:
'来看看这个有趣的页面!'
,
title
:
'来看看这个有趣的页面!'
,
path
:
`pages/main/main?
code=
${
tribeInfo
?.
groupNo
}
`,
path
:
`pages/main/main?
groupId=
${
tribeInfo
?.
id
}
&
userId
=
$
{
userInfo
.
userId
}
`,
imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?',
imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?',
}
}
})
})
...
@@ -73,7 +74,7 @@ const Group = () => {
...
@@ -73,7 +74,7 @@ const Group = () => {
<TopHeader />
<TopHeader />
<View style={{ paddingTop: `
$
{
tabBarHeight
}
px
` }}>
<View style={{ paddingTop: `
$
{
tabBarHeight
}
px
` }}>
<MainHeader
isCreator={!tribeInfo?.groupNo
} />
<MainHeader
groupNo={tribeInfo?.groupNo!
} />
<View>
<View>
{!tribeInfo?.groupNo ? <Creator onClick={setTrue} /> : <Members />}
{!tribeInfo?.groupNo ? <Creator onClick={setTrue} /> : <Members />}
...
...
src/pages/main/main.tsx
View file @
f52b7c02
import
{
View
}
from
'@tarojs/components'
import
{
View
}
from
'@tarojs/components'
import
{
getMenuButtonBoundingClientRect
,
useDidShow
,
getCurrentInstance
,
getTabBar
,
pageScrollTo
,
getSystemInfoSync
}
from
'@tarojs/taro'
import
{
useRouter
,
showToast
,
getMenuButtonBoundingClientRect
,
useDidShow
,
getCurrentInstance
,
getTabBar
,
pageScrollTo
,
getSystemInfoSync
,
showModal
}
from
'@tarojs/taro'
import
{
useState
,
useMemo
,
use
Effect
,
use
Callback
}
from
'react'
import
{
useState
,
useMemo
,
useCallback
}
from
'react'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
joinTribe
}
from
'@/api/group'
import
{
useRequest
}
from
'@/hooks'
import
type
{
TabbarRef
}
from
'../../custom-tab-bar/index'
import
type
{
TabbarRef
}
from
'../../custom-tab-bar/index'
import
{
CurrentRoundId
,
SceneContext
,
StageStatus
}
from
'./components/scene/constants'
import
{
CurrentRoundId
,
SceneContext
,
StageStatus
}
from
'./components/scene/constants'
...
@@ -9,16 +11,25 @@ import MainHeader from './components/header'
...
@@ -9,16 +11,25 @@ import MainHeader from './components/header'
import
MainChapter
from
'./components/chapter'
import
MainChapter
from
'./components/chapter'
import
MainScene
from
'./components/scene'
import
MainScene
from
'./components/scene'
import
MainShortCut
from
'./components/short-cut'
import
MainShortCut
from
'./components/short-cut'
import
styles
from
'./main.module.scss'
import
styles
from
'./main.module.scss'
const
MainPage
=
()
=>
{
const
MainPage
=
()
=>
{
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
[
isReady
,
setIsReady
]
=
useState
(
false
)
const
[
isReady
,
setIsReady
]
=
useState
(
false
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
fetchStage
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
fetchStage
)
const
fetchStage
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
fetchStage
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
router
=
useRouter
<
{
groupId
:
string
,
userId
:
string
}
>
()
const
{
groupId
,
userId
}
=
router
.
params
const
{
run
}
=
useRequest
(
joinTribe
,
{
immediate
:
false
,
onSuccess
:
()
=>
{
showToast
()
}
})
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
height
=
getSystemInfoSync
().
windowHeight
const
height
=
getSystemInfoSync
().
windowHeight
...
@@ -31,8 +42,12 @@ const MainPage = () => {
...
@@ -31,8 +42,12 @@ const MainPage = () => {
useDidShow
(()
=>
{
useDidShow
(()
=>
{
fetchAccount
()
fetchAccount
()
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
tabbar
?.
setSelected
(
0
)
tabbar
?.
setSelected
(
0
)
joinTribeByCode
()
fetchStage
().
then
((
list
)
=>
{
fetchStage
().
then
((
list
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
!
list
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
))
{
if
(
!
list
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
))
{
...
@@ -46,6 +61,17 @@ const MainPage = () => {
...
@@ -46,6 +61,17 @@ const MainPage = () => {
})
})
})
})
const
joinTribeByCode
=
useCallback
(()
=>
{
if
(
groupId
&&
+
userId
!==
userInfo
.
userId
)
{
showModal
({
title
:
'加入部落'
,
success
:
()
=>
{
run
({
groupId
:
+
groupId
})
}
})
}
},
[
groupId
,
userId
,
userInfo
.
userId
])
return
(
return
(
<>
<>
<
MainHeader
/>
<
MainHeader
/>
...
...
src/pages/prepare/index.tsx
View file @
f52b7c02
...
@@ -29,6 +29,8 @@ const Prepare = () => {
...
@@ -29,6 +29,8 @@ const Prepare = () => {
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
cardNum
=
useStoreState
(
state
=>
state
.
userModel
.
cardNum
)
const
cardNum
=
useStoreState
(
state
=>
state
.
userModel
.
cardNum
)
const
point
=
useStoreState
(
state
=>
state
.
userModel
.
point
)
const
point
=
useStoreState
(
state
=>
state
.
userModel
.
point
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
tribeInfo
=
useStoreState
(
state
=>
state
.
groupModel
.
tribeInfo
)
const
getStageDetail
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
getStageDetail
)
const
getStageDetail
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
getStageDetail
)
const
getQuestionList
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
getQuestionList
)
const
getQuestionList
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
getQuestionList
)
...
@@ -72,7 +74,7 @@ const Prepare = () => {
...
@@ -72,7 +74,7 @@ const Prepare = () => {
useShareAppMessage
(()
=>
{
useShareAppMessage
(()
=>
{
return
{
return
{
title
:
'来看看这个有趣的页面!'
,
title
:
'来看看这个有趣的页面!'
,
path
:
'pages/main/main?code=1111'
,
path
:
`pages/main/main?groupId=
${
tribeInfo
?.
id
}
&
userId
=
$
{
userInfo
.
userId
}
`
,
imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?',
imageUrl: 'https://picx.zhimg.com/v2-7b7b072d4bebd5ccf48c04ec1146e844_1440w.jpg?',
}
}
})
})
...
...
src/pages/prepare/render.tsx
View file @
f52b7c02
...
@@ -17,6 +17,7 @@ export const formatTime = (time: number) => {
...
@@ -17,6 +17,7 @@ export const formatTime = (time: number) => {
}
}
export
const
renderList
=
(
list
:
StageRank
[]
=
[])
=>
{
export
const
renderList
=
(
list
:
StageRank
[]
=
[])
=>
{
console
.
log
(
'---'
,
list
)
const
isEmpty
=
list
.
length
<
1
const
isEmpty
=
list
.
length
<
1
const
user
=
list
.
find
(
item
=>
item
.
me
)
const
user
=
list
.
find
(
item
=>
item
.
me
)
return
(
return
(
...
...
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