|
@@ -67,7 +67,7 @@ |
|
|
<view class="imageBox"> |
|
|
<view class="imageBox"> |
|
|
<image :src="QRCodeUrl" mode="scaleToFill" /> |
|
|
<image :src="QRCodeUrl" mode="scaleToFill" /> |
|
|
</view> |
|
|
</view> |
|
|
<text>打开微信扫码登录小程序</text> |
|
|
|
|
|
|
|
|
<text>打开微信扫码上传照片</text> |
|
|
<view class="orangeBtn" style="margin-top: 100rpx">取 消</view> |
|
|
<view class="orangeBtn" style="margin-top: 100rpx">取 消</view> |
|
|
</view> |
|
|
</view> |
|
|
</u-overlay> |
|
|
</u-overlay> |
|
@@ -78,7 +78,7 @@ |
|
|
import { ref, onMounted } from "vue"; |
|
|
import { ref, onMounted } from "vue"; |
|
|
import { onLoad, onShow, onUnload } from "@dcloudio/uni-app"; |
|
|
import { onLoad, onShow, onUnload } from "@dcloudio/uni-app"; |
|
|
|
|
|
|
|
|
import { getImageQrcode } from "../../api/camera.js"; |
|
|
|
|
|
|
|
|
import { getImageQrcode, findImage } from "../../api/camera.js"; |
|
|
|
|
|
|
|
|
let imgSrc = ref(""); |
|
|
let imgSrc = ref(""); |
|
|
let isSuccess = ref(false); |
|
|
let isSuccess = ref(false); |
|
@@ -88,6 +88,8 @@ let modelUrl = ref(""); |
|
|
let QRCodeUrl = ref(""); |
|
|
let QRCodeUrl = ref(""); |
|
|
let showQrCode = ref(false); |
|
|
let showQrCode = ref(false); |
|
|
|
|
|
|
|
|
|
|
|
let timer = ref(null); |
|
|
|
|
|
|
|
|
const startCamera = () => { |
|
|
const startCamera = () => { |
|
|
function getUserMedia(constraints, success, error) { |
|
|
function getUserMedia(constraints, success, error) { |
|
|
if (navigator.mediaDevices.getUserMedia) { |
|
|
if (navigator.mediaDevices.getUserMedia) { |
|
@@ -184,8 +186,10 @@ const takePicture = () => { |
|
|
console.log("Take Picture !"); |
|
|
console.log("Take Picture !"); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 确认照片 |
|
|
const confirmPhoto = () => {}; |
|
|
const confirmPhoto = () => {}; |
|
|
|
|
|
|
|
|
|
|
|
// 不满意,重新拍一张 |
|
|
const reTry = () => { |
|
|
const reTry = () => { |
|
|
isSuccess.value = false; |
|
|
isSuccess.value = false; |
|
|
isShowCanvas.value = true; |
|
|
isShowCanvas.value = true; |
|
@@ -202,6 +206,21 @@ const uploadImg = async () => { |
|
|
const res = await getImageQrcode(UserId); |
|
|
const res = await getImageQrcode(UserId); |
|
|
QRCodeUrl.value = res.data.wxQrcode; |
|
|
QRCodeUrl.value = res.data.wxQrcode; |
|
|
showQrCode.value = true; |
|
|
showQrCode.value = true; |
|
|
|
|
|
|
|
|
|
|
|
// 成功展示二维码之后,轮询获取上传照片状态 |
|
|
|
|
|
timer.value = setInterval(() => { |
|
|
|
|
|
refreshUploadStatus(UserId); |
|
|
|
|
|
}, 1000); |
|
|
|
|
|
console.log(res, "res"); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.log(error, "error"); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 刷新状态,直到返回用户上传的图片url |
|
|
|
|
|
const refreshUploadStatus = async (id) => { |
|
|
|
|
|
try { |
|
|
|
|
|
const res = await findImage(id); |
|
|
console.log(res, "res"); |
|
|
console.log(res, "res"); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.log(error, "error"); |
|
|
console.log(error, "error"); |
|
@@ -215,7 +234,7 @@ onLoad((options) => { |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
console.log(this); |
|
|
console.log(this); |
|
|
|
|
|
|
|
|
|
|
|
clearInterval(timer.value); |
|
|
startCamera(); |
|
|
startCamera(); |
|
|
}); |
|
|
}); |
|
|
</script> |
|
|
</script> |
|
|