Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM_4-1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
JM_4-1
Commits
b9bdd406
Commit
b9bdd406
authored
Oct 20, 2021
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 存储page改到store
parent
743f571c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
15 deletions
+64
-15
play.component.ts
src/app/play/play.component.ts
+64
-15
No files found.
src/app/play/play.component.ts
View file @
b9bdd406
...
...
@@ -156,6 +156,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
aspect
)
{
console
.
log
(
'
aspect :
'
,
aspect
);
this
.
initPageData
(
aspect
);
this
.
initStoreData
(
aspect
);
}
if
(
data
&&
typeof
data
==
'
object
'
)
{
...
...
@@ -228,6 +229,49 @@ export class PlayComponent implements OnInit, OnDestroy {
}
// 用于存储私有数据 当翻页时清空
storeData
;
initStoreData
(
aspect
)
{
const
storeDataStr
=
aspect
?.
user_aspect
;
if
(
!
storeDataStr
)
{
this
.
storeData
=
{};
}
else
{
this
.
storeData
=
JSON
.
parse
(
storeDataStr
);
}
console
.
log
(
'
this.storeData:
'
,
this
.
storeData
);
}
setStoreData
(
key
,
value
,
isSend
=
true
)
{
if
(
this
.
storeData
)
{
console
.
log
(
'
this.storeData:
'
,
this
.
storeData
);
this
.
storeData
[
key
]
=
value
;
if
(
isSend
)
{
this
.
sendStoreData
();
}
}
}
getStoreData
(
key
)
{
return
this
.
storeData
&&
this
.
storeData
[
key
];
}
sendStoreData
()
{
const
data
=
this
.
storeData
;
if
(
window
&&
window
[
'
courseware
'
])
{
let
storeAspect
=
window
[
'
courseware
'
].
storeAspect
;
if
(
storeAspect
)
{
storeAspect
(
data
);
}
}
}
initDefaultData
()
{
...
...
@@ -627,23 +671,28 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
progress
==
'
1
'
)
{
const
resultData
=
this
.
get
Pag
eData
(
'
resultData
'
)
const
resultData
=
this
.
get
Stor
eData
(
'
resultData
'
)
if
(
resultData
)
{
this
.
initResultView
(
resultData
);
return
;
}
this
.
gameStart
();
const
progressStore
=
this
.
getStoreData
(
'
progress
'
)
if
(
progressStore
==
'
2
'
||
progressStore
==
'
3
'
)
{
const
submitCount
=
this
.
getStoreData
(
'
submitCount
'
)
this
.
submitCount
=
submitCount
;
this
.
checkShowSubTemplateOne
();
return
;
}
if
(
progress
==
'
2
'
||
progress
==
'
3
'
)
{
const
submitCount
=
this
.
getPageData
(
'
submitCount
'
)
this
.
submitCount
=
submitCount
;
this
.
checkShowSubTemplateOne
();
this
.
gameStart
();
return
;
}
}
...
...
@@ -696,7 +745,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
else
{
const
resultData
=
this
.
getResultData
();
this
.
sendResult
(
resultData
);
this
.
set
Pag
eData
(
'
resultData
'
,
resultData
);
this
.
set
Stor
eData
(
'
resultData
'
,
resultData
);
}
...
...
@@ -1615,7 +1664,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.showSubTemplate(0);
console
.
log
(
'
in checkShowSubTemplateOne
'
)
const
progress
=
this
.
get
Pag
eData
(
'
progress
'
);
const
progress
=
this
.
get
Stor
eData
(
'
progress
'
);
console
.
log
(
'
progress:
'
,
progress
);
...
...
@@ -1719,8 +1768,8 @@ export class PlayComponent implements OnInit, OnDestroy {
delayCall
(
0.3
,
()
=>
{
this
.
initResultView
();
this
.
set
Pag
eData
(
'
progress
'
,
'
2
'
,
false
);
this
.
set
Pag
eData
(
'
submitCount
'
,
this
.
submitCount
);
this
.
set
Stor
eData
(
'
progress
'
,
'
2
'
,
false
);
this
.
set
Stor
eData
(
'
submitCount
'
,
this
.
submitCount
);
this
.
serverSendAnswer
(
'
4-1
'
,
this
.
resultAnswerArr
);
})
}
...
...
@@ -2133,11 +2182,11 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
serverSendAnswer
(
key
,
JSON
.
parse
(
msgData
.
data
));
const
progress
=
this
.
get
Pag
eData
(
'
progress
'
);
const
progress
=
this
.
get
Stor
eData
(
'
progress
'
);
if
(
progress
==
'
2
'
)
{
this
.
set
Pag
eData
(
'
progress
'
,
'
3
'
);
this
.
set
Stor
eData
(
'
progress
'
,
'
3
'
);
}
else
{
this
.
set
Pag
eData
(
'
progress
'
,
'
4
'
);
this
.
set
Stor
eData
(
'
progress
'
,
'
4
'
);
}
console
.
log
(
'
in temp_send_result __ msgData:
'
,
msgData
);
}
...
...
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