diff --git a/src/pages.json b/src/pages.json index 1dc0088..2952d01 100644 --- a/src/pages.json +++ b/src/pages.json @@ -48,5 +48,10 @@ "rpxCalcMaxDeviceWidth": 1080, "rpxCalcBaseDeviceWidth": 1080, "rpxCalcIncludeWidth": 1080 + }, + "app": { + "requiredBackgroundModes": [ + "camera" + ] } } \ No newline at end of file diff --git a/src/pages/camera/index copy 2.vue b/src/pages/camera/index copy 2.vue new file mode 100644 index 0000000..cd901ed --- /dev/null +++ b/src/pages/camera/index copy 2.vue @@ -0,0 +1,177 @@ + + +// js部分 + + + diff --git a/src/pages/camera/index.vue b/src/pages/camera/index.vue index 3611997..080996c 100644 --- a/src/pages/camera/index.vue +++ b/src/pages/camera/index.vue @@ -12,12 +12,16 @@ - 拍照 + 拍照 重拍 + @@ -34,22 +38,7 @@ import Webcam from "../../utils/webcam"; const photoUrl = ref(null); function takePhoto() { // console.log(Webcam.snap); - uni.chooseImage({ - sourceType: ["camera"], - success: function (res) { - console.log(JSON.stringify(res.tempFilePaths)); - }, - fail: (err) => { - console.error("选择图片失败", err); - uni.showToast({ - title: "选择图片失败, 请稍后重试", - icon: "none", - }); - }, - }); - return; Webcam.snap((res) => { - // Webcam.freeze(); photoUrl.value = res; document.getElementById("results").innerHTML = ''; @@ -87,7 +76,7 @@ onMounted(() => { flip_horiz: true, //是否镜像 }); // DOM元素必须已经创建并且为空。将ID或CSS选择器传递给Webcam.attach()函数(挂载dom) - // Webcam.attach("#my_camera"); + Webcam.attach("#my_camera"); }); //#endregion ----------------------------- @@ -97,7 +86,7 @@ onMounted(() => { padding: 0; width: 100vw; height: 100vh; - // overflow: hidden; + overflow: hidden; } .top { display: flex; diff --git a/src/pages/chooseStyle/index.vue b/src/pages/chooseStyle/index.vue index 22c1dc2..cf77a8c 100644 --- a/src/pages/chooseStyle/index.vue +++ b/src/pages/chooseStyle/index.vue @@ -242,7 +242,7 @@ function createPhoto(item) { // background-color: red; .moreIcon { margin-left: 50rpx; - margin-top: 20rpx; + margin-top: 15rpx; width: 130rpx; height: 60rpx; border-radius: 40rpx;