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
e4b3fed5
Commit
e4b3fed5
authored
Apr 21, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加引导
parent
da443de1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
24 deletions
+24
-24
complete-head.tsx
src/pages/game/complete/components/complete-head.tsx
+3
-3
main-component.tsx
src/pages/main/components/main-component.tsx
+3
-3
index.tsx
src/pages/main/components/tutorial/index.tsx
+4
-4
guide.ts
src/store/modules/guide.ts
+8
-8
storage.ts
src/utils/storage.ts
+6
-6
No files found.
src/pages/game/complete/components/complete-head.tsx
View file @
e4b3fed5
...
@@ -108,7 +108,7 @@ const GameCompleteHead = () => {
...
@@ -108,7 +108,7 @@ const GameCompleteHead = () => {
const
time
=
useFormatTick
((
gameResult
?.
resultTime
??
0
)
*
1000
)
const
time
=
useFormatTick
((
gameResult
?.
resultTime
??
0
)
*
1000
)
const
au
=
useMemo
(()
=>
getAudioSrc
(
gameResult
?.
level
),
[
gameResult
?.
level
])
const
au
=
useMemo
(()
=>
getAudioSrc
(
gameResult
?.
level
),
[
gameResult
?.
level
])
const
errQuestionGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
e
rrQuestionGuideComplete
)
const
isErrQuestionGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isE
rrQuestionGuideComplete
)
const
completeErrQuestionGuide
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
completeErrQuestionGuide
)
const
completeErrQuestionGuide
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
completeErrQuestionGuide
)
const
[
isActive
,
setIsActive
]
=
useState
(
false
)
const
[
isActive
,
setIsActive
]
=
useState
(
false
)
...
@@ -179,7 +179,7 @@ const GameCompleteHead = () => {
...
@@ -179,7 +179,7 @@ const GameCompleteHead = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
gameResult
)
return
if
(
!
gameResult
)
return
let
timer
let
timer
if
(
!
e
rrQuestionGuideComplete
&&
gameResult
.
errNum
>
0
&&
!
gameResult
.
isTimeout
)
{
if
(
!
isE
rrQuestionGuideComplete
&&
gameResult
.
errNum
>
0
&&
!
gameResult
.
isTimeout
)
{
timer
=
setTimeout
(()
=>
{
timer
=
setTimeout
(()
=>
{
setIsActive
(
true
)
setIsActive
(
true
)
},
1000
)
},
1000
)
...
@@ -189,7 +189,7 @@ const GameCompleteHead = () => {
...
@@ -189,7 +189,7 @@ const GameCompleteHead = () => {
clearTimeout
(
timer
)
clearTimeout
(
timer
)
}
}
}
}
},
[
e
rrQuestionGuideComplete
,
gameResult
])
},
[
isE
rrQuestionGuideComplete
,
gameResult
])
if
(
!
gameResult
)
{
if
(
!
gameResult
)
{
return
null
return
null
...
...
src/pages/main/components/main-component.tsx
View file @
e4b3fed5
...
@@ -31,7 +31,7 @@ const MainPage = () => {
...
@@ -31,7 +31,7 @@ const MainPage = () => {
const
isReady
=
useStoreState
(
state
=>
state
.
mainModel
.
isReady
)
const
isReady
=
useStoreState
(
state
=>
state
.
mainModel
.
isReady
)
const
point
=
useStoreState
(
state
=>
state
.
userModel
.
point
)
const
point
=
useStoreState
(
state
=>
state
.
userModel
.
point
)
const
isGroupGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isGroupGuideComplete
)
const
isGroupGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isGroupGuideComplete
)
const
mainGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
m
ainGuideComplete
)
const
isMainGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isM
ainGuideComplete
)
const
isStoreGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isStoreGuideComplete
)
const
isStoreGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isStoreGuideComplete
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
fetchAccount
=
useStoreActions
(
actions
=>
actions
.
userModel
.
fetchAccount
)
const
updateGroupGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGroupGuideActive
)
const
updateGroupGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGroupGuideActive
)
...
@@ -51,7 +51,7 @@ const MainPage = () => {
...
@@ -51,7 +51,7 @@ const MainPage = () => {
},
[])
},
[])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isGroupGuideComplete
||
!
m
ainGuideComplete
||
!
isStoreGuideComplete
)
{
if
(
isGroupGuideComplete
||
!
isM
ainGuideComplete
||
!
isStoreGuideComplete
)
{
return
return
}
}
...
@@ -66,7 +66,7 @@ const MainPage = () => {
...
@@ -66,7 +66,7 @@ const MainPage = () => {
}
}
}
}
fn
()
fn
()
},
[
point
,
isGroupGuideComplete
,
stageList
,
updateGroupGuideActive
,
fetchTribeInfo
,
m
ainGuideComplete
,
isStoreGuideComplete
])
},
[
point
,
isGroupGuideComplete
,
stageList
,
updateGroupGuideActive
,
fetchTribeInfo
,
isM
ainGuideComplete
,
isStoreGuideComplete
])
const
isFocus
=
useFocus
()
const
isFocus
=
useFocus
()
...
...
src/pages/main/components/tutorial/index.tsx
View file @
e4b3fed5
...
@@ -15,7 +15,7 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
...
@@ -15,7 +15,7 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
const
joinDefered
=
useStoreState
(
state
=>
state
.
userModel
.
joinDefered
)
const
joinDefered
=
useStoreState
(
state
=>
state
.
userModel
.
joinDefered
)
const
updateUserInfo
=
useStoreActions
(
actions
=>
actions
.
userModel
.
updateUserInfo
)
const
updateUserInfo
=
useStoreActions
(
actions
=>
actions
.
userModel
.
updateUserInfo
)
const
updateGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGuideActive
)
const
updateGuideActive
=
useStoreActions
(
actions
=>
actions
.
guideModel
.
updateGuideActive
)
const
mainGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
m
ainGuideComplete
)
const
isMainGuideComplete
=
useStoreState
(
state
=>
state
.
guideModel
.
isM
ainGuideComplete
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
const
updating
=
useStoreState
(
state
=>
state
.
userModel
.
updating
)
const
updating
=
useStoreState
(
state
=>
state
.
userModel
.
updating
)
...
@@ -46,10 +46,10 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
...
@@ -46,10 +46,10 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
const
handleConfirm
=
useCallback
(()
=>
{
const
handleConfirm
=
useCallback
(()
=>
{
setStep
(
0
)
setStep
(
0
)
if
(
!
m
ainGuideComplete
)
{
if
(
!
isM
ainGuideComplete
)
{
updateGuideActive
(
true
)
updateGuideActive
(
true
)
}
}
},
[
updateGuideActive
,
m
ainGuideComplete
])
},
[
updateGuideActive
,
isM
ainGuideComplete
])
const
loadData
=
useCallback
(()
=>
{
const
loadData
=
useCallback
(()
=>
{
return
getAreaAndGrades
().
then
(
setData
)
return
getAreaAndGrades
().
then
(
setData
)
...
@@ -95,7 +95,7 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
...
@@ -95,7 +95,7 @@ const Tutorial = forwardRef<TutorialRef, {}>((_, ref) => {
setStep
(
2
)
setStep
(
2
)
}
else
{
}
else
{
setStep
(
0
)
setStep
(
0
)
if
(
!
m
ainGuideComplete
)
{
if
(
!
isM
ainGuideComplete
)
{
updateGuideActive
(
true
)
updateGuideActive
(
true
)
}
}
}
}
...
...
src/store/modules/guide.ts
View file @
e4b3fed5
...
@@ -13,9 +13,9 @@ export interface GuideModel {
...
@@ -13,9 +13,9 @@ export interface GuideModel {
updateGuideActive
:
Action
<
GuideModel
,
boolean
>
;
updateGuideActive
:
Action
<
GuideModel
,
boolean
>
;
updateGroupGuideActive
:
Action
<
GuideModel
,
boolean
>
;
updateGroupGuideActive
:
Action
<
GuideModel
,
boolean
>
;
/** 完成首页引导 */
/** 完成首页引导 */
m
ainGuideComplete
:
boolean
|
null
;
isM
ainGuideComplete
:
boolean
|
null
;
/** 完成查看错题引导 */
/** 完成查看错题引导 */
e
rrQuestionGuideComplete
:
boolean
|
null
;
isE
rrQuestionGuideComplete
:
boolean
|
null
;
/** 完成部落引导 */
/** 完成部落引导 */
isGroupGuideComplete
:
boolean
|
null
;
isGroupGuideComplete
:
boolean
|
null
;
/** 完成学分小店引导 */
/** 完成学分小店引导 */
...
@@ -38,8 +38,8 @@ const guideModel: GuideModel = {
...
@@ -38,8 +38,8 @@ const guideModel: GuideModel = {
groupGuideStep
:
0
,
groupGuideStep
:
0
,
storeGuideStep
:
0
,
storeGuideStep
:
0
,
isStoreGuideComplete
:
getStorage
(
StorageKeys
.
isStoreGuideComplete
),
isStoreGuideComplete
:
getStorage
(
StorageKeys
.
isStoreGuideComplete
),
mainGuideComplete
:
getStorage
(
StorageKeys
.
m
ainGuideComplete
),
isMainGuideComplete
:
getStorage
(
StorageKeys
.
isM
ainGuideComplete
),
errQuestionGuideComplete
:
getStorage
(
StorageKeys
.
e
rrQuestionGuideComplete
),
isErrQuestionGuideComplete
:
getStorage
(
StorageKeys
.
isE
rrQuestionGuideComplete
),
isGroupGuideComplete
:
getStorage
(
StorageKeys
.
isGroupGuideComplete
),
isGroupGuideComplete
:
getStorage
(
StorageKeys
.
isGroupGuideComplete
),
updateGuideActive
:
action
((
state
,
payload
)
=>
{
updateGuideActive
:
action
((
state
,
payload
)
=>
{
...
@@ -74,18 +74,18 @@ const guideModel: GuideModel = {
...
@@ -74,18 +74,18 @@ const guideModel: GuideModel = {
}),
}),
completeErrQuestionGuide
:
thunk
(
async
(
actions
)
=>
{
completeErrQuestionGuide
:
thunk
(
async
(
actions
)
=>
{
actions
.
updateState
({
e
rrQuestionGuideComplete
:
true
})
actions
.
updateState
({
isE
rrQuestionGuideComplete
:
true
})
updateStorage
(
StorageKeys
.
e
rrQuestionGuideComplete
,
true
)
updateStorage
(
StorageKeys
.
isE
rrQuestionGuideComplete
,
true
)
}),
}),
completeMainGuide
:
thunk
(
async
(
actions
)
=>
{
completeMainGuide
:
thunk
(
async
(
actions
)
=>
{
actions
.
updateState
({
actions
.
updateState
({
m
ainGuideComplete
:
true
,
isM
ainGuideComplete
:
true
,
mainGuideActive
:
false
,
mainGuideActive
:
false
,
})
})
updateStorage
(
StorageKeys
.
m
ainGuideComplete
,
true
)
updateStorage
(
StorageKeys
.
isM
ainGuideComplete
,
true
)
}),
}),
}
}
...
...
src/utils/storage.ts
View file @
e4b3fed5
...
@@ -10,9 +10,9 @@ export enum StorageKeys {
...
@@ -10,9 +10,9 @@ export enum StorageKeys {
openid
,
openid
,
/** 完成首页引导 */
/** 完成首页引导 */
m
ainGuideComplete
,
isM
ainGuideComplete
,
/** 完成页查看错题引导 */
/** 完成页查看错题引导 */
e
rrQuestionGuideComplete
,
isE
rrQuestionGuideComplete
,
/** 完成部落引导 */
/** 完成部落引导 */
isGroupGuideComplete
,
isGroupGuideComplete
,
...
@@ -24,8 +24,8 @@ export enum StorageKeys {
...
@@ -24,8 +24,8 @@ export enum StorageKeys {
type
Storage
=
{
type
Storage
=
{
[
StorageKeys
.
userInfo
]:
UserInfo
|
null
;
[
StorageKeys
.
userInfo
]:
UserInfo
|
null
;
[
StorageKeys
.
openid
]:
string
|
null
|
undefined
;
[
StorageKeys
.
openid
]:
string
|
null
|
undefined
;
[
StorageKeys
.
m
ainGuideComplete
]:
boolean
|
null
;
[
StorageKeys
.
isM
ainGuideComplete
]:
boolean
|
null
;
[
StorageKeys
.
e
rrQuestionGuideComplete
]:
boolean
|
null
;
[
StorageKeys
.
isE
rrQuestionGuideComplete
]:
boolean
|
null
;
[
StorageKeys
.
isGroupGuideComplete
]:
boolean
|
null
;
[
StorageKeys
.
isGroupGuideComplete
]:
boolean
|
null
;
[
StorageKeys
.
isStoreGuideComplete
]:
boolean
|
null
;
[
StorageKeys
.
isStoreGuideComplete
]:
boolean
|
null
;
}
}
...
@@ -42,8 +42,8 @@ export function reloadStore () {
...
@@ -42,8 +42,8 @@ export function reloadStore () {
[
[
StorageKeys
.
openid
,
StorageKeys
.
openid
,
StorageKeys
.
userInfo
,
StorageKeys
.
userInfo
,
StorageKeys
.
m
ainGuideComplete
,
StorageKeys
.
isM
ainGuideComplete
,
StorageKeys
.
e
rrQuestionGuideComplete
,
StorageKeys
.
isE
rrQuestionGuideComplete
,
StorageKeys
.
isGroupGuideComplete
,
StorageKeys
.
isGroupGuideComplete
,
StorageKeys
.
isStoreGuideComplete
StorageKeys
.
isStoreGuideComplete
].
forEach
((
element
)
=>
{
].
forEach
((
element
)
=>
{
...
...
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