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
414216a4
Commit
414216a4
authored
Apr 05, 2023
by
m
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://118.24.71.244/hewenhao/GeekLearnMathWeapp
parents
cfb790aa
1b5aadd4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
7 deletions
+43
-7
index.tsx
src/pages/game/play/index.tsx
+19
-4
index.config.ts
src/pages/group/index.config.ts
+2
-1
index.tsx
src/pages/group/index.tsx
+1
-1
constants.ts
src/pages/main/components/scene/constants.ts
+7
-0
main.config.ts
src/pages/main/main.config.ts
+2
-1
preload-image.ts
src/utils/preload-image.ts
+12
-0
No files found.
src/pages/game/play/index.tsx
View file @
414216a4
import
{
View
,
ScrollView
}
from
'@tarojs/components'
import
{
View
,
ScrollView
}
from
'@tarojs/components'
import
{
useStoreState
}
from
'@/store/hooks'
import
{
useStoreState
}
from
'@/store/hooks'
// import { useEffect } from 'react'
import
{
preloadImage
}
from
'@/utils/preload-image'
// import { useRouter } from '@tarojs/taro'
import
{
useEffect
}
from
'react'
import
{
useBoolean
}
from
'@/hooks/use-boolean'
import
assets
from
'@/assets/oss/assets-complete'
import
ModalContinue
from
'./components/modal-continue'
import
ModalContinue
from
'./components/modal-continue'
import
PageHead
from
'./components/page-head'
import
PageHead
from
'./components/page-head'
import
PageFooter
from
'./components/page-footer'
import
PageFooter
from
'./components/page-footer'
import
Question
from
'./components/question'
import
Question
from
'./components/question'
...
@@ -13,10 +13,25 @@ import NumberKeyboard from './components/number-keyboard'
...
@@ -13,10 +13,25 @@ import NumberKeyboard from './components/number-keyboard'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
let
isLoad
=
false
const
preloadCompleteImages
=
()
=>
{
if
(
isLoad
)
return
isLoad
=
true
const
items
:
string
[]
=
[]
for
(
const
key
in
assets
)
{
items
.
push
(
assets
[
key
].
u
)
}
preloadImage
(
items
)
}
const
GamePlay
=
()
=>
{
const
GamePlay
=
()
=>
{
const
currentQuestion
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestion
)
const
currentQuestion
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestion
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
useEffect
(()
=>
{
preloadCompleteImages
()
},
[])
return
(
return
(
<>
<>
<
View
className=
{
styles
.
viewport
}
>
<
View
className=
{
styles
.
viewport
}
>
...
...
src/pages/group/index.config.ts
View file @
414216a4
export
default
definePageConfig
({
export
default
definePageConfig
({
navigationBarTitleText
:
'pk-math'
,
navigationBarTitleText
:
'pk-math'
,
navigationStyle
:
'custom'
navigationStyle
:
'custom'
,
navigationBarTextStyle
:
'white'
})
})
src/pages/group/index.tsx
View file @
414216a4
...
@@ -21,7 +21,7 @@ import styles from './index.module.scss'
...
@@ -21,7 +21,7 @@ import styles from './index.module.scss'
import
memberStyles
from
'./components/members.module.scss'
import
memberStyles
from
'./components/members.module.scss'
const
Group
=
()
=>
{
const
Group
=
()
=>
{
const
page
=
getCurrentInstance
().
page
const
page
=
useMemo
(()
=>
getCurrentInstance
().
page
,
[])
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
groupNo
,
setGroupNo
]
=
useState
<
string
>
(
''
)
const
[
groupNo
,
setGroupNo
]
=
useState
<
string
>
(
''
)
...
...
src/pages/main/components/scene/constants.ts
View file @
414216a4
...
@@ -2,6 +2,7 @@ import assets from '@/assets/oss/assets-main'
...
@@ -2,6 +2,7 @@ import assets from '@/assets/oss/assets-main'
import
{
createContext
}
from
'react'
import
{
createContext
}
from
'react'
import
{
type
Stage
,
StageStatus
,
StageLevel
,
StageType
}
from
'@/api'
import
{
type
Stage
,
StageStatus
,
StageLevel
,
StageType
}
from
'@/api'
import
type
{
ImageSource
}
from
'@/types'
import
type
{
ImageSource
}
from
'@/types'
import
{
preloadImage
}
from
'@/utils/preload-image'
export
const
SceneContext
=
createContext
<
{
ready
:
boolean
}
>
({
ready
:
false
})
export
const
SceneContext
=
createContext
<
{
ready
:
boolean
}
>
({
ready
:
false
})
...
@@ -25,6 +26,12 @@ const NomalPartBgPool = [
...
@@ -25,6 +26,12 @@ const NomalPartBgPool = [
assets
[
'round-center-6.png'
],
assets
[
'round-center-6.png'
],
]
]
preloadImage
([
...
NomalPartBgPool
.
map
(
c
=>
c
.
u
),
...
SpeicalPartBgPool
.
map
(
c
=>
c
.
u
),
...
PartBgPool
.
map
(
c
=>
c
.
u
)
])
export
{
StageStatus
,
StageLevel
,
Stage
,
StageType
}
export
{
StageStatus
,
StageLevel
,
Stage
,
StageType
}
export
const
CurrentRoundId
=
'__current_round__'
export
const
CurrentRoundId
=
'__current_round__'
...
...
src/pages/main/main.config.ts
View file @
414216a4
export
default
definePageConfig
({
export
default
definePageConfig
({
navigationBarTitleText
:
'pk-math'
,
navigationBarTitleText
:
'pk-math'
,
navigationStyle
:
'custom'
navigationStyle
:
'custom'
,
navigationBarTextStyle
:
'white'
})
})
src/utils/preload-image.ts
0 → 100644
View file @
414216a4
declare
const
wx
:
any
export
function
preloadImage
(
urls
:
string
[])
{
if
(
typeof
wx
!==
'undefined'
&&
typeof
wx
.
preloadAssets
===
'function'
)
{
wx
.
preloadAssets
({
data
:
urls
.
map
(
src
=>
({
type
:
'image'
,
src
,
}))
})
}
}
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