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
f1c49d87
Commit
f1c49d87
authored
Apr 04, 2023
by
m
Browse files
Options
Browse Files
Download
Plain Diff
feat: update
parents
051dd08d
adedecb8
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
426 additions
and
1250 deletions
+426
-1250
global.d.ts
global.d.ts
+8
-1
auth.ts
src/api/auth.ts
+2
-15
game.ts
src/api/game.ts
+10
-2
index.module.scss
src/custom-tab-bar/index.module.scss
+9
-1
index.tsx
src/custom-tab-bar/index.tsx
+3
-2
index.js
src/native-components/count-up/index.js
+40
-13
fail.png
src/pages/game/complete/assets/fail.png
+0
-0
rocket.png
src/pages/game/complete/assets/rocket.png
+0
-0
complete-achieve.module.scss
...ges/game/complete/components/complete-achieve.module.scss
+73
-1
complete-achieve.tsx
src/pages/game/complete/components/complete-achieve.tsx
+64
-49
complete-head.module.scss
src/pages/game/complete/components/complete-head.module.scss
+17
-0
time-red.png
src/pages/game/play/assets/time-red.png
+0
-0
count-up.module.scss
src/pages/game/play/components/count-up.module.scss
+8
-0
count-up.tsx
src/pages/game/play/components/count-up.tsx
+46
-23
modal-continue.tsx
src/pages/game/play/components/modal-continue.tsx
+8
-0
index.ts
src/pages/game/play/model/index.ts
+63
-37
test-1.json
src/pages/game/play/model/test-1.json
+0
-112
test-2.json
src/pages/game/play/model/test-2.json
+0
-112
test-3.json
src/pages/game/play/model/test-3.json
+0
-112
test-4.json
src/pages/game/play/model/test-4.json
+0
-278
test.json
src/pages/game/play/model/test.json
+0
-413
utils.ts
src/pages/game/play/model/utils.ts
+2
-4
chapter.module.scss
src/pages/main/components/chapter.module.scss
+3
-1
constants.ts
src/pages/main/components/scene/constants.ts
+26
-14
index.tsx
src/pages/main/components/scene/index.tsx
+2
-20
small-part.tsx
src/pages/main/components/scene/small-part.tsx
+1
-1
short-cut.tsx
src/pages/main/components/short-cut.tsx
+7
-2
main.tsx
src/pages/main/main.tsx
+14
-13
model.ts
src/pages/main/model.ts
+6
-3
index.tsx
src/pages/prepare/index.tsx
+2
-0
user.ts
src/store/modules/user.ts
+4
-0
types.ts
src/types.ts
+3
-3
silent-login.ts
src/utils/silent-login.ts
+3
-6
storage.ts
src/utils/storage.ts
+2
-12
No files found.
global.d.ts
View file @
f1c49d87
...
@@ -13,7 +13,14 @@ declare module '*.styl';
...
@@ -13,7 +13,14 @@ declare module '*.styl';
type
CountUptime
=
React
.
FC
<
{
maxNum
}
>
type
CountUptime
=
React
.
FC
<
{
maxNum
}
>
type
CountUpTime
=
React
.
DetailedHTMLProps
<
React
.
HTMLAttributes
<
HTMLElement
>
&
{
'max-value'
?:
number
,
onTimeup
?:
()
=>
void
},
HTMLElement
>
type
CountUpTime
=
React
.
DetailedHTMLProps
<
React
.
HTMLAttributes
<
HTMLElement
>
&
{
'maxValue'
?:
number
;
'isDown'
?:
boolean
;
'startValue'
:
number
;
exceedTime
:
number
;
onTimeup
?:
()
=>
void
;
onExceed
?:
()
=>
void
;
},
HTMLElement
>
declare
namespace
JSX
{
declare
namespace
JSX
{
interface
IntrinsicElements
{
interface
IntrinsicElements
{
...
...
src/api/auth.ts
View file @
f1c49d87
import
{
request
,
requestAfterSilentLogin
}
from
'@/utils/request'
import
{
request
,
requestAfterSilentLogin
}
from
'@/utils/request'
import
type
{
UserInfo
}
from
'@/types'
type
LoginResult
=
{
type
LoginResult
=
UserInfo
phone
?:
string
|
null
;
/** 用户openId */
openId
:
string
;
/** 用户昵称 */
nickname
?:
string
|
null
;
/** 用户头像 */
avatarUrl
?:
string
|
null
;
/** 登录token */
token
:
string
;
/** 用户ID */
userId
:
number
;
/** */
unionId
:
string
;
}
/** 静默登录 */
/** 静默登录 */
export
function
silentLoginApi
(
code
:
string
)
{
export
function
silentLoginApi
(
code
:
string
)
{
...
...
src/api/game.ts
View file @
f1c49d87
...
@@ -10,6 +10,14 @@ export const getQuestionList = (stageId: number) => {
...
@@ -10,6 +10,14 @@ export const getQuestionList = (stageId: number) => {
}))
}))
}
}
export
const
resumeGame
=
(
stageId
:
number
)
=>
{
return
requestAfterSilentLogin
<
null
,
{
stageId
:
number
,
userId
?:
number
}
>
(
userInfo
=>
({
method
:
'GET'
,
url
:
'/service-idea/stage/resumeStage'
,
data
:
{
stageId
,
userId
:
userInfo
?.
userId
}
}))
}
export
const
enum
StageStatus
{
export
const
enum
StageStatus
{
CURRENT
=
'CURRENT'
,
CURRENT
=
'CURRENT'
,
DISABLED
=
'DISABLED'
,
DISABLED
=
'DISABLED'
,
...
@@ -19,7 +27,7 @@ export const enum StageStatus {
...
@@ -19,7 +27,7 @@ export const enum StageStatus {
export
const
enum
StageType
{
export
const
enum
StageType
{
Strong
=
'强化'
,
Strong
=
'强化'
,
Enhance
=
'应用'
,
Enhance
=
'应用'
,
OneStop
=
'一
站
到底'
,
OneStop
=
'一
战
到底'
,
}
}
export
const
enum
StageLevel
{
export
const
enum
StageLevel
{
...
@@ -46,7 +54,7 @@ export type StageRank = {
...
@@ -46,7 +54,7 @@ export type StageRank = {
bestResultTime
:
number
;
bestResultTime
:
number
;
firstResultTime
:
number
;
firstResultTime
:
number
;
me
:
boolean
;
me
:
boolean
;
nickName
:
string
;
nickName
:
string
|
null
;
no
:
number
;
no
:
number
;
secondName
:
string
;
secondName
:
string
;
userId
:
number
;
userId
:
number
;
...
...
src/custom-tab-bar/index.module.scss
View file @
f1c49d87
...
@@ -30,14 +30,22 @@
...
@@ -30,14 +30,22 @@
}
}
.bg
{
.bg
{
width
:
100%
;
height
:
100%
;
height
:
100%
;
width
:
calc
(
100%
+
48px
);
position
:
absolute
;
position
:
absolute
;
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
bottom
:
0
;
bottom
:
0
;
right
:
0
;
right
:
0
;
z-index
:
1
;
z-index
:
1
;
&
.left
{
right
:
-48px
;
}
&
.right
{
left
:
-48px
;
}
}
}
.icon
{
.icon
{
...
...
src/custom-tab-bar/index.tsx
View file @
f1c49d87
import
{
useState
,
useImperativeHandle
,
forwardRef
,
useCallback
,
type
ForwardRefRenderFunction
}
from
'react'
import
{
useState
,
useImperativeHandle
,
forwardRef
,
useCallback
,
type
ForwardRefRenderFunction
}
from
'react'
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
switchTab
}
from
'@tarojs/taro'
import
{
switchTab
}
from
'@tarojs/taro'
import
classNames
from
'classnames'
import
styles
from
'./index.module.scss'
import
styles
from
'./index.module.scss'
type
TabbarRef
=
{
type
TabbarRef
=
{
...
@@ -28,13 +29,13 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
...
@@ -28,13 +29,13 @@ const Tabbar: ForwardRefRenderFunction<TabbarRef, {}> = (_, ref) => {
<
View
className=
{
styles
.
inner
}
>
<
View
className=
{
styles
.
inner
}
>
<
View
className=
{
styles
.
left
}
onClick=
{
()
=>
_switchTab
(
0
,
'/pages/main/main'
)
}
>
<
View
className=
{
styles
.
left
}
onClick=
{
()
=>
_switchTab
(
0
,
'/pages/main/main'
)
}
>
{
selected
===
0
&&
(
{
selected
===
0
&&
(
<
Image
src=
"/assets/tabbar/personal-bg.png"
className=
{
styles
.
bg
}
></
Image
>
<
Image
src=
"/assets/tabbar/personal-bg.png"
className=
{
classNames
(
styles
.
bg
,
styles
.
left
)
}
></
Image
>
)
}
)
}
<
Image
src=
"/assets/tabbar/personal-on.png"
className=
{
styles
.
icon
}
/>
<
Image
src=
"/assets/tabbar/personal-on.png"
className=
{
styles
.
icon
}
/>
</
View
>
</
View
>
<
View
className=
{
styles
.
right
}
onClick=
{
()
=>
_switchTab
(
1
,
'/pages/group/index'
)
}
>
<
View
className=
{
styles
.
right
}
onClick=
{
()
=>
_switchTab
(
1
,
'/pages/group/index'
)
}
>
{
selected
===
1
&&
(
{
selected
===
1
&&
(
<
Image
src=
"/assets/tabbar/group-bg.png"
className=
{
styles
.
bg
}
></
Image
>
<
Image
src=
"/assets/tabbar/group-bg.png"
className=
{
classNames
(
styles
.
bg
,
styles
.
right
)
}
></
Image
>
)
}
)
}
<
Image
src=
"/assets/tabbar/group-on.png"
className=
{
styles
.
icon
}
/>
<
Image
src=
"/assets/tabbar/group-on.png"
className=
{
styles
.
icon
}
/>
</
View
>
</
View
>
...
...
src/native-components/count-up/index.js
View file @
f1c49d87
...
@@ -27,16 +27,28 @@ Component({
...
@@ -27,16 +27,28 @@ Component({
type
:
Number
,
type
:
Number
,
value
:
100
*
60
*
60
value
:
100
*
60
*
60
},
},
isDown
:
{
type
:
Boolean
,
value
:
false
,
},
startValue
:
{
type
:
Number
,
value
:
0
},
exceedTime
:
{
type
:
Number
,
value
:
20
}
},
},
data
:
{
data
:
{
minutes
:
'00'
,
minutes
:
'00'
,
seconds
:
'00'
seconds
:
'00'
,
},
},
attached
()
{
attached
()
{
this
.
_tick
=
0
this
.
_tick
=
this
.
data
.
startValue
this
.
start
Count
()
this
.
start
()
console
.
log
(
this
)
console
.
log
(
this
)
},
},
...
@@ -46,13 +58,33 @@ Component({
...
@@ -46,13 +58,33 @@ Component({
clearInterval
(
this
.
_timer
)
clearInterval
(
this
.
_timer
)
}
}
},
},
startCount
()
{
getCount
()
{
if
(
this
.
data
.
isDown
)
{
return
this
.
data
.
startValue
-
this
.
_tick
}
return
this
.
_tick
},
start
()
{
this
.
stop
()
this
.
stop
()
this
.
_timer
=
setInterval
(()
=>
{
this
.
_timer
=
setInterval
(()
=>
{
this
.
_tick
+=
1
const
isDown
=
this
.
data
.
isDown
if
(
this
.
_tick
>=
this
.
data
.
maxValue
)
{
if
(
isDown
)
{
this
.
stop
()
this
.
_tick
-=
1
this
.
triggerEvent
(
'timeup'
)
if
(
this
.
_tick
<=
0
)
{
this
.
stop
()
this
.
triggerEvent
(
'timeup'
)
}
if
(
this
.
_tick
===
this
.
data
.
exceedTime
)
{
this
.
triggerEvent
(
'exceed'
)
}
}
else
{
this
.
_tick
+=
1
if
(
this
.
_tick
>=
this
.
data
.
maxValue
)
{
this
.
stop
()
this
.
triggerEvent
(
'timeup'
)
}
}
}
const
{
minutes
,
seconds
}
=
this
.
data
const
{
minutes
,
seconds
}
=
this
.
data
const
val
=
this
.
_tick
*
1000
const
val
=
this
.
_tick
*
1000
...
@@ -70,11 +102,6 @@ Component({
...
@@ -70,11 +102,6 @@ Component({
this
.
setData
(
opts
)
this
.
setData
(
opts
)
},
1000
)
},
1000
)
},
},
onMyButtonTap
:
function
()
{
this
.
setData
({
// 更新属性和数据的方法与更新页面数据的方法类似
})
},
}
}
})
})
src/pages/game/complete/assets/fail.png
0 → 100644
View file @
f1c49d87
17.8 KB
src/pages/game/complete/assets/rocket.png
0 → 100644
View file @
f1c49d87
423 Bytes
src/pages/game/complete/components/complete-achieve.module.scss
View file @
f1c49d87
...
@@ -13,6 +13,67 @@
...
@@ -13,6 +13,67 @@
align-items
:
center
;
align-items
:
center
;
background
:
#F7F7F7
;
background
:
#F7F7F7
;
border-radius
:
32px
;
border-radius
:
32px
;
animation-name
:
fadeIn
;
animation-duration
:
.5s
;
animation-timing-function
:
ease-out
;
animation-iteration-count
:
1
;
animation-fill-mode
:
backwards
;
&
:nth-child
(
1
)
{
animation-delay
:
0
.5s
;
}
&
:nth-child
(
2
)
{
animation-delay
:
1s
;
}
&
:nth-child
(
3
)
{
animation-delay
:
1
.5s
;
}
&
:nth-child
(
4
)
{
animation-delay
:
2s
;
}
}
@keyframes
fadeIn
{
0
%
{
opacity
:
0
;
transform
:
scale3d
(
1
.5
,
1
.5
,
1
)
translateY
(
100px
);
}
100
%
{
opacity
:
1
;
transform
:
scale3d
(
1
,
1
,
1
)
translateY
(
0px
);
}
}
.icon_wrap
{
position
:
relative
;
margin-right
:
24px
;
}
.rocket
{
position
:
absolute
;
width
:
34px
;
height
:
32px
;
bottom
:
0
;
right
:
-10px
;
animation-name
:
updown
;
animation-timing-function
:
ease-in-out
;
animation-duration
:
1
.3s
;
animation-iteration-count
:
infinite
;
animation-delay
:
0s
;
}
@keyframes
updown
{
0
%
{
transform
:
translateY
(
-10px
);
}
50
%
{
transform
:
translateY
(
0px
);
}
100
%
{
transform
:
translateY
(
-10px
);
}
}
}
.achieve_item_main
{
.achieve_item_main
{
...
@@ -67,7 +128,6 @@
...
@@ -67,7 +128,6 @@
.achieve_icon
{
.achieve_icon
{
width
:
96px
;
width
:
96px
;
height
:
96px
;
height
:
96px
;
margin-right
:
24px
;
}
}
.bonus_icon
{
.bonus_icon
{
...
@@ -103,6 +163,18 @@
...
@@ -103,6 +163,18 @@
}
}
}
}
.fail
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
padding-top
:
10vh
;
}
.fail_icon
{
width
:
498px
;
height
:
96px
;
}
.gap
{
.gap
{
height
:
160px
;
height
:
160px
;
}
}
...
...
src/pages/game/complete/components/complete-achieve.tsx
View file @
f1c49d87
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
assets
from
'@/assets/oss/assets-complete'
import
assets
from
'@/assets/oss/assets-complete'
import
{
useMemo
}
from
'react'
import
{
useMemo
,
useCallback
}
from
'react'
import
{
navigateBack
}
from
'@tarojs/taro'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
useStoreState
}
from
'@/store/hooks'
import
{
useStoreState
}
from
'@/store/hooks'
import
{
StageLevel
}
from
'@/api'
import
{
StageLevel
}
from
'@/api'
...
@@ -68,11 +69,16 @@ const GameCompleteAchieve = () => {
...
@@ -68,11 +69,16 @@ const GameCompleteAchieve = () => {
return
Math
.
ceil
(
rankNo
/
500
)
*
500
return
Math
.
ceil
(
rankNo
/
500
)
*
500
},
[
rankNo
])
},
[
rankNo
])
const
handleContinue
=
useCallback
(()
=>
{
navigateBack
()
},
[])
const
renderBtn
=
()
=>
(
const
renderBtn
=
()
=>
(
<
View
className=
{
styles
.
footer
}
>
<
View
className=
{
styles
.
footer
}
>
<
View
<
View
className=
{
styles
.
btn_continue
}
className=
{
styles
.
btn_continue
}
hoverClass=
{
styles
.
is_active
}
hoverClass=
{
styles
.
is_active
}
onClick=
{
handleContinue
}
>
>
继续
继续
</
View
>
</
View
>
...
@@ -83,10 +89,12 @@ const GameCompleteAchieve = () => {
...
@@ -83,10 +89,12 @@ const GameCompleteAchieve = () => {
return
null
return
null
}
}
if
(
gameResult
.
errNum
>
0
)
{
if
(
gameResult
.
errNum
>
0
||
!
gameResult
.
level
)
{
return
(
return
(
<>
<>
<
View
>
没关系,差一点就成功了! 加油!加油!
</
View
>
<
View
className=
{
classNames
(
styles
.
wrap
,
styles
.
fail
)
}
>
<
Image
src=
{
require
(
'../assets/fail.png'
)
}
className=
{
styles
.
fail_icon
}
></
Image
>
</
View
>
{
renderBtn
()
}
{
renderBtn
()
}
</>
</>
)
)
...
@@ -96,68 +104,75 @@ const GameCompleteAchieve = () => {
...
@@ -96,68 +104,75 @@ const GameCompleteAchieve = () => {
<>
<>
<
View
className=
{
styles
.
wrap
}
>
<
View
className=
{
styles
.
wrap
}
>
<
View
className=
{
styles
.
title
}
>
本关成就获得
</
View
>
<
View
className=
{
styles
.
title
}
>
本关成就获得
</
View
>
<
View
className=
{
styles
.
achieve_item
}
>
<
View
>
<
Image
src=
{
level
}
className=
{
styles
.
achieve_icon
}
></
Image
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
styles
.
main_text
}
>
{
gameResult
.
level
}
等级
<
Text
className=
{
classNames
(
styles
.
first_time
,
gameResult
.
levelReward
<=
0
&&
styles
.
is_second
)
}
>
{
gameResult
.
levelReward
>
0
?
'首次达成'
:
'二次达成'
}
</
Text
>
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
全对且用时≤
{
time
.
minutes
}
分
{
time
.
seconds
}
秒
</
View
>
</
View
>
{
gameResult
.
levelReward
>
0
&&
(
<
View
>
<
Image
src=
{
require
(
'../assets/bonus.png'
)
}
className=
{
styles
.
bonus_icon
}
></
Image
>
<
View
className=
{
styles
.
bonus_text
}
>
+
{
gameResult
.
levelReward
}
</
View
>
</
View
>
)
}
</
View
>
{
topIcon
&&
(
<
View
className=
{
styles
.
achieve_item
}
>
<
View
className=
{
styles
.
achieve_item
}
>
<
Image
src=
{
topIcon
}
className=
{
styles
.
achieve_icon
}
></
Image
>
<
View
className=
{
styles
.
icon_wrap
}
>
<
Image
src=
{
level
}
className=
{
styles
.
achieve_icon
}
/>
{
gameResult
.
levelReward
>
0
&&
(
<
Image
src=
{
require
(
'../assets/rocket.png'
)
}
className=
{
styles
.
rocket
}
/>
)
}
</
View
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
styles
.
main_text
}
>
<
View
className=
{
styles
.
main_text
}
>
TOP
{
gameResult
?.
gear
??
0
}
%
{
gameResult
.
level
}
等级
<
Text
className=
{
classNames
(
styles
.
first_time
,
gameResult
.
gear
Reward
<=
0
&&
styles
.
is_second
)
}
>
<
Text
className=
{
classNames
(
styles
.
first_time
,
gameResult
.
level
Reward
<=
0
&&
styles
.
is_second
)
}
>
{
gameResult
.
gear
Reward
>
0
?
'首次达成'
:
'二次达成'
}
{
gameResult
.
level
Reward
>
0
?
'首次达成'
:
'二次达成'
}
</
Text
>
</
Text
>
</
View
>
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
恭喜你成为了最优秀的
{
gameResult
?.
gear
??
0
}
%
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
全对且用时≤
{
time
.
minutes
}
分
{
time
.
seconds
}
秒
</
View
>
</
View
>
</
View
>
{
gameResult
.
gear
Reward
>
0
&&
(
{
gameResult
.
level
Reward
>
0
&&
(
<
View
>
<
View
>
<
Image
src=
{
require
(
'../assets/bonus.png'
)
}
className=
{
styles
.
bonus_icon
}
></
Image
>
<
Image
src=
{
require
(
'../assets/bonus.png'
)
}
className=
{
styles
.
bonus_icon
}
></
Image
>
<
View
className=
{
styles
.
bonus_text
}
>
+
{
gameResult
.
gear
Reward
}
</
View
>
<
View
className=
{
styles
.
bonus_text
}
>
+
{
gameResult
.
level
Reward
}
</
View
>
</
View
>
</
View
>
)
}
)
}
</
View
>
</
View
>
)
}
{
topIcon
&&
(
<
View
className=
{
styles
.
achieve_item
}
>
<
Image
src=
{
topIcon
}
className=
{
styles
.
achieve_icon
}
></
Image
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
styles
.
main_text
}
>
TOP
{
gameResult
?.
gear
??
0
}
%
<
Text
className=
{
classNames
(
styles
.
first_time
,
gameResult
.
gearReward
<=
0
&&
styles
.
is_second
)
}
>
{
gameResult
.
gearReward
>
0
?
'首次达成'
:
'二次达成'
}
</
Text
>
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
恭喜你成为了最优秀的
{
gameResult
?.
gear
??
0
}
%
</
View
>
</
View
>
{
gameResult
.
gearReward
>
0
&&
(
<
View
>
<
Image
src=
{
require
(
'../assets/bonus.png'
)
}
className=
{
styles
.
bonus_icon
}
></
Image
>
<
View
className=
{
styles
.
bonus_text
}
>
+
{
gameResult
.
gearReward
}
</
View
>
</
View
>
)
}
</
View
>
)
}
<
View
className=
{
styles
.
achieve_item
}
>
<
Image
src=
{
assets
[
'rank.png'
].
u
}
className=
{
styles
.
achieve_icon
}
></
Image
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
styles
.
main_text
}
>
全市排名
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
恭喜你进入了全市前
{
rankNoS
}
名
</
View
>
</
View
>
<
View
className=
{
styles
.
rank_text
}
>
{
rankNo
}
名
</
View
>
</
View
>
{
gameResult
?.
upGear
&&
(
<
View
className=
{
styles
.
achieve_item
}
>
<
View
className=
{
styles
.
achieve_item
}
>
<
Image
src=
{
assets
[
'
upgear
.png'
].
u
}
className=
{
styles
.
achieve_icon
}
></
Image
>
<
Image
src=
{
assets
[
'
rank
.png'
].
u
}
className=
{
styles
.
achieve_icon
}
></
Image
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
styles
.
main_text
}
>
升档成功
</
View
>
<
View
className=
{
styles
.
main_text
}
>
全市排名
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
提升到
{
gameResult
.
gear
-
10
}
%-
{
gameResult
.
gear
}
%
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
恭喜你进入了全市前
{
rankNoS
}
名
</
View
>
</
View
>
</
View
>
{
gameResult
.
upGearReward
>
0
&&
(
<
View
className=
{
styles
.
rank_text
}
>
{
rankNo
}
名
</
View
>
<
View
>
<
Image
src=
{
require
(
'../assets/bonus.png'
)
}
className=
{
styles
.
bonus_icon
}
></
Image
>
<
View
className=
{
styles
.
bonus_text
}
>
+
{
gameResult
.
upGearReward
}
</
View
>
</
View
>
)
}
</
View
>
</
View
>
)
}
{
gameResult
?.
upGear
&&
(
<
View
className=
{
styles
.
achieve_item
}
>
<
Image
src=
{
assets
[
'upgear.png'
].
u
}
className=
{
styles
.
achieve_icon
}
></
Image
>
<
View
className=
{
cs
.
flex__item
}
>
<
View
className=
{
styles
.
main_text
}
>
升档成功
</
View
>
<
View
className=
{
styles
.
tips_text
}
>
提升到
{
gameResult
.
gear
-
10
}
%-
{
gameResult
.
gear
}
%
</
View
>
</
View
>
{
gameResult
.
upGearReward
>
0
&&
(
<
View
>
<
Image
src=
{
require
(
'../assets/bonus.png'
)
}
className=
{
styles
.
bonus_icon
}
></
Image
>
<
View
className=
{
styles
.
bonus_text
}
>
+
{
gameResult
.
upGearReward
}
</
View
>
</
View
>
)
}
</
View
>
)
}
</
View
>
<
View
className=
{
styles
.
gap
}
></
View
>
<
View
className=
{
styles
.
gap
}
></
View
>
</
View
>
</
View
>
{
renderBtn
()
}
{
renderBtn
()
}
...
...
src/pages/game/complete/components/complete-head.module.scss
View file @
f1c49d87
...
@@ -20,6 +20,23 @@
...
@@ -20,6 +20,23 @@
display
:
block
;
display
:
block
;
margin
:
0
auto
;
margin
:
0
auto
;
height
:
536px
;
height
:
536px
;
animation-name
:
fadeIn
;
animation-duration
:
.5s
;
animation-timing-function
:
ease-out
;
animation-iteration-count
:
1
;
animation-fill-mode
:
backwards
;
animation-delay
:
0s
;
}
@keyframes
fadeIn
{
0
%
{
opacity
:
0
;
transform
:
scale3d
(
1
.5
,
1
.5
,
1
)
translateY
(
100px
);
}
100
%
{
opacity
:
1
;
transform
:
scale3d
(
1
,
1
,
1
)
translateY
(
0px
);
}
}
}
.tips
{
.tips
{
...
...
src/pages/game/play/assets/time-red.png
0 → 100644
View file @
f1c49d87
406 Bytes
src/pages/game/play/components/count-up.module.scss
View file @
f1c49d87
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
padding
:
40px
32px
100px
32px
;
padding
:
40px
32px
100px
32px
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
&
.is_stop
{
padding-bottom
:
50px
;
}
}
}
.process
{
.process
{
...
@@ -27,6 +31,10 @@
...
@@ -27,6 +31,10 @@
color
:
#465164
;
color
:
#465164
;
line-height
:
46px
;
line-height
:
46px
;
&
.red
{
color
:
#FF7770
;
}
.icon
{
.icon
{
width
:
32px
;
width
:
32px
;
height
:
32px
;
height
:
32px
;
...
...
src/pages/game/play/components/count-up.tsx
View file @
f1c49d87
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
View
,
Image
}
from
'@tarojs/components'
import
{
useState
,
useEffect
,
useCallback
,
useMemo
,
useRef
}
from
'react'
import
{
useState
,
useEffect
,
useCallback
,
useMemo
}
from
'react'
import
{
createSelectorQuery
,
getCurrentInstance
}
from
'@tarojs/taro'
import
{
createSelectorQuery
}
from
'@tarojs/taro'
import
{
useStoreState
}
from
'@/store/hooks'
import
classNames
from
'classnames'
import
{
type
StageDetail
}
from
'@/api'
import
{
useBoolean
}
from
'@/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
type
StageDetail
,
StageType
}
from
'@/api'
import
styles
from
'./count-up.module.scss'
import
styles
from
'./count-up.module.scss'
...
@@ -15,10 +17,12 @@ type CountUpProps = {
...
@@ -15,10 +17,12 @@ type CountUpProps = {
const
CountUp
=
(
props
:
CountUpProps
)
=>
{
const
CountUp
=
(
props
:
CountUpProps
)
=>
{
const
{
stageDetail
}
=
props
const
{
stageDetail
}
=
props
const
currentQuestionIndex
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestionIndex
)
const
currentQuestionIndex
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestionIndex
)
const
counterId
=
useStoreState
(
states
=>
states
.
gameModel
.
counterId
)
const
questionList
=
useStoreState
(
state
=>
state
.
gameModel
.
questionList
)
const
questionList
=
useStoreState
(
state
=>
state
.
gameModel
.
questionList
)
const
isSubmit
=
useStoreState
(
state
=>
state
.
gameModel
.
isSubmit
)
const
isSubmit
=
useStoreState
(
state
=>
state
.
gameModel
.
isSubmit
)
const
submit
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
submit
)
const
[
width
,
setWidth
]
=
useState
(
0
)
const
[
width
,
setWidth
]
=
useState
(
0
)
const
countUp
=
useRef
<
any
>
(
null
)
const
[
isExceed
,
exceedActions
]
=
useBoolean
(
false
)
const
questionLength
=
useMemo
(()
=>
{
const
questionLength
=
useMemo
(()
=>
{
return
questionList
.
length
return
questionList
.
length
...
@@ -35,6 +39,17 @@ const CountUp = (props: CountUpProps) => {
...
@@ -35,6 +39,17 @@ const CountUp = (props: CountUpProps) => {
})
})
},
[])
},
[])
const
isOneStop
=
useMemo
(()
=>
{
return
stageDetail
.
type
===
StageType
.
OneStop
},
[
stageDetail
])
const
startTick
=
useMemo
(()
=>
{
if
(
stageDetail
.
type
===
StageType
.
OneStop
)
{
return
stageDetail
.
bTime
}
return
0
},
[
stageDetail
])
const
roleStyle
=
useMemo
(()
=>
{
const
roleStyle
=
useMemo
(()
=>
{
return
{
return
{
transform
:
`translateX(
${
width
}
px)`
,
transform
:
`translateX(
${
width
}
px)`
,
...
@@ -42,14 +57,6 @@ const CountUp = (props: CountUpProps) => {
...
@@ -42,14 +57,6 @@ const CountUp = (props: CountUpProps) => {
}
}
},
[
width
,
stageDetail
.
bTime
])
},
[
width
,
stageDetail
.
bTime
])
useEffect
(()
=>
{
if
(
isSubmit
&&
countUp
.
current
?.
sid
)
{
console
.
log
(
countUp
.
current
)
const
comp
=
getCurrentInstance
()?.
page
?.
selectComponent
?.(
`#
${
countUp
.
current
.
sid
}
`
)
as
any
comp
?.
stop
?.()
}
},
[
isSubmit
])
const
processInnerStyle
=
useMemo
(()
=>
{
const
processInnerStyle
=
useMemo
(()
=>
{
if
(
isSubmit
)
{
if
(
isSubmit
)
{
return
{
return
{
...
@@ -63,21 +70,37 @@ const CountUp = (props: CountUpProps) => {
...
@@ -63,21 +70,37 @@ const CountUp = (props: CountUpProps) => {
const
handleTimeUp
=
useCallback
(()
=>
{
const
handleTimeUp
=
useCallback
(()
=>
{
console
.
log
(
'upd1'
)
console
.
log
(
'upd1'
)
},
[])
if
(
isOneStop
)
{
submit
()
}
},
[
submit
,
isOneStop
])
return
(
return
(
<
View
className=
{
styles
.
count
}
>
<
View
className=
{
classNames
(
styles
.
count
,
isOneStop
&&
styles
.
is_stop
)
}
>
<
View
className=
{
styles
.
process
}
id=
{
id
}
>
<
View
className=
{
styles
.
process
}
id=
{
id
}
>
<
View
className=
{
styles
.
process_inner
}
style=
{
processInnerStyle
}
></
View
>
<
View
className=
{
styles
.
process_inner
}
style=
{
processInnerStyle
}
></
View
>
<
View
className=
{
styles
.
role
}
style=
{
roleStyle
}
>
{
!
isOneStop
&&
(
<
View
className=
{
styles
.
tick
}
></
View
>
<
View
className=
{
styles
.
role
}
style=
{
roleStyle
}
>
<
Image
src=
{
require
(
'../assets/count-cat.png'
)
}
className=
{
styles
.
cat
}
></
Image
>
<
View
className=
{
styles
.
tick
}
></
View
>
<
View
className=
{
styles
.
tips
}
>
通关要求
</
View
>
<
Image
src=
{
require
(
'../assets/count-cat.png'
)
}
className=
{
styles
.
cat
}
></
Image
>
</
View
>
<
View
className=
{
styles
.
tips
}
>
通关要求
</
View
>
</
View
>
)
}
</
View
>
</
View
>
<
View
className=
{
styles
.
time
}
>
<
View
className=
{
classNames
(
styles
.
time
,
isExceed
&&
styles
.
red
)
}
>
<
Image
src=
{
require
(
'../assets/count-time.png'
)
}
className=
{
styles
.
icon
}
></
Image
>
{
isExceed
<
count
-
up
-
time
max
-
value=
{
60
*
60
}
onTimeup=
{
handleTimeUp
}
ref=
{
countUp
}
/>
?
(<
Image
src=
{
require
(
'../assets/time-red.png'
)
}
className=
{
styles
.
icon
}
></
Image
>)
:
(<
Image
src=
{
require
(
'../assets/count-time.png'
)
}
className=
{
styles
.
icon
}
></
Image
>)
}
<
count
-
up
-
time
exceedTime=
{
20
}
onExceed=
{
exceedActions
.
setTrue
}
maxValue=
{
60
*
60
}
startValue=
{
startTick
}
isDown=
{
isOneStop
}
onTimeup=
{
handleTimeUp
}
id=
{
counterId
}
/>
</
View
>
</
View
>
</
View
>
</
View
>
)
)
...
...
src/pages/game/play/components/modal-continue.tsx
View file @
f1c49d87
...
@@ -19,6 +19,8 @@ const ModalContinue = (props: ModalContinueProps) => {
...
@@ -19,6 +19,8 @@ const ModalContinue = (props: ModalContinueProps) => {
const
cardNum
=
useStoreState
(
state
=>
state
.
userModel
.
cardNum
)
const
cardNum
=
useStoreState
(
state
=>
state
.
userModel
.
cardNum
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
submit
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
submit
)
const
reborn
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
reborn
)
const
handleClick
=
useCallback
(()
=>
{
const
handleClick
=
useCallback
(()
=>
{
if
(
closeOnClickModal
)
{
if
(
closeOnClickModal
)
{
...
@@ -32,6 +34,10 @@ const ModalContinue = (props: ModalContinueProps) => {
...
@@ -32,6 +34,10 @@ const ModalContinue = (props: ModalContinueProps) => {
}
}
},
[
fetchAccount
,
modalContinueVisible
])
},
[
fetchAccount
,
modalContinueVisible
])
const
handleReborn
=
useCallback
(()
=>
{
reborn
()
},
[
reborn
])
return
(
return
(
<
RootPortal
>
<
RootPortal
>
<
View
className=
{
classNames
(
styles
.
mask
,
modalContinueVisible
&&
styles
.
is_show
)
}
onClick=
{
handleClick
}
>
<
View
className=
{
classNames
(
styles
.
mask
,
modalContinueVisible
&&
styles
.
is_show
)
}
onClick=
{
handleClick
}
>
...
@@ -43,12 +49,14 @@ const ModalContinue = (props: ModalContinueProps) => {
...
@@ -43,12 +49,14 @@ const ModalContinue = (props: ModalContinueProps) => {
<
View
<
View
className=
{
styles
.
btn_left
}
className=
{
styles
.
btn_left
}
hoverClass=
{
styles
.
is_active
}
hoverClass=
{
styles
.
is_active
}
onClick=
{
()
=>
submit
()
}
>
>
放弃
放弃
</
View
>
</
View
>
<
View
<
View
className=
{
classNames
(
styles
.
btn_right
,
!
canGoNext
&&
styles
.
disabled
)
}
className=
{
classNames
(
styles
.
btn_right
,
!
canGoNext
&&
styles
.
disabled
)
}
hoverClass=
{
canGoNext
?
styles
.
is_active
:
null
}
hoverClass=
{
canGoNext
?
styles
.
is_active
:
null
}
onClick=
{
handleReborn
}
>
>
<
Image
src=
{
require
(
'@/pages/main/assets/ph.png'
)
}
className=
{
styles
.
icon
}
></
Image
>
<
Image
src=
{
require
(
'@/pages/main/assets/ph.png'
)
}
className=
{
styles
.
icon
}
></
Image
>
<
Text
>
-1 继续
</
Text
>
<
Text
>
-1 继续
</
Text
>
...
...
src/pages/game/play/model/index.ts
View file @
f1c49d87
import
{
action
,
Action
,
computed
,
Computed
,
Thunk
,
thunk
}
from
'easy-peasy'
import
{
action
,
Action
,
computed
,
Computed
,
Thunk
,
thunk
}
from
'easy-peasy'
import
{
AppStoreModel
}
from
'@/store/store-model'
import
{
AppStoreModel
}
from
'@/store/store-model'
import
{
getQuestionList
,
type
StageDetail
,
getStageDetail
,
completeStage
,
StageType
,
type
CompleteStageOut
,
StageLevel
}
from
'@/api'
import
{
getQuestionList
,
type
StageDetail
,
getStageDetail
,
completeStage
,
StageType
,
type
CompleteStageOut
,
resumeGame
}
from
'@/api'
import
{
showLoading
,
hideLoading
,
showModal
,
redirectTo
,
vibrateShort
}
from
'@tarojs/taro'
import
{
showLoading
,
hideLoading
,
showModal
,
redirectTo
,
vibrateShort
,
getCurrentInstance
}
from
'@tarojs/taro'
import
{
import
{
QuestionType
,
QuestionType
,
QuestionAnswer
,
QuestionAnswer
,
...
@@ -10,13 +10,20 @@ import {
...
@@ -10,13 +10,20 @@ import {
}
from
'../types'
}
from
'../types'
import
{
buildCompleteStageParam
,
convertQuestion
,
determinQuestion
}
from
'./utils'
import
{
buildCompleteStageParam
,
convertQuestion
,
determinQuestion
}
from
'./utils'
import
questionListJson
from
'./test.json'
interface
CompleteStageDetail
extends
CompleteStageOut
{
interface
CompleteStageDetail
extends
CompleteStageOut
{
errNum
:
number
;
errNum
:
number
;
levelTime
:
number
;
levelTime
:
number
;
}
}
const
COUNTER_ID
=
'z__countdown__'
const
getCounter
=
()
=>
{
return
getCurrentInstance
()?.
page
?.
selectComponent
?.(
`#
${
COUNTER_ID
}
`
)
as
any
}
const
stopCounter
=
()
=>
getCounter
()?.
stop
()
const
startCounter
=
()
=>
getCounter
()?.
start
()
interface
GameModelState
{
interface
GameModelState
{
/** 题目列表 */
/** 题目列表 */
questionList
:
QuestionType
[];
questionList
:
QuestionType
[];
...
@@ -30,6 +37,11 @@ interface GameModelState {
...
@@ -30,6 +37,11 @@ interface GameModelState {
isSubmit
:
boolean
;
isSubmit
:
boolean
;
modalContinueVisible
:
boolean
;
modalContinueVisible
:
boolean
;
/** 是否复活过 */
isReborn
:
boolean
;
/** 计时器id */
counterId
:
string
;
}
}
export
interface
GameModel
extends
GameModelState
{
export
interface
GameModel
extends
GameModelState
{
...
@@ -58,28 +70,15 @@ export interface GameModel extends GameModelState {
...
@@ -58,28 +70,15 @@ export interface GameModel extends GameModelState {
handleGoNext
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
handleGoNext
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
submit
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
submit
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
reborn
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
}
}
const
gameModel
:
GameModel
=
{
const
gameModel
:
GameModel
=
{
questionList
:
questionListJson
as
QuestionType
[],
counterId
:
COUNTER_ID
,
gameResult
:
{
questionList
:
[],
/** 排名档位 */
gameResult
:
null
,
gear
:
10
,
isReborn
:
false
,
gearReward
:
10
,
levelBefore
:
StageLevel
.
B
,
levelReward
:
20
,
upGearReward
:
40
,
errNum
:
0
,
/** 成就等级:SAB */
level
:
StageLevel
.
B
,
levelTime
:
50
,
/** 排名 */
ranks
:
[],
/** 耗时 */
resultTime
:
60
,
/** 是否升档奖励 */
upGear
:
true
},
modalContinueVisible
:
false
,
modalContinueVisible
:
false
,
gameStartTime
:
0
,
gameStartTime
:
0
,
isSubmit
:
false
,
isSubmit
:
false
,
...
@@ -171,26 +170,49 @@ const gameModel: GameModel = {
...
@@ -171,26 +170,49 @@ const gameModel: GameModel = {
}),
}),
handleGoNext
:
thunk
(
async
(
actions
,
_
,
helpers
)
=>
{
handleGoNext
:
thunk
(
async
(
actions
,
_
,
helpers
)
=>
{
const
{
canGoNext
,
currentQuestionIndex
,
questionList
,
stageDetail
,
currentQuestion
}
=
helpers
.
getState
()
const
{
canGoNext
,
currentQuestionIndex
,
questionList
,
stageDetail
,
currentQuestion
,
isReborn
}
=
helpers
.
getState
()
if
(
!
canGoNext
)
return
if
(
!
canGoNext
)
return
if
(
questionList
.
length
===
currentQuestionIndex
+
1
)
{
console
.
log
(
'submit'
)
if
(
stageDetail
?.
type
===
StageType
.
OneStop
&&
currentQuestion
&&
!
determinQuestion
(
currentQuestion
))
{
actions
.
submit
()
const
cardNum
=
helpers
.
getStoreState
().
userModel
.
cardNum
/** 没有复活过并且有答题卡 */
if
(
!
isReborn
&&
cardNum
>
0
)
{
stopCounter
()
actions
.
updateState
({
modalContinueVisible
:
true
,
isReborn
:
true
})
}
else
{
actions
.
submit
()
}
return
return
}
}
if
(
stageDetail
?.
type
===
StageType
.
OneStop
)
{
if
(
questionList
.
length
===
currentQuestionIndex
+
1
)
{
if
(
currentQuestion
&&
!
determinQuestion
(
currentQuestion
))
{
actions
.
submit
()
actions
.
updateState
({
return
modalContinueVisible
:
true
,
})
return
}
}
}
actions
.
updateCurrentIndex
(
currentQuestionIndex
+
1
)
actions
.
updateCurrentIndex
(
currentQuestionIndex
+
1
)
}),
}),
reborn
:
thunk
(
async
(
actions
,
_
,
helpers
)
=>
{
const
{
stageDetail
}
=
helpers
.
getState
()
if
(
!
stageDetail
)
return
try
{
await
resumeGame
(
stageDetail
.
id
)
helpers
.
getStoreActions
().
userModel
.
fetchAccount
()
startCounter
()
actions
.
updateState
({
modalContinueVisible
:
false
})
}
catch
(
err
)
{
showModal
({
title
:
'提示'
,
showCancel
:
false
,
content
:
err
.
message
,
success
:
()
=>
{
actions
.
submit
()
}
})
}
}),
getStageDetail
:
thunk
(
async
(
actions
,
round
)
=>
{
getStageDetail
:
thunk
(
async
(
actions
,
round
)
=>
{
try
{
try
{
showLoading
()
showLoading
()
...
@@ -210,7 +232,7 @@ const gameModel: GameModel = {
...
@@ -210,7 +232,7 @@ const gameModel: GameModel = {
}
}
}),
}),
getQuestionList
:
thunk
(
async
(
actions
,
round
)
=>
{
getQuestionList
:
thunk
(
async
(
actions
,
round
,
helpers
)
=>
{
try
{
try
{
// showLoading()
// showLoading()
const
{
data
:
questionList
}
=
await
getQuestionList
(
round
)
const
{
data
:
questionList
}
=
await
getQuestionList
(
round
)
...
@@ -220,8 +242,11 @@ const gameModel: GameModel = {
...
@@ -220,8 +242,11 @@ const gameModel: GameModel = {
isSubmit
:
false
,
isSubmit
:
false
,
currentQuestionIndex
:
0
,
currentQuestionIndex
:
0
,
modalContinueVisible
:
false
,
modalContinueVisible
:
false
,
isReborn
:
false
,
gameStartTime
:
Date
.
now
(),
gameStartTime
:
Date
.
now
(),
})
})
/** 更新账户余额 */
helpers
.
getStoreActions
().
userModel
.
fetchAccount
()
// hideLoading()
// hideLoading()
}
catch
(
err
)
{
}
catch
(
err
)
{
// hideLoading()
// hideLoading()
...
@@ -245,8 +270,9 @@ const gameModel: GameModel = {
...
@@ -245,8 +270,9 @@ const gameModel: GameModel = {
title
:
'提交中'
title
:
'提交中'
})
})
actions
.
updateState
({
isSubmit
:
true
})
actions
.
updateState
({
isSubmit
:
true
})
const
{
questionList
,
gameStartTime
,
stageDetail
}
=
helpers
.
getState
()
stopCounter
()
const
params
=
buildCompleteStageParam
(
questionList
,
stageDetail
!
,
gameStartTime
)
const
{
questionList
,
stageDetail
}
=
helpers
.
getState
()
const
params
=
buildCompleteStageParam
(
questionList
,
stageDetail
!
,
getCounter
()?.
getCount
()
??
0
)
const
{
data
:
gameResult
}
=
await
completeStage
(
params
)
const
{
data
:
gameResult
}
=
await
completeStage
(
params
)
actions
.
updateState
({
actions
.
updateState
({
gameResult
:
{
gameResult
:
{
...
...
src/pages/game/play/model/test-1.json
deleted
100644 → 0
View file @
051dd08d
[
{
"answers"
:
[{
"contentText"
:
"11"
,
"sort"
:
0
}],
"contentText"
:
"1<MathSymbol value=
\"
+
\"
/>10<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"1"
,
"sort"
:
0
},
{
"contentText"
:
"10"
,
"sort"
:
1
},
{
"contentText"
:
"11"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"11"
,
"sort"
:
0
}],
"contentText"
:
"1<MathSymbol value=
\"
+
\"
/>10<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"1"
,
"sort"
:
0
},
{
"contentText"
:
"10"
,
"sort"
:
1
},
{
"contentText"
:
"11"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"30"
,
"sort"
:
0
}],
"contentText"
:
"18<MathSymbol value=
\"
+
\"
/>12<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"18"
,
"sort"
:
0
},
{
"contentText"
:
"12"
,
"sort"
:
1
},
{
"contentText"
:
"30"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"39"
,
"sort"
:
0
}],
"contentText"
:
"34<MathSymbol value=
\"
+
\"
/>5<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"34"
,
"sort"
:
0
},
{
"contentText"
:
"5"
,
"sort"
:
1
},
{
"contentText"
:
"39"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"95"
,
"sort"
:
0
}],
"contentText"
:
"48<MathSymbol value=
\"
+
\"
/>47<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"48"
,
"sort"
:
0
},
{
"contentText"
:
"47"
,
"sort"
:
1
},
{
"contentText"
:
"95"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"65"
,
"sort"
:
0
}],
"contentText"
:
"22<MathSymbol value=
\"
+
\"
/>43<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"22"
,
"sort"
:
0
},
{
"contentText"
:
"43"
,
"sort"
:
1
},
{
"contentText"
:
"65"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"28"
,
"sort"
:
0
}],
"contentText"
:
"16<MathSymbol value=
\"
+
\"
/>12<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"16"
,
"sort"
:
0
},
{
"contentText"
:
"12"
,
"sort"
:
1
},
{
"contentText"
:
"28"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"50"
,
"sort"
:
0
}],
"contentText"
:
"2<MathSymbol value=
\"
+
\"
/>48<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"2"
,
"sort"
:
0
},
{
"contentText"
:
"48"
,
"sort"
:
1
},
{
"contentText"
:
"50"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"65"
,
"sort"
:
0
}],
"contentText"
:
"46<MathSymbol value=
\"
+
\"
/>19<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"46"
,
"sort"
:
0
},
{
"contentText"
:
"19"
,
"sort"
:
1
},
{
"contentText"
:
"65"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"84"
,
"sort"
:
0
}],
"contentText"
:
"48<MathSymbol value=
\"
+
\"
/>36<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"48"
,
"sort"
:
0
},
{
"contentText"
:
"36"
,
"sort"
:
1
},
{
"contentText"
:
"84"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
}
]
src/pages/game/play/model/test-2.json
deleted
100644 → 0
View file @
051dd08d
[
{
"answers"
:
[{
"contentText"
:
"32"
,
"sort"
:
0
}],
"contentText"
:
"48<MathSymbol value=
\"
+
\"
/><AnswerBlank index=
\"
0
\"
/><MathSymbol value=
\"
=
\"
/>80"
,
"questionItems"
:
[
{
"contentText"
:
"48"
,
"sort"
:
0
},
{
"contentText"
:
"32"
,
"sort"
:
1
},
{
"contentText"
:
"80"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"53"
,
"sort"
:
0
}],
"contentText"
:
"14<MathSymbol value=
\"
+
\"
/>39<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"14"
,
"sort"
:
0
},
{
"contentText"
:
"39"
,
"sort"
:
1
},
{
"contentText"
:
"53"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"62"
,
"sort"
:
0
}],
"contentText"
:
"39<MathSymbol value=
\"
+
\"
/>23<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"39"
,
"sort"
:
0
},
{
"contentText"
:
"23"
,
"sort"
:
1
},
{
"contentText"
:
"62"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"83"
,
"sort"
:
0
}],
"contentText"
:
"49<MathSymbol value=
\"
+
\"
/>34<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"49"
,
"sort"
:
0
},
{
"contentText"
:
"34"
,
"sort"
:
1
},
{
"contentText"
:
"83"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"35"
,
"sort"
:
0
}],
"contentText"
:
"10<MathSymbol value=
\"
+
\"
/><AnswerBlank index=
\"
0
\"
/><MathSymbol value=
\"
=
\"
/>45"
,
"questionItems"
:
[
{
"contentText"
:
"10"
,
"sort"
:
0
},
{
"contentText"
:
"35"
,
"sort"
:
1
},
{
"contentText"
:
"45"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"58"
,
"sort"
:
0
}],
"contentText"
:
"48<MathSymbol value=
\"
+
\"
/>10<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"48"
,
"sort"
:
0
},
{
"contentText"
:
"10"
,
"sort"
:
1
},
{
"contentText"
:
"58"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"18"
,
"sort"
:
0
}],
"contentText"
:
"4<MathSymbol value=
\"
+
\"
/>14<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"4"
,
"sort"
:
0
},
{
"contentText"
:
"14"
,
"sort"
:
1
},
{
"contentText"
:
"18"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"1"
,
"sort"
:
0
}],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/><MathSymbol value=
\"
+
\"
/>44<MathSymbol value=
\"
=
\"
/>45"
,
"questionItems"
:
[
{
"contentText"
:
"1"
,
"sort"
:
0
},
{
"contentText"
:
"44"
,
"sort"
:
1
},
{
"contentText"
:
"45"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"0"
,
"sort"
:
0
}],
"contentText"
:
"9<MathSymbol value=
\"
+
\"
/><AnswerBlank index=
\"
0
\"
/><MathSymbol value=
\"
=
\"
/>9"
,
"questionItems"
:
[
{
"contentText"
:
"9"
,
"sort"
:
0
},
{
"contentText"
:
"0"
,
"sort"
:
1
},
{
"contentText"
:
"9"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"6"
,
"sort"
:
0
}],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/><MathSymbol value=
\"
+
\"
/>44<MathSymbol value=
\"
=
\"
/>50"
,
"questionItems"
:
[
{
"contentText"
:
"6"
,
"sort"
:
0
},
{
"contentText"
:
"44"
,
"sort"
:
1
},
{
"contentText"
:
"50"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
}
]
src/pages/game/play/model/test-3.json
deleted
100644 → 0
View file @
051dd08d
[
{
"answers"
:
[{
"contentText"
:
"20"
,
"sort"
:
0
}],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/>元钱可以买1元笔记本21本"
,
"questionItems"
:
[
{
"contentText"
:
"20"
,
"sort"
:
0
},
{
"contentText"
:
"1"
,
"sort"
:
1
},
{
"contentText"
:
"21"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"74"
,
"sort"
:
0
}],
"contentText"
:
"48元钱可以买26元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"48"
,
"sort"
:
0
},
{
"contentText"
:
"26"
,
"sort"
:
1
},
{
"contentText"
:
"74"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"32"
,
"sort"
:
0
}],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/>元钱可以买24元笔记本56本"
,
"questionItems"
:
[
{
"contentText"
:
"32"
,
"sort"
:
0
},
{
"contentText"
:
"24"
,
"sort"
:
1
},
{
"contentText"
:
"56"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"19"
,
"sort"
:
0
}],
"contentText"
:
"9元钱可以买10元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"9"
,
"sort"
:
0
},
{
"contentText"
:
"10"
,
"sort"
:
1
},
{
"contentText"
:
"19"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"12"
,
"sort"
:
0
}],
"contentText"
:
"11元钱可以买1元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"11"
,
"sort"
:
0
},
{
"contentText"
:
"1"
,
"sort"
:
1
},
{
"contentText"
:
"12"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"66"
,
"sort"
:
0
}],
"contentText"
:
"30元钱可以买36元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"30"
,
"sort"
:
0
},
{
"contentText"
:
"36"
,
"sort"
:
1
},
{
"contentText"
:
"66"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"2"
,
"sort"
:
0
}],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/>元钱可以买7元笔记本9本"
,
"questionItems"
:
[
{
"contentText"
:
"2"
,
"sort"
:
0
},
{
"contentText"
:
"7"
,
"sort"
:
1
},
{
"contentText"
:
"9"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"3"
,
"sort"
:
0
}],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/>元钱可以买14元笔记本17本"
,
"questionItems"
:
[
{
"contentText"
:
"3"
,
"sort"
:
0
},
{
"contentText"
:
"14"
,
"sort"
:
1
},
{
"contentText"
:
"17"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"16"
,
"sort"
:
0
}],
"contentText"
:
"27元钱可以买<AnswerBlank index=
\"
0
\"
/>元笔记本43本"
,
"questionItems"
:
[
{
"contentText"
:
"27"
,
"sort"
:
0
},
{
"contentText"
:
"16"
,
"sort"
:
1
},
{
"contentText"
:
"43"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[{
"contentText"
:
"13"
,
"sort"
:
0
}],
"contentText"
:
"6元钱可以买<AnswerBlank index=
\"
0
\"
/>元笔记本19本"
,
"questionItems"
:
[
{
"contentText"
:
"6"
,
"sort"
:
0
},
{
"contentText"
:
"13"
,
"sort"
:
1
},
{
"contentText"
:
"19"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
}
]
src/pages/game/play/model/test-4.json
deleted
100644 → 0
View file @
051dd08d
[
{
"answers"
:
[
{
"contentText"
:
"69"
,
"sort"
:
0
}
],
"contentText"
:
"28<MathSymbol value=
\"
+
\"
/>41<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"28"
,
"sort"
:
0
},
{
"contentText"
:
"41"
,
"sort"
:
1
},
{
"contentText"
:
"69"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
,
"sort"
:
11
},
{
"answers"
:
[
{
"contentText"
:
"44"
,
"sort"
:
0
}
],
"contentText"
:
"30元钱可以买<AnswerBlank index=
\"
0
\"
/>元笔记本74本"
,
"questionItems"
:
[
{
"contentText"
:
"30"
,
"sort"
:
0
},
{
"contentText"
:
"44"
,
"sort"
:
1
},
{
"contentText"
:
"74"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
,
"sort"
:
13
},
{
"answers"
:
[
{
"contentText"
:
"C"
,
"sort"
:
1
}
],
"contentText"
:
"爸爸把一盘糖果的一半给了弟弟,把剩下的糖果给了一半给姐姐,这时盘里还剩8块,请问盘里原来有几块糖?"
,
"options"
:
[
{
"answer"
:
false
,
"contentText"
:
"16块"
,
"index"
:
"A"
},
{
"answer"
:
false
,
"contentText"
:
"24块"
,
"index"
:
"B"
},
{
"answer"
:
true
,
"contentText"
:
"32块"
,
"index"
:
"C"
},
{
"answer"
:
false
,
"contentText"
:
"64块"
,
"index"
:
"D"
}
],
"questionType"
:
"选择题"
,
"simpleType"
:
false
,
"sort"
:
28
},
{
"answers"
:
[
{
"contentText"
:
"35"
,
"sort"
:
0
}
],
"contentText"
:
"22<MathSymbol value=
\"
+
\"
/>13<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"22"
,
"sort"
:
0
},
{
"contentText"
:
"13"
,
"sort"
:
1
},
{
"contentText"
:
"35"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
,
"sort"
:
49
},
{
"answers"
:
[
{
"contentText"
:
"59"
,
"sort"
:
0
}
],
"contentText"
:
"43元钱可以买16元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"43"
,
"sort"
:
0
},
{
"contentText"
:
"16"
,
"sort"
:
1
},
{
"contentText"
:
"59"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
,
"sort"
:
51
},
{
"answers"
:
[
{
"contentText"
:
"13"
,
"sort"
:
0
}
],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/>元钱可以买21元笔记本34本"
,
"questionItems"
:
[
{
"contentText"
:
"13"
,
"sort"
:
0
},
{
"contentText"
:
"21"
,
"sort"
:
1
},
{
"contentText"
:
"34"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
,
"sort"
:
82
},
{
"answers"
:
[
{
"contentText"
:
"45"
,
"sort"
:
0
}
],
"contentText"
:
"33<MathSymbol value=
\"
+
\"
/>12<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"33"
,
"sort"
:
0
},
{
"contentText"
:
"12"
,
"sort"
:
1
},
{
"contentText"
:
"45"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
,
"sort"
:
83
},
{
"answers"
:
[
{
"contentText"
:
"20"
,
"sort"
:
0
}
],
"contentText"
:
"8<MathSymbol value=
\"
+
\"
/>12<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"8"
,
"sort"
:
0
},
{
"contentText"
:
"12"
,
"sort"
:
1
},
{
"contentText"
:
"20"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
,
"sort"
:
92
},
{
"answers"
:
[
{
"contentText"
:
"18"
,
"sort"
:
0
}
],
"contentText"
:
"7<MathSymbol value=
\"
+
\"
/>11<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"7"
,
"sort"
:
0
},
{
"contentText"
:
"11"
,
"sort"
:
1
},
{
"contentText"
:
"18"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
,
"sort"
:
95
},
{
"answers"
:
[
{
"contentText"
:
"C"
,
"sort"
:
1
}
],
"contentText"
:
"《钢铁是怎样炼成的》是前苏联作家奥斯特洛夫斯基的自传体小说,小说的主人公是()?"
,
"options"
:
[
{
"answer"
:
false
,
"contentText"
:
"格列佛"
,
"index"
:
"A"
},
{
"answer"
:
false
,
"contentText"
:
"汤姆·索亚"
,
"index"
:
"B"
},
{
"answer"
:
true
,
"contentText"
:
"保尔·柯察金"
,
"index"
:
"C"
},
{
"answer"
:
false
,
"contentText"
:
"海伦"
,
"index"
:
"D"
}
],
"questionType"
:
"选择题"
,
"simpleType"
:
false
,
"sort"
:
98
}
]
src/pages/game/play/model/test.json
deleted
100644 → 0
View file @
051dd08d
[
{
"answers"
:
[
{
"contentText"
:
"C"
,
"sort"
:
1
}
],
"contentText"
:
"爸爸把一盘糖果的一半给了弟弟,把剩下的糖果给了一半给姐姐,这时盘里还剩8块,请问盘里原来有几块糖?"
,
"options"
:
[
{
"answer"
:
false
,
"contentText"
:
"16块"
,
"index"
:
"A"
},
{
"answer"
:
false
,
"contentText"
:
"24块"
,
"index"
:
"B"
},
{
"answer"
:
true
,
"contentText"
:
"32块"
,
"index"
:
"C"
},
{
"answer"
:
false
,
"contentText"
:
"64块"
,
"index"
:
"D"
}
],
"questionType"
:
"选择题"
,
"simpleType"
:
false
},
{
"contentText"
:
"<p>某班50名学生在一次百米测试中,成绩全部介于13秒与19秒之间,将测试结果分成六组,得到频率分布直方图(如图).设成绩小于16秒的学生人数占全班总人数的百分比为<i>x</i>,成绩大于等于15秒且小于17秒的学生人数为<i>y</i>,则从频率分布直方图中可分析出<i>x</i>和<i>y</i>分别为( )</p><p><img src=
\"
https://profile-1257124244.cos.ap-chengdu.myqcloud.com/question/image/943c1ee2-ed62-42d7-b381-d0e3d31677a7.png
\"
style=
\"
max-width:90vw;max-height:62.005104vw
\"
alt=
\"\"
width=
\"
202.90031
\"
height=
\"
139.78728
\"
></p>"
,
"options"
:
[
{
"contentText"
:
"<p>0.56,35</p>"
,
"answer"
:
true
,
"index"
:
"A"
},
{
"contentText"
:
"<p>0.56,45</p>"
,
"answer"
:
false
,
"index"
:
"B"
},
{
"contentText"
:
"<p>0.44,35</p>"
,
"answer"
:
false
,
"index"
:
"C"
},
{
"contentText"
:
"<p>0.44,45</p>"
,
"answer"
:
false
,
"index"
:
"D"
}
],
"answers"
:
[
{
"contentText"
:
"C"
,
"sort"
:
1
}
],
"questionType"
:
"选择题"
,
"simpleType"
:
false
,
"sort"
:
98
},
{
"answers"
:
[
{
"contentText"
:
"C"
,
"sort"
:
1
}
],
"contentText"
:
"《钢铁是怎样炼成的》是前苏联作家奥斯特洛夫斯基的自传体小说,小说的主人公是()?"
,
"options"
:
[
{
"answer"
:
false
,
"contentText"
:
"格列佛"
,
"index"
:
"A"
},
{
"answer"
:
false
,
"contentText"
:
"汤姆·索亚"
,
"index"
:
"B"
},
{
"answer"
:
true
,
"contentText"
:
"保尔·柯察金"
,
"index"
:
"C"
},
{
"answer"
:
false
,
"contentText"
:
"海伦"
,
"index"
:
"D"
}
],
"questionType"
:
"选择题"
,
"simpleType"
:
false
,
"sort"
:
98
},
{
"answers"
:
[
{
"contentText"
:
"20"
,
"sort"
:
0
}
],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/>元钱可以买1元笔记本21本"
,
"questionItems"
:
[
{
"contentText"
:
"20"
,
"sort"
:
0
},
{
"contentText"
:
"1"
,
"sort"
:
1
},
{
"contentText"
:
"21"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"contentText"
:
"7998<AnswerBlank index=
\"
0
\"
compare=
\"
1
\"
/>7988"
,
"questionType"
:
"选择题"
,
"answers"
:
[
{
"sort"
:
0
,
"contentText"
:
"C"
}
],
"simpleType"
:
true
,
"options"
:
[
{
"index"
:
"A"
,
"contentText"
:
"<b><</b>"
,
"answer"
:
false
},
{
"index"
:
"B"
,
"contentText"
:
"<b>=</b>"
,
"answer"
:
false
},
{
"index"
:
"C"
,
"contentText"
:
"<b>></b>"
,
"answer"
:
true
}
]
},
{
"questionItems"
:
[
{
"sort"
:
0
,
"contentText"
:
"57"
},
{
"sort"
:
1
,
"contentText"
:
"8"
}
],
"simpleType"
:
true
,
"questionType"
:
"竖式除法"
,
"answers"
:
[
{
"sort"
:
0
,
"contentText"
:
"A"
},
{
"sort"
:
1
,
"contentText"
:
"A"
},
{
"sort"
:
2
,
"contentText"
:
"A"
},
{
"sort"
:
3
,
"contentText"
:
"A"
}
]
},
{
"answers"
:
[
{
"contentText"
:
"28"
,
"sort"
:
0
}
],
"contentText"
:
"16<MathSymbol value=
\"
+
\"
/>12<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"16"
,
"sort"
:
0
},
{
"contentText"
:
"12"
,
"sort"
:
1
},
{
"contentText"
:
"28"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
},
{
"answers"
:
[
{
"contentText"
:
"50"
,
"sort"
:
0
}
],
"contentText"
:
"2<MathSymbol value=
\"
+
\"
/>48<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"2"
,
"sort"
:
0
},
{
"contentText"
:
"48"
,
"sort"
:
1
},
{
"contentText"
:
"50"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
},
{
"answers"
:
[
{
"contentText"
:
"32"
,
"sort"
:
0
}
],
"contentText"
:
"<AnswerBlank index=
\"
0
\"
/>元钱可以买24元笔记本56本"
,
"questionItems"
:
[
{
"contentText"
:
"32"
,
"sort"
:
0
},
{
"contentText"
:
"24"
,
"sort"
:
1
},
{
"contentText"
:
"56"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[
{
"contentText"
:
"53"
,
"sort"
:
0
}
],
"contentText"
:
"14<MathSymbol value=
\"
+
\"
/>39<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"14"
,
"sort"
:
0
},
{
"contentText"
:
"39"
,
"sort"
:
1
},
{
"contentText"
:
"53"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
},
{
"answers"
:
[
{
"contentText"
:
"62"
,
"sort"
:
0
}
],
"contentText"
:
"39<MathSymbol value=
\"
+
\"
/>23<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"39"
,
"sort"
:
0
},
{
"contentText"
:
"23"
,
"sort"
:
1
},
{
"contentText"
:
"62"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
},
{
"answers"
:
[
{
"contentText"
:
"83"
,
"sort"
:
0
}
],
"contentText"
:
"49<MathSymbol value=
\"
+
\"
/>34<MathSymbol value=
\"
=
\"
/><AnswerBlank index=
\"
0
\"
/>"
,
"questionItems"
:
[
{
"contentText"
:
"49"
,
"sort"
:
0
},
{
"contentText"
:
"34"
,
"sort"
:
1
},
{
"contentText"
:
"83"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
true
},
{
"answers"
:
[
{
"contentText"
:
"19"
,
"sort"
:
0
}
],
"contentText"
:
"9元钱可以买10元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"9"
,
"sort"
:
0
},
{
"contentText"
:
"10"
,
"sort"
:
1
},
{
"contentText"
:
"19"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[
{
"contentText"
:
"12"
,
"sort"
:
0
}
],
"contentText"
:
"11元钱可以买1元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"11"
,
"sort"
:
0
},
{
"contentText"
:
"1"
,
"sort"
:
1
},
{
"contentText"
:
"12"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
},
{
"answers"
:
[
{
"contentText"
:
"66"
,
"sort"
:
0
}
],
"contentText"
:
"30元钱可以买36元笔记本<AnswerBlank index=
\"
0
\"
/>本"
,
"questionItems"
:
[
{
"contentText"
:
"30"
,
"sort"
:
0
},
{
"contentText"
:
"36"
,
"sort"
:
1
},
{
"contentText"
:
"66"
,
"sort"
:
2
}
],
"questionType"
:
"随机填空"
,
"simpleType"
:
false
}
]
src/pages/game/play/model/utils.ts
View file @
f1c49d87
...
@@ -35,11 +35,9 @@ export function convertQuestion (question: QuestionType): QuestionType {
...
@@ -35,11 +35,9 @@ export function convertQuestion (question: QuestionType): QuestionType {
return
question
return
question
}
}
export
function
buildCompleteStageParam
(
questionList
:
QuestionType
[],
stageDetail
:
StageDetail
,
gameStar
tTime
:
number
):
CompleteStageParam
{
export
function
buildCompleteStageParam
(
questionList
:
QuestionType
[],
stageDetail
:
StageDetail
,
resul
tTime
:
number
):
CompleteStageParam
{
const
correctNum
=
questionList
.
map
(
c
=>
determinQuestion
(
c
)).
filter
(
Boolean
).
length
const
correctNum
=
questionList
.
map
(
c
=>
determinQuestion
(
c
)).
filter
(
Boolean
).
length
const
resultTime
=
Math
.
round
((
Date
.
now
()
-
gameStartTime
)
/
1000
)
const
{
sTime
,
aTime
,
bTime
}
=
stageDetail
const
{
sTime
,
aTime
,
bTime
}
=
stageDetail
let
level
:
StageLevel
|
null
=
null
let
level
:
StageLevel
|
null
=
null
...
@@ -67,7 +65,7 @@ export function buildCompleteStageParam (questionList: QuestionType[], stageDeta
...
@@ -67,7 +65,7 @@ export function buildCompleteStageParam (questionList: QuestionType[], stageDeta
stageId
:
stageDetail
.
id
,
stageId
:
stageDetail
.
id
,
questions
:
questionList
.
map
(
convert
),
questions
:
questionList
.
map
(
convert
),
num
,
num
,
resultTime
:
Math
.
round
((
Date
.
now
()
-
gameStartTime
)
/
1000
)
,
resultTime
,
}
}
}
}
...
...
src/pages/main/components/chapter.module.scss
View file @
f1c49d87
...
@@ -6,8 +6,10 @@
...
@@ -6,8 +6,10 @@
color
:
#FFFFFF
;
color
:
#FFFFFF
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
width
:
750px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
position
:
relative
;
z-index
:
1
;
box-shadow
:
0
1px
14px
rgba
(
0
,
81
,
231
,
0
.1
);
}
}
.chapterContent
{
.chapterContent
{
...
...
src/pages/main/components/scene/constants.ts
View file @
f1c49d87
...
@@ -47,6 +47,27 @@ let evenIndex = 0
...
@@ -47,6 +47,27 @@ let evenIndex = 0
let
oddIndex
=
0
let
oddIndex
=
0
let
specialIndex
=
0
let
specialIndex
=
0
export
function
stageToParts
(
stageList
:
Stage
[]):
Part
[]
{
evenIndex
=
0
oddIndex
=
0
specialIndex
=
0
const
ret
:
Part
[]
=
[]
stageList
.
forEach
(
item
=>
{
const
last
=
ret
.
find
(
c
=>
c
.
number
===
(
item
.
part
??
1
)
-
1
)
if
(
last
)
{
last
.
stages
.
push
(
item
)
}
else
{
ret
.
push
({
number
:
(
item
.
part
??
1
)
-
1
,
stages
:
[
item
]
})
}
})
return
ret
}
export
function
groupRoundToSmallPart
(
list
:
Stage
[]):
SmallPart
[]
{
export
function
groupRoundToSmallPart
(
list
:
Stage
[]):
SmallPart
[]
{
const
ret
:
SmallPart
[]
=
[]
const
ret
:
SmallPart
[]
=
[]
let
flag
:
'even'
|
'odd'
=
'even'
let
flag
:
'even'
|
'odd'
=
'even'
...
@@ -56,10 +77,10 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
...
@@ -56,10 +77,10 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
while
(
start
<
len
)
{
while
(
start
<
len
)
{
if
(
flag
===
'even'
)
{
if
(
flag
===
'even'
)
{
const
round
s
=
list
.
slice
(
start
,
start
+
2
)
const
stage
s
=
list
.
slice
(
start
,
start
+
2
)
let
partType
:
SmallPart
[
'type'
]
=
'even'
let
partType
:
SmallPart
[
'type'
]
=
'even'
let
bg
:
ImageSource
let
bg
:
ImageSource
if
(
round
s
.
length
<
2
)
{
if
(
stage
s
.
length
<
2
)
{
specialIndex
+=
1
specialIndex
+=
1
partType
=
'special'
partType
=
'special'
bg
=
getSmallPartBg
(
specialIndex
,
partType
)
bg
=
getSmallPartBg
(
specialIndex
,
partType
)
...
@@ -68,7 +89,7 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
...
@@ -68,7 +89,7 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
bg
=
getSmallPartBg
(
evenIndex
,
partType
)
bg
=
getSmallPartBg
(
evenIndex
,
partType
)
}
}
ret
.
push
({
ret
.
push
({
round
s
,
stage
s
,
bg
,
bg
,
offset
:
start
,
offset
:
start
,
type
:
partType
type
:
partType
...
@@ -78,7 +99,7 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
...
@@ -78,7 +99,7 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
}
else
if
(
flag
===
'odd'
)
{
}
else
if
(
flag
===
'odd'
)
{
oddIndex
+=
1
oddIndex
+=
1
ret
.
push
({
ret
.
push
({
round
s
:
list
.
slice
(
start
,
start
+
1
),
stage
s
:
list
.
slice
(
start
,
start
+
1
),
bg
:
getSmallPartBg
(
oddIndex
,
'odd'
),
bg
:
getSmallPartBg
(
oddIndex
,
'odd'
),
offset
:
start
,
offset
:
start
,
type
:
'odd'
type
:
'odd'
...
@@ -91,17 +112,8 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
...
@@ -91,17 +112,8 @@ export function groupRoundToSmallPart (list: Stage[]): SmallPart[] {
return
ret
return
ret
}
}
export
const
enum
RoundState
{
/** 未解锁 */
Locked
=
1
,
/** 已完成 */
Clear
=
2
,
/** 已解锁 */
UnLocked
=
3
}
export
type
SmallPart
=
{
export
type
SmallPart
=
{
round
s
:
Stage
[];
stage
s
:
Stage
[];
bg
:
ImageSource
;
bg
:
ImageSource
;
offset
:
number
;
offset
:
number
;
type
:
'odd'
|
'even'
|
'special'
;
type
:
'odd'
|
'even'
|
'special'
;
...
...
src/pages/main/components/scene/index.tsx
View file @
f1c49d87
...
@@ -2,34 +2,16 @@ import { View } from '@tarojs/components'
...
@@ -2,34 +2,16 @@ import { View } from '@tarojs/components'
import
assets
from
'@/assets/oss/assets-main'
import
assets
from
'@/assets/oss/assets-main'
import
{
useMemo
}
from
'react'
import
{
useMemo
}
from
'react'
import
LazeImage
from
'../lazy-image'
import
LazeImage
from
'../lazy-image'
import
{
Part
,
Stage
}
from
'./constants'
import
{
stageToParts
,
type
Stage
}
from
'./constants'
import
ScenePart
from
'./part'
import
ScenePart
from
'./part'
type
SceneProps
=
{
type
SceneProps
=
{
stageList
:
Stage
[];
stageList
:
Stage
[];
}
}
function
toPart
(
stageList
:
Stage
[]):
Part
[]
{
const
ret
:
Part
[]
=
[]
stageList
.
forEach
(
item
=>
{
const
last
=
ret
.
find
(
c
=>
c
.
number
===
(
item
.
part
||
0
))
if
(
last
)
{
last
.
stages
.
push
(
item
)
}
else
{
ret
.
push
({
number
:
item
.
part
??
0
,
stages
:
[
item
]
})
}
})
return
ret
}
const
Scene
=
(
props
:
SceneProps
)
=>
{
const
Scene
=
(
props
:
SceneProps
)
=>
{
const
partList
=
useMemo
(()
=>
{
const
partList
=
useMemo
(()
=>
{
return
toPart
(
props
.
stageList
)
return
stageToParts
(
props
.
stageList
)
},
[
props
.
stageList
])
},
[
props
.
stageList
])
return
(
return
(
...
...
src/pages/main/components/scene/small-part.tsx
View file @
f1c49d87
...
@@ -24,7 +24,7 @@ const SceneSmallPart = (props: SceneSmallPartProps) => {
...
@@ -24,7 +24,7 @@ const SceneSmallPart = (props: SceneSmallPartProps) => {
const
{
part
}
=
props
const
{
part
}
=
props
return
(
return
(
<
LazeImage
source=
{
part
.
bg
}
>
<
LazeImage
source=
{
part
.
bg
}
>
{
part
.
round
s
.
map
((
item
,
index
)
=>
{
{
part
.
stage
s
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
RoundComp
stage=
{
item
}
key=
{
item
.
id
}
className=
{
getClassName
(
index
,
part
.
type
)
}
/>
<
RoundComp
stage=
{
item
}
key=
{
item
.
id
}
className=
{
getClassName
(
index
,
part
.
type
)
}
/>
)
)
...
...
src/pages/main/components/short-cut.tsx
View file @
f1c49d87
...
@@ -3,7 +3,8 @@ import assets from '@/assets/oss/assets-main'
...
@@ -3,7 +3,8 @@ import assets from '@/assets/oss/assets-main'
import
{
useEffect
,
useState
,
useRef
}
from
'react'
import
{
useEffect
,
useState
,
useRef
}
from
'react'
import
{
usePageScroll
,
createIntersectionObserver
}
from
'@tarojs/taro'
import
{
usePageScroll
,
createIntersectionObserver
}
from
'@tarojs/taro'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
CurrentRoundId
}
from
'./scene/constants'
import
{
useStoreState
}
from
'@/store/hooks'
import
{
CurrentRoundId
,
StageStatus
}
from
'./scene/constants'
import
styles
from
'./short-cut.module.scss'
import
styles
from
'./short-cut.module.scss'
...
@@ -16,12 +17,16 @@ const ShortCut = (props: ShortCutProps) => {
...
@@ -16,12 +17,16 @@ const ShortCut = (props: ShortCutProps) => {
const
[
isDown
,
setIsDown
]
=
useState
(
false
)
const
[
isDown
,
setIsDown
]
=
useState
(
false
)
const
scrollRef
=
useRef
(
0
)
const
scrollRef
=
useRef
(
0
)
const
lastEffectedScroll
=
useRef
(
0
)
const
lastEffectedScroll
=
useRef
(
0
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
usePageScroll
((
payload
)
=>
{
usePageScroll
((
payload
)
=>
{
scrollRef
.
current
=
payload
.
scrollTop
scrollRef
.
current
=
payload
.
scrollTop
})
})
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
stageList
.
some
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
))
{
return
}
lastEffectedScroll
.
current
=
scrollRef
.
current
lastEffectedScroll
.
current
=
scrollRef
.
current
// @ts-ignore
// @ts-ignore
let
observer
=
createIntersectionObserver
()
let
observer
=
createIntersectionObserver
()
...
@@ -42,7 +47,7 @@ const ShortCut = (props: ShortCutProps) => {
...
@@ -42,7 +47,7 @@ const ShortCut = (props: ShortCutProps) => {
observer
=
null
!
observer
=
null
!
}
}
}
}
},
[])
},
[
stageList
])
return
(
return
(
<
View
className=
{
styles
.
shortcut
}
>
<
View
className=
{
styles
.
shortcut
}
>
...
...
src/pages/main/main.tsx
View file @
f1c49d87
...
@@ -4,7 +4,7 @@ import { useState, useMemo, useEffect, useCallback } from 'react'
...
@@ -4,7 +4,7 @@ import { useState, useMemo, useEffect, useCallback } from 'react'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
type
{
TabbarRef
}
from
'../../custom-tab-bar/index'
import
type
{
TabbarRef
}
from
'../../custom-tab-bar/index'
import
{
CurrentRoundId
,
SceneContext
}
from
'./components/scene/constants'
import
{
CurrentRoundId
,
SceneContext
,
StageStatus
}
from
'./components/scene/constants'
import
MainHeader
from
'./components/header'
import
MainHeader
from
'./components/header'
import
MainChapter
from
'./components/chapter'
import
MainChapter
from
'./components/chapter'
import
MainScene
from
'./components/scene'
import
MainScene
from
'./components/scene'
...
@@ -18,14 +18,8 @@ const MainPage = () => {
...
@@ -18,14 +18,8 @@ const MainPage = () => {
const
fetchStage
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
fetchStage
)
const
fetchStage
=
useStoreActions
(
actions
=>
actions
.
mainModel
.
fetchStage
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
useDidShow
(()
=>
{
fetchAccount
()
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
tabbar
?.
setSelected
(
0
)
})
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
[
nav
]
=
useState
(
getMenuButtonBoundingClientRect
())
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
scrollToCurrent
=
useCallback
((
callback
?:
()
=>
void
)
=>
{
const
height
=
getSystemInfoSync
().
windowHeight
const
height
=
getSystemInfoSync
().
windowHeight
pageScrollTo
({
pageScrollTo
({
...
@@ -35,15 +29,22 @@ const MainPage = () => {
...
@@ -35,15 +29,22 @@ const MainPage = () => {
})
})
},
[])
},
[])
useEffect
(()
=>
{
useDidShow
(()
=>
{
fetchStage
().
then
(()
=>
{
fetchAccount
()
const
tabbar
=
getTabBar
<
TabbarRef
>
(
page
)
tabbar
?.
setSelected
(
0
)
fetchStage
().
then
((
list
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
scrollToCurrent
(()
=>
{
if
(
!
list
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
))
{
setIsReady
(
true
)
setIsReady
(
true
)
})
}
else
{
scrollToCurrent
(()
=>
{
setIsReady
(
true
)
})
}
},
1000
)
},
1000
)
})
})
}
,
[
scrollToCurrent
,
fetchStage
]
)
})
return
(
return
(
<>
<>
...
...
src/pages/main/model.ts
View file @
f1c49d87
...
@@ -7,7 +7,7 @@ import { type Stage, getStageList } from '@/api'
...
@@ -7,7 +7,7 @@ import { type Stage, getStageList } from '@/api'
export
interface
MainModel
{
export
interface
MainModel
{
stageList
:
Stage
[];
stageList
:
Stage
[];
updateStageList
:
Action
<
MainModel
,
Stage
[]
>
;
updateStageList
:
Action
<
MainModel
,
Stage
[]
>
;
fetchStage
:
Thunk
<
MainModel
,
void
,
void
,
AppStoreModel
>
;
fetchStage
:
Thunk
<
MainModel
,
void
,
void
,
AppStoreModel
,
Promise
<
Stage
[]
>
>
;
}
}
const
mainModel
:
MainModel
=
{
const
mainModel
:
MainModel
=
{
...
@@ -16,12 +16,15 @@ const mainModel: MainModel = {
...
@@ -16,12 +16,15 @@ const mainModel: MainModel = {
state
.
stageList
=
stageList
state
.
stageList
=
stageList
}),
}),
fetchStage
:
thunk
(
async
(
actions
,
_
)
=>
{
fetchStage
:
thunk
(
async
(
actions
,
_
)
=>
{
let
ret
:
Stage
[]
=
[]
try
{
try
{
const
{
data
:
stageList
}
=
await
getStageList
()
const
{
data
:
stageList
}
=
await
getStageList
()
actions
.
updateStageList
(
stageList
)
ret
=
stageList
}
catch
(
err
)
{
}
catch
(
err
)
{
actions
.
updateStageList
([])
ret
=
[]
}
}
actions
.
updateStageList
(
ret
)
return
ret
}),
}),
}
}
...
...
src/pages/prepare/index.tsx
View file @
f1c49d87
...
@@ -41,6 +41,8 @@ const Prepare = () => {
...
@@ -41,6 +41,8 @@ const Prepare = () => {
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
getStageDetail
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
getStageDetail
)
const
getStageDetail
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
getStageDetail
)
const
getQuestionList
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
getQuestionList
)
const
cardNum
=
useStoreState
(
state
=>
state
.
userModel
.
cardNum
)
const
{
run
:
exchange
,
loading
}
=
useRequest
(
pointToCard
,
{
immediate
:
false
})
const
{
run
:
exchange
,
loading
}
=
useRequest
(
pointToCard
,
{
immediate
:
false
})
...
...
src/store/modules/user.ts
View file @
f1c49d87
...
@@ -12,12 +12,16 @@ export interface UserModel {
...
@@ -12,12 +12,16 @@ export interface UserModel {
point
:
number
;
point
:
number
;
updateState
:
Action
<
UserModel
,
{
cardNum
:
number
;
point
:
number
}
>
;
updateState
:
Action
<
UserModel
,
{
cardNum
:
number
;
point
:
number
}
>
;
fetchAccount
:
Thunk
<
UserModel
,
void
,
void
,
AppStoreModel
>
;
fetchAccount
:
Thunk
<
UserModel
,
void
,
void
,
AppStoreModel
>
;
updateUserInfo
:
Action
<
UserModel
,
UserInfo
>
;
}
}
const
userModel
:
UserModel
=
{
const
userModel
:
UserModel
=
{
userInfo
:
getStorage
(
StorageKeys
.
userInfo
)
!
,
userInfo
:
getStorage
(
StorageKeys
.
userInfo
)
!
,
cardNum
:
0
,
cardNum
:
0
,
point
:
0
,
point
:
0
,
updateUserInfo
:
action
((
state
,
user
)
=>
{
state
.
userInfo
=
user
}),
updateState
:
action
((
state
,
{
cardNum
,
point
})
=>
{
updateState
:
action
((
state
,
{
cardNum
,
point
})
=>
{
state
.
cardNum
=
cardNum
state
.
cardNum
=
cardNum
state
.
point
=
point
state
.
point
=
point
...
...
src/types.ts
View file @
f1c49d87
import
type
Taro
from
'@tarojs/taro'
import
type
Taro
from
'@tarojs/taro'
export
type
UserInfo
=
{
export
type
UserInfo
=
{
openId
:
string
;
userId
?:
number
;
userId
?:
number
;
phone
?:
string
|
null
;
city
?:
string
;
nickname
?:
string
|
null
;
nickname
?:
string
|
null
;
avatarUrl
?:
string
|
null
;
phone
?:
string
|
null
;
expire
?:
number
;
}
}
export
type
RequestResultPagingLike
<
T
>
=
RequestResult
<
PagingLike
<
T
>>
export
type
RequestResultPagingLike
<
T
>
=
RequestResult
<
PagingLike
<
T
>>
...
...
src/utils/silent-login.ts
View file @
f1c49d87
import
{
silentLoginApi
}
from
'@/api'
import
{
silentLoginApi
}
from
'@/api'
// import store from '@/store';
import
store
from
'@/store'
import
Taro
from
'@tarojs/taro'
import
Taro
from
'@tarojs/taro'
import
{
setProfile
}
from
'./skynet'
import
{
setProfile
}
from
'./skynet'
import
{
Deferred
}
from
'./deferred'
import
{
Deferred
}
from
'./deferred'
...
@@ -27,11 +27,8 @@ async function silentLogin () {
...
@@ -27,11 +27,8 @@ async function silentLogin () {
const { data } = await silentLoginApi(code)
const { data } = await silentLoginApi(code)
updateStorage(StorageKeys.openid, data.openId)
updateStorage(StorageKeys.openid, data.openId)
updateStorage(StorageKeys.unionid, data.unionId)
updateStorage(StorageKeys.userInfo, data)
updateStorage(StorageKeys.token, data.token)
store.getActions().userModel.updateUserInfo(data)
updateStorage(StorageKeys.userInfo, {
userId: data.userId,
})
setProfile(data.openId, `
$
{
data
.
userId
}
`)
setProfile(data.openId, `
$
{
data
.
userId
}
`)
} catch (silentLoginError) {
} catch (silentLoginError) {
...
...
src/utils/storage.ts
View file @
f1c49d87
...
@@ -6,19 +6,13 @@ const storagePrefix = `${process.env.TARO_STORAGE_KEY}`
...
@@ -6,19 +6,13 @@ const storagePrefix = `${process.env.TARO_STORAGE_KEY}`
export
enum
StorageKeys
{
export
enum
StorageKeys
{
/** 用户信息 */
/** 用户信息 */
userInfo
=
1
,
userInfo
=
1
,
/** token */
token
,
/** openid */
/** openid */
openid
,
openid
,
/** unionid */
unionid
,
}
}
type
Storage
=
{
type
Storage
=
{
[
StorageKeys
.
userInfo
]:
UserInfo
|
null
;
[
StorageKeys
.
userInfo
]:
UserInfo
|
null
;
[
StorageKeys
.
token
]:
string
|
null
;
[
StorageKeys
.
openid
]:
string
|
null
|
undefined
[
StorageKeys
.
openid
]:
string
|
null
;
[
StorageKeys
.
unionid
]:
string
|
null
;
}
}
const
store
:
Storage
=
{}
as
Storage
const
store
:
Storage
=
{}
as
Storage
...
@@ -32,9 +26,7 @@ export function reloadStore () {
...
@@ -32,9 +26,7 @@ export function reloadStore () {
try
{
try
{
[
[
StorageKeys
.
openid
,
StorageKeys
.
openid
,
StorageKeys
.
userInfo
,
StorageKeys
.
userInfo
StorageKeys
.
token
,
StorageKeys
.
unionid
].
forEach
((
element
)
=>
{
].
forEach
((
element
)
=>
{
updateStorage
(
element
,
Taro
.
getStorageSync
(
`
${
storagePrefix
}${
element
}
`
)
??
null
)
updateStorage
(
element
,
Taro
.
getStorageSync
(
`
${
storagePrefix
}${
element
}
`
)
??
null
)
})
})
...
@@ -45,8 +37,6 @@ export function reloadStore () {
...
@@ -45,8 +37,6 @@ export function reloadStore () {
reloadStore
()
reloadStore
()
console
.
log
(
store
,
1111111
)
export
function
getStorage
<
T
extends
StorageKeys
>
(
key
:
T
):
Storage
[
T
]
|
null
{
export
function
getStorage
<
T
extends
StorageKeys
>
(
key
:
T
):
Storage
[
T
]
|
null
{
return
store
[
key
]
return
store
[
key
]
}
}
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