zhengnaiwen_citu 4 месяцев назад
Родитель
Сommit
ce9a24f2d6
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      src/views/components/MCamera.vue

+ 3 - 3
src/views/components/MCamera.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="faceRecognition">
     <img :src="src" alt="" v-show="false" ref="img">
+    <!-- style="position: fixed; left: 0;top: 0;background: #FFF;z-index: 999;" -->
     <video
       v-show="false"
       ref="video"
@@ -133,10 +134,10 @@ export default {
           drawX = (canvas.width - drawWidth) / 2
           drawY = 0
         } else {
-          drawHeight = canvas.width * videoAspectRatio
+          drawHeight = canvas.height
           drawWidth = canvas.width
           drawX = 0
-          drawY = (canvas.height - drawHeight) / 2
+          drawY = (canvas.width / videoAspectRatio - canvas.height) / 2
         }
         // 保存当前画布状态
         context.save()
@@ -169,7 +170,6 @@ export default {
         const query = new FormData()
         query.append('file', file)
         const { data } = await uploadImg(query)
-        debugger
         this.$emit('photo', data, img)
       } catch (error) {
         this.checkLoading = false