Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
肖文锋
/
pdfPreview
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
231d2d0d
authored
Jun 17, 2020
by
xiaowenfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了学习进度、学习时长追踪API
parent
e244d158
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
11 deletions
src/App.vue
src/App.vue
View file @
231d2d0d
...
...
@@ -169,6 +169,7 @@ export default {
return
{
pageIndex
:
1
,
// pdf页码
pageLength
:
null
,
// 总页码
startTime
:
null
,
scale
:
2
,
// 缩放比例
borderSize
:
9
,
// viewerContainer容器border大小
pageSize
:
1
,
...
...
@@ -198,9 +199,10 @@ export default {
this
.
playInitializationData
=
window
.
parent
.
playInitializationData
;
this
.
LMSPlayInitialize
();
this
.
LMSTrackingInitialize
();
this
.
LMSCatalogUrl
();
//
this.LMSCatalogUrl();
this
.
LMSGetLocationPoint
();
this
.
LMSGetLessonStatus
();
this
.
startTime
=
new
Date
().
getTime
();
pdfJs
.
GlobalWorkerOptions
.
workerSrc
=
require
(
"pdfjs-dist/build/pdf.worker"
);
this
.
preview
();
},
...
...
@@ -360,6 +362,9 @@ export default {
}
this
.
pageIndex
=
this
.
pageIndex
-
1
;
this
.
LMSSetLocationPoint
();
this
.
LMSSetLessProgress
();
this
.
LMSSetSessionTime
();
this
.
LMSCommit
();
this
.
preview
();
},
next
()
{
...
...
@@ -371,10 +376,12 @@ export default {
}
this
.
pageIndex
=
this
.
pageIndex
+
1
;
this
.
LMSSetLocationPoint
();
this
.
LMSSetLessProgress
();
this
.
LMSSetSessionTime
();
if
(
this
.
pageIndex
===
this
.
pageLength
)
{
this
.
LMSSetLessonStatus
();
this
.
LMSCommit
();
this
.
LMSSetLessonStatus
(
"completed"
);
}
this
.
LMSCommit
();
this
.
preview
();
},
changeSelected
(
index
)
{
...
...
@@ -549,6 +556,30 @@ export default {
this
.
playInitializationData
.
value
=
this
.
pageIndex
;
this
.
LMSSetValueUrl
();
},
LMSSetLessProgress
()
{
this
.
playInitializationData
.
element
=
"cmi.core.lesson_progress"
;
this
.
playInitializationData
.
value
=
parseInt
(
(
this
.
pageIndex
/
this
.
pageLength
)
*
100
);
this
.
LMSSetValueUrl
();
},
LMSSetSessionTime
()
{
this
.
playInitializationData
.
element
=
"cmi.core.session_time"
;
let
currentTime
=
new
Date
().
getTime
();
this
.
playInitializationData
.
value
=
this
.
timeToFormat
(
(
currentTime
-
this
.
startTime
)
/
1000
);
this
.
LMSSetValueUrl
();
},
LMSSetLessonStatus
(
status
)
{
this
.
playInitializationData
.
element
=
"cmi.core.lesson_status"
;
this
.
playInitializationData
.
value
=
status
;
this
.
LMSSetValueUrl
();
},
LMSGetLessonStatus
()
{
this
.
playInitializationData
.
element
=
"cmi.core.lesson_status"
;
this
.
LMSGetValueUrl
();
},
LMSCommit
(
fn
)
{
$
.
ajax
({
type
:
"post"
,
...
...
@@ -570,14 +601,25 @@ export default {
}
});
},
LMSSetLessonStatus
()
{
this
.
playInitializationData
.
element
=
"cmi.core.lesson_status"
;
this
.
playInitializationData
.
value
=
"completed"
;
this
.
LMSSetValueUrl
();
},
LMSGetLessonStatus
()
{
this
.
playInitializationData
.
element
=
"cmi.core.lesson_status"
;
this
.
LMSGetValueUrl
();
timeToFormat
(
times
)
{
var
result
=
"00:00:00"
;
var
hour
,
minute
,
second
;
if
(
times
>
0
)
{
hour
=
Math
.
floor
(
times
/
3600
);
if
(
hour
<
10
)
{
hour
=
"0"
+
hour
;
}
minute
=
Math
.
floor
((
times
-
3600
*
hour
)
/
60
);
if
(
minute
<
10
)
{
minute
=
"0"
+
minute
;
}
second
=
Math
.
floor
((
times
-
3600
*
hour
-
60
*
minute
)
%
60
);
if
(
second
<
10
)
{
second
=
"0"
+
second
;
}
result
=
hour
+
":"
+
minute
+
":"
+
second
;
}
return
result
;
}
}
};
...
...
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