Commit aad79c52 by xiaowenfeng

1、添加了一个人脸登记模块;

2、添加了一个人脸识别模块
parent 3b5d958f
...@@ -83,7 +83,9 @@ export default { ...@@ -83,7 +83,9 @@ export default {
.catch(this.error); .catch(this.error);
}, },
error(err) { error(err) {
alert(`访问用户媒体设备失败!\n${err.name},${err.message}!`); alert(
`打开摄像头失败!\n如设备不支持,可使用手机APP\n${err.name},${err.message}!`
);
}, },
success(stream) { success(stream) {
// Older browsers may not have srcObject // Older browsers may not have srcObject
......
...@@ -199,7 +199,7 @@ export default { ...@@ -199,7 +199,7 @@ export default {
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
.detector-box { .detector-box {
width: 400px; width: 900px;
display: inline-block; display: inline-block;
} }
h4 { h4 {
......
...@@ -198,7 +198,7 @@ export default { ...@@ -198,7 +198,7 @@ export default {
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
.detector-box { .detector-box {
width: 400px; width: 900px;
display: inline-block; display: inline-block;
} }
h4 { h4 {
......
...@@ -170,6 +170,7 @@ export default { ...@@ -170,6 +170,7 @@ export default {
pageIndex: 1, // pdf页码 pageIndex: 1, // pdf页码
pageLength: null, // 总页码 pageLength: null, // 总页码
startTime: null, startTime: null,
is404: false,
scale: 2, // 缩放比例 scale: 2, // 缩放比例
borderSize: 9, // viewerContainer容器border大小 borderSize: 9, // viewerContainer容器border大小
shouldRenderHtml: false, // pdf预览时是否需要渲染成html shouldRenderHtml: false, // pdf预览时是否需要渲染成html
...@@ -210,15 +211,27 @@ export default { ...@@ -210,15 +211,27 @@ export default {
methods: { methods: {
async preview() { async preview() {
if (this.pdf === null) { if (this.pdf === null) {
let that = this;
try {
let pdf = await pdfJs.getDocument( let pdf = await pdfJs.getDocument(
this.pdfUrl === "" this.pdfUrl === ""
? "http://b2b-flv.qida.com/product/20191105/23386fd7-5551-4fa2-81cc-025945a75eeb/out.pdf" ? "https://qida-videos.oss-cn-shenzhen.aliyuncs.com/404.pdf"
: this.pdfUrl : this.pdfUrl
); );
console.log("获取PDF", pdf); console.log("获取PDF", pdf);
this.pdf = pdf; this.pdf = pdf;
} catch (error) {
console.log(error);
that.pdfUrl = "";
that.is404 = true;
that.preview();
return;
}
} }
this.pageLength = this.pdf._pdfInfo.numPages; this.pageLength = this.pdf._pdfInfo.numPages;
if (!this.is404) {
this.isOnePage();
}
let page = await this.pdf.getPage(this.pageIndex); let page = await this.pdf.getPage(this.pageIndex);
const devicePixelRatio = window.devicePixelRatio; const devicePixelRatio = window.devicePixelRatio;
const scale = this.pageSize * this.scale * devicePixelRatio; const scale = this.pageSize * this.scale * devicePixelRatio;
...@@ -272,6 +285,15 @@ export default { ...@@ -272,6 +285,15 @@ export default {
}); });
return { bufferCanvas, textLayerDiv: textLayerDiv[0], bodyHeight }; 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) { async renderCanvas(bufferCanvas, viewport, page) {
let bufferContext = bufferCanvas.getContext("2d"); let bufferContext = bufferCanvas.getContext("2d");
let renderContext = { let renderContext = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment