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
4fa13543
Commit
4fa13543
authored
Apr 05, 2023
by
m
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://118.24.71.244/hewenhao/GeekLearnMathWeapp
parents
0669d574
2d413a31
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
6 deletions
+44
-6
auth.ts
src/api/auth.ts
+8
-0
utils.ts
src/pages/game/play/model/utils.ts
+13
-1
main.tsx
src/pages/main/main.tsx
+7
-3
index.tsx
src/pages/market/index.tsx
+4
-1
user.ts
src/store/modules/user.ts
+12
-1
No files found.
src/api/auth.ts
View file @
4fa13543
...
@@ -36,3 +36,11 @@ export function getAccountInfo () {
...
@@ -36,3 +36,11 @@ export function getAccountInfo () {
}
}
}))
}))
}
}
export
function
getSetting
()
{
return
requestAfterSilentLogin
<
{
pointToCard
:
number
},
{}
>
(()
=>
({
method
:
'GET'
,
url
:
'/service-idea/inlet/config/getConfig'
,
data
:
{}
}))
}
src/pages/game/play/model/utils.ts
View file @
4fa13543
import
{
type
CompleteStageParam
,
type
StageDetail
,
StageLevel
,
type
CompleteQuestion
}
from
'@/api'
import
{
type
CompleteStageParam
,
type
StageDetail
,
StageLevel
,
type
CompleteQuestion
}
from
'@/api'
import
{
getLogManager
}
from
'@tarojs/taro'
import
{
getStorage
,
StorageKeys
}
from
'@/utils/storage'
import
{
type
QuestionType
,
isBlankQuestion
,
isVerticalDivisionQuestion
,
isSelectionQuestion
}
from
'../types'
import
{
type
QuestionType
,
isBlankQuestion
,
isVerticalDivisionQuestion
,
isSelectionQuestion
}
from
'../types'
const
logger
=
getLogManager
({
level
:
1
})
export
function
convertQuestion
(
question
:
QuestionType
):
QuestionType
{
export
function
convertQuestion
(
question
:
QuestionType
):
QuestionType
{
if
(
isVerticalDivisionQuestion
(
question
))
{
if
(
isVerticalDivisionQuestion
(
question
))
{
const
{
questionItems
}
=
question
const
{
questionItems
}
=
question
...
@@ -36,7 +40,13 @@ export function convertQuestion (question: QuestionType): QuestionType {
...
@@ -36,7 +40,13 @@ export function convertQuestion (question: QuestionType): QuestionType {
}
}
export
function
buildCompleteStageParam
(
questionList
:
QuestionType
[],
stageDetail
:
StageDetail
,
resultTime
:
number
):
CompleteStageParam
{
export
function
buildCompleteStageParam
(
questionList
:
QuestionType
[],
stageDetail
:
StageDetail
,
resultTime
:
number
):
CompleteStageParam
{
const
correctNum
=
questionList
.
map
(
c
=>
determinQuestion
(
c
)).
filter
(
Boolean
).
length
const
wrongList
=
questionList
.
map
(
c
=>
!
determinQuestion
(
c
)).
filter
(
Boolean
)
const
wrongLength
=
wrongList
.
length
if
(
wrongLength
>
0
)
{
logger
.
debug
(
getStorage
(
StorageKeys
.
userInfo
)?.
userId
,
'错误列表'
,
wrongList
)
console
.
log
(
'错误列表'
,
wrongList
)
}
const
{
sTime
,
aTime
,
bTime
}
=
stageDetail
const
{
sTime
,
aTime
,
bTime
}
=
stageDetail
...
@@ -45,6 +55,8 @@ export function buildCompleteStageParam (questionList: QuestionType[], stageDeta
...
@@ -45,6 +55,8 @@ export function buildCompleteStageParam (questionList: QuestionType[], stageDeta
const
num
=
questionList
.
length
const
num
=
questionList
.
length
let
levelTime
:
number
=
0
let
levelTime
:
number
=
0
const
correctNum
=
num
-
wrongLength
if
(
correctNum
===
num
)
{
if
(
correctNum
===
num
)
{
if
(
resultTime
<=
sTime
)
{
if
(
resultTime
<=
sTime
)
{
level
=
StageLevel
.
S
level
=
StageLevel
.
S
...
...
src/pages/main/main.tsx
View file @
4fa13543
import
{
View
}
from
'@tarojs/components'
import
{
View
}
from
'@tarojs/components'
import
{
useRouter
,
showToast
,
getMenuButtonBoundingClientRect
,
useDidShow
,
getCurrentInstance
,
getTabBar
,
pageScrollTo
,
getSystemInfoSync
,
showModal
}
from
'@tarojs/taro'
import
{
useRouter
,
showToast
,
getMenuButtonBoundingClientRect
,
useDidShow
,
getCurrentInstance
,
getTabBar
,
pageScrollTo
,
getSystemInfoSync
,
showModal
,
nextTick
}
from
'@tarojs/taro'
import
{
useState
,
useMemo
,
useCallback
}
from
'react'
import
{
useState
,
useMemo
,
useCallback
}
from
'react'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
getTribeInfo
,
joinTribe
}
from
'@/api/group'
import
{
getTribeInfo
,
joinTribe
}
from
'@/api/group'
...
@@ -41,7 +45,7 @@ const MainPage = () => {
...
@@ -41,7 +45,7 @@ const MainPage = () => {
tabbar
?.
setSelected
(
0
)
tabbar
?.
setSelected
(
0
)
fetchStage
().
then
((
list
)
=>
{
fetchStage
().
then
((
list
)
=>
{
setTimeout
(()
=>
{
nextTick
(()
=>
{
if
(
!
list
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
))
{
if
(
!
list
.
find
(
c
=>
c
.
status
===
StageStatus
.
CURRENT
))
{
setIsReady
(
true
)
setIsReady
(
true
)
}
else
{
}
else
{
...
@@ -49,7 +53,7 @@ const MainPage = () => {
...
@@ -49,7 +53,7 @@ const MainPage = () => {
setIsReady
(
true
)
setIsReady
(
true
)
})
})
}
}
}
,
1000
)
})
})
})
fetchTribeInfo
().
then
((
res
)
=>
{
fetchTribeInfo
().
then
((
res
)
=>
{
...
...
src/pages/market/index.tsx
View file @
4fa13543
...
@@ -45,9 +45,12 @@ const StudyMarket = () => {
...
@@ -45,9 +45,12 @@ const StudyMarket = () => {
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
isVisible
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
const
[
currentGoods
,
setCurrentGoods
]
=
useState
<
ExchangeGoods
|
null
>
(
null
)
const
[
currentGoods
,
setCurrentGoods
]
=
useState
<
ExchangeGoods
|
null
>
(
null
)
const
point
=
useStoreState
(
state
=>
state
.
userModel
.
point
)
const
point
=
useStoreState
(
state
=>
state
.
userModel
.
point
)
const
setting
=
useStoreState
(
state
=>
state
.
userModel
.
setting
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
getSetting
=
useStoreActions
(
actions
=>
actions
.
userModel
.
getSetting
)
useDidShow
(()
=>
{
useDidShow
(()
=>
{
getSetting
()
fetchAccount
()
fetchAccount
()
})
})
...
@@ -70,7 +73,7 @@ const StudyMarket = () => {
...
@@ -70,7 +73,7 @@ const StudyMarket = () => {
title=
{
item
.
subTitle
}
title=
{
item
.
subTitle
}
cover=
{
item
.
img
}
cover=
{
item
.
img
}
stock=
{
item
.
stock
}
stock=
{
item
.
stock
}
price=
{
item
.
price
}
price=
{
setting
.
pointToCard
}
disabled=
{
item
.
stock
!==
null
&&
item
.
stock
<
1
}
disabled=
{
item
.
stock
!==
null
&&
item
.
stock
<
1
}
subtitle=
{
item
.
description
}
subtitle=
{
item
.
description
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
...
...
src/store/modules/user.ts
View file @
4fa13543
import
{
import
{
action
,
Action
,
Thunk
,
thunk
,
State
action
,
Action
,
Thunk
,
thunk
,
State
}
from
'easy-peasy'
}
from
'easy-peasy'
import
{
getAccountInfo
}
from
'@/api'
import
{
getAccountInfo
,
getSetting
}
from
'@/api'
import
type
{
UserInfo
}
from
'@/types'
import
type
{
UserInfo
}
from
'@/types'
import
{
pointToCard
}
from
'@/api/account'
import
{
pointToCard
}
from
'@/api/account'
import
{
showModal
,
showToast
,
showLoading
,
hideLoading
}
from
'@tarojs/taro'
import
{
showModal
,
showToast
,
showLoading
,
hideLoading
}
from
'@tarojs/taro'
...
@@ -15,6 +15,8 @@ export interface UserModel {
...
@@ -15,6 +15,8 @@ export interface UserModel {
updateState
:
Action
<
UserModel
,
Partial
<
State
<
UserModel
>>>
;
updateState
:
Action
<
UserModel
,
Partial
<
State
<
UserModel
>>>
;
fetchAccount
:
Thunk
<
UserModel
,
void
,
void
,
AppStoreModel
>
;
fetchAccount
:
Thunk
<
UserModel
,
void
,
void
,
AppStoreModel
>
;
updateUserInfo
:
Action
<
UserModel
,
UserInfo
>
;
updateUserInfo
:
Action
<
UserModel
,
UserInfo
>
;
setting
:
{
pointToCard
:
number
};
getSetting
:
Thunk
<
UserModel
,
void
,
void
,
AppStoreModel
>
;
exchangeItem
:
Thunk
<
UserModel
,
{
name
:
string
;
num
:
number
;
},
void
,
AppStoreModel
>
;
exchangeItem
:
Thunk
<
UserModel
,
{
name
:
string
;
num
:
number
;
},
void
,
AppStoreModel
>
;
}
}
...
@@ -23,6 +25,15 @@ const userModel: UserModel = {
...
@@ -23,6 +25,15 @@ const userModel: UserModel = {
userInfo
:
getStorage
(
StorageKeys
.
userInfo
)
!
,
userInfo
:
getStorage
(
StorageKeys
.
userInfo
)
!
,
cardNum
:
0
,
cardNum
:
0
,
point
:
0
,
point
:
0
,
setting
:
{
pointToCard
:
Infinity
},
getSetting
:
thunk
(
async
(
actions
)
=>
{
try
{
const
{
data
}
=
await
getSetting
()
actions
.
updateState
({
setting
:
data
})
}
catch
(
err
)
{
actions
.
updateState
({
setting
:
{
pointToCard
:
Infinity
}
})
}
}),
exchangeItem
:
thunk
(
async
(
actions
,
payload
)
=>
{
exchangeItem
:
thunk
(
async
(
actions
,
payload
)
=>
{
try
{
try
{
showLoading
({
mask
:
true
,
title
:
'兑换中...'
})
showLoading
({
mask
:
true
,
title
:
'兑换中...'
})
...
...
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