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