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
aad79c52
authored
Aug 20, 2020
by
xiaowenfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、添加了一个人脸登记模块;
2、添加了一个人脸识别模块
parent
3b5d958f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
10 deletions
src/components/TinyFaceDetector.vue
src/views/FaceDetect.vue
src/views/FaceRegister.vue
src/views/PreviewPDF.vue
src/components/TinyFaceDetector.vue
View file @
aad79c52
...
...
@@ -83,7 +83,9 @@ export default {
.
catch
(
this
.
error
);
},
error
(
err
)
{
alert
(
`访问用户媒体设备失败!\n
${
err
.
name
}
,
${
err
.
message
}
!`
);
alert
(
`打开摄像头失败!\n如设备不支持,可使用手机APP\n
${
err
.
name
}
,
${
err
.
message
}
!`
);
},
success
(
stream
)
{
// Older browsers may not have srcObject
...
...
src/views/FaceDetect.vue
View file @
aad79c52
...
...
@@ -199,7 +199,7 @@ export default {
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
.detector-box
{
width
:
4
00px
;
width
:
9
00px
;
display
:
inline-block
;
}
h4
{
...
...
src/views/FaceRegister.vue
View file @
aad79c52
...
...
@@ -198,7 +198,7 @@ export default {
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
.detector-box
{
width
:
4
00px
;
width
:
9
00px
;
display
:
inline-block
;
}
h4
{
...
...
src/views/PreviewPDF.vue
View file @
aad79c52
...
...
@@ -170,6 +170,7 @@ export default {
pageIndex
:
1
,
// pdf页码
pageLength
:
null
,
// 总页码
startTime
:
null
,
is404
:
false
,
scale
:
2
,
// 缩放比例
borderSize
:
9
,
// viewerContainer容器border大小
shouldRenderHtml
:
false
,
// pdf预览时是否需要渲染成html
...
...
@@ -210,15 +211,27 @@ export default {
methods
:
{
async
preview
()
{
if
(
this
.
pdf
===
null
)
{
let
pdf
=
await
pdfJs
.
getDocument
(
this
.
pdfUrl
===
""
?
"http://b2b-flv.qida.com/product/20191105/23386fd7-5551-4fa2-81cc-025945a75eeb/out.pdf"
:
this
.
pdfUrl
);
console
.
log
(
"获取PDF"
,
pdf
);
this
.
pdf
=
pdf
;
let
that
=
this
;
try
{
let
pdf
=
await
pdfJs
.
getDocument
(
this
.
pdfUrl
===
""
?
"https://qida-videos.oss-cn-shenzhen.aliyuncs.com/404.pdf"
:
this
.
pdfUrl
);
console
.
log
(
"获取PDF"
,
pdf
);
this
.
pdf
=
pdf
;
}
catch
(
error
)
{
console
.
log
(
error
);
that
.
pdfUrl
=
""
;
that
.
is404
=
true
;
that
.
preview
();
return
;
}
}
this
.
pageLength
=
this
.
pdf
.
_pdfInfo
.
numPages
;
if
(
!
this
.
is404
)
{
this
.
isOnePage
();
}
let
page
=
await
this
.
pdf
.
getPage
(
this
.
pageIndex
);
const
devicePixelRatio
=
window
.
devicePixelRatio
;
const
scale
=
this
.
pageSize
*
this
.
scale
*
devicePixelRatio
;
...
...
@@ -272,6 +285,15 @@ export default {
});
return
{
bufferCanvas
,
textLayerDiv
:
textLayerDiv
[
0
],
bodyHeight
};
},
isOnePage
()
{
if
(
this
.
pageLength
===
1
)
{
this
.
LMSSetLocationPoint
();
this
.
LMSSetLessProgress
();
this
.
LMSSetSessionTime
();
this
.
LMSSetLessonStatus
(
"completed"
);
this
.
LMSCommit
();
}
},
async
renderCanvas
(
bufferCanvas
,
viewport
,
page
)
{
let
bufferContext
=
bufferCanvas
.
getContext
(
"2d"
);
let
renderContext
=
{
...
...
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