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
778cb505
Commit
778cb505
authored
Apr 11, 2023
by
raca
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://118.24.71.244/hewenhao/GeekLearnMathWeapp
parents
403153bb
a49df9b3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
18 deletions
+44
-18
complete-achieve.tsx
src/pages/game/complete/components/complete-achieve.tsx
+1
-1
index.tsx
src/pages/group/index.tsx
+24
-1
main-component.tsx
src/pages/main/components/main-component.tsx
+6
-15
scene-4.tsx
src/pages/main/guide/scene-4.tsx
+1
-1
model.ts
src/pages/main/model.ts
+12
-0
No files found.
src/pages/game/complete/components/complete-achieve.tsx
View file @
778cb505
...
...
@@ -119,7 +119,7 @@ const GameCompleteAchieve = () => {
{
gameResult
.
levelReward
>
0
?
'首次达成'
:
'二次达成'
}
</
Text
>
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
全对且用时≤
{
time
.
minutes
}
分
{
time
.
seconds
}
秒
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
全对且用时≤
{
time
.
minutes
!==
'00'
?
`${time.minutes}分`
:
''
}
{
time
.
seconds
}
秒
</
View
>
</
View
>
{
gameResult
.
levelReward
>
0
&&
(
<
View
>
...
...
src/pages/group/index.tsx
View file @
778cb505
...
...
@@ -4,7 +4,7 @@ import { useMemo, useState, useEffect, useRef, useCallback } from 'react'
import
Modal
from
'@/components/Modal'
import
Button
from
'@/components/Button'
import
{
useBoolean
,
useRequest
,
useShare
}
from
'@/hooks'
import
{
useBoolean
,
useRequest
,
useShare
,
useFocus
}
from
'@/hooks'
import
{
createTribe
}
from
'@/api/group'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
type
{
TabbarRef
}
from
'@/custom-tab-bar/index'
...
...
@@ -21,6 +21,21 @@ import ShareButton from './components/share-button'
import
styles
from
'./index.module.scss'
import
memberStyles
from
'./components/members.module.scss'
function
LazyPlayer
()
{
const
player
=
useStoreState
(
state
=>
state
.
mainModel
.
player
)
const
isFocus
=
useFocus
()
useEffect
(()
=>
{
if
(
isFocus
)
{
player
.
play
()
}
else
{
player
.
pause
()
}
},
[
player
,
isFocus
])
return
null
}
const
randomPick
=
(
arr
:
string
[])
=>
{
const
len
=
arr
.
length
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
len
)
...
...
@@ -34,6 +49,7 @@ const Group = () => {
const
dataRef
=
useRef
<
NickNameWord
>
({
noun
:
[],
adj
:
[]
})
const
[
groupNo
,
setGroupNo
]
=
useState
(
''
)
const
[
refresher
,
{
toggle
}]
=
useBoolean
(
false
)
const
[
isRender
,
renderAction
]
=
useBoolean
(
false
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
tribeInfo
=
useStoreState
(
state
=>
state
.
groupModel
.
tribeInfo
)
...
...
@@ -51,6 +67,12 @@ const Group = () => {
setGroupNo
(
nam
)
},
[])
useEffect
(()
=>
{
setTimeout
(()
=>
{
renderAction
.
setTrue
()
},
0
)
},
[
renderAction
])
useEffect
(()
=>
{
const
fn
=
async
()
=>
{
const
words
=
await
getNickNameWords
(
'words'
)
...
...
@@ -112,6 +134,7 @@ const Group = () => {
return
(
<
View
>
{
isRender
&&
<
LazyPlayer
/>
}
<
TopHeader
/>
<
ScrollView
refresherEnabled=
{
!!
tribeInfo
?.
id
}
...
...
src/pages/main/components/main-component.tsx
View file @
778cb505
...
...
@@ -3,12 +3,10 @@ import {
getMenuButtonBoundingClientRect
,
getCurrentInstance
,
getTabBar
,
pageScrollTo
,
getSystemInfoSync
,
nextTick
,
createInnerAudioContext
}
from
'@tarojs/taro'
import
{
useMemo
,
useCallback
,
useEffect
,
useRef
}
from
'react'
import
{
useMemo
,
useCallback
,
useEffect
}
from
'react'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useFocus
}
from
'@/hooks/use-focus'
import
audio
from
'@/assets/oss/assets-audio'
import
type
{
TabbarRef
}
from
'../../../custom-tab-bar/index'
import
{
CurrentRoundId
,
StageStatus
}
from
'./scene/constants'
...
...
@@ -21,23 +19,15 @@ import ShareModal from './share-modal'
import
styles
from
'./main-component.module.scss'
const
getPlayer
=
()
=>
{
const
player
=
createInnerAudioContext
()
player
.
src
=
audio
[
'首页-背景音乐.mp3'
].
u
player
.
loop
=
true
return
player
}
const
MainPage
=
()
=>
{
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
updateReady
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
updateReady
)
const
fetchStage
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
fetchStage
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
const
player
=
useStoreState
(
state
=>
state
.
mainModel
.
player
)
const
isReady
=
useStoreState
(
state
=>
state
.
mainModel
.
isReady
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
nav
=
useMemo
(
getMenuButtonBoundingClientRect
,
[])
const
playerRef
=
useRef
(
getPlayer
())
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
height
=
getSystemInfoSync
().
windowHeight
...
...
@@ -52,11 +42,12 @@ const MainPage = () => {
useEffect
(()
=>
{
if
(
isFocus
)
{
player
Ref
.
current
.
play
()
player
.
play
()
}
else
{
playerRef
.
current
.
pause
()
console
.
log
(
222
)
player
.
pause
()
}
},
[
isFocus
])
},
[
player
,
isFocus
])
useEffect
(()
=>
{
if
(
isFocus
)
{
...
...
src/pages/main/guide/scene-4.tsx
View file @
778cb505
...
...
@@ -104,7 +104,7 @@ const Scene4 = (props: Scene4Props) => {
<
Image
src=
{
icons
[
1
]
}
className=
{
styles
.
icon
}
></
Image
>
<
View
className=
{
styles
.
text
}
>
<
View
>
本次练习非常优秀哦,
</
View
>
<
View
>
排在所有同学
前
<
Text
className=
{
styles
.
glod
}
>
前百分之
{
getLevelName
(
level
)
}
</
Text
></
View
>
<
View
>
排在所有同学
<
Text
className=
{
styles
.
glod
}
>
前百分之
{
getLevelName
(
level
)
}
</
Text
></
View
>
</
View
>
</
View
>
<
View
className=
{
styles
.
tips
}
>
* 共有 TOP30% → TOP20% → TOP10% 三个成就
</
View
>
...
...
src/pages/main/model.ts
View file @
778cb505
import
{
action
,
Action
,
Thunk
,
thunk
}
from
'easy-peasy'
import
{
createInnerAudioContext
,
type
InnerAudioContext
}
from
'@tarojs/taro'
import
{
AppStoreModel
}
from
'@/store/store-model'
import
{
type
Stage
,
getStageList
}
from
'@/api'
import
audio
from
'@/assets/oss/assets-audio'
const
getPlayer
=
()
=>
{
const
player
=
createInnerAudioContext
()
player
.
src
=
audio
[
'首页-背景音乐.mp3'
].
u
player
.
loop
=
true
return
player
}
export
interface
MainModel
{
stageList
:
Stage
[];
isReady
:
boolean
;
player
:
InnerAudioContext
;
updateReady
:
Action
<
MainModel
,
boolean
>
;
updateStageList
:
Action
<
MainModel
,
Stage
[]
>
;
fetchStage
:
Thunk
<
MainModel
,
void
,
void
,
AppStoreModel
,
Promise
<
Stage
[]
>>
;
...
...
@@ -14,6 +25,7 @@ export interface MainModel {
const
mainModel
:
MainModel
=
{
isReady
:
false
,
player
:
getPlayer
(),
stageList
:
[],
updateReady
:
action
((
state
,
payload
)
=>
{
state
.
isReady
=
payload
...
...
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