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
eb2bfb58
Commit
eb2bfb58
authored
Apr 05, 2023
by
m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
9eedc348
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
19 deletions
+32
-19
header.tsx
src/pages/group/components/header.tsx
+9
-7
members.tsx
src/pages/group/components/members.tsx
+1
-1
index.tsx
src/pages/group/index.tsx
+3
-6
index.ts
src/pages/group/model/index.ts
+19
-5
No files found.
src/pages/group/components/header.tsx
View file @
eb2bfb58
...
...
@@ -2,8 +2,9 @@ import { View, Text, Image } from '@tarojs/components'
import
{
showToast
}
from
'@tarojs/taro'
import
classNames
from
'classnames'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useRequest
}
from
'@/hooks'
import
{
queryTribePoint
,
postTribePoint
,
type
PointType
}
from
'@/api/group'
import
{
postTribePoint
,
type
PointType
}
from
'@/api/group'
import
assets
from
'@/assets/oss/assets-group'
import
TextPrinter
from
'./text-printer'
...
...
@@ -22,16 +23,15 @@ const renderCreator = () => (
)
const
CroupHeader
=
({
groupNo
}:
{
groupNo
:
string
})
=>
{
const
{
data
,
run
:
refresh
}
=
useRequest
(
queryTribePoint
,
{
immediate
:
!!
groupNo
})
const
queryTribePoint
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
queryTribePoint
)
const
points
=
useStoreState
(
state
=>
state
.
groupModel
.
points
)
const
{
run
}
=
useRequest
(
postTribePoint
,
{
immediate
:
false
,
throttleDelay
:
1000
,
onSuccess
:
()
=>
{
showToast
({
title
:
'领取成功'
})
refresh
()
queryTribePoint
()
}
})
...
...
@@ -53,7 +53,9 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => {
+
{
item
.
point
||
0
}
</
Text
>
</
View
>
<
Text
className=
{
styles
.
members_stroke
}
>
{
item
.
type
===
'MEMBERNUM'
?
'今日部落津贴'
:
'成功邀请1人'
}
</
Text
>
<
Text
className=
{
styles
.
members_stroke
}
>
{
item
.
type
===
'MEMBERNUM'
?
'今日部落津贴'
:
'成功邀请1人'
}
</
Text
>
</
View
>
)
...
...
@@ -63,7 +65,7 @@ const CroupHeader = ({ groupNo }: { groupNo: string }) => {
<
Text
className=
{
styles
.
members_text
}
>
{
groupNo
}
部落
</
Text
>
</
View
>
<
View
className=
{
styles
.
members_content
}
>
{
data
?.
map
(
renderItem
)
}
{
points
?.
map
(
renderItem
)
}
</
View
>
</
View
>
)
...
...
src/pages/group/components/members.tsx
View file @
eb2bfb58
...
...
@@ -27,7 +27,7 @@ const Members = () => {
{
item
.
memberName
||
'-'
}
{
isCurrent
&&
<
Text
>
(你)
</
Text
>
}
</
Text
>
{
i
sCurrent
&&
<
Image
className=
{
styles
.
crown
}
src=
{
assets
[
'crown-small.png'
].
u
}
/>
}
{
i
tem
.
identity
===
'LEADER'
&&
<
Image
className=
{
styles
.
crown
}
src=
{
assets
[
'crown-small.png'
].
u
}
/>
}
</
View
>
<
Text
className=
{
styles
.
schoolName
}
>
{
item
.
schoolName
}
</
Text
>
</
View
>
...
...
src/pages/group/index.tsx
View file @
eb2bfb58
...
...
@@ -5,7 +5,7 @@ import { useMemo, useState } from 'react'
import
Modal
from
'@/components/Modal'
import
Button
from
'@/components/Button'
import
{
useBoolean
,
useRequest
}
from
'@/hooks'
import
{
createTribe
,
queryTribePoint
}
from
'@/api/group'
import
{
createTribe
}
from
'@/api/group'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
type
{
TabbarRef
}
from
'@/custom-tab-bar/index'
...
...
@@ -30,6 +30,7 @@ const Group = () => {
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
tribeInfo
=
useStoreState
(
state
=>
state
.
groupModel
.
tribeInfo
)
const
fetchTribeInfo
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
fetchTribeInfo
)
const
queryTribePoint
=
useStoreActions
(
actions
=>
actions
.
groupModel
.
queryTribePoint
)
const
tabBarHeight
=
useMemo
(()
=>
{
return
nav
.
height
+
nav
.
top
+
5
...
...
@@ -56,10 +57,6 @@ const Group = () => {
}
})
const { run: refresh } = useRequest(queryTribePoint, {
immediate: false
})
const onConfirm = () => {
if (!groupNo) {
showModal({ title: '部落名不能为空' })
...
...
@@ -71,7 +68,7 @@ const Group = () => {
const onRefresher = async () => {
try {
toggle()
await Promise.all([fetchTribeInfo(),
refresh
()])
await Promise.all([fetchTribeInfo(),
queryTribePoint
()])
} finally {
setTimeout(() => toggle(), 600)
}
...
...
src/pages/group/model/index.ts
View file @
eb2bfb58
import
Taro
from
'@tarojs/taro'
import
{
action
,
Action
,
computed
,
Computed
,
Thunk
,
thunk
action
,
Action
,
computed
,
Computed
,
Thunk
,
thunk
,
State
}
from
'easy-peasy'
import
{
getTribeInfo
,
type
TribeInfo
,
type
MemberItem
}
from
'@/api/group'
import
{
getTribeInfo
,
queryTribePoint
,
type
PointType
,
type
TribeInfo
,
type
MemberItem
}
from
'@/api/group'
import
{
AppStoreModel
}
from
'@/store/store-model'
export
interface
GroupModel
{
points
:
PointType
[],
tribeInfo
:
TribeInfo
|
null
;
groupMembers
:
Computed
<
GroupModel
,
MemberItem
[]
>
;
isEmpty
:
Computed
<
GroupModel
,
boolean
>
;
updateState
:
Action
<
GroupModel
,
TribeInfo
|
null
>
;
updateState
:
Action
<
GroupModel
,
Partial
<
State
<
GroupModel
>>
>
;
fetchTribeInfo
:
Thunk
<
GroupModel
,
void
,
void
,
AppStoreModel
,
Promise
<
TribeInfo
>>
;
queryTribePoint
:
Thunk
<
GroupModel
>
;
}
const
groupModel
:
GroupModel
=
{
tribeInfo
:
null
,
points
:
[],
groupMembers
:
computed
((
state
)
=>
state
.
tribeInfo
?.
groupMembers
||
[]),
isEmpty
:
computed
((
state
)
=>
state
.
groupMembers
.
length
<
1
),
updateState
:
action
((
state
,
payload
)
=>
{
state
.
tribeInfo
=
payload
for
(
const
key
in
payload
)
{
state
[
key
]
=
payload
[
key
]
}
}),
fetchTribeInfo
:
thunk
(
async
(
actions
)
=>
{
...
...
@@ -34,8 +39,17 @@ const groupModel: GroupModel = {
}
finally
{
setTimeout
(()
=>
Taro
.
hideLoading
(),
300
)
}
actions
.
updateState
(
ret
)
actions
.
updateState
(
{
tribeInfo
:
ret
}
)
return
ret
}),
queryTribePoint
:
thunk
(
async
(
actions
)
=>
{
try
{
const
{
data
}
=
await
queryTribePoint
()
actions
.
updateState
({
points
:
data
})
}
catch
(
err
)
{
actions
.
updateState
({
points
:
[]
})
Taro
.
showModal
({
title
:
err
.
message
})
}
})
}
...
...
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