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
31ec509c
Commit
31ec509c
authored
Apr 11, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 换背景音乐
parent
77d23314
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
5 deletions
+31
-5
.oss
assets/audio/.oss
+6
-2
S通关.wav
assets/audio/S通关.wav
+0
-0
首页-背景音乐.mp3
assets/audio/首页-背景音乐.mp3
+0
-0
assets-audio.ts
src/assets/oss/assets-audio.ts
+4
-1
main-component.tsx
src/pages/main/components/main-component.tsx
+21
-2
No files found.
assets/audio/.oss
View file @
31ec509c
...
...
@@ -4,8 +4,8 @@
"ossName": "/pk-math/4P1LV2HsBxu3yHnf8hWeR2FFdk5o.wav"
},
"S通关.wav": {
"u": "https://cdn.jkwljy.com/pk-math/
PPZySMdpZGhmSjMHofsLm911A2g
.wav",
"ossName": "/pk-math/
PPZySMdpZGhmSjMHofsLm911A2g
.wav"
"u": "https://cdn.jkwljy.com/pk-math/
2PvTqgCAoSm9uVo7DxTtnvRDtBTR
.wav",
"ossName": "/pk-math/
2PvTqgCAoSm9uVo7DxTtnvRDtBTR
.wav"
},
"最后10秒 一战到底.mp3": {
"u": "https://cdn.jkwljy.com/pk-math/4Li9G8xoEyenYFWcawvFELxkkLTG.mp3",
...
...
@@ -50,5 +50,9 @@
"打字声2.mp3": {
"u": "https://cdn.jkwljy.com/pk-math/v4SqPWo3mjH5SZaksSwfpRvVVbD.mp3",
"ossName": "/pk-math/v4SqPWo3mjH5SZaksSwfpRvVVbD.mp3"
},
"首页-背景音乐.mp3": {
"u": "https://cdn.jkwljy.com/pk-math/41JjW5zMK8jz2WUzc7GvCnsunENM.mp3",
"ossName": "/pk-math/41JjW5zMK8jz2WUzc7GvCnsunENM.mp3"
}
}
assets/audio/S通关.wav
View file @
31ec509c
No preview for this file type
assets/audio/首页-背景音乐.mp3
0 → 100644
View file @
31ec509c
File added
src/assets/oss/assets-audio.ts
View file @
31ec509c
...
...
@@ -5,7 +5,7 @@ export default {
"u"
:
"https://cdn.jkwljy.com/pk-math/4P1LV2HsBxu3yHnf8hWeR2FFdk5o.wav"
},
"S通关.wav"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/
PPZySMdpZGhmSjMHofsLm911A2g
.wav"
"u"
:
"https://cdn.jkwljy.com/pk-math/
2PvTqgCAoSm9uVo7DxTtnvRDtBTR
.wav"
},
"最后10秒 一战到底.mp3"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/4Li9G8xoEyenYFWcawvFELxkkLTG.mp3"
...
...
@@ -39,5 +39,8 @@ export default {
},
"打字声2.mp3"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/v4SqPWo3mjH5SZaksSwfpRvVVbD.mp3"
},
"首页-背景音乐.mp3"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/41JjW5zMK8jz2WUzc7GvCnsunENM.mp3"
}
}
as
const
src/pages/main/components/main-component.tsx
View file @
31ec509c
...
...
@@ -2,11 +2,13 @@ import { View } from '@tarojs/components'
import
{
getMenuButtonBoundingClientRect
,
getCurrentInstance
,
getTabBar
,
pageScrollTo
,
getSystemInfoSync
,
nextTick
nextTick
,
createInnerAudioContext
}
from
'@tarojs/taro'
import
{
useMemo
,
useCallback
,
useEffect
}
from
'react'
import
{
useMemo
,
useCallback
,
useEffect
,
useRef
}
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'
...
...
@@ -19,6 +21,14 @@ 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
)
...
...
@@ -27,6 +37,7 @@ const MainPage = () => {
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
...
...
@@ -39,6 +50,14 @@ const MainPage = () => {
const
isFocus
=
useFocus
()
useEffect
(()
=>
{
if
(
isFocus
)
{
playerRef
.
current
.
play
()
}
else
{
playerRef
.
current
.
pause
()
}
},
[
isFocus
])
useEffect
(()
=>
{
if
(
isFocus
)
{
fetchAccount
()
...
...
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