From 6444ec1692a1ce43b45da7dfb9e5d3c5a589313e Mon Sep 17 00:00:00 2001 From: XiaoXinPro 14 IAH5R <568170040@qq.com> Date: Mon, 25 Sep 2023 19:03:08 +0800 Subject: [PATCH] upload --- src/api/camera.js | 31 ++++++++++++++++ src/pages/camera/index.vue | 74 +++++++++++++++++++++++++++++++++++++- src/style/my.scss | 2 -- 3 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 src/api/camera.js diff --git a/src/api/camera.js b/src/api/camera.js new file mode 100644 index 0000000..c6e5d41 --- /dev/null +++ b/src/api/camera.js @@ -0,0 +1,31 @@ +import { request } from "../utils/request" + +/** +* @description:获取上传二维码 +* @param machineQrcodeId +* @return: status +*/ +export function getImageQrcode(machineQrcodeId) { + return request({ + url: `/api/screenImg/imageQrcode`, + method: 'post', + data: { + machineQrcodeId + } + }) +} + +/** +* @description:生成画报 +* @param {appId,img} +* @return: data +*/ +export function getUserQrcodeApi(data) { + return request({ + url: `/api/miniApp/getUserQrcode`, + method: 'POST', + responseType: "arraybuffer", + data + }) +} + diff --git a/src/pages/camera/index.vue b/src/pages/camera/index.vue index eb57241..d060fcc 100644 --- a/src/pages/camera/index.vue +++ b/src/pages/camera/index.vue @@ -19,7 +19,7 @@ >
-
+
上传照片
@@ -57,6 +57,20 @@
+ + + + + + 打开微信扫码登录小程序 + 取 消 + + @@ -64,11 +78,16 @@ import { ref, onMounted } from "vue"; import { onLoad, onShow, onUnload } from "@dcloudio/uni-app"; +import { getImageQrcode } from "../../api/camera.js"; + let imgSrc = ref(""); let isSuccess = ref(false); let isShowCanvas = ref(true); let modelUrl = ref(""); +let QRCodeUrl = ref(""); +let showQrCode = ref(false); + const startCamera = () => { function getUserMedia(constraints, success, error) { if (navigator.mediaDevices.getUserMedia) { @@ -176,6 +195,19 @@ const reTry = () => { }, 10); }; +// 点击上传照片按钮 +const uploadImg = async () => { + const UserId = localStorage.getItem("UserId"); + try { + const res = await getImageQrcode(UserId); + QRCodeUrl.value = res.data.wxQrcode; + showQrCode.value = true; + console.log(res, "res"); + } catch (error) { + console.log(error, "error"); + } +}; + onLoad((options) => { console.log(options, "options"); modelUrl.value = options.modelUrl; @@ -346,5 +378,45 @@ onMounted(() => { } } } + .overlay { + .content { + width: 100%; + height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + .imageBox { + position: relative; + margin-top: 200rpx; + width: 500rpx; + height: 500rpx; + border-radius: 30rpx; + background-color: #fff; + .mask { + position: absolute; + width: 500rpx; + height: 500rpx; + border-radius: 30rpx; + background-color: rgba($color: #000000, $alpha: 0.7); + z-index: 2; + } + image { + width: 500rpx; + height: 500rpx; + border-radius: 30rpx; + background-color: #fff; + } + } + text { + margin-top: 20rpx; + font-weight: 900; + font-size: 32rpx; + } + // .orangeBtn { + // margin-top: 100rpx; + // } + } + } } diff --git a/src/style/my.scss b/src/style/my.scss index 160a68b..1ce9921 100644 --- a/src/style/my.scss +++ b/src/style/my.scss @@ -47,8 +47,6 @@ view { } .orangeBtn { - position: absolute; - bottom: 50; background-color: #FF4F00; width: 520rpx; height: 100rpx;