|
@@ -1,15 +1,9 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <uni-popup ref="popupRef" type="dialog" :animation="false" :is-mask-click="false"
|
|
|
|
|
- mask-background-color="rgba(0, 0, 0, 0.4);">
|
|
|
|
|
- <uni-popup-dialog mode="input" class="phone-camera my-dialog-cc" :title="title" :duration="2000"
|
|
|
|
|
- :before-close="true" @close="handleClose" @confirm="handleConfirm">
|
|
|
|
|
- <view class="phone-camera-box" style="overflow: hidden;">
|
|
|
|
|
- <view v-show="!showConfirmBtn" class="sxt-tip-box" style="text-align: center;">{{textMess}}</view>
|
|
|
|
|
- <camera v-show="showConfirmBtn" class="camera" device-position="back" flash="off" @initdone="onVideoSuccess"
|
|
|
|
|
- style="width:100%; height: 320rpx;"></camera>
|
|
|
|
|
- </view>
|
|
|
|
|
- </uni-popup-dialog>
|
|
|
|
|
- </uni-popup>
|
|
|
|
|
|
|
+ <view class="phone-camera-box">
|
|
|
|
|
+ <view v-show="!showConfirmBtn" class="sxt-tip-box" style="text-align: center;">{{textMess}}</view>
|
|
|
|
|
+ <camera v-show="showConfirmBtn" class="camera" device-position="front" flash="off" @initdone="onVideoSuccess"
|
|
|
|
|
+ style="width:100%; height: 320rpx;"></camera>
|
|
|
|
|
+ </view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
@@ -23,15 +17,7 @@
|
|
|
useH5Camera
|
|
useH5Camera
|
|
|
} from "./useCamera.js"
|
|
} from "./useCamera.js"
|
|
|
|
|
|
|
|
- defineProps({
|
|
|
|
|
- title: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: '摄像头确认'
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
const emits = defineEmits(['success', 'error', 'cancel'])
|
|
const emits = defineEmits(['success', 'error', 'cancel'])
|
|
|
-
|
|
|
|
|
const popupRef = ref(null)
|
|
const popupRef = ref(null)
|
|
|
const showConfirmBtn = ref(false);
|
|
const showConfirmBtn = ref(false);
|
|
|
const cameraContext = ref(null);
|
|
const cameraContext = ref(null);
|
|
@@ -64,8 +50,6 @@
|
|
|
|
|
|
|
|
function showDialog() {
|
|
function showDialog() {
|
|
|
textMess.value = '摄像头正在初始化...'
|
|
textMess.value = '摄像头正在初始化...'
|
|
|
- popupRef.value.open();
|
|
|
|
|
-
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
showConfirmBtn.value = true;
|
|
showConfirmBtn.value = true;
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
@@ -76,13 +60,11 @@
|
|
|
|
|
|
|
|
function handleClose() {
|
|
function handleClose() {
|
|
|
emits('cancel')
|
|
emits('cancel')
|
|
|
- popupRef.value.close();
|
|
|
|
|
stopCamera && stopCamera()
|
|
stopCamera && stopCamera()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function handleConfirm() {
|
|
function handleConfirm() {
|
|
|
emits('success')
|
|
emits('success')
|
|
|
- popupRef.value.close();
|
|
|
|
|
stopCamera && stopCamera()
|
|
stopCamera && stopCamera()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -98,6 +80,7 @@
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
|
.phone-camera-box {
|
|
.phone-camera-box {
|
|
|
|
|
+ margin-top: 60px;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|
|
|
|
|
|