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
1ba4a327
Commit
1ba4a327
authored
Mar 28, 2023
by
m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update 进入关卡ye2
parent
37d4ffa2
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
529 additions
and
3 deletions
+529
-3
app.config.ts.tpl
scripts/app.config.ts.tpl
+2
-1
index.module.scss
...ges/level-prepare/components/level-info/index.module.scss
+94
-0
index.tsx
src/pages/level-prepare/components/level-info/index.tsx
+38
-0
start-challenge-button.tsx
...-prepare/components/level-info/start-challenge-button.tsx
+59
-0
top-left-info.tsx
...ges/level-prepare/components/level-info/top-left-info.tsx
+14
-0
index.module.scss
...s/level-prepare/components/ranking-list/index.module.scss
+35
-0
index.tsx
src/pages/level-prepare/components/ranking-list/index.tsx
+58
-0
time-display.module.scss
...-prepare/components/ranking-list/time-display.module.scss
+0
-0
time-display.tsx
...es/level-prepare/components/ranking-list/time-display.tsx
+20
-0
user-info.module.scss
...vel-prepare/components/ranking-list/user-info.module.scss
+19
-0
user-info.tsx
...pages/level-prepare/components/ranking-list/user-info.tsx
+21
-0
index.module.scss
src/pages/level-prepare/index.module.scss
+0
-0
index.tsx
src/pages/level-prepare/index.tsx
+24
-0
types.ts
src/pages/level-prepare/types.ts
+19
-0
utils.ts
src/pages/level-prepare/utils.ts
+6
-0
index.ts
src/store/index.ts
+2
-1
level-prepare.ts
src/store/modules/level-prepare.ts
+115
-0
store-model.ts
src/store/store-model.ts
+3
-1
No files found.
scripts/app.config.ts.tpl
View file @
1ba4a327
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
export default {
export default {
pages: [
pages: [
'pages/main/main',
'pages/main/main',
'pages/group/index'
'pages/group/index',
'pages/level-prepare/index',
],
],
subPackages: {
{
packages
}
},
subPackages: {
{
packages
}
},
resizable: true,
resizable: true,
...
...
src/pages/level-prepare/components/level-info/index.module.scss
0 → 100644
View file @
1ba4a327
.wrapper
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
margin-bottom
:
60px
;
}
.title
{
font-weight
:
bold
;
}
.totalQuestions
{
margin-top
:
24px
;
}
.requirement
{
display
:
flex
;
justify-content
:
space-between
;
width
:
60%
;
margin-top
:
24px
;
}
.duration
{
}
.startChallenge
{
position
:
relative
;
margin-top
:
48px
;
z-index
:
1
;
width
:
70%
;
}
.tip
{
position
:
absolute
;
z-index
:
10
;
top
:
-32px
;
right
:
-12%
;
font-size
:
24px
;
color
:
#ff0000
;
background-color
:
#fff
;
border
:
1px
solid
#ff0000
;
border-radius
:
8px
;
padding
:
8px
12px
;
}
.modal
{
position
:
fixed
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
background-color
:
white
;
padding
:
20px
;
border-radius
:
10px
;
z-index
:
101
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
box-shadow
:
0
2px
8px
rgba
(
0
,
0
,
0
,
0
.1
);
width
:
80%
;
max-width
:
400px
;
}
.modalOverlay
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
background-color
:
rgba
(
0
,
0
,
0
,
0
.5
);
z-index
:
100
;
}
.modal
button
{
margin-top
:
10px
;
}
.topLeftInfo
{
position
:
absolute
;
top
:
0
;
left
:
24px
;
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
font-size
:
20px
;
}
.calculation
,
.enhancement
{
background-color
:
#f5f5f5
;
padding
:
4px
8px
;
border
:
1px
solid
#ccc
;
}
src/pages/level-prepare/components/level-info/index.tsx
0 → 100644
View file @
1ba4a327
import
React
from
'react'
;
import
{
View
,
Text
}
from
'@tarojs/components'
;
import
{
useStoreState
}
from
'@/store/hooks'
;
import
TopLeftInfo
from
'./top-left-info'
;
// import StartChallengeButton from './start-challenge-button';
import
{
formatTime
}
from
'../../utils'
import
styles
from
'./index.module.scss'
;
const
LevelInfo
:
React
.
FC
=
()
=>
{
const
levelInfo
=
useStoreState
((
state
)
=>
state
.
levelPrepareModel
.
levelInfo
)
const
onStartChallenge
=
()
=>
{
console
.
log
(
'onStartChallenge'
)
}
return
(
<
View
className=
{
styles
.
wrapper
}
>
<
Text
className=
{
styles
.
title
}
>
{
levelInfo
.
title
}
</
Text
>
<
Text
className=
{
styles
.
totalQuestions
}
>
共
{
levelInfo
.
totalQuestions
}
题
</
Text
>
<
View
className=
{
styles
.
requirement
}
>
<
Text
className=
{
styles
.
passingRequirement
}
>
通过要求:
{
levelInfo
.
passingRequirement
}
</
Text
>
<
Text
className=
{
styles
.
duration
}
>
时间:
{
formatTime
(
levelInfo
.
duration
)
}
</
Text
>
</
View
>
{
/* <StartChallengeButton /> */
}
<
TopLeftInfo
/>
</
View
>
)
}
export
default
LevelInfo
;
src/pages/level-prepare/components/level-info/start-challenge-button.tsx
0 → 100644
View file @
1ba4a327
// import React, { useState, useEffect, useRef } from 'react'
// import { View, Text, Button } from '@tarojs/components'
// import Taro from '@tarojs/taro';
// import styles from './index.module.scss';
// const StartChallengeButton: React.FC = () => {
// const [showModal, setShowModal] = useState(false)
// const hasFreePass = false
// const modalRef = useRef(null)
// const [opacity, setOpacity] = useState(0)
// const [scale, setScale] = useState(0.8)
// const handleChallengeClick = () => {
// if (!hasFreePass) {
// setShowModal(true);
// } else {
// // Start the challenge
// }
// }
// useEffect(() => {
// if (showModal) {
// const animation = Taro.createAnimation({
// duration: 200,
// timingFunction: 'ease-out',
// });
// animation.opacity(1).scale(1).step();
// if (modalRef.current) {
// modalRef.current.animate(animation.export());
// }
// }
// }, [showModal]);
// return (
// <View className={styles.startChallenge}>
// <Button onClick={handleChallengeClick}>开始闯关</Button>
// <Text className={styles.tip}>
// {hasFreePass ? '首次免答题卡' : '-1答题卡'}
// </Text>
// {showModal && (
// <>
// <View className={styles.modalOverlay}>
// </View>
// <View ref={modalRef} className={styles.modal}>
// <Text>你的答题卡已经用完了</Text>
// <Button onClick={handleChallengeClick}>建设学习部落得更多答题卡</Button>
// <Button onClick={handleChallengeClick}>购买</Button>
// <Button onClick={() => setShowModal(false)}>关闭</Button>
// </View>
// </>
// )}
// </View>
// )
// }
// export default StartChallengeButton
\ No newline at end of file
src/pages/level-prepare/components/level-info/top-left-info.tsx
0 → 100644
View file @
1ba4a327
import
{
View
,
Text
}
from
'@tarojs/components'
import
styles
from
'./index.module.scss'
;
const
TopLeftInfo
=
()
=>
{
return
(
<
View
className=
{
styles
.
topLeftInfo
}
>
<
Text
className=
{
styles
.
calculation
}
>
计算达标
</
Text
>
<
Text
className=
{
styles
.
enhancement
}
>
强化
</
Text
>
</
View
>
)
}
export
default
TopLeftInfo
\ No newline at end of file
src/pages/level-prepare/components/ranking-list/index.module.scss
0 → 100644
View file @
1ba4a327
.wrap
{
display
:
flex
;
flex-direction
:
column
;
}
.title
{
text-align
:
center
;
margin-bottom
:
24px
;
}
.list
{
min-height
:
300px
;
max-height
:
400px
;
overflow
:
hidden
;
overflow-y
:
auto
;
display
:
flex
;
flex-direction
:
column
;
row-gap
:
24px
;
}
.item
{
padding
:
0
24px
;
display
:
flex
;
justify-content
:
space-between
;
}
.highlight
{
background-color
:
yellow
;
}
.noTopThree
{
border
:
1px
solid
red
;
margin
:
24px
0
;
}
\ No newline at end of file
src/pages/level-prepare/components/ranking-list/index.tsx
0 → 100644
View file @
1ba4a327
import
{
View
,
Button
,
Text
}
from
'@tarojs/components'
import
React
,
{
useState
}
from
'react'
import
classNames
from
'classnames'
import
{
useStoreState
}
from
'@/store/hooks'
;
import
{
User
}
from
'../../types'
import
UserInfo
from
'./user-info'
import
TimeDisplay
from
'./time-display'
import
styles
from
'./index.module.scss'
interface
RankingListProps
{
users
:
User
[];
currentUser
?:
User
;
}
const
RankingList
:
React
.
FC
<
RankingListProps
>
=
({
users
,
currentUser
})
=>
{
const
[
showAll
,
setShowAll
]
=
useState
(
false
)
const
{
currentUserInTopThree
,
topThreeUsers
}
=
useStoreState
((
state
)
=>
state
.
levelPrepareModel
)
const
renderItem
=
(
user
:
User
)
=>
{
const
isCurrentUser
=
currentUser
&&
currentUser
.
nickname
===
user
.
nickname
return
(
<
View
key=
{
user
.
nickname
}
className=
{
classNames
(
styles
.
item
,
isCurrentUser
&&
styles
.
highlight
)
}
>
<
UserInfo
{
...
user
}
/>
<
TimeDisplay
time=
{
user
.
time
}
/>
</
View
>
)
}
const
displayUsers
=
showAll
?
users
:
topThreeUsers
return
(
<
View
className=
{
styles
.
wrap
}
>
<
Text
className=
{
styles
.
title
}
>
本关英雄榜
</
Text
>
<
View
className=
{
styles
.
list
}
>
{
displayUsers
.
map
(
renderItem
)
}
</
View
>
{
!
showAll
&&
(
<
Button
className=
{
styles
.
loadMore
}
onClick=
{
()
=>
setShowAll
(
!
showAll
)
}
>
展示更多
</
Button
>
)
}
{
!
currentUserInTopThree
&&
currentUser
&&
(
<
View
key=
{
currentUser
.
nickname
}
className=
{
classNames
(
styles
.
item
,
styles
.
noTopThree
)
}
>
<
UserInfo
{
...
currentUser
}
/>
<
TimeDisplay
time=
{
currentUser
.
time
}
/>
</
View
>
)
}
</
View
>
)
}
export
default
RankingList
src/pages/level-prepare/components/ranking-list/time-display.module.scss
0 → 100644
View file @
1ba4a327
src/pages/level-prepare/components/ranking-list/time-display.tsx
0 → 100644
View file @
1ba4a327
import
React
from
'react'
import
{
Text
}
from
'@tarojs/components'
;
import
{
TimeDisplayProps
}
from
'../../types'
const
formatTime
=
(
time
:
number
):
string
=>
{
const
minutes
=
Math
.
floor
(
time
/
60
);
const
seconds
=
time
%
60
;
return
`
${
minutes
}
分
${
seconds
}
秒`
;
}
const
TimeDisplay
:
React
.
FC
<
TimeDisplayProps
>
=
({
time
=
0
})
=>
{
return
(
<
Text
className=
'time-display'
>
{
formatTime
(
time
)
}
</
Text
>
)
}
export
default
TimeDisplay
\ No newline at end of file
src/pages/level-prepare/components/ranking-list/user-info.module.scss
0 → 100644
View file @
1ba4a327
.userInfo
{
display
:
flex
;
column-gap
:
16px
;
}
.avatar
{
width
:
60px
;
height
:
60px
;
border-radius
:
50%
;
background-color
:
pink
;
}
.userDetails
{
display
:
flex
;
flex-direction
:
column
;
row-gap
:
16px
;
line-height
:
1
;
}
\ No newline at end of file
src/pages/level-prepare/components/ranking-list/user-info.tsx
0 → 100644
View file @
1ba4a327
import
React
from
'react'
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
;
import
{
UserInfoProps
}
from
'../../types'
import
styles
from
'./user-info.module.scss'
const
UserInfo
:
React
.
FC
<
UserInfoProps
>
=
({
avatar
,
nickname
,
schoolName
})
=>
{
return
(
<
View
className=
{
styles
.
userInfo
}
>
<
View
className=
{
styles
.
avatar
}
/>
{
/* <Image className='avatar' src={avatar} /> */
}
<
View
className=
{
styles
.
userDetails
}
>
<
Text
className=
'nickname'
>
{
nickname
}
</
Text
>
<
Text
className=
'school'
>
{
schoolName
}
</
Text
>
</
View
>
</
View
>
)
}
export
default
UserInfo
\ No newline at end of file
src/pages/level-prepare/index.module.scss
0 → 100644
View file @
1ba4a327
src/pages/level-prepare/index.tsx
0 → 100644
View file @
1ba4a327
import
{
View
}
from
'@tarojs/components'
;
import
{
useEffect
}
from
'react'
;
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
;
import
LevelInfo
from
'./components/level-info/index'
;
import
Ranking
from
'./components/ranking-list/index'
const
StagePrepare
:
React
.
FC
=
()
=>
{
const
{
currentUser
,
list
}
=
useStoreState
((
state
)
=>
state
.
levelPrepareModel
)
const
refresh
=
useStoreActions
((
actions
)
=>
actions
.
levelPrepareModel
.
refresh
)
useEffect
(()
=>
{
refresh
()
},
[
currentUser
])
return
(
<
View
>
<
LevelInfo
/>
<
Ranking
users=
{
list
}
currentUser=
{
currentUser
}
/>
</
View
>
);
};
export
default
StagePrepare
;
\ No newline at end of file
src/pages/level-prepare/types.ts
0 → 100644
View file @
1ba4a327
export
type
UserInfoProps
=
{
avatar
?:
string
;
nickname
?:
string
;
schoolName
?:
string
;
}
export
type
TimeDisplayProps
=
{
time
?:
number
;
}
export
type
User
=
UserInfoProps
&
TimeDisplayProps
export
interface
LevelInfo
{
title
:
string
;
totalQuestions
:
number
;
passingRequirement
:
string
;
duration
:
number
;
}
\ No newline at end of file
src/pages/level-prepare/utils.ts
0 → 100644
View file @
1ba4a327
export
const
formatTime
=
(
time
:
number
)
=>
{
const
minutes
=
Math
.
floor
(
time
/
60
)
const
seconds
=
time
%
60
return
`
${
minutes
}
分
${
seconds
}
秒`
}
\ No newline at end of file
src/store/index.ts
View file @
1ba4a327
...
@@ -3,4 +3,4 @@ import storeModel, { AppStoreModel } from './store-model'
...
@@ -3,4 +3,4 @@ import storeModel, { AppStoreModel } from './store-model'
const
store
=
createStore
<
AppStoreModel
>
(
storeModel
)
const
store
=
createStore
<
AppStoreModel
>
(
storeModel
)
export
default
store
export
default
store
\ No newline at end of file
src/store/modules/level-prepare.ts
0 → 100644
View file @
1ba4a327
import
{
computed
,
Action
,
Computed
,
action
}
from
'easy-peasy'
import
WithPaging
from
'@/utils/with-paging'
import
{
PagingFn
}
from
'@/types'
import
{
User
,
LevelInfo
}
from
'@/pages/level-prepare/types'
interface
Model
{
levelInfo
:
LevelInfo
;
setTitle
:
Action
<
LevelPrepareModel
,
string
>
;
setTotalQuestions
:
Action
<
LevelPrepareModel
,
number
>
;
setPassingRequirement
:
Action
<
LevelPrepareModel
,
string
>
;
setDuration
:
Action
<
LevelPrepareModel
,
number
>
;
currentUser
:
User
;
setCurrentUser
:
Action
<
LevelPrepareModel
,
User
>
;
topThreeUsers
:
Computed
<
LevelPrepareModel
,
User
[]
>
;
currentUserInTopThree
:
Computed
<
LevelPrepareModel
,
boolean
>
;
}
const
api
:
PagingFn
<
any
,
{}
>
=
async
()
=>
{
return
{
code
:
0
,
sysTime
:
Date
.
now
(),
data
:
{
list
:
[
{
nickname
:
'index1'
,
schoolName
:
'index1'
,
avatar
:
'index1'
,
time
:
10
,
},
{
nickname
:
'index2'
,
schoolName
:
'index2'
,
avatar
:
'index1'
,
time
:
20
,
},
{
nickname
:
'index3'
,
schoolName
:
'index3'
,
avatar
:
'index1'
,
time
:
30
,
},
{
nickname
:
'index4'
,
schoolName
:
'index4'
,
avatar
:
'index4'
,
time
:
110
,
},,
{
nickname
:
'index5'
,
schoolName
:
'index5'
,
avatar
:
'index1'
,
time
:
30
,
},
{
nickname
:
'index6'
,
schoolName
:
'inex6'
,
avatar
:
'index6'
,
time
:
110
,
},
],
total
:
400
,
hasNextPage
:
true
}
}
}
const
levelPrepareModel
=
WithPaging
<
User
,
Model
,
{}
>
(
api
)({
currentUser
:
{
nickname
:
'index4'
,
schoolName
:
'index4'
,
avatar
:
'index4'
,
time
:
30
,
},
levelInfo
:
{
title
:
'表内除法'
,
totalQuestions
:
10
,
passingRequirement
:
'全√'
,
duration
:
80
,
},
topThreeUsers
:
computed
((
state
)
=>
state
.
list
.
slice
(
0
,
3
)),
currentUserInTopThree
:
computed
(
(
state
)
=>
state
.
topThreeUsers
.
some
(
(
user
)
=>
user
.
nickname
===
state
.
currentUser
.
nickname
),
),
setCurrentUser
:
action
((
state
,
user
)
=>
{
state
.
currentUser
=
user
}),
setTitle
:
action
((
state
,
payload
)
=>
{
state
.
levelInfo
.
title
=
payload
;
}),
setTotalQuestions
:
action
((
state
,
payload
)
=>
{
state
.
levelInfo
.
totalQuestions
=
payload
;
}),
setPassingRequirement
:
action
((
state
,
payload
)
=>
{
state
.
levelInfo
.
passingRequirement
=
payload
;
}),
setDuration
:
action
((
state
,
payload
)
=>
{
state
.
levelInfo
.
duration
=
payload
;
}),
})
export
default
levelPrepareModel
export
type
LevelPrepareModel
=
typeof
levelPrepareModel
;
src/store/store-model.ts
View file @
1ba4a327
import
cartModel
from
'./modules/cart'
import
cartModel
from
'./modules/cart'
import
counterModel
from
'./modules/counter'
import
counterModel
from
'./modules/counter'
import
levelPrepareModel
from
'./modules/level-prepare'
const
appStoreModel
=
{
const
appStoreModel
=
{
cartModel
,
cartModel
,
counterModel
counterModel
,
levelPrepareModel
,
}
}
export
default
appStoreModel
export
default
appStoreModel
...
...
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