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
6c0742f3
Commit
6c0742f3
authored
Apr 11, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
a49df9b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
27 deletions
+8
-27
index.tsx
src/pages/group/index.tsx
+1
-24
main-component.tsx
src/pages/main/components/main-component.tsx
+5
-3
stage.tsx
src/pages/main/components/scene/stage.tsx
+2
-0
No files found.
src/pages/group/index.tsx
View file @
6c0742f3
...
...
@@ -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
,
useFocus
}
from
'@/hooks'
import
{
useBoolean
,
useRequest
,
useShare
}
from
'@/hooks'
import
{
createTribe
}
from
'@/api/group'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
type
{
TabbarRef
}
from
'@/custom-tab-bar/index'
...
...
@@ -21,21 +21,6 @@ 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
)
...
...
@@ -49,7 +34,6 @@ 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
)
...
...
@@ -67,12 +51,6 @@ const Group = () => {
setGroupNo
(
nam
)
},
[])
useEffect
(()
=>
{
setTimeout
(()
=>
{
renderAction
.
setTrue
()
},
0
)
},
[
renderAction
])
useEffect
(()
=>
{
const
fn
=
async
()
=>
{
const
words
=
await
getNickNameWords
(
'words'
)
...
...
@@ -134,7 +112,6 @@ const Group = () => {
return
(
<
View
>
{
isRender
&&
<
LazyPlayer
/>
}
<
TopHeader
/>
<
ScrollView
refresherEnabled=
{
!!
tribeInfo
?.
id
}
...
...
src/pages/main/components/main-component.tsx
View file @
6c0742f3
...
...
@@ -3,6 +3,7 @@ import {
getMenuButtonBoundingClientRect
,
getCurrentInstance
,
getTabBar
,
pageScrollTo
,
getSystemInfoSync
,
nextTick
,
onAppHide
,
}
from
'@tarojs/taro'
import
{
useMemo
,
useCallback
,
useEffect
}
from
'react'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
...
...
@@ -40,12 +41,13 @@ const MainPage = () => {
const
isFocus
=
useFocus
()
onAppHide
(()
=>
{
player
.
pause
()
})
useEffect
(()
=>
{
if
(
isFocus
)
{
player
.
play
()
}
else
{
console
.
log
(
222
)
player
.
pause
()
}
},
[
player
,
isFocus
])
...
...
src/pages/main/components/scene/stage.tsx
View file @
6c0742f3
...
...
@@ -106,6 +106,7 @@ const StageComp = (props: StageProps) => {
const
{
stage
}
=
props
const
updateState
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
updateState
)
const
isReady
=
useStoreState
(
state
=>
state
.
mainModel
.
isReady
)
const
player
=
useStoreState
(
state
=>
state
.
mainModel
.
player
)
const
renderRound
=
(
ready
:
boolean
)
=>
{
switch
(
stage
.
status
)
{
...
...
@@ -149,6 +150,7 @@ const StageComp = (props: StageProps) => {
/** 从首页进入更新状态 */
updateState
({
isSubmit
:
false
})
navigateTo
({
url
:
`/pages/prepare/index?id=
${
stage
.
id
}
`
})
player
.
stop
()
}
}
...
...
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