Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hw_online_005
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
hw_online_005
Commits
1cc6ce4c
Commit
1cc6ce4c
authored
Jun 01, 2020
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 学情展示 提供数据
parent
46168354
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
397 additions
and
39 deletions
+397
-39
RankStatistics.test.ts
src/app/play/RankStatistics.test.ts
+47
-0
RankStatistics.ts
src/app/play/RankStatistics.ts
+56
-0
play.component.ts
src/app/play/play.component.ts
+294
-39
1.jpeg
src/assets/play/head_old/1.jpeg
+0
-0
1.png
src/assets/play/head_old/1.png
+0
-0
2.png
src/assets/play/head_old/2.png
+0
-0
3.png
src/assets/play/head_old/3.png
+0
-0
4.png
src/assets/play/head_old/4.png
+0
-0
5.png
src/assets/play/head_old/5.png
+0
-0
6.png
src/assets/play/head_old/6.png
+0
-0
7.png
src/assets/play/head_old/7.png
+0
-0
8.png
src/assets/play/head_old/8.png
+0
-0
9.png
src/assets/play/head_old/9.png
+0
-0
No files found.
src/app/play/RankStatistics.test.ts
0 → 100644
View file @
1cc6ce4c
// import {RankStatisticsManager} from './RankStatistics';
//
// describe('RankStatistics', () => {
// const sm = new RankStatisticsManager();
//
// test('列表中已经含有某用户数据,则更新数据。', () => {
// let testList = [{ uuid: '1', number: 1 }];
// let data = { uuid: '1', number: 2 };
//
// sm.rankDataList = testList;
// sm.addRankDataToList(data);
//
// expect(testList.length).toEqual(1);
// expect(testList[0].uuid).toEqual('1');
// expect(testList[0].number).toEqual(2);
// });
//
// test('列表中没有某用户的数据,则插入新数据。', () => {
// let testList = [{ uuid: '1', number: 1 }];
// let data = { uuid: '2', number: 2 };
//
// sm.rankDataList = testList;
// sm.addRankDataToList(data);
//
// expect(testList.length).toEqual(2);
// });
//
// test('数组中的数据先按照rightNum降序排列,再按照duration升序排列。', () => {
// let testList = [
// { uuid: '1', rightNum: 1, duration: 7 },
// { uuid: '2', rightNum: 1, duration: 5 },
// { uuid: '3', rightNum: 1, duration: 9 },
// { uuid: '4', rightNum: 3, duration: 9 }];
// let data =
// { uuid: '5', rightNum: 2, duration: 7 };
//
// sm.rankDataList = testList;
// sm.addRankDataToList(data);
//
// expect(testList[0].uuid).toEqual('4');
// expect(testList[1].uuid).toEqual('5');
// expect(testList[2].uuid).toEqual('2');
// expect(testList[3].uuid).toEqual('1');
// expect(testList[4].uuid).toEqual('3');
// });
//
// });
src/app/play/RankStatistics.ts
0 → 100644
View file @
1cc6ce4c
export
class
RankStatisticsManager
{
MESSAGE_RANK
=
'
hw-gameRank
'
;
_rankDataList
=
[];
// set rankDataList(arr) {
// this._rankDataList = arr;
// }
//
get
rankDataList
()
{
return
this
.
_rankDataList
;
}
addRankDataToList
(
data
)
{
for
(
let
i
=
0
;
i
<
this
.
_rankDataList
.
length
;
++
i
)
{
if
(
this
.
_rankDataList
[
i
].
uuid
==
data
.
uuid
)
{
this
.
_rankDataList
.
splice
(
i
,
1
);
break
;
}
}
this
.
_rankDataList
.
push
(
data
);
this
.
_rankDataList
.
sort
((
a
,
b
)
=>
{
if
(
a
.
rightNum
===
b
.
rightNum
)
{
return
a
.
duration
-
b
.
duration
;
}
else
{
return
b
.
rightNum
-
a
.
rightNum
;
}
});
}
getOneRankData
(
uuid
)
{
console
.
log
(
'
getOneRankData uuid:
'
,
uuid
);
console
.
log
(
'
this._rankDataList:
'
,
this
.
_rankDataList
);
for
(
let
i
=
0
;
i
<
this
.
_rankDataList
.
length
;
i
++
)
{
console
.
log
(
'
---- uuid:
'
,
this
.
_rankDataList
[
i
].
uuid
);
if
(
this
.
_rankDataList
[
i
].
uuid
==
uuid
)
{
return
this
.
_rankDataList
[
i
];
}
}
}
sendRankDataEvent
(
otherData
=
null
)
{
const
data
=
{
rankData
:
this
.
_rankDataList
};
if
(
otherData
)
{
for
(
const
key
in
otherData
)
{
data
[
key
]
=
otherData
[
key
];
}
}
(
<
any
>
window
).
courseware
.
sendEvent
(
this
.
MESSAGE_RANK
,
data
);
}
}
src/app/play/play.component.ts
View file @
1cc6ce4c
This diff is collapsed.
Click to expand it.
src/assets/play/head_old/1.jpeg
0 → 100644
View file @
1cc6ce4c
49.4 KB
src/assets/play/head_old/1.png
0 → 100644
View file @
1cc6ce4c
10.8 KB
src/assets/play/head_old/2.png
0 → 100644
View file @
1cc6ce4c
9.54 KB
src/assets/play/head_old/3.png
0 → 100644
View file @
1cc6ce4c
9.52 KB
src/assets/play/head_old/4.png
0 → 100644
View file @
1cc6ce4c
16 KB
src/assets/play/head_old/5.png
0 → 100644
View file @
1cc6ce4c
10.7 KB
src/assets/play/head_old/6.png
0 → 100644
View file @
1cc6ce4c
11.3 KB
src/assets/play/head_old/7.png
0 → 100644
View file @
1cc6ce4c
9.26 KB
src/assets/play/head_old/8.png
0 → 100644
View file @
1cc6ce4c
12.4 KB
src/assets/play/head_old/9.png
0 → 100644
View file @
1cc6ce4c
12.8 KB
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