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
5bc1cc39
Commit
5bc1cc39
authored
Apr 17, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化滚动
parent
df42b9cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
main-component.tsx
src/pages/main/components/main-component.tsx
+9
-5
model.ts
src/pages/main/model.ts
+4
-3
No files found.
src/pages/main/components/main-component.tsx
View file @
5bc1cc39
...
@@ -59,15 +59,19 @@ const MainPage = () => {
...
@@ -59,15 +59,19 @@ const MainPage = () => {
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
tabbar
?.
setSelected
(
0
)
tabbar
?.
setSelected
(
0
)
fetchStage
().
then
((
list
)
=>
{
fetchStage
().
then
((
[
list
,
preList
]
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
nextTick
(()
=>
{
nextTick
(()
=>
{
if
(
!
list
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
))
{
const
currentItem
=
list
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
)
if
(
!
currentItem
)
{
updateReady
(
true
)
updateReady
(
true
)
}
else
{
}
else
{
scrollToCurrent
(()
=>
{
const
lastItem
=
preList
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
)
updateReady
(
true
)
if
(
currentItem
?.
id
!==
lastItem
?.
id
)
{
})
scrollToCurrent
(()
=>
{
updateReady
(
true
)
})
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
updateReady
(
true
)
updateReady
(
true
)
},
300
)
},
300
)
...
...
src/pages/main/model.ts
View file @
5bc1cc39
...
@@ -20,7 +20,7 @@ export interface MainModel {
...
@@ -20,7 +20,7 @@ export interface MainModel {
player
:
InnerAudioContext
;
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
[],
Stage
[]
]
>>
;
}
}
const
mainModel
:
MainModel
=
{
const
mainModel
:
MainModel
=
{
...
@@ -33,7 +33,8 @@ const mainModel: MainModel = {
...
@@ -33,7 +33,8 @@ const mainModel: MainModel = {
updateStageList
:
action
((
state
,
stageList
)
=>
{
updateStageList
:
action
((
state
,
stageList
)
=>
{
state
.
stageList
=
stageList
state
.
stageList
=
stageList
}),
}),
fetchStage
:
thunk
(
async
(
actions
,
_
)
=>
{
fetchStage
:
thunk
(
async
(
actions
,
_
,
helpers
)
=>
{
const
{
stageList
:
preStageList
}
=
helpers
.
getState
()
let
ret
:
Stage
[]
=
[]
let
ret
:
Stage
[]
=
[]
try
{
try
{
const
{
data
:
stageList
}
=
await
getStageList
()
const
{
data
:
stageList
}
=
await
getStageList
()
...
@@ -42,7 +43,7 @@ const mainModel: MainModel = {
...
@@ -42,7 +43,7 @@ const mainModel: MainModel = {
ret
=
[]
ret
=
[]
}
}
actions
.
updateStageList
(
ret
)
actions
.
updateStageList
(
ret
)
return
ret
return
[
ret
,
preStageList
]
as
[
Stage
[],
Stage
[]]
}),
}),
}
}
...
...
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